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

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

Issue 273193004: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. Created 6 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
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "cc/base/switches.h" 9 #include "cc/base/switches.h"
10 #include "content/browser/frame_host/debug_urls.h" 10 #include "content/browser/frame_host/debug_urls.h"
11 #include "content/browser/webui/web_ui_impl.h" 11 #include "content/browser/webui/web_ui_impl.h"
12 #include "content/public/browser/content_browser_client.h" 12 #include "content/public/browser/content_browser_client.h"
13 #include "content/public/common/url_constants.h" 13 #include "content/public/common/url_constants.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 // Handles rewriting view-source URLs for what we'll actually load. 18 // Handles rewriting view-source URLs for what we'll actually load.
19 static bool HandleViewSource(GURL* url, BrowserContext* browser_context) { 19 static bool HandleViewSource(GURL* url, BrowserContext* browser_context) {
20 if (url->SchemeIs(kViewSourceScheme)) { 20 if (url->SchemeIs(kViewSourceScheme)) {
21 // Load the inner URL instead. 21 // Load the inner URL instead.
22 *url = GURL(url->GetContent()); 22 *url = GURL(url->GetContent());
23 23
24 // Bug 26129: limit view-source to view the content and not any 24 // Bug 26129: limit view-source to view the content and not any
25 // other kind of 'active' url scheme like 'javascript' or 'data'. 25 // other kind of 'active' url scheme like 'javascript' or 'data'.
26 static const char* const default_allowed_sub_schemes[] = { 26 static const char* const default_allowed_sub_schemes[] = {
27 url::kHttpScheme, 27 url::kHttpScheme,
28 url::kHttpsScheme, 28 url::kHttpsScheme,
29 kFtpScheme, 29 url::kFtpScheme,
30 kChromeDevToolsScheme, 30 kChromeDevToolsScheme,
31 kChromeUIScheme, 31 kChromeUIScheme,
32 kFileScheme, 32 url::kFileScheme,
33 kFileSystemScheme 33 url::kFileSystemScheme
34 }; 34 };
35 35
36 // Merge all the schemes for which view-source is allowed by default, with 36 // Merge all the schemes for which view-source is allowed by default, with
37 // the WebUI schemes defined by the ContentBrowserClient. 37 // the WebUI schemes defined by the ContentBrowserClient.
38 std::vector<std::string> all_allowed_sub_schemes; 38 std::vector<std::string> all_allowed_sub_schemes;
39 for (size_t i = 0; i < arraysize(default_allowed_sub_schemes); ++i) 39 for (size_t i = 0; i < arraysize(default_allowed_sub_schemes); ++i)
40 all_allowed_sub_schemes.push_back(default_allowed_sub_schemes[i]); 40 all_allowed_sub_schemes.push_back(default_allowed_sub_schemes[i]);
41 GetContentClient()->browser()->GetAdditionalWebUISchemes( 41 GetContentClient()->browser()->GetAdditionalWebUISchemes(
42 &all_allowed_sub_schemes); 42 &all_allowed_sub_schemes);
43 43
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return true; 147 return true;
148 } else if (handler(&test_url, browser_context)) { 148 } else if (handler(&test_url, browser_context)) {
149 return reverse_rewriter(url, browser_context); 149 return reverse_rewriter(url, browser_context);
150 } 150 }
151 } 151 }
152 } 152 }
153 return false; 153 return false;
154 } 154 }
155 155
156 } // namespace content 156 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/load_url_params.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