Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6851)

Unified Diff: chrome/browser/extensions/extension_special_storage_policy.cc

Issue 2441083002: Use threadsafe version of GetPermissionStatus in ExtensionSpecialStoragePolicy (Closed)
Patch Set: git cl try Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_special_storage_policy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 71849341a8a51ee1cedb29f5525e7e15e7bd1453..956ef460d37f2066c181fabcda4c6f7fb49674e3 100644
--- a/chrome/browser/extensions/extension_special_storage_policy.cc
+++ b/chrome/browser/extensions/extension_special_storage_policy.cc
@@ -15,11 +15,14 @@
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
+#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
+#include "chrome/browser/permissions/permission_manager.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"
#include "components/content_settings/core/browser/cookie_settings.h"
+#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "content/public/browser/browser_context.h"
@@ -83,8 +86,12 @@ void LogHostedAppUnlimitedStorageUsage(
ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy(Profile* profile)
: profile_(profile) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (profile_) {
cookie_settings_ = CookieSettingsFactory::GetForProfile(profile_).get();
+ permission_manager_ = PermissionManager::Get(profile_);
+ host_content_settings_map_ =
+ HostContentSettingsMapFactory::GetForProfile(profile_);
}
}
@@ -144,8 +151,12 @@ bool ExtensionSpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) {
}
bool ExtensionSpecialStoragePolicy::IsStorageDurable(const GURL& origin) {
+ if (!host_content_settings_map_ || !permission_manager_)
+ return false;
+
blink::mojom::PermissionStatus status =
- PermissionManager::Get(profile_)->GetPermissionStatus(
+ permission_manager_->GetPermissionStatus(
+ host_content_settings_map_.get(),
content::PermissionType::DURABLE_STORAGE, origin, origin);
return status == blink::mojom::PermissionStatus::GRANTED;
}
« no previous file with comments | « chrome/browser/extensions/extension_special_storage_policy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698