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

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

Issue 10454113: Renaming `BrowsingDataHelper::IsValidScheme`, as it's poorly descriptive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bernhard. Created 8 years, 6 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 | « chrome/browser/browsing_data_helper.h ('k') | chrome/browser/browsing_data_helper_unittest.cc » ('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/browsing_data_helper.h" 5 #include "chrome/browser/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/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
11 #include "content/public/browser/child_process_security_policy.h" 11 #include "content/public/browser/child_process_security_policy.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
14 14
15 // Static 15 // Static
16 bool BrowsingDataHelper::IsValidScheme(const std::string& scheme) { 16 bool BrowsingDataHelper::IsWebScheme(const std::string& scheme) {
17 // Special-case `file://` scheme iff cookies and site data are enabled via 17 // Special-case `file://` scheme iff cookies and site data are enabled via
18 // the `--allow-file-cookies` CLI flag. 18 // the `--allow-file-cookies` CLI flag.
19 if (scheme == chrome::kFileScheme) { 19 if (scheme == chrome::kFileScheme) {
20 return CommandLine::ForCurrentProcess()->HasSwitch( 20 return CommandLine::ForCurrentProcess()->HasSwitch(
21 switches::kEnableFileCookies); 21 switches::kEnableFileCookies);
22 22
23 // Otherwise, all "web safe" schemes are valid, except `chrome-extension://` 23 // Otherwise, all "web safe" schemes are valid, except `chrome-extension://`
24 // and `chrome-devtools://`. 24 // and `chrome-devtools://`.
25 } else { 25 } else {
26 content::ChildProcessSecurityPolicy* policy = 26 content::ChildProcessSecurityPolicy* policy =
27 content::ChildProcessSecurityPolicy::GetInstance(); 27 content::ChildProcessSecurityPolicy::GetInstance();
28 return (policy->IsWebSafeScheme(scheme) && 28 return (policy->IsWebSafeScheme(scheme) &&
29 scheme != chrome::kChromeDevToolsScheme && 29 !BrowsingDataHelper::IsExtensionScheme(scheme) &&
30 scheme != chrome::kExtensionScheme); 30 scheme != chrome::kChromeDevToolsScheme);
31 } 31 }
32 } 32 }
33 33
34 // Static 34 // Static
35 bool BrowsingDataHelper::IsValidScheme(const WebKit::WebString& scheme) { 35 bool BrowsingDataHelper::IsWebScheme(const WebKit::WebString& scheme) {
36 return BrowsingDataHelper::IsValidScheme(UTF16ToUTF8(scheme)); 36 return BrowsingDataHelper::IsWebScheme(UTF16ToUTF8(scheme));
37 } 37 }
38 38
39 // Static 39 // Static
40 bool BrowsingDataHelper::HasValidScheme(const GURL& origin) { 40 bool BrowsingDataHelper::HasWebScheme(const GURL& origin) {
41 return BrowsingDataHelper::IsValidScheme(origin.scheme()); 41 return BrowsingDataHelper::IsWebScheme(origin.scheme());
42 } 42 }
43
44 // Static
45 bool BrowsingDataHelper::IsExtensionScheme(const std::string& scheme) {
46 return scheme == chrome::kExtensionScheme;
47 }
48
49 // Static
50 bool BrowsingDataHelper::IsExtensionScheme(const WebKit::WebString& scheme) {
51 return BrowsingDataHelper::IsExtensionScheme(UTF16ToUTF8(scheme));
52 }
53
54 // Static
55 bool BrowsingDataHelper::HasExtensionScheme(const GURL& origin) {
56 return BrowsingDataHelper::IsExtensionScheme(origin.scheme());
57 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_helper.h ('k') | chrome/browser/browsing_data_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698