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

Side by Side Diff: chrome/browser/extensions/extension_tab_util.cc

Issue 292713003: Session restore shouldn't care about profile home pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 6 years, 7 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 | Annotate | Revision Log
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/extensions/extension_tab_util.h" 5 #include "chrome/browser/extensions/extension_tab_util.h"
6 6
7 #include "apps/app_window.h" 7 #include "apps/app_window.h"
8 #include "apps/app_window_registry.h" 8 #include "apps/app_window_registry.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" 10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 NULL)) { 159 NULL)) {
160 // TODO(rpaquay): Error message? 160 // TODO(rpaquay): Error message?
161 return NULL; 161 return NULL;
162 } 162 }
163 } 163 }
164 164
165 // TODO(rafaelw): handle setting remaining tab properties: 165 // TODO(rafaelw): handle setting remaining tab properties:
166 // -title 166 // -title
167 // -favIconUrl 167 // -favIconUrl
168 168
169 std::string url_string;
170 GURL url; 169 GURL url;
171 if (params.url.get()) { 170 if (params.url.get()) {
172 url_string = *params.url; 171 std::string url_string= *params.url;
173 url = ExtensionTabUtil::ResolvePossiblyRelativeURL( 172 url = ExtensionTabUtil::ResolvePossiblyRelativeURL(
174 url_string, function->GetExtension()); 173 url_string, function->GetExtension());
175 if (!url.is_valid()) { 174 if (!url.is_valid()) {
176 *error = 175 *error =
177 ErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, url_string); 176 ErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, url_string);
178 return NULL; 177 return NULL;
179 } 178 }
179 } else {
180 url = GURL(chrome::kChromeUINewTabURL);
180 } 181 }
181 182
182 // Don't let extensions crash the browser or renderers. 183 // Don't let extensions crash the browser or renderers.
183 if (ExtensionTabUtil::IsCrashURL(url)) { 184 if (ExtensionTabUtil::IsCrashURL(url)) {
184 *error = keys::kNoCrashBrowserError; 185 *error = keys::kNoCrashBrowserError;
185 return NULL; 186 return NULL;
186 } 187 }
187 188
188 // Default to foreground for the new tab. The presence of 'active' property 189 // Default to foreground for the new tab. The presence of 'active' property
189 // will override this default. 190 // will override this default.
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 content::PAGE_TRANSITION_LINK, 571 content::PAGE_TRANSITION_LINK,
571 false); 572 false);
572 browser->OpenURL(params); 573 browser->OpenURL(params);
573 browser->window()->Show(); 574 browser->window()->Show();
574 WebContents* web_contents = 575 WebContents* web_contents =
575 browser->tab_strip_model()->GetActiveWebContents(); 576 browser->tab_strip_model()->GetActiveWebContents();
576 web_contents->GetDelegate()->ActivateContents(web_contents); 577 web_contents->GetDelegate()->ActivateContents(web_contents);
577 } 578 }
578 579
579 } // namespace extensions 580 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698