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

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

Issue 2485253002: Remove unnecessary calls to GURL() (Closed)
Patch Set: Assert that StringPiece must always be canonicalized. Fix some constants. Created 4 years, 1 month 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
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"
(...skipping 24 matching lines...) Expand all
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698