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

Unified Diff: chrome/browser/ui/browser_init.cc

Issue 10332024: [cros] Show release notes in app window + restore sesssion. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: open NTP for new user. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_init.cc
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index 0a2f4eba08d422ec4fe002c55e10dba1a47accce..e2359aac9758c5f34b236be4c4c74a39bfc0b991 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -893,14 +893,25 @@ bool BrowserInit::LaunchWithProfile::Launch(
}
}
+ // True if we need to restore session even if --app switch is passed.
+ bool app_restore_session =
+ command_line_.HasSwitch(switches::kAppRestoreSession);
+
// Open the required browser windows and tabs. First, see if
// we're being run as an application window. If so, the user
// opened an app shortcut. Don't restore tabs or open initial
// URLs in that case. The user should see the window as an app,
// not as chrome.
- if (OpenApplicationWindow(profile)) {
+ // Special case is when app switches are passed but we do want to restore
+ // session. In that case open app window + focus it after session is restored.
+ if (OpenApplicationWindow(profile) && !app_restore_session) {
RecordLaunchModeHistogram(LM_AS_WEBAPP);
} else {
+ Browser* browser_to_focus = NULL;
+ // In case of app mode + session restore we want to focus that app.
+ if (app_restore_session)
+ browser_to_focus = BrowserList::GetLastActive();
+
RecordLaunchModeHistogram(urls_to_open.empty()?
LM_TO_BE_DECIDED : LM_WITH_URLS);
@@ -914,6 +925,9 @@ bool BrowserInit::LaunchWithProfile::Launch(
// be an app tab.
OpenApplicationTab(profile);
+ if (browser_to_focus)
+ browser_to_focus->GetSelectedWebContents()->GetView()->SetInitialFocus();
+
if (process_startup) {
if (browser_defaults::kOSSupportsOtherBrowsers &&
!command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) {

Powered by Google App Engine
This is Rietveld 408576698