Merge pull request #155 from atom/remove-websql-limitation

Remove websql's storage limitation
This commit is contained in:
Cheng Zhao 2015-10-13 09:03:20 +08:00
commit 34fb1c65bf
5 changed files with 79 additions and 1 deletions

View file

@ -8,6 +8,7 @@
#include "browser/inspectable_web_contents_impl.h" #include "browser/inspectable_web_contents_impl.h"
#include "browser/network_delegate.h" #include "browser/network_delegate.h"
#include "browser/permission_manager.h" #include "browser/permission_manager.h"
#include "browser/special_storage_policy.h"
#include "common/application_info.h" #include "common/application_info.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
@ -96,6 +97,7 @@ scoped_refptr<BrowserContext> BrowserContext::From(
BrowserContext::BrowserContext(const std::string& partition, bool in_memory) BrowserContext::BrowserContext(const std::string& partition, bool in_memory)
: in_memory_(in_memory), : in_memory_(in_memory),
resource_context_(new ResourceContext), resource_context_(new ResourceContext),
storage_policy_(new SpecialStoragePolicy),
weak_factory_(this) { weak_factory_(this) {
if (!PathService::Get(DIR_USER_DATA, &path_)) { if (!PathService::Get(DIR_USER_DATA, &path_)) {
PathService::Get(DIR_APP_DATA, &path_); PathService::Get(DIR_APP_DATA, &path_);
@ -213,7 +215,7 @@ content::BrowserPluginGuestManager* BrowserContext::GetGuestManager() {
} }
storage::SpecialStoragePolicy* BrowserContext::GetSpecialStoragePolicy() { storage::SpecialStoragePolicy* BrowserContext::GetSpecialStoragePolicy() {
return nullptr; return storage_policy_.get();
} }
content::PushMessagingService* BrowserContext::GetPushMessagingService() { content::PushMessagingService* BrowserContext::GetPushMessagingService() {

View file

@ -18,6 +18,10 @@
class PrefRegistrySimple; class PrefRegistrySimple;
class PrefService; class PrefService;
namespace storage {
class SpecialStoragePolicy;
}
namespace brightray { namespace brightray {
class PermissionManager; class PermissionManager;
@ -112,6 +116,7 @@ class BrowserContext : public base::RefCounted<BrowserContext>,
scoped_ptr<ResourceContext> resource_context_; scoped_ptr<ResourceContext> resource_context_;
scoped_ptr<DevToolsNetworkController> controller_; scoped_ptr<DevToolsNetworkController> controller_;
scoped_refptr<URLRequestContextGetter> url_request_getter_; scoped_refptr<URLRequestContextGetter> url_request_getter_;
scoped_refptr<storage::SpecialStoragePolicy> storage_policy_;
scoped_ptr<PrefService> prefs_; scoped_ptr<PrefService> prefs_;
scoped_ptr<PermissionManager> permission_manager_; scoped_ptr<PermissionManager> permission_manager_;

View file

@ -0,0 +1,39 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "browser/special_storage_policy.h"
namespace brightray {
SpecialStoragePolicy::SpecialStoragePolicy() {
}
SpecialStoragePolicy::~SpecialStoragePolicy() {
}
bool SpecialStoragePolicy::IsStorageProtected(const GURL& origin) {
return true;
}
bool SpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) {
return true;
}
bool SpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
return false;
}
bool SpecialStoragePolicy::CanQueryDiskSize(const GURL& origin) {
return true;
}
bool SpecialStoragePolicy::HasSessionOnlyOrigins() {
return false;
}
bool SpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) {
return false;
}
} // namespace brightray

View file

@ -0,0 +1,30 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BRIGHTRAY_BROWSER_SPECIAL_STORAGE_POLICY_H_
#define BRIGHTRAY_BROWSER_SPECIAL_STORAGE_POLICY_H_
#include "storage/browser/quota/special_storage_policy.h"
namespace brightray {
class SpecialStoragePolicy : public storage::SpecialStoragePolicy {
public:
SpecialStoragePolicy();
// storage::SpecialStoragePolicy implementation.
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;
protected:
~SpecialStoragePolicy() override;
};
} // namespace brightray
#endif // BRIGHTRAY_BROWSER_SPECIAL_STORAGE_POLICY_H_

View file

@ -63,6 +63,8 @@
'browser/platform_notification_service_impl.h', 'browser/platform_notification_service_impl.h',
'browser/linux/notification_presenter_linux.h', 'browser/linux/notification_presenter_linux.h',
'browser/linux/notification_presenter_linux.cc', 'browser/linux/notification_presenter_linux.cc',
'browser/special_storage_policy.cc',
'browser/special_storage_policy.h',
'browser/url_request_context_getter.cc', 'browser/url_request_context_getter.cc',
'browser/url_request_context_getter.h', 'browser/url_request_context_getter.h',
'browser/views/inspectable_web_contents_view_views.h', 'browser/views/inspectable_web_contents_view_views.h',