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

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

Issue 460009: Merge 33380 - This fixes an issue where view source on a local file would ret... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/249/src/
Patch Set: Created 11 years 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 | « no previous file | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/browser_url_handler.h" 5 #include "chrome/browser/browser_url_handler.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/browser_about_handler.h" 8 #include "chrome/browser/browser_about_handler.h"
9 #include "chrome/browser/dom_ui/dom_ui_factory.h" 9 #include "chrome/browser/dom_ui/dom_ui_factory.h"
10 #include "chrome/browser/extensions/extension_dom_ui.h" 10 #include "chrome/browser/extensions/extension_dom_ui.h"
11 #include "chrome/browser/profile.h" 11 #include "chrome/browser/profile.h"
12 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
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, Profile* profile) { 16 static bool HandleViewSource(GURL* url, Profile* profile) {
17 if (url->SchemeIs(chrome::kViewSourceScheme)) { 17 if (url->SchemeIs(chrome::kViewSourceScheme)) {
18 // Load the inner URL instead. 18 // Load the inner URL instead.
19 *url = GURL(url->path()); 19 *url = GURL(url->path());
20 20
21 // 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
22 // other kind of 'active' url scheme like 'javascript' or 'data'. 22 // other kind of 'active' url scheme like 'javascript' or 'data'.
23 static const char* const allowed_sub_schemes[] = { 23 static const char* const allowed_sub_schemes[] = {
24 chrome::kHttpScheme, chrome::kHttpsScheme, chrome::kFtpScheme, 24 chrome::kHttpScheme, chrome::kHttpsScheme, chrome::kFtpScheme,
25 chrome::kChromeUIScheme 25 chrome::kChromeUIScheme, chrome::kFileScheme
26 }; 26 };
27 27
28 bool is_sub_scheme_allowed = false; 28 bool is_sub_scheme_allowed = false;
29 for (size_t i = 0; i < arraysize(allowed_sub_schemes); i++) { 29 for (size_t i = 0; i < arraysize(allowed_sub_schemes); i++) {
30 if (url->SchemeIs(allowed_sub_schemes[i])) { 30 if (url->SchemeIs(allowed_sub_schemes[i])) {
31 is_sub_scheme_allowed = true; 31 is_sub_scheme_allowed = true;
32 break; 32 break;
33 } 33 }
34 } 34 }
35 35
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 // static 77 // static
78 void BrowserURLHandler::RewriteURLIfNecessary(GURL* url, Profile* profile) { 78 void BrowserURLHandler::RewriteURLIfNecessary(GURL* url, Profile* profile) {
79 if (url_handlers_.empty()) 79 if (url_handlers_.empty())
80 InitURLHandlers(); 80 InitURLHandlers();
81 for (size_t i = 0; i < url_handlers_.size(); ++i) { 81 for (size_t i = 0; i < url_handlers_.size(); ++i) {
82 if ((*url_handlers_[i])(url, profile)) 82 if ((*url_handlers_[i])(url, profile))
83 return; 83 return;
84 } 84 }
85 } 85 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698