diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser.cc | 3 | ||||
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 6 | ||||
-rw-r--r-- | chrome/browser/crash_recovery_uitest.cc | 5 | ||||
-rw-r--r-- | chrome/browser/history/history.cc | 3 | ||||
-rw-r--r-- | chrome/browser/history/url_database.cc | 3 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host_unittest.cc | 5 | ||||
-rw-r--r-- | chrome/browser/renderer_host/renderer_security_policy_unittest.cc | 24 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc | 3 | ||||
-rw-r--r-- | chrome/browser/site_instance_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/tab_contents/navigation_controller.cc | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents/site_instance.cc | 12 | ||||
-rw-r--r-- | chrome/browser/task_manager.cc | 3 | ||||
-rw-r--r-- | chrome/browser/toolbar_model.cc | 4 |
13 files changed, 43 insertions, 37 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 311d500..6b9fe7d 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -34,6 +34,7 @@ #include "chrome/common/page_transition_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" +#include "chrome/common/url_constants.h" #ifdef CHROME_PERSONALIZATION #include "chrome/personalization/personalization.h" #endif @@ -2281,7 +2282,7 @@ NavigationController* Browser::BuildRestoredNavigationController( } else { // No navigations. Create a tab with about:blank. TabContents* contents = - CreateTabContentsForURL(GURL("about:blank"), GURL(), profile_, + CreateTabContentsForURL(GURL(chrome::kAboutBlankURL), GURL(), profile_, PageTransition::START_PAGE, false, NULL); return new NavigationController(contents, profile_); } diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 7f25a60..0d83902 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -169,7 +169,7 @@ bool BrowserAboutHandler::MaybeHandle(GURL* url, // about:blank is special. Frames are allowed to access about:blank, // but they are not allowed to access other types of about pages. // Just ignore the about:blank and let the TAB_CONTENTS_WEB handle it. - if (StringToLowerASCII(url->path()) == "blank") { + if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutBlankURL)) { return false; } @@ -192,7 +192,7 @@ bool BrowserAboutHandler::MaybeHandle(GURL* url, // Navigate the renderer to about:blank. This is kind of stupid but is the // easiest thing to do in this situation without adding a lot of complexity // for this developer-only feature. - *url = GURL("about:blank"); + *url = GURL(chrome::kAboutBlankURL); return false; } @@ -205,7 +205,7 @@ bool BrowserAboutHandler::MaybeHandle(GURL* url, NOTIMPLEMENTED(); // TODO(port) Implement this. #endif - *url = GURL("about:blank"); + *url = GURL(chrome::kAboutBlankURL); return false; } #endif diff --git a/chrome/browser/crash_recovery_uitest.cc b/chrome/browser/crash_recovery_uitest.cc index d094124..0355ec0 100644 --- a/chrome/browser/crash_recovery_uitest.cc +++ b/chrome/browser/crash_recovery_uitest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/file_util.h" +#include "chrome/common/url_constants.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/ui/ui_test.h" @@ -30,7 +31,7 @@ TEST_F(CrashRecoveryUITest, Reload) { // Cause the renderer to crash. expected_crashes_ = 1; - tab->NavigateToURLAsync(GURL("about:crash")); + tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL)); Sleep(1000); // Wait for the browser to notice the renderer crash. @@ -63,7 +64,7 @@ TEST_F(CrashRecoveryUITest, LoadInNewTab) { // Cause the renderer to crash. expected_crashes_ = 1; - tab->NavigateToURLAsync(GURL("about:crash")); + tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL)); Sleep(1000); // Wait for the browser to notice the renderer crash. diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc index 49707cf..ced7b64 100644 --- a/chrome/browser/history/history.cc +++ b/chrome/browser/history/history.cc @@ -578,8 +578,7 @@ bool HistoryService::CanAddURL(const GURL& url) const { return false; if (url.SchemeIs(chrome::kAboutScheme)) { - std::string path = url.path(); - if (path.empty() || LowerCaseEqualsASCII(path, "blank")) + if (LowerCaseEqualsASCII(url.spec(), chrome::kAboutBlankURL)) return false; // We allow all other about URLs since the user may like to see things // like "about:memory" or "about:histograms" in their history and diff --git a/chrome/browser/history/url_database.cc b/chrome/browser/history/url_database.cc index 6db3b10..5bef3f5 100644 --- a/chrome/browser/history/url_database.cc +++ b/chrome/browser/history/url_database.cc @@ -10,6 +10,7 @@ #include "base/string_util.h" #include "chrome/common/l10n_util.h" #include "chrome/common/sqlite_utils.h" +#include "chrome/common/url_constants.h" #include "googleurl/src/gurl.h" using base::Time; @@ -408,7 +409,7 @@ void URLDatabase::GetMostRecentKeywordSearchTerms( bool URLDatabase::MigrateFromVersion11ToVersion12() { URLRow about_row; - if (GetRowForURL(GURL("about:blank"), &about_row)) { + if (GetRowForURL(GURL(chrome::kAboutBlankURL), &about_row)) { about_row.set_favicon_id(0); return UpdateURLRow(about_row.id(), about_row); } diff --git a/chrome/browser/renderer_host/render_view_host_unittest.cc b/chrome/browser/renderer_host/render_view_host_unittest.cc index 0ae9e46..22ee2ab 100644 --- a/chrome/browser/renderer_host/render_view_host_unittest.cc +++ b/chrome/browser/renderer_host/render_view_host_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/renderer_host/test_render_view_host.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
+#include "chrome/common/url_constants.h"
namespace {
@@ -15,7 +16,7 @@ class RenderViewHostTest : public RenderViewHostTestHarness { // All about URLs reported by the renderer should get rewritten to about:blank.
// See RenderViewHost::OnMsgNavigate for a discussion.
TEST_F(RenderViewHostTest, FilterAbout) {
- rvh()->SendNavigate(1, GURL("about:cache"));
+ rvh()->SendNavigate(1, GURL(chrome::kAboutCacheURL));
ASSERT_TRUE(controller_->GetActiveEntry());
- EXPECT_EQ(GURL("about:blank"), controller_->GetActiveEntry()->url());
+ EXPECT_EQ(GURL(chrome::kAboutBlankURL), controller_->GetActiveEntry()->url());
}
diff --git a/chrome/browser/renderer_host/renderer_security_policy_unittest.cc b/chrome/browser/renderer_host/renderer_security_policy_unittest.cc index c9faaea..d237b7e 100644 --- a/chrome/browser/renderer_host/renderer_security_policy_unittest.cc +++ b/chrome/browser/renderer_host/renderer_security_policy_unittest.cc @@ -87,26 +87,26 @@ TEST_F(RendererSecurityPolicyTest, AboutTest) { EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL("aBouT:BlAnK"))); EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL("aBouT:blank"))); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:memory"))); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:crash"))); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:cache"))); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:hang"))); + EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kAboutMemoryURL))); + EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kAboutCrashURL))); + EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kAboutCacheURL))); + EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kAboutHangURL))); EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("aBoUt:memory"))); EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:CrASh"))); EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("abOuT:cAChe"))); - p->GrantRequestURL(kRendererID, GURL("about:memory")); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:memory"))); + p->GrantRequestURL(kRendererID, GURL(chrome::kAboutMemoryURL)); + EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kAboutMemoryURL))); - p->GrantRequestURL(kRendererID, GURL("about:crash")); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:crash"))); + p->GrantRequestURL(kRendererID, GURL(chrome::kAboutCrashURL)); + EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kAboutCrashURL))); - p->GrantRequestURL(kRendererID, GURL("about:cache")); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:cache"))); + p->GrantRequestURL(kRendererID, GURL(chrome::kAboutCacheURL)); + EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kAboutCacheURL))); - p->GrantRequestURL(kRendererID, GURL("about:hang")); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:hang"))); + p->GrantRequestURL(kRendererID, GURL(chrome::kAboutHangURL)); + EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kAboutHangURL))); p->Remove(kRendererID); } diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc index 5d3a6b8..61fa1b4 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc @@ -12,6 +12,7 @@ #include "chrome/browser/automation/url_request_failed_dns_job.h" #include "chrome/browser/automation/url_request_mock_http_job.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/url_constants.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/ui/ui_test.h" @@ -189,7 +190,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteAfterCrash) { // Cause the renderer to crash. expected_crashes_ = 1; - tab->NavigateToURLAsync(GURL("about:crash")); + tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL)); Sleep(sleep_timeout_ms()); // Wait for browser to notice the renderer crash. // Navigate to a new cross-site page. The browser should not wait around for diff --git a/chrome/browser/site_instance_unittest.cc b/chrome/browser/site_instance_unittest.cc index 71fa4d9..85fa7d5 100644 --- a/chrome/browser/site_instance_unittest.cc +++ b/chrome/browser/site_instance_unittest.cc @@ -241,9 +241,9 @@ TEST_F(SiteInstanceTest, IsSameWebSite) { GURL url_foo_https = GURL("https://foo/a.html"); GURL url_foo_port = GURL("http://foo:8080/a.html"); GURL url_javascript = GURL("javascript:alert(1);"); - GURL url_crash = GURL("about:crash"); - GURL url_hang = GURL("about:hang"); - GURL url_shorthang = GURL("about:shorthang"); + GURL url_crash = GURL(chrome::kAboutCrashURL); + GURL url_hang = GURL(chrome::kAboutHangURL); + GURL url_shorthang = GURL(chrome::kAboutShortHangURL); // Same scheme and port -> same site. EXPECT_TRUE(SiteInstance::IsSameWebSite(url_foo, url_foo2)); diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index def6c34..adf9568 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -386,7 +386,8 @@ void NavigationController::RemoveEntryAtIndex(int index, NavigateToPendingEntry(false); } else { // If there is nothing to show, show a default page. - LoadURL(default_url.is_empty() ? GURL("about:blank") : default_url, + LoadURL(default_url.is_empty() ? GURL(chrome::kAboutBlankURL) : + default_url, GURL(), PageTransition::START_PAGE); } } else if (last_committed_entry_index_ > index) { diff --git a/chrome/browser/tab_contents/site_instance.cc b/chrome/browser/tab_contents/site_instance.cc index a2a051f..6b6f65f 100644 --- a/chrome/browser/tab_contents/site_instance.cc +++ b/chrome/browser/tab_contents/site_instance.cc @@ -131,12 +131,12 @@ bool SiteInstance::IsSameWebSite(const GURL& url1, const GURL& url2) { // We treat about:crash, about:hang, and about:shorthang as the same site as // any URL, since they are used as demos for crashing/hanging a process. - GURL about_crash = GURL("about:crash"); - GURL about_hang = GURL("about:hang"); - GURL about_shorthang = GURL("about:shorthang"); - if (url1 == about_crash || url2 == about_crash || - url1 == about_hang || url2 == about_hang || - url1 == about_shorthang || url2 == about_shorthang) + if (url1.spec() == chrome::kAboutCrashURL || + url2.spec() == chrome::kAboutCrashURL || + url1.spec() == chrome::kAboutHangURL || + url2.spec() == chrome::kAboutHangURL || + url1.spec() == chrome::kAboutShortHangURL || + url2.spec() == chrome::kAboutShortHangURL) return true; // If either URL is invalid, they aren't part of the same site. diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index ae17dbe..ba2dafa 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -18,6 +18,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/resource_bundle.h" +#include "chrome/common/url_constants.h" #include "chrome/views/accelerator.h" #include "chrome/views/background.h" #include "chrome/views/link.h" @@ -919,7 +920,7 @@ void TaskManagerContents::LinkActivated(views::Link* source, DCHECK(source == about_memory_link_); Browser* browser = BrowserList::GetLastActive(); DCHECK(browser); - browser->OpenURL(GURL("about:memory"), GURL(), NEW_FOREGROUND_TAB, + browser->OpenURL(GURL(chrome::kAboutMemoryURL), GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); } diff --git a/chrome/browser/toolbar_model.cc b/chrome/browser/toolbar_model.cc index 08dc00b..14b99e1 100644 --- a/chrome/browser/toolbar_model.cc +++ b/chrome/browser/toolbar_model.cc @@ -12,6 +12,7 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" +#include "chrome/common/url_constants.h" #include "grit/generated_resources.h" #include "net/base/net_util.h" @@ -30,8 +31,7 @@ ToolbarModel::~ToolbarModel() { // ToolbarModel Implementation. std::wstring ToolbarModel::GetText() { - static const GURL kAboutBlankURL("about:blank"); - GURL url(kAboutBlankURL); + GURL url(chrome::kAboutBlankURL); std::wstring languages; // Empty if we don't have a |navigation_controller|. NavigationController* navigation_controller = GetNavigationController(); |