diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index ff3be6ede185..4bf558d4293b 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -8,6 +8,7 @@ #include "browser/inspectable_web_contents_impl.h" #include "browser/network_delegate.h" #include "browser/permission_manager.h" +#include "browser/special_storage_policy.h" #include "common/application_info.h" #include "base/files/file_path.h" @@ -96,6 +97,7 @@ scoped_refptr BrowserContext::From( BrowserContext::BrowserContext(const std::string& partition, bool in_memory) : in_memory_(in_memory), resource_context_(new ResourceContext), + storage_policy_(new SpecialStoragePolicy), weak_factory_(this) { if (!PathService::Get(DIR_USER_DATA, &path_)) { PathService::Get(DIR_APP_DATA, &path_); @@ -213,7 +215,7 @@ content::BrowserPluginGuestManager* BrowserContext::GetGuestManager() { } storage::SpecialStoragePolicy* BrowserContext::GetSpecialStoragePolicy() { - return nullptr; + return storage_policy_.get(); } content::PushMessagingService* BrowserContext::GetPushMessagingService() { diff --git a/brightray/browser/browser_context.h b/brightray/browser/browser_context.h index 3159b377bdca..3c9b68d88385 100644 --- a/brightray/browser/browser_context.h +++ b/brightray/browser/browser_context.h @@ -18,6 +18,10 @@ class PrefRegistrySimple; class PrefService; +namespace storage { +class SpecialStoragePolicy; +} + namespace brightray { class PermissionManager; @@ -112,6 +116,7 @@ class BrowserContext : public base::RefCounted, scoped_ptr resource_context_; scoped_ptr controller_; scoped_refptr url_request_getter_; + scoped_refptr storage_policy_; scoped_ptr prefs_; scoped_ptr permission_manager_; diff --git a/brightray/browser/special_storage_policy.cc b/brightray/browser/special_storage_policy.cc new file mode 100644 index 000000000000..f28e8e5caf3f --- /dev/null +++ b/brightray/browser/special_storage_policy.cc @@ -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 diff --git a/brightray/browser/special_storage_policy.h b/brightray/browser/special_storage_policy.h new file mode 100644 index 000000000000..9e02a4ac28c9 --- /dev/null +++ b/brightray/browser/special_storage_policy.h @@ -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_ diff --git a/brightray/filenames.gypi b/brightray/filenames.gypi index b614b6538f2f..bbde28694d99 100644 --- a/brightray/filenames.gypi +++ b/brightray/filenames.gypi @@ -63,6 +63,8 @@ 'browser/platform_notification_service_impl.h', 'browser/linux/notification_presenter_linux.h', '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.h', 'browser/views/inspectable_web_contents_view_views.h',