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

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

Issue 1171333003: Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again now that CQ is fixed Created 5 years, 4 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
« no previous file with comments | « chrome/browser/browser_about_handler.h ('k') | chrome/browser/chrome_content_browser_client.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) 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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/thread_task_runner_handle.h" 14 #include "base/thread_task_runner_handle.h"
15 #include "chrome/browser/lifetime/application_lifetime.h" 15 #include "chrome/browser/lifetime/application_lifetime.h"
16 #include "chrome/browser/ui/browser_dialogs.h" 16 #include "chrome/browser/ui/browser_dialogs.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
19 #include "components/url_fixer/url_fixer.h" 19 #include "components/url_formatter/url_fixer.h"
20 20
21 bool FixupBrowserAboutURL(GURL* url, 21 bool FixupBrowserAboutURL(GURL* url,
22 content::BrowserContext* browser_context) { 22 content::BrowserContext* browser_context) {
23 // Ensure that any cleanup done by FixupURL happens before the rewriting 23 // Ensure that any cleanup done by FixupURL happens before the rewriting
24 // phase that determines the virtual URL, by including it in an initial 24 // phase that determines the virtual URL, by including it in an initial
25 // URLHandler. This prevents minor changes from producing a virtual URL, 25 // URLHandler. This prevents minor changes from producing a virtual URL,
26 // which could lead to a URL spoof. 26 // which could lead to a URL spoof.
27 *url = url_fixer::FixupURL(url->possibly_invalid_spec(), std::string()); 27 *url = url_formatter::FixupURL(url->possibly_invalid_spec(), std::string());
28 return true; 28 return true;
29 } 29 }
30 30
31 bool WillHandleBrowserAboutURL(GURL* url, 31 bool WillHandleBrowserAboutURL(GURL* url,
32 content::BrowserContext* browser_context) { 32 content::BrowserContext* browser_context) {
33 // TODO(msw): Eliminate "about:*" constants and literals from code and tests, 33 // TODO(msw): Eliminate "about:*" constants and literals from code and tests,
34 // then hopefully we can remove this forced fixup. 34 // then hopefully we can remove this forced fixup.
35 FixupBrowserAboutURL(url, browser_context); 35 FixupBrowserAboutURL(url, browser_context);
36 36
37 // Check that about: URLs are fixed up to chrome: by url_fixer::FixupURL. 37 // Check that about: URLs are fixed up to chrome: by url_formatter::FixupURL.
38 DCHECK((*url == GURL(url::kAboutBlankURL)) || 38 DCHECK((*url == GURL(url::kAboutBlankURL)) ||
39 !url->SchemeIs(url::kAboutScheme)); 39 !url->SchemeIs(url::kAboutScheme));
40 40
41 // Only handle chrome://foo/, url_fixer::FixupURL translates about:foo. 41 // Only handle chrome://foo/, url_formatter::FixupURL translates about:foo.
42 if (!url->SchemeIs(content::kChromeUIScheme)) 42 if (!url->SchemeIs(content::kChromeUIScheme))
43 return false; 43 return false;
44 44
45 std::string host(url->host()); 45 std::string host(url->host());
46 std::string path; 46 std::string path;
47 // Replace about with chrome-urls. 47 // Replace about with chrome-urls.
48 if (host == chrome::kChromeUIAboutHost) 48 if (host == chrome::kChromeUIAboutHost)
49 host = chrome::kChromeUIChromeURLsHost; 49 host = chrome::kChromeUIChromeURLsHost;
50 // Replace cache with view-http-cache. 50 // Replace cache with view-http-cache.
51 if (host == chrome::kChromeUICacheHost) { 51 if (host == chrome::kChromeUICacheHost) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 FROM_HERE, base::Bind(&chrome::AttemptRestart)); 112 FROM_HERE, base::Bind(&chrome::AttemptRestart));
113 return true; 113 return true;
114 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { 114 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) {
115 base::ThreadTaskRunnerHandle::Get()->PostTask( 115 base::ThreadTaskRunnerHandle::Get()->PostTask(
116 FROM_HERE, base::Bind(&chrome::AttemptExit)); 116 FROM_HERE, base::Bind(&chrome::AttemptExit));
117 return true; 117 return true;
118 } 118 }
119 119
120 return false; 120 return false;
121 } 121 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_about_handler.h ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698