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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_helper.cc

Issue 428323002: ifdef remaining extensions code in chrome/browser/browsing_data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang again Created 6 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) 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/browsing_data/browsing_data_helper.h" 5 #include "chrome/browser/browsing_data/browsing_data_helper.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_special_storage_policy.h"
10 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
11 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
12 #include "content/public/browser/child_process_security_policy.h" 11 #include "content/public/browser/child_process_security_policy.h"
13 #include "extensions/common/constants.h" 12 #include "extensions/common/constants.h"
14 #include "url/gurl.h" 13 #include "url/gurl.h"
14 #include "webkit/browser/quota/special_storage_policy.h"
15 15
16 // Static 16 // Static
17 bool BrowsingDataHelper::IsWebScheme(const std::string& scheme) { 17 bool BrowsingDataHelper::IsWebScheme(const std::string& scheme) {
18 // Special-case `file://` scheme iff cookies and site data are enabled via 18 // Special-case `file://` scheme iff cookies and site data are enabled via
19 // the `--allow-file-cookies` CLI flag. 19 // the `--allow-file-cookies` CLI flag.
20 if (scheme == url::kFileScheme) { 20 if (scheme == url::kFileScheme) {
21 return base::CommandLine::ForCurrentProcess()->HasSwitch( 21 return base::CommandLine::ForCurrentProcess()->HasSwitch(
22 switches::kEnableFileCookies); 22 switches::kEnableFileCookies);
23 } 23 }
24 24
(...skipping 16 matching lines...) Expand all
41 return scheme == extensions::kExtensionScheme; 41 return scheme == extensions::kExtensionScheme;
42 } 42 }
43 43
44 // Static 44 // Static
45 bool BrowsingDataHelper::HasExtensionScheme(const GURL& origin) { 45 bool BrowsingDataHelper::HasExtensionScheme(const GURL& origin) {
46 return BrowsingDataHelper::IsExtensionScheme(origin.scheme()); 46 return BrowsingDataHelper::IsExtensionScheme(origin.scheme());
47 } 47 }
48 48
49 // Static 49 // Static
50 bool BrowsingDataHelper::DoesOriginMatchMask(const GURL& origin, 50 bool BrowsingDataHelper::DoesOriginMatchMask(const GURL& origin,
51 int origin_set_mask, ExtensionSpecialStoragePolicy* policy) { 51 int origin_set_mask, quota::SpecialStoragePolicy* policy) {
52 // Packaged apps and extensions match iff EXTENSION. 52 // Packaged apps and extensions match iff EXTENSION.
53 if (BrowsingDataHelper::HasExtensionScheme(origin.GetOrigin()) && 53 if (BrowsingDataHelper::HasExtensionScheme(origin.GetOrigin()) &&
54 origin_set_mask & EXTENSION) 54 origin_set_mask & EXTENSION)
55 return true; 55 return true;
56 56
57 // If a websafe origin is unprotected, it matches iff UNPROTECTED_WEB. 57 // If a websafe origin is unprotected, it matches iff UNPROTECTED_WEB.
58 if ((!policy || !policy->IsStorageProtected(origin.GetOrigin())) && 58 if ((!policy || !policy->IsStorageProtected(origin.GetOrigin())) &&
59 BrowsingDataHelper::HasWebScheme(origin.GetOrigin()) && 59 BrowsingDataHelper::HasWebScheme(origin.GetOrigin()) &&
60 origin_set_mask & UNPROTECTED_WEB) 60 origin_set_mask & UNPROTECTED_WEB)
61 return true; 61 return true;
62 62
63 // Hosted applications (protected and websafe origins) iff PROTECTED_WEB. 63 // Hosted applications (protected and websafe origins) iff PROTECTED_WEB.
64 if (policy && 64 if (policy &&
65 policy->IsStorageProtected(origin.GetOrigin()) && 65 policy->IsStorageProtected(origin.GetOrigin()) &&
66 BrowsingDataHelper::HasWebScheme(origin.GetOrigin()) && 66 BrowsingDataHelper::HasWebScheme(origin.GetOrigin()) &&
67 origin_set_mask & PROTECTED_WEB) 67 origin_set_mask & PROTECTED_WEB)
68 return true; 68 return true;
69 69
70 return false; 70 return false;
71 } 71 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_helper.h ('k') | chrome/browser/browsing_data/browsing_data_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698