| OLD | NEW |
| 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" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 repl.SetScheme(chrome::kViewSourceScheme, | 53 repl.SetScheme(chrome::kViewSourceScheme, |
| 54 url_parse::Component(0, strlen(chrome::kViewSourceScheme))); | 54 url_parse::Component(0, strlen(chrome::kViewSourceScheme))); |
| 55 repl.SetPath(url->spec().c_str(), | 55 repl.SetPath(url->spec().c_str(), |
| 56 url_parse::Component(0, url->spec().size())); | 56 url_parse::Component(0, url->spec().size())); |
| 57 *url = url->ReplaceComponents(repl); | 57 *url = url->ReplaceComponents(repl); |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Handles rewriting DOM UI URLs. | 61 // Handles rewriting DOM UI URLs. |
| 62 static bool HandleDOMUI(GURL* url, Profile* profile) { | 62 static bool HandleDOMUI(GURL* url, Profile* profile) { |
| 63 if (!DOMUIFactory::UseDOMUIForURL(*url)) | 63 if (!DOMUIFactory::UseDOMUIForURL(profile, *url)) |
| 64 return false; | 64 return false; |
| 65 | 65 |
| 66 // Special case the new tab page. In older versions of Chrome, the new tab | 66 // Special case the new tab page. In older versions of Chrome, the new tab |
| 67 // page was hosted at chrome-internal:<blah>. This might be in people's saved | 67 // page was hosted at chrome-internal:<blah>. This might be in people's saved |
| 68 // sessions or bookmarks, so we say any URL with that scheme triggers the new | 68 // sessions or bookmarks, so we say any URL with that scheme triggers the new |
| 69 // tab page. | 69 // tab page. |
| 70 if (url->SchemeIs(chrome::kChromeInternalScheme)) { | 70 if (url->SchemeIs(chrome::kChromeInternalScheme)) { |
| 71 // Rewrite it with the proper new tab URL. | 71 // Rewrite it with the proper new tab URL. |
| 72 *url = GURL(chrome::kChromeUINewTabURL); | 72 *url = GURL(chrome::kChromeUINewTabURL); |
| 73 } | 73 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 GURL test_url(original); | 113 GURL test_url(original); |
| 114 if ((*url_handlers_[i].first)(&test_url, profile)) { | 114 if ((*url_handlers_[i].first)(&test_url, profile)) { |
| 115 if (url_handlers_[i].second) | 115 if (url_handlers_[i].second) |
| 116 return (*url_handlers_[i].second)(url, profile); | 116 return (*url_handlers_[i].second)(url, profile); |
| 117 else | 117 else |
| 118 return false; | 118 return false; |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 return false; | 121 return false; |
| 122 } | 122 } |
| OLD | NEW |