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

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

Issue 13209004: Add a flag to override unlimitedStorage quota for any origins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move from content/ to chrome/ Created 7 years, 8 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
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/stl_util.h" 10 #include "base/stl_util.h"
10 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/content_settings/cookie_settings.h" 12 #include "chrome/browser/content_settings/cookie_settings.h"
13 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/content_settings.h" 14 #include "chrome/common/content_settings.h"
13 #include "chrome/common/content_settings_types.h" 15 #include "chrome/common/content_settings_types.h"
14 #include "chrome/common/extensions/extension.h" 16 #include "chrome/common/extensions/extension.h"
15 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
16 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
17 #include "extensions/common/constants.h" 19 #include "extensions/common/constants.h"
18 20
19 using content::BrowserThread; 21 using content::BrowserThread;
20 using extensions::APIPermission; 22 using extensions::APIPermission;
21 23
22 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy( 24 ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy(
23 CookieSettings* cookie_settings) 25 CookieSettings* cookie_settings)
24 : cookie_settings_(cookie_settings) {} 26 : cookie_settings_(cookie_settings) {}
25 27
26 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {} 28 ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {}
27 29
28 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) { 30 bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) {
29 if (origin.SchemeIs(extensions::kExtensionScheme)) 31 if (origin.SchemeIs(extensions::kExtensionScheme))
30 return true; 32 return true;
31 base::AutoLock locker(lock_); 33 base::AutoLock locker(lock_);
32 return protected_apps_.Contains(origin); 34 return protected_apps_.Contains(origin);
33 } 35 }
34 36
35 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) { 37 bool ExtensionSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) {
38 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUnlimitedStorage))
39 return true;
40
36 base::AutoLock locker(lock_); 41 base::AutoLock locker(lock_);
37 return unlimited_extensions_.Contains(origin); 42 return unlimited_extensions_.Contains(origin);
38 } 43 }
39 44
40 bool ExtensionSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) { 45 bool ExtensionSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
41 if (cookie_settings_ == NULL) 46 if (cookie_settings_ == NULL)
42 return false; 47 return false;
43 return cookie_settings_->IsCookieSessionOnly(origin); 48 return cookie_settings_->IsCookieSessionOnly(origin);
44 } 49 }
45 50
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 205
201 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() { 206 void ExtensionSpecialStoragePolicy::SpecialCollection::Clear() {
202 ClearCache(); 207 ClearCache();
203 extensions_.Clear(); 208 extensions_.Clear();
204 } 209 }
205 210
206 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() { 211 void ExtensionSpecialStoragePolicy::SpecialCollection::ClearCache() {
207 STLDeleteValues(&cached_results_); 212 STLDeleteValues(&cached_results_);
208 cached_results_.clear(); 213 cached_results_.clear();
209 } 214 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698