This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3958 from medic/patch-time
Implement --unlimited-storage switch for crosswalk
- Loading branch information
Showing
7 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) 2016 Medic Mobile, Ltd All Rights Reserved | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "xwalk/runtime/browser/xwalk_special_storage_policy.h" | ||
|
||
using namespace xwalk; | ||
|
||
XWalkSpecialStoragePolicy::XWalkSpecialStoragePolicy(void) {} | ||
|
||
XWalkSpecialStoragePolicy::~XWalkSpecialStoragePolicy() {} | ||
|
||
bool XWalkSpecialStoragePolicy::IsStorageProtected(const GURL& origin) { | ||
// Prevent data being removed by the browsing data remover. | ||
return true; | ||
} | ||
|
||
bool XWalkSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) { | ||
// Prevent data being affected by quota or storage pressure eviction. | ||
return true; | ||
} | ||
|
||
bool XWalkSpecialStoragePolicy::IsStorageDurable(const GURL& origin) { | ||
// Prevent storage pressure eviction. | ||
return true; | ||
} | ||
|
||
bool XWalkSpecialStoragePolicy::CanQueryDiskSize(const GURL& origin) { | ||
// Let anything query remaining disk size. This could potentially allow for | ||
// fingerprinting of a user, but seems less of a risk in a crosswalk app than | ||
// it would in a more general browser. | ||
return true; | ||
} | ||
|
||
bool XWalkSpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) { | ||
// I don't actually know if Crosswalk can guarantee if there is isolated | ||
// storage or not. Chrome seems to implement this through a special plugin, | ||
// so it seems safe to say that we can't guarantee that storage is isolated. | ||
return false; | ||
} | ||
|
||
bool XWalkSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) { | ||
// As per HasSessionOnlyOrigins(), no origins are session-only. | ||
return false; | ||
} | ||
|
||
bool XWalkSpecialStoragePolicy::HasSessionOnlyOrigins() { | ||
// Do not allow any origins to have session-only storage. | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2016 Medic Mobile, Ltd All Rights Reserved | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef XWALK_RUNTIME_BROWSER_XWALK_SPECIAL_STORAGE_POLICY_H_ | ||
#define XWALK_RUNTIME_BROWSER_XWALK_SPECIAL_STORAGE_POLICY_H_ | ||
|
||
#include "storage/browser/quota/special_storage_policy.h" | ||
|
||
namespace xwalk { | ||
|
||
class XWalkSpecialStoragePolicy : public storage::SpecialStoragePolicy { | ||
public: | ||
XWalkSpecialStoragePolicy(); | ||
|
||
// storage::SpecialStoragePolicy methods used by storage subsystems and the | ||
// browsing data remover. These methods are safe to call on any thread. | ||
bool IsStorageProtected(const GURL& origin) override; | ||
bool IsStorageUnlimited(const GURL& origin) override; | ||
bool IsStorageSessionOnly(const GURL& origin) override; | ||
bool CanQueryDiskSize(const GURL& origin) override; | ||
bool HasIsolatedStorage(const GURL& origin) override; | ||
bool HasSessionOnlyOrigins() override; | ||
bool IsStorageDurable(const GURL& origin) override; | ||
|
||
protected: | ||
~XWalkSpecialStoragePolicy() override; | ||
}; | ||
|
||
} // namespace xwalk | ||
|
||
#endif // XWALK_RUNTIME_BROWSER_XWALK_SPECIAL_STORAGE_POLICY_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters