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

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

Issue 7619010: Session-only local storage cleared on exit. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Code review comments (tiny). 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"
9 #include "chrome/common/content_settings.h"
8 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
9 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
10 #include "content/browser/browser_thread.h" 12 #include "content/browser/browser_thread.h"
11 13
12 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy() {} 14 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy(
15 HostContentSettingsMap* host_content_settings_map)
16 : host_content_settings_map_(host_content_settings_map) {}
13 17
14 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {} 18 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {}
15 19
16 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) { 20 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) {
17 if (origin.SchemeIs(chrome::kExtensionScheme)) 21 if (origin.SchemeIs(chrome::kExtensionScheme))
18 return true; 22 return true;
19 base::AutoLock locker(lock_); 23 base::AutoLock locker(lock_);
20 return protected_apps_.Contains(origin); 24 return protected_apps_.Contains(origin);
21 } 25 }
22 26
23 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) { 27 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) {
24 base::AutoLock locker(lock_); 28 base::AutoLock locker(lock_);
25 return unlimited_extensions_.Contains(origin); 29 return unlimited_extensions_.Contains(origin);
26 } 30 }
27 31
32 bool ExtensionSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
33 if (host_content_settings_map_ == NULL)
34 return false;
35 ContentSetting content_setting = host_content_settings_map_->
36 GetCookieContentSetting(origin, origin, true);
37 return (content_setting == CONTENT_SETTING_SESSION_ONLY);
38 }
39
28 bool ExtensionSpecialStoragePolicy::IsFileHandler( 40 bool ExtensionSpecialStoragePolicy::IsFileHandler(
29 const std::string& extension_id) { 41 const std::string& extension_id) {
30 base::AutoLock locker(lock_); 42 base::AutoLock locker(lock_);
31 return file_handler_extensions_.ContainsExtension(extension_id); 43 return file_handler_extensions_.ContainsExtension(extension_id);
32 } 44 }
33 45
34 void ExtensionSpecialStoragePolicy::GrantRightsForExtension( 46 void ExtensionSpecialStoragePolicy::GrantRightsForExtension(
35 const Extension* extension) { 47 const Extension* extension) {
36 DCHECK(extension); 48 DCHECK(extension);
37 if (!extension->is_hosted_app() && 49 if (!extension->is_hosted_app() &&
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 void ExtensionSpecialStoragePolicy::SpecialCollection::Remove( 150 void ExtensionSpecialStoragePolicy::SpecialCollection::Remove(
139 const Extension* extension) { 151 const Extension* extension) {
140 cached_results_.clear(); 152 cached_results_.clear();
141 extensions_.erase(extension->id()); 153 extensions_.erase(extension->id());
142 } 154 }
143 155
144 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { 156 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() {
145 cached_results_.clear(); 157 cached_results_.clear();
146 extensions_.clear(); 158 extensions_.clear();
147 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698