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

Side by Side Diff: chrome/browser/extensions/extension_special_storage_policy.cc

Issue 7713034: HostContentSettingsMap refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_special_storage_policy.h" 5 #include "chrome/browser/extensions/extension_special_storage_policy.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/content_settings/host_content_settings_map.h" 8 #include "chrome/browser/content_settings/host_content_settings_map.h"
9 #include "chrome/common/content_settings.h" 9 #include "chrome/common/content_settings.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "content/browser/browser_thread.h" 12 #include "content/browser/browser_thread.h"
13 13
14 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy( 14 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy(
15 HostContentSettingsMap* host_content_settings_map) 15 CookieContentSettings* cookie_content_settings)
16 : host_content_settings_map_(host_content_settings_map) {} 16 : cookie_content_settings_(cookie_content_settings) {}
17 17
18 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {} 18 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {}
19 19
20 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) { 20 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) {
21 if (origin.SchemeIs(chrome::kExtensionScheme)) 21 if (origin.SchemeIs(chrome::kExtensionScheme))
22 return true; 22 return true;
23 base::AutoLock locker(lock_); 23 base::AutoLock locker(lock_);
24 return protected_apps_.Contains(origin); 24 return protected_apps_.Contains(origin);
25 } 25 }
26 26
27 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) { 27 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) {
28 base::AutoLock locker(lock_); 28 base::AutoLock locker(lock_);
29 return unlimited_extensions_.Contains(origin); 29 return unlimited_extensions_.Contains(origin);
30 } 30 }
31 31
32 bool ExtensionSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) { 32 bool ExtensionSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
33 if (host_content_settings_map_ == NULL) 33 if (cookie_content_settings_ == NULL)
34 return false; 34 return false;
35 ContentSetting content_setting = host_content_settings_map_-> 35 return cookie_content_settings_->EnforceSessionOnly(origin);
36 GetCookieContentSetting(origin, origin, true);
37 return (content_setting == CONTENT_SETTING_SESSION_ONLY);
38 } 36 }
39 37
40 bool ExtensionSpecialStoragePolicy::IsFileHandler( 38 bool ExtensionSpecialStoragePolicy::IsFileHandler(
41 const std::string& extension_id) { 39 const std::string& extension_id) {
42 base::AutoLock locker(lock_); 40 base::AutoLock locker(lock_);
43 return file_handler_extensions_.ContainsExtension(extension_id); 41 return file_handler_extensions_.ContainsExtension(extension_id);
44 } 42 }
45 43
46 void ExtensionSpecialStoragePolicy::GrantRightsForExtension( 44 void ExtensionSpecialStoragePolicy::GrantRightsForExtension(
47 const Extension* extension) { 45 const Extension* extension) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 void ExtensionSpecialStoragePolicy::SpecialCollection::Remove( 148 void ExtensionSpecialStoragePolicy::SpecialCollection::Remove(
151 const Extension* extension) { 149 const Extension* extension) {
152 cached_results_.clear(); 150 cached_results_.clear();
153 extensions_.erase(extension->id()); 151 extensions_.erase(extension->id());
154 } 152 }
155 153
156 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { 154 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() {
157 cached_results_.clear(); 155 cached_results_.clear();
158 extensions_.clear(); 156 extensions_.clear();
159 } 157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698