OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "chrome/browser/lifetime/application_lifetime.h" | 11 #include "chrome/browser/lifetime/application_lifetime.h" |
12 #include "chrome/browser/ui/browser_dialogs.h" | 12 #include "chrome/browser/ui/browser_dialogs.h" |
13 #include "chrome/common/net/url_fixer_upper.h" | 13 #include "chrome/common/net/url_fixer_upper.h" |
14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
15 | 15 |
16 bool WillHandleBrowserAboutURL(GURL* url, | 16 bool WillHandleBrowserAboutURL(GURL* url, |
17 content::BrowserContext* browser_context) { | 17 content::BrowserContext* browser_context) { |
18 // TODO(msw): Eliminate "about:*" constants and literals from code and tests, | 18 // TODO(msw): Eliminate "about:*" constants and literals from code and tests, |
19 // then hopefully we can remove this forced fixup. | 19 // then hopefully we can remove this forced fixup. |
20 *url = URLFixerUpper::FixupURL(url->possibly_invalid_spec(), std::string()); | 20 *url = URLFixerUpper::FixupURL(url->possibly_invalid_spec(), std::string()); |
21 | 21 |
22 // Check that about: URLs are fixed up to chrome: by URLFixerUpper::FixupURL. | 22 // Check that about: URLs are fixed up to chrome: by URLFixerUpper::FixupURL. |
23 DCHECK((*url == GURL(content::kAboutBlankURL)) || | 23 DCHECK((*url == GURL(url::kAboutBlankURL)) || |
24 !url->SchemeIs(content::kAboutScheme)); | 24 !url->SchemeIs(url::kAboutScheme)); |
25 | 25 |
26 // Only handle chrome://foo/, URLFixerUpper::FixupURL translates about:foo. | 26 // Only handle chrome://foo/, URLFixerUpper::FixupURL translates about:foo. |
27 if (!url->SchemeIs(content::kChromeUIScheme)) | 27 if (!url->SchemeIs(content::kChromeUIScheme)) |
28 return false; | 28 return false; |
29 | 29 |
30 std::string host(url->host()); | 30 std::string host(url->host()); |
31 std::string path; | 31 std::string path; |
32 // Replace about with chrome-urls. | 32 // Replace about with chrome-urls. |
33 if (host == chrome::kChromeUIAboutHost) | 33 if (host == chrome::kChromeUIAboutHost) |
34 host = chrome::kChromeUIChromeURLsHost; | 34 host = chrome::kChromeUIChromeURLsHost; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // Run the dialog. This will re-use the existing one if it's already up. | 100 // Run the dialog. This will re-use the existing one if it's already up. |
101 chrome::ShowAboutIPCDialog(); | 101 chrome::ShowAboutIPCDialog(); |
102 return true; | 102 return true; |
103 } | 103 } |
104 #endif | 104 #endif |
105 | 105 |
106 #endif // OFFICIAL_BUILD | 106 #endif // OFFICIAL_BUILD |
107 | 107 |
108 return false; | 108 return false; |
109 } | 109 } |
OLD | NEW |