| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return true; | 35 return true; |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool WillHandleBrowserAboutURL(GURL* url, | 38 bool WillHandleBrowserAboutURL(GURL* url, |
| 39 content::BrowserContext* browser_context) { | 39 content::BrowserContext* browser_context) { |
| 40 // TODO(msw): Eliminate "about:*" constants and literals from code and tests, | 40 // TODO(msw): Eliminate "about:*" constants and literals from code and tests, |
| 41 // then hopefully we can remove this forced fixup. | 41 // then hopefully we can remove this forced fixup. |
| 42 FixupBrowserAboutURL(url, browser_context); | 42 FixupBrowserAboutURL(url, browser_context); |
| 43 | 43 |
| 44 // Check that about: URLs are fixed up to chrome: by url_formatter::FixupURL. | 44 // Check that about: URLs are fixed up to chrome: by url_formatter::FixupURL. |
| 45 DCHECK((*url == GURL(url::kAboutBlankURL)) || | 45 DCHECK((*url == url::kAboutBlankURL) || |
| 46 !url->SchemeIs(url::kAboutScheme)); | 46 !url->SchemeIs(url::kAboutScheme)); |
| 47 | 47 |
| 48 // Only handle chrome://foo/, url_formatter::FixupURL translates about:foo. | 48 // Only handle chrome://foo/, url_formatter::FixupURL translates about:foo. |
| 49 if (!url->SchemeIs(content::kChromeUIScheme)) | 49 if (!url->SchemeIs(content::kChromeUIScheme)) |
| 50 return false; | 50 return false; |
| 51 | 51 |
| 52 std::string host(url->host()); | 52 std::string host(url->host()); |
| 53 std::string path; | 53 std::string path; |
| 54 // Replace about with chrome-urls. | 54 // Replace about with chrome-urls. |
| 55 if (host == chrome::kChromeUIAboutHost) | 55 if (host == chrome::kChromeUIAboutHost) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 FROM_HERE, base::Bind(&chrome::AttemptRestart)); | 140 FROM_HERE, base::Bind(&chrome::AttemptRestart)); |
| 141 return true; | 141 return true; |
| 142 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { | 142 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { |
| 143 base::ThreadTaskRunnerHandle::Get()->PostTask( | 143 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 144 FROM_HERE, base::Bind(&chrome::AttemptExit)); | 144 FROM_HERE, base::Bind(&chrome::AttemptExit)); |
| 145 return true; | 145 return true; |
| 146 } | 146 } |
| 147 | 147 |
| 148 return false; | 148 return false; |
| 149 } | 149 } |
| OLD | NEW |