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

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

Issue 6513010: WebUI: Get rid of more references to DOMUI in the rest of the directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/dom_ui/menu_ui.cc » ('j') | 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) 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/dom_ui/web_ui_factory.h" 9 #include "chrome/browser/dom_ui/web_ui_factory.h"
10 #include "chrome/browser/extensions/extension_web_ui.h" 10 #include "chrome/browser/extensions/extension_web_ui.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 url_canon::Replacements<char> repl; 53 url_canon::Replacements<char> repl;
54 repl.SetScheme(chrome::kViewSourceScheme, 54 repl.SetScheme(chrome::kViewSourceScheme,
55 url_parse::Component(0, strlen(chrome::kViewSourceScheme))); 55 url_parse::Component(0, strlen(chrome::kViewSourceScheme)));
56 repl.SetPath(url->spec().c_str(), 56 repl.SetPath(url->spec().c_str(),
57 url_parse::Component(0, url->spec().size())); 57 url_parse::Component(0, url->spec().size()));
58 *url = url->ReplaceComponents(repl); 58 *url = url->ReplaceComponents(repl);
59 return true; 59 return true;
60 } 60 }
61 61
62 // Handles rewriting Web UI URLs. 62 // Handles rewriting Web UI URLs.
63 static bool HandleDOMUI(GURL* url, Profile* profile) { 63 static bool HandleWebUI(GURL* url, Profile* profile) {
64 if (!WebUIFactory::UseWebUIForURL(profile, *url)) 64 if (!WebUIFactory::UseWebUIForURL(profile, *url))
65 return false; 65 return false;
66 66
67 // Special case the new tab page. In older versions of Chrome, the new tab 67 // 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 68 // 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 69 // sessions or bookmarks, so we say any URL with that scheme triggers the new
70 // tab page. 70 // tab page.
71 if (url->SchemeIs(chrome::kChromeInternalScheme)) { 71 if (url->SchemeIs(chrome::kChromeInternalScheme)) {
72 // Rewrite it with the proper new tab URL. 72 // Rewrite it with the proper new tab URL.
73 *url = GURL(chrome::kChromeUINewTabURL); 73 *url = GURL(chrome::kChromeUINewTabURL);
(...skipping 18 matching lines...) Expand all
92 URLHandler null_handler = NULL; 92 URLHandler null_handler = NULL;
93 #endif 93 #endif
94 94
95 // Add the default URL handlers. 95 // Add the default URL handlers.
96 url_handlers_.push_back( 96 url_handlers_.push_back(
97 HandlerPair(&ExtensionWebUI::HandleChromeURLOverride, null_handler)); 97 HandlerPair(&ExtensionWebUI::HandleChromeURLOverride, null_handler));
98 // about: 98 // about:
99 url_handlers_.push_back(HandlerPair(&WillHandleBrowserAboutURL, 99 url_handlers_.push_back(HandlerPair(&WillHandleBrowserAboutURL,
100 null_handler)); 100 null_handler));
101 // chrome: & friends. 101 // chrome: & friends.
102 url_handlers_.push_back(HandlerPair(&HandleDOMUI, null_handler)); 102 url_handlers_.push_back(HandlerPair(&HandleWebUI, null_handler));
103 // view-source: 103 // view-source:
104 url_handlers_.push_back(HandlerPair(&HandleViewSource, &ReverseViewSource)); 104 url_handlers_.push_back(HandlerPair(&HandleViewSource, &ReverseViewSource));
105 } 105 }
106 106
107 // static 107 // static
108 void BrowserURLHandler::RewriteURLIfNecessary(GURL* url, Profile* profile, 108 void BrowserURLHandler::RewriteURLIfNecessary(GURL* url, Profile* profile,
109 bool* reverse_on_redirect) { 109 bool* reverse_on_redirect) {
110 if (url_handlers_.empty()) 110 if (url_handlers_.empty())
111 InitURLHandlers(); 111 InitURLHandlers();
112 for (size_t i = 0; i < url_handlers_.size(); ++i) { 112 for (size_t i = 0; i < url_handlers_.size(); ++i) {
(...skipping 11 matching lines...) Expand all
124 GURL test_url(original); 124 GURL test_url(original);
125 if ((*url_handlers_[i].first)(&test_url, profile)) { 125 if ((*url_handlers_[i].first)(&test_url, profile)) {
126 if (url_handlers_[i].second) 126 if (url_handlers_[i].second)
127 return (*url_handlers_[i].second)(url, profile); 127 return (*url_handlers_[i].second)(url, profile);
128 else 128 else
129 return false; 129 return false;
130 } 130 }
131 } 131 }
132 return false; 132 return false;
133 } 133 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/dom_ui/menu_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698