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

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: Fixing the previous patch set. Created 9 years, 3 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/cookie_settings.h"
8 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
9 #include "chrome/common/content_settings.h" 10 #include "chrome/common/content_settings.h"
10 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
11 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
12 #include "content/browser/browser_thread.h" 13 #include "content/browser/browser_thread.h"
13 14
14 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy( 15 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy(
15 HostContentSettingsMap* host_content_settings_map) 16 CookieSettings* cookie_settings)
16 : host_content_settings_map_(host_content_settings_map) {} 17 : cookie_settings_(cookie_settings) {}
17 18
18 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {} 19 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {}
19 20
20 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) { 21 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) {
21 if (origin.SchemeIs(chrome::kExtensionScheme)) 22 if (origin.SchemeIs(chrome::kExtensionScheme))
22 return true; 23 return true;
23 base::AutoLock locker(lock_); 24 base::AutoLock locker(lock_);
24 return protected_apps_.Contains(origin); 25 return protected_apps_.Contains(origin);
25 } 26 }
26 27
27 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) { 28 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) {
28 base::AutoLock locker(lock_); 29 base::AutoLock locker(lock_);
29 return unlimited_extensions_.Contains(origin); 30 return unlimited_extensions_.Contains(origin);
30 } 31 }
31 32
32 bool ExtensionSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) { 33 bool ExtensionSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
33 if (host_content_settings_map_ == NULL) 34 if (cookie_settings_ == NULL)
34 return false; 35 return false;
35 ContentSetting content_setting = host_content_settings_map_-> 36 return cookie_settings_->IsCookieSessionOnly(origin);
36 GetCookieContentSetting(origin, origin, true);
37 return (content_setting == CONTENT_SETTING_SESSION_ONLY);
38 } 37 }
39 38
40 bool ExtensionSpecialStoragePolicy::IsFileHandler( 39 bool ExtensionSpecialStoragePolicy::IsFileHandler(
41 const std::string& extension_id) { 40 const std::string& extension_id) {
42 base::AutoLock locker(lock_); 41 base::AutoLock locker(lock_);
43 return file_handler_extensions_.ContainsExtension(extension_id); 42 return file_handler_extensions_.ContainsExtension(extension_id);
44 } 43 }
45 44
46 void ExtensionSpecialStoragePolicy::GrantRightsForExtension( 45 void ExtensionSpecialStoragePolicy::GrantRightsForExtension(
47 const Extension* extension) { 46 const Extension* extension) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 void ExtensionSpecialStoragePolicy::SpecialCollection::Remove( 149 void ExtensionSpecialStoragePolicy::SpecialCollection::Remove(
151 const Extension* extension) { 150 const Extension* extension) {
152 cached_results_.clear(); 151 cached_results_.clear();
153 extensions_.erase(extension->id()); 152 extensions_.erase(extension->id());
154 } 153 }
155 154
156 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { 155 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() {
157 cached_results_.clear(); 156 cached_results_.clear();
158 extensions_.clear(); 157 extensions_.clear();
159 } 158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698