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

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

Issue 7811006: Add full support for filesystem URLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged out; haven't built yet. Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "content/browser/browser_url_handler.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "content/browser/webui/web_ui.h" 8 #include "content/browser/webui/web_ui.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 "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
12 12
13 // Handles rewriting view-source URLs for what we'll actually load. 13 // Handles rewriting view-source URLs for what we'll actually load.
14 static bool HandleViewSource(GURL* url, 14 static bool HandleViewSource(GURL* url,
15 content::BrowserContext* browser_context) { 15 content::BrowserContext* browser_context) {
16 if (url->SchemeIs(chrome::kViewSourceScheme)) { 16 if (url->SchemeIs(chrome::kViewSourceScheme)) {
17 // Load the inner URL instead. 17 // Load the inner URL instead.
18 *url = GURL(url->path()); 18 *url = GURL(url->path());
19 19
20 // Bug 26129: limit view-source to view the content and not any 20 // Bug 26129: limit view-source to view the content and not any
21 // other kind of 'active' url scheme like 'javascript' or 'data'. 21 // other kind of 'active' url scheme like 'javascript' or 'data'.
22 static const char* const allowed_sub_schemes[] = { 22 static const char* const allowed_sub_schemes[] = {
23 chrome::kHttpScheme, chrome::kHttpsScheme, chrome::kFtpScheme, 23 chrome::kHttpScheme, chrome::kHttpsScheme, chrome::kFtpScheme,
24 chrome::kChromeDevToolsScheme, chrome::kChromeUIScheme, 24 chrome::kChromeDevToolsScheme, chrome::kChromeUIScheme,
25 chrome::kFileScheme 25 chrome::kFileScheme, chrome::kFileSystemScheme
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (!handler) { 114 if (!handler) {
115 if (reverse_rewriter(url, browser_context)) 115 if (reverse_rewriter(url, browser_context))
116 return true; 116 return true;
117 } else if (handler(&test_url, browser_context)) { 117 } else if (handler(&test_url, browser_context)) {
118 return reverse_rewriter(url, browser_context); 118 return reverse_rewriter(url, browser_context);
119 } 119 }
120 } 120 }
121 } 121 }
122 return false; 122 return false;
123 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698