OLD | NEW |
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/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 9 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
12 #include "content/public/browser/child_process_security_policy.h" | 12 #include "content/public/browser/child_process_security_policy.h" |
13 #include "extensions/common/constants.h" | 13 #include "extensions/common/constants.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 15 #include "third_party/WebKit/public/platform/WebString.h" |
16 | 16 |
17 // Static | 17 // Static |
18 bool BrowsingDataHelper::IsWebScheme(const std::string& scheme) { | 18 bool BrowsingDataHelper::IsWebScheme(const std::string& scheme) { |
19 // Special-case `file://` scheme iff cookies and site data are enabled via | 19 // Special-case `file://` scheme iff cookies and site data are enabled via |
20 // the `--allow-file-cookies` CLI flag. | 20 // the `--allow-file-cookies` CLI flag. |
21 if (scheme == chrome::kFileScheme) { | 21 if (scheme == chrome::kFileScheme) { |
22 return CommandLine::ForCurrentProcess()->HasSwitch( | 22 return CommandLine::ForCurrentProcess()->HasSwitch( |
23 switches::kEnableFileCookies); | 23 switches::kEnableFileCookies); |
24 | 24 |
25 // Otherwise, all "web safe" schemes are valid, except `chrome-extension://` | 25 // Otherwise, all "web safe" schemes are valid, except `chrome-extension://` |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return true; | 73 return true; |
74 | 74 |
75 // Hosted applications (protected and websafe origins) iff PROTECTED_WEB. | 75 // Hosted applications (protected and websafe origins) iff PROTECTED_WEB. |
76 if (policy->IsStorageProtected(origin.GetOrigin()) && | 76 if (policy->IsStorageProtected(origin.GetOrigin()) && |
77 BrowsingDataHelper::HasWebScheme(origin.GetOrigin()) && | 77 BrowsingDataHelper::HasWebScheme(origin.GetOrigin()) && |
78 origin_set_mask & PROTECTED_WEB) | 78 origin_set_mask & PROTECTED_WEB) |
79 return true; | 79 return true; |
80 | 80 |
81 return false; | 81 return false; |
82 } | 82 } |
OLD | NEW |