| 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..5f7c1c338dbcba79f1857b69fd93ee6fa51cb6d3 100644
|
| --- a/chrome/browser/ui/browser_init.cc
|
| +++ b/chrome/browser/ui/browser_init.cc
|
| @@ -898,9 +898,16 @@ bool BrowserInit::LaunchWithProfile::Launch(
|
| // 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) && !browser_defaults::kAppRestoreSession) {
|
| RecordLaunchModeHistogram(LM_AS_WEBAPP);
|
| } else {
|
| + Browser* browser_to_focus = NULL;
|
| + // In case of app mode + session restore we want to focus that app.
|
| + if (browser_defaults::kAppRestoreSession)
|
| + browser_to_focus = BrowserList::GetLastActive();
|
| +
|
| RecordLaunchModeHistogram(urls_to_open.empty()?
|
| LM_TO_BE_DECIDED : LM_WITH_URLS);
|
|
|
| @@ -914,6 +921,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)) {
|
|
|