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

Side by Side Diff: content/browser/browser_url_handler_impl.cc

Issue 23112033: content: Move kHttpsScheme constant into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 "content/browser/browser_url_handler_impl.h" 5 #include "content/browser/browser_url_handler_impl.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "content/browser/webui/web_ui_impl.h" 8 #include "content/browser/webui/web_ui_impl.h"
9 #include "content/public/browser/content_browser_client.h" 9 #include "content/public/browser/content_browser_client.h"
10 #include "content/public/common/url_constants.h" 10 #include "content/public/common/url_constants.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 // Handles rewriting view-source URLs for what we'll actually load. 15 // Handles rewriting view-source URLs for what we'll actually load.
16 static bool HandleViewSource(GURL* url, 16 static bool HandleViewSource(GURL* url, BrowserContext* browser_context) {
17 BrowserContext* browser_context) {
18 if (url->SchemeIs(kViewSourceScheme)) { 17 if (url->SchemeIs(kViewSourceScheme)) {
19 // Load the inner URL instead. 18 // Load the inner URL instead.
20 *url = GURL(url->path()); 19 *url = GURL(url->path());
21 20
22 // Bug 26129: limit view-source to view the content and not any 21 // Bug 26129: limit view-source to view the content and not any
23 // other kind of 'active' url scheme like 'javascript' or 'data'. 22 // other kind of 'active' url scheme like 'javascript' or 'data'.
24 static const char* const allowed_sub_schemes[] = { 23 static const char* const allowed_sub_schemes[] = {
25 chrome::kHttpScheme, chrome::kHttpsScheme, chrome::kFtpScheme, 24 chrome::kHttpScheme, kHttpsScheme, chrome::kFtpScheme,
26 chrome::kChromeDevToolsScheme, chrome::kChromeUIScheme, 25 chrome::kChromeDevToolsScheme, chrome::kChromeUIScheme,
27 chrome::kFileScheme, chrome::kFileSystemScheme 26 chrome::kFileScheme, chrome::kFileSystemScheme
28 }; 27 };
29 28
30 bool is_sub_scheme_allowed = false; 29 bool is_sub_scheme_allowed = false;
31 for (size_t i = 0; i < arraysize(allowed_sub_schemes); i++) { 30 for (size_t i = 0; i < arraysize(allowed_sub_schemes); i++) {
32 if (url->SchemeIs(allowed_sub_schemes[i])) { 31 if (url->SchemeIs(allowed_sub_schemes[i])) {
33 is_sub_scheme_allowed = true; 32 is_sub_scheme_allowed = true;
34 break; 33 break;
35 } 34 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return true; 125 return true;
127 } else if (handler(&test_url, browser_context)) { 126 } else if (handler(&test_url, browser_context)) {
128 return reverse_rewriter(url, browser_context); 127 return reverse_rewriter(url, browser_context);
129 } 128 }
130 } 129 }
131 } 130 }
132 return false; 131 return false;
133 } 132 }
134 133
135 } // namespace content 134 } // namespace content
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | content/browser/child_process_security_policy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698