OLD | NEW |
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/startup/startup_browser_creator_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 first_tab = false; | 774 first_tab = false; |
775 } | 775 } |
776 if (!chrome::GetActiveWebContents(browser)) { | 776 if (!chrome::GetActiveWebContents(browser)) { |
777 // TODO: this is a work around for 110909. Figure out why it's needed. | 777 // TODO: this is a work around for 110909. Figure out why it's needed. |
778 if (!browser->tab_count()) | 778 if (!browser->tab_count()) |
779 chrome::AddBlankTab(browser, true); | 779 chrome::AddBlankTab(browser, true); |
780 else | 780 else |
781 chrome::ActivateTabAt(browser, 0, false); | 781 chrome::ActivateTabAt(browser, 0, false); |
782 } | 782 } |
783 | 783 |
784 browser->window()->Show(); | 784 // The default behaviour is to show the window, as expressed by the default |
785 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial | 785 // value of StartupBrowserCreated::show_main_browser_window_. If this was set |
786 // focus explicitly. | 786 // to true ahead of this place, it means another task must have been spawned |
787 chrome::GetActiveWebContents(browser)->GetView()->SetInitialFocus(); | 787 // to take care of that. |
| 788 if (!browser_creator_ || browser_creator_->show_main_browser_window()) { |
| 789 browser->window()->Show(); |
| 790 // TODO(jcampan): http://crbug.com/8123 we should not need to set the |
| 791 // initial focus explicitly. |
| 792 chrome::GetActiveWebContents(browser)->GetView()->SetInitialFocus(); |
| 793 } |
788 | 794 |
789 return browser; | 795 return browser; |
790 } | 796 } |
791 | 797 |
792 void StartupBrowserCreatorImpl::AddInfoBarsIfNecessary( | 798 void StartupBrowserCreatorImpl::AddInfoBarsIfNecessary( |
793 Browser* browser, | 799 Browser* browser, |
794 chrome::startup::IsProcessStartup is_process_startup) { | 800 chrome::startup::IsProcessStartup is_process_startup) { |
795 if (!browser || !profile_ || browser->tab_count() == 0) | 801 if (!browser || !profile_ || browser->tab_count() == 0) |
796 return; | 802 return; |
797 | 803 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 // New: | 930 // New: |
925 prefs->GetString(prefs::kHomePage), | 931 prefs->GetString(prefs::kHomePage), |
926 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), | 932 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), |
927 prefs->GetBoolean(prefs::kShowHomeButton), | 933 prefs->GetBoolean(prefs::kShowHomeButton), |
928 // Backup: | 934 // Backup: |
929 backup_homepage, | 935 backup_homepage, |
930 backup_homepage_is_ntp, | 936 backup_homepage_is_ntp, |
931 backup_show_home_button)); | 937 backup_show_home_button)); |
932 } | 938 } |
933 } | 939 } |
OLD | NEW |