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

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: 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/common/content_settings.h"
8 #include "chrome/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
9 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
11 #include "chrome/browser/content_settings/host_content_settings_map.h"
jochen (gone - plz use gerrit) 2011/08/17 11:29:06 alphabetical ordering
marja 2011/08/17 11:51:16 Done.
10 12
11 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy() {} 13 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy(
14 HostContentSettingsMap* host_content_settings_map)
15 : host_content_settings_map_(host_content_settings_map) {}
12 16
13 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {} 17 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {}
14 18
15 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) { 19 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) {
16 if (origin.SchemeIs(chrome::kExtensionScheme)) 20 if (origin.SchemeIs(chrome::kExtensionScheme))
17 return true; 21 return true;
18 base::AutoLock locker(lock_); 22 base::AutoLock locker(lock_);
19 return protected_apps_.Contains(origin); 23 return protected_apps_.Contains(origin);
20 } 24 }
21 25
22 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) { 26 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) {
23 base::AutoLock locker(lock_); 27 base::AutoLock locker(lock_);
24 return unlimited_extensions_.Contains(origin); 28 return unlimited_extensions_.Contains(origin);
25 } 29 }
26 30
31 bool ExtensionSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
32 ContentSetting content_setting = host_content_settings_map_->
jochen (gone - plz use gerrit) 2011/08/17 11:29:06 since host_content_settings_map_ can be NULL, you
marja 2011/08/17 11:51:16 Done.
33 GetCookieContentSetting(origin, origin, true);
34 return (content_setting == CONTENT_SETTING_SESSION_ONLY);
35 }
36
27 bool ExtensionSpecialStoragePolicy::IsFileHandler( 37 bool ExtensionSpecialStoragePolicy::IsFileHandler(
28 const std::string& extension_id) { 38 const std::string& extension_id) {
29 base::AutoLock locker(lock_); 39 base::AutoLock locker(lock_);
30 return file_handler_extensions_.ContainsExtension(extension_id); 40 return file_handler_extensions_.ContainsExtension(extension_id);
31 } 41 }
32 42
33 void ExtensionSpecialStoragePolicy::GrantRightsForExtension( 43 void ExtensionSpecialStoragePolicy::GrantRightsForExtension(
34 const Extension* extension) { 44 const Extension* extension) {
35 DCHECK(extension); 45 DCHECK(extension);
36 if (!extension->is_hosted_app() && 46 if (!extension->is_hosted_app() &&
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 void ExtensionSpecialStoragePolicy::SpecialCollection::Remove( 124 void ExtensionSpecialStoragePolicy::SpecialCollection::Remove(
115 const Extension* extension) { 125 const Extension* extension) {
116 cached_results_.clear(); 126 cached_results_.clear();
117 extensions_.erase(extension->id()); 127 extensions_.erase(extension->id());
118 } 128 }
119 129
120 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { 130 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() {
121 cached_results_.clear(); 131 cached_results_.clear();
122 extensions_.clear(); 132 extensions_.clear();
123 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698