| Index: chrome/browser/extensions/extension_special_storage_policy.cc
|
| diff --git a/chrome/browser/extensions/extension_special_storage_policy.cc b/chrome/browser/extensions/extension_special_storage_policy.cc
|
| index 7f0ba19676b4d83ffbefb89ccf74d0939c2ecb91..95e0719eeaae0de24292da927d0474132e6cce82 100644
|
| --- a/chrome/browser/extensions/extension_special_storage_policy.cc
|
| +++ b/chrome/browser/extensions/extension_special_storage_policy.cc
|
| @@ -15,7 +15,6 @@
|
| #include "base/stl_util.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "chrome/browser/content_settings/cookie_settings_factory.h"
|
| -#include "chrome/browser/permissions/permission_manager.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
|
| #include "chrome/common/url_constants.h"
|
| @@ -24,7 +23,6 @@
|
| #include "components/content_settings/core/common/content_settings_types.h"
|
| #include "content/public/browser/browser_context.h"
|
| #include "content/public/browser/browser_thread.h"
|
| -#include "content/public/browser/permission_type.h"
|
| #include "content/public/browser/storage_partition.h"
|
| #include "content/public/common/url_constants.h"
|
| #include "extensions/common/constants.h"
|
| @@ -62,10 +60,10 @@
|
| GURL launch_url =
|
| extensions::AppLaunchInfo::GetLaunchWebURL(extension.get()).GetOrigin();
|
| content::StoragePartition* partition =
|
| - browser_context ? // |browser_context| can be nullptr in unittests.
|
| + browser_context ? // |browser_context| can be NULL in unittests.
|
| content::BrowserContext::GetStoragePartitionForSite(browser_context,
|
| launch_url) :
|
| - nullptr;
|
| + NULL;
|
| if (partition) {
|
| // We only have to query for kStorageTypePersistent data usage, because apps
|
| // cannot ask for any more temporary storage, according to
|
| @@ -81,11 +79,9 @@
|
|
|
| } // namespace
|
|
|
| -ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy(Profile* profile)
|
| - : profile_(profile) {
|
| - if (profile_) {
|
| - cookie_settings_ = CookieSettingsFactory::GetForProfile(profile_).get();
|
| - }
|
| +ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy(
|
| + content_settings::CookieSettings* cookie_settings)
|
| + : cookie_settings_(cookie_settings) {
|
| }
|
|
|
| ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {}
|
| @@ -113,7 +109,7 @@
|
| }
|
|
|
| bool ExtensionSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
|
| - if (cookie_settings_ == nullptr)
|
| + if (cookie_settings_.get() == NULL)
|
| return false;
|
| return cookie_settings_->IsCookieSessionOnly(origin);
|
| }
|
| @@ -124,9 +120,9 @@
|
| }
|
|
|
| bool ExtensionSpecialStoragePolicy::HasSessionOnlyOrigins() {
|
| - if (cookie_settings_ == nullptr)
|
| + if (cookie_settings_.get() == NULL)
|
| return false;
|
| - if (cookie_settings_->GetDefaultCookieSetting(nullptr) ==
|
| + if (cookie_settings_->GetDefaultCookieSetting(NULL) ==
|
| CONTENT_SETTING_SESSION_ONLY)
|
| return true;
|
| ContentSettingsForOneType entries;
|
| @@ -144,10 +140,7 @@
|
| }
|
|
|
| bool ExtensionSpecialStoragePolicy::IsStorageDurable(const GURL& origin) {
|
| - blink::mojom::PermissionStatus status =
|
| - PermissionManager::Get(profile_)->GetPermissionStatus(
|
| - content::PermissionType::DURABLE_STORAGE, origin, origin);
|
| - return status == blink::mojom::PermissionStatus::GRANTED;
|
| + return cookie_settings_->IsStorageDurable(origin);
|
| }
|
|
|
| bool ExtensionSpecialStoragePolicy::NeedsProtection(
|
|
|