Session restore shouldn't care about profile home pages.
The logic where we treated an empty URL as home page is outdated.
This CL contains the following additional fixes:
1) Disallow using empty URLs to denote anything (home page, new tab
page...) and force the callers of chrome::Navigate to specify which URL they
want to open. Using empty URLs was hiding bugs (see below).
2) Fixed StartupBrowserCreatorTest.UpdateWithTwoProfiles and
ProfilesWithoutPagesNotLaunched so that they don't work by accident (about:blank
used to be the home page - it wasn't restoring the previous session, but
launching the home page).
3) There was some code passing GURL("new_tab_page") around, and
comparing against that. But that's an invalid URL, so GURL will just make it
empty, and the result is not what is expected. (E.g,. GURL("foo") ==
GURL("new_tab_page")).
4) Fixed other places which were passing GURL("something_invalid") around and
pretending it's something meaningful. It was just a coincidence that nothing was
broken.
BUG=371852
[email protected]
Review URL: https://codereview.chromium.org/292713003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272182 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index 1cde659..0c6d040 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -166,10 +166,9 @@
// -title
// -favIconUrl
- std::string url_string;
GURL url;
if (params.url.get()) {
- url_string = *params.url;
+ std::string url_string= *params.url;
url = ExtensionTabUtil::ResolvePossiblyRelativeURL(
url_string, function->GetExtension());
if (!url.is_valid()) {
@@ -177,6 +176,8 @@
ErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, url_string);
return NULL;
}
+ } else {
+ url = GURL(chrome::kChromeUINewTabURL);
}
// Don't let extensions crash the browser or renderers.