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

Side by Side Diff: chrome/browser/ui/browser_init.cc

Issue 10356059: Merge 135882 - [cros] Show release notes in app window + restore sesssion. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1084/src/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/defaults.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/browser_init.h" 5 #include "chrome/browser/ui/browser_init.h"
6 6
7 #include <algorithm> // For max(). 7 #include <algorithm> // For max().
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 } else { 893 } else {
894 DLOG(WARNING) << "Invalid http debugger port number " << port; 894 DLOG(WARNING) << "Invalid http debugger port number " << port;
895 } 895 }
896 } 896 }
897 897
898 // Open the required browser windows and tabs. First, see if 898 // Open the required browser windows and tabs. First, see if
899 // we're being run as an application window. If so, the user 899 // we're being run as an application window. If so, the user
900 // opened an app shortcut. Don't restore tabs or open initial 900 // opened an app shortcut. Don't restore tabs or open initial
901 // URLs in that case. The user should see the window as an app, 901 // URLs in that case. The user should see the window as an app,
902 // not as chrome. 902 // not as chrome.
903 if (OpenApplicationWindow(profile)) { 903 // Special case is when app switches are passed but we do want to restore
904 // session. In that case open app window + focus it after session is restored.
905 if (OpenApplicationWindow(profile) && !browser_defaults::kAppRestoreSession) {
904 RecordLaunchModeHistogram(LM_AS_WEBAPP); 906 RecordLaunchModeHistogram(LM_AS_WEBAPP);
905 } else { 907 } else {
908 Browser* browser_to_focus = NULL;
909 // In case of app mode + session restore we want to focus that app.
910 if (browser_defaults::kAppRestoreSession)
911 browser_to_focus = BrowserList::GetLastActive();
912
906 RecordLaunchModeHistogram(urls_to_open.empty()? 913 RecordLaunchModeHistogram(urls_to_open.empty()?
907 LM_TO_BE_DECIDED : LM_WITH_URLS); 914 LM_TO_BE_DECIDED : LM_WITH_URLS);
908 915
909 // Notify user if the Preferences backup is invalid or changes to settings 916 // Notify user if the Preferences backup is invalid or changes to settings
910 // affecting browser startup have been detected. 917 // affecting browser startup have been detected.
911 CheckPreferencesBackup(profile); 918 CheckPreferencesBackup(profile);
912 919
913 ProcessLaunchURLs(process_startup, urls_to_open); 920 ProcessLaunchURLs(process_startup, urls_to_open);
914 921
915 // If this is an app launch, but we didn't open an app window, it may 922 // If this is an app launch, but we didn't open an app window, it may
916 // be an app tab. 923 // be an app tab.
917 OpenApplicationTab(profile); 924 OpenApplicationTab(profile);
918 925
926 if (browser_to_focus)
927 browser_to_focus->GetSelectedWebContents()->GetView()->SetInitialFocus();
928
919 if (process_startup) { 929 if (process_startup) {
920 if (browser_defaults::kOSSupportsOtherBrowsers && 930 if (browser_defaults::kOSSupportsOtherBrowsers &&
921 !command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) { 931 !command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) {
922 if (!CheckIfAutoLaunched(profile)) { 932 if (!CheckIfAutoLaunched(profile)) {
923 // Check whether we are the default browser. 933 // Check whether we are the default browser.
924 CheckDefaultBrowser(profile); 934 CheckDefaultBrowser(profile);
925 } 935 }
926 } 936 }
927 #if defined(OS_MACOSX) 937 #if defined(OS_MACOSX)
928 // Check whether the auto-update system needs to be promoted from user 938 // Check whether the auto-update system needs to be promoted from user
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 1920
1911 Profile* profile = ProfileManager::GetLastUsedProfile(); 1921 Profile* profile = ProfileManager::GetLastUsedProfile();
1912 if (!profile) { 1922 if (!profile) {
1913 // We should only be able to get here if the profile already exists and 1923 // We should only be able to get here if the profile already exists and
1914 // has been created. 1924 // has been created.
1915 NOTREACHED(); 1925 NOTREACHED();
1916 return; 1926 return;
1917 } 1927 }
1918 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); 1928 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL);
1919 } 1929 }
OLDNEW
« no previous file with comments | « chrome/browser/defaults.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698