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

Unified Diff: chrome/browser/storage/durable_storage_permission_context.cc

Issue 1478433002: Permissions: Move common logic from DecidePermission to RequestPermission (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@innoinherit
Patch Set: Rebase / git cl format Created 5 years 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/storage/durable_storage_permission_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/storage/durable_storage_permission_context.cc
diff --git a/chrome/browser/storage/durable_storage_permission_context.cc b/chrome/browser/storage/durable_storage_permission_context.cc
index 4e520bb320accda943fa511a21696a37062fb87e..370d2aef27cf39fdb3c4a718aa5c4da456305381 100644
--- a/chrome/browser/storage/durable_storage_permission_context.cc
+++ b/chrome/browser/storage/durable_storage_permission_context.cc
@@ -33,45 +33,8 @@ void DurableStoragePermissionContext::DecidePermission(
const GURL& embedding_origin,
bool user_gesture,
const BrowserPermissionCallback& callback) {
- // TODO(dgrogan): Reuse the base class's implementation of everything from
- // here to using bookmarks.
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- if (!requesting_origin.is_valid() || !embedding_origin.is_valid()) {
- std::string type_name =
- content_settings::WebsiteSettingsRegistry::GetInstance()
- ->Get(CONTENT_SETTINGS_TYPE_DURABLE_STORAGE)
- ->name();
-
- DVLOG(1) << "Attempt to use " << type_name
- << " from an invalid URL: " << requesting_origin << ","
- << embedding_origin << " (" << type_name
- << " is not supported in popups)";
- NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
- false /* persist */, CONTENT_SETTING_BLOCK);
- return;
- }
-
- if (IsRestrictedToSecureOrigins() &&
- !content::IsOriginSecure(requesting_origin)) {
- NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
- false /* persist */, CONTENT_SETTING_BLOCK);
- return;
- }
-
- ContentSetting content_setting =
- HostContentSettingsMapFactory::GetForProfile(profile())
- ->GetContentSettingAndMaybeUpdateLastUsage(
- requesting_origin, embedding_origin,
- CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, std::string());
-
- DCHECK_NE(CONTENT_SETTING_BLOCK, content_setting);
- if (content_setting == CONTENT_SETTING_ALLOW) {
- NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
- false /* persist */, content_setting);
- return;
- }
-
// TODO(dgrogan): Remove bookmarks check in favor of site engagement. In the
// meantime maybe grant permission to A2HS origins as well.
BookmarkModel* model = BookmarkModelFactory::GetForProfileIfExists(profile());
« no previous file with comments | « chrome/browser/storage/durable_storage_permission_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698