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

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

Issue 6713082: Move WebUIFactory to chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove WebUISource references Created 9 years, 9 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 "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/extensions/extension_web_ui.h" 9 #include "chrome/browser/extensions/extension_web_ui.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h"
11 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
12 #include "content/browser/webui/web_ui_factory.h" 13 #include "content/browser/webui/web_ui.h"
13 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
14 15
15 // Handles rewriting view-source URLs for what we'll actually load. 16 // Handles rewriting view-source URLs for what we'll actually load.
16 static bool HandleViewSource(GURL* url, Profile* profile) { 17 static bool HandleViewSource(GURL* url, Profile* profile) {
17 if (url->SchemeIs(chrome::kViewSourceScheme)) { 18 if (url->SchemeIs(chrome::kViewSourceScheme)) {
18 // Load the inner URL instead. 19 // Load the inner URL instead.
19 *url = GURL(url->path()); 20 *url = GURL(url->path());
20 21
21 // Bug 26129: limit view-source to view the content and not any 22 // Bug 26129: limit view-source to view the content and not any
22 // other kind of 'active' url scheme like 'javascript' or 'data'. 23 // other kind of 'active' url scheme like 'javascript' or 'data'.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 repl.SetScheme(chrome::kViewSourceScheme, 55 repl.SetScheme(chrome::kViewSourceScheme,
55 url_parse::Component(0, strlen(chrome::kViewSourceScheme))); 56 url_parse::Component(0, strlen(chrome::kViewSourceScheme)));
56 repl.SetPath(url->spec().c_str(), 57 repl.SetPath(url->spec().c_str(),
57 url_parse::Component(0, url->spec().size())); 58 url_parse::Component(0, url->spec().size()));
58 *url = url->ReplaceComponents(repl); 59 *url = url->ReplaceComponents(repl);
59 return true; 60 return true;
60 } 61 }
61 62
62 // Handles rewriting Web UI URLs. 63 // Handles rewriting Web UI URLs.
63 static bool HandleWebUI(GURL* url, Profile* profile) { 64 static bool HandleWebUI(GURL* url, Profile* profile) {
64 if (!WebUIFactory::UseWebUIForURL(profile, *url)) 65 if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(profile, *url))
65 return false; 66 return false;
66 67
67 // Special case the new tab page. In older versions of Chrome, the new tab 68 // Special case the new tab page. In older versions of Chrome, the new tab
68 // page was hosted at chrome-internal:<blah>. This might be in people's saved 69 // page was hosted at chrome-internal:<blah>. This might be in people's saved
69 // sessions or bookmarks, so we say any URL with that scheme triggers the new 70 // sessions or bookmarks, so we say any URL with that scheme triggers the new
70 // tab page. 71 // tab page.
71 if (url->SchemeIs(chrome::kChromeInternalScheme)) { 72 if (url->SchemeIs(chrome::kChromeInternalScheme)) {
72 // Rewrite it with the proper new tab URL. 73 // Rewrite it with the proper new tab URL.
73 *url = GURL(chrome::kChromeUINewTabURL); 74 *url = GURL(chrome::kChromeUINewTabURL);
74 } 75 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 GURL test_url(original); 125 GURL test_url(original);
125 if ((*url_handlers_[i].first)(&test_url, profile)) { 126 if ((*url_handlers_[i].first)(&test_url, profile)) {
126 if (url_handlers_[i].second) 127 if (url_handlers_[i].second)
127 return (*url_handlers_[i].second)(url, profile); 128 return (*url_handlers_[i].second)(url, profile);
128 else 129 else
129 return false; 130 return false;
130 } 131 }
131 } 132 }
132 return false; 133 return false;
133 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698