summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_init.cc20
-rw-r--r--chrome/browser/browser_list.h7
-rw-r--r--chrome/browser/views/frame/browser_view.cc11
3 files changed, 15 insertions, 23 deletions
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc
index e5f7d23..66c8b35 100644
--- a/chrome/browser/browser_init.cc
+++ b/chrome/browser/browser_init.cc
@@ -552,20 +552,14 @@ bool BrowserInit::LaunchWithProfile::Launch(Profile* profile,
} else {
RecordLaunchModeHistogram(LM_AS_WEBAPP);
}
- // After this point, BrowserList::GetLastActive() should be non-NULL on all
- // platforms until there are no more Browsers.
-
-#if !defined(OS_MACOSX)
- // In kiosk mode, we want to always be fullscreen, so switch to that now.
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
- BrowserList::GetLastActive()->ToggleFullscreenMode();
-#endif
#if defined(OS_WIN)
// Print the selected page if the command line switch exists. Note that the
// current selected tab would be the page which will be printed.
- if (command_line_.HasSwitch(switches::kPrint))
- BrowserList::GetLastActive()->Print();
+ if (command_line_.HasSwitch(switches::kPrint)) {
+ Browser* browser = BrowserList::GetLastActive();
+ browser->Print();
+ }
#endif
// If we're recording or playing back, startup the EventRecorder now
@@ -749,6 +743,12 @@ Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser(
#endif
}
+#if !defined(OS_MACOSX)
+ // In kiosk mode, we want to always be fullscreen, so switch to that now.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
+ browser->ToggleFullscreenMode();
+#endif
+
bool first_tab = true;
for (size_t i = 0; i < tabs.size(); ++i) {
// We skip URLs that we'd have to launch an external protocol handler for.
diff --git a/chrome/browser/browser_list.h b/chrome/browser/browser_list.h
index e709704..9e52aba 100644
--- a/chrome/browser/browser_list.h
+++ b/chrome/browser/browser_list.h
@@ -53,8 +53,11 @@ class BrowserList {
// most recently open Browser's window was closed, returns the first Browser
// in the list. If no Browsers exist, returns NULL.
//
- // WARNING: This is NULL until a browser becomes active. That should happen
- // during launch; see comment in BrowserInit::LaunchWithProfile::Launch().
+ // WARNING: this is NULL until a browser becomes active. If during startup
+ // a browser does not become active (perhaps the user launches Chrome, then
+ // clicks on another app before the first browser window appears) then this
+ // returns NULL.
+ // WARNING #2: this will always be NULL in unit tests run on the bots.
static Browser* GetLastActive();
// Identical in behavior to GetLastActive(), except that the most recently
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 3e9374c..0e11eaa 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -675,17 +675,6 @@ void BrowserView::Show() {
RestoreFocus();
frame_->GetWindow()->Show();
-
- // The following block also appears in BrowserWindowGtk::Show().
-#if !defined(OS_WIN)
- // The Browser associated with this browser window must become the active
- // browser at the time Show() is called. This is the natural behavior under
- // Windows, but gtk_widget_show won't show the widget (and therefore won't
- // call OnFocusIn()) until we return to the runloop. Therefore any calls to
- // BrowserList::GetLastActive() (for example, in bookmark_util), will return
- // the previous browser instead if we don't explicitly set it here.
- BrowserList::SetLastActive(browser());
-#endif
}
void BrowserView::SetBounds(const gfx::Rect& bounds) {