| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "chrome/browser/ui/browser_list.h" | 45 #include "chrome/browser/ui/browser_list.h" |
| 46 #include "chrome/browser/ui/browser_navigator.h" | 46 #include "chrome/browser/ui/browser_navigator.h" |
| 47 #include "chrome/browser/ui/browser_window.h" | 47 #include "chrome/browser/ui/browser_window.h" |
| 48 #include "chrome/browser/ui/extensions/application_launch.h" | 48 #include "chrome/browser/ui/extensions/application_launch.h" |
| 49 #include "chrome/browser/ui/startup/autolaunch_prompt.h" | 49 #include "chrome/browser/ui/startup/autolaunch_prompt.h" |
| 50 #include "chrome/browser/ui/startup/bad_flags_prompt.h" | 50 #include "chrome/browser/ui/startup/bad_flags_prompt.h" |
| 51 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 51 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 52 #include "chrome/browser/ui/startup/obsolete_os_prompt.h" | 52 #include "chrome/browser/ui/startup/obsolete_os_prompt.h" |
| 53 #include "chrome/browser/ui/startup/session_crashed_prompt.h" | 53 #include "chrome/browser/ui/startup/session_crashed_prompt.h" |
| 54 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 54 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 55 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 55 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 56 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 56 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
| 57 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 57 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 58 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 58 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 59 #include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" | 59 #include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" |
| 60 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 60 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
| 61 #include "chrome/common/chrome_constants.h" | 61 #include "chrome/common/chrome_constants.h" |
| 62 #include "chrome/common/chrome_notification_types.h" | 62 #include "chrome/common/chrome_notification_types.h" |
| 63 #include "chrome/common/chrome_paths.h" | 63 #include "chrome/common/chrome_paths.h" |
| 64 #include "chrome/common/chrome_result_codes.h" | 64 #include "chrome/common/chrome_result_codes.h" |
| 65 #include "chrome/common/chrome_switches.h" | 65 #include "chrome/common/chrome_switches.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // affecting browser startup have been detected. | 308 // affecting browser startup have been detected. |
| 309 CheckPreferencesBackup(profile); | 309 CheckPreferencesBackup(profile); |
| 310 | 310 |
| 311 ProcessLaunchURLs(process_startup, urls_to_open); | 311 ProcessLaunchURLs(process_startup, urls_to_open); |
| 312 | 312 |
| 313 // If this is an app launch, but we didn't open an app window, it may | 313 // If this is an app launch, but we didn't open an app window, it may |
| 314 // be an app tab. | 314 // be an app tab. |
| 315 OpenApplicationTab(profile); | 315 OpenApplicationTab(profile); |
| 316 | 316 |
| 317 if (browser_to_focus) | 317 if (browser_to_focus) |
| 318 browser_to_focus->GetSelectedWebContents()->GetView()->SetInitialFocus(); | 318 browser_to_focus->GetActiveWebContents()->GetView()->SetInitialFocus(); |
| 319 | 319 |
| 320 if (process_startup) { | 320 if (process_startup) { |
| 321 if (browser_defaults::kOSSupportsOtherBrowsers && | 321 if (browser_defaults::kOSSupportsOtherBrowsers && |
| 322 !command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) { | 322 !command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) { |
| 323 if (!browser::ShowAutolaunchPrompt(profile)) | 323 if (!browser::ShowAutolaunchPrompt(profile)) |
| 324 browser::ShowDefaultBrowserPrompt(profile); | 324 browser::ShowDefaultBrowserPrompt(profile); |
| 325 } | 325 } |
| 326 #if defined(OS_MACOSX) | 326 #if defined(OS_MACOSX) |
| 327 // Check whether the auto-update system needs to be promoted from user | 327 // Check whether the auto-update system needs to be promoted from user |
| 328 // to system. | 328 // to system. |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 content::PAGE_TRANSITION_START_PAGE); | 699 content::PAGE_TRANSITION_START_PAGE); |
| 700 params.disposition = first_tab ? NEW_FOREGROUND_TAB : | 700 params.disposition = first_tab ? NEW_FOREGROUND_TAB : |
| 701 NEW_BACKGROUND_TAB; | 701 NEW_BACKGROUND_TAB; |
| 702 params.tabstrip_index = index; | 702 params.tabstrip_index = index; |
| 703 params.tabstrip_add_types = add_types; | 703 params.tabstrip_add_types = add_types; |
| 704 params.extension_app_id = tabs[i].app_id; | 704 params.extension_app_id = tabs[i].app_id; |
| 705 browser::Navigate(¶ms); | 705 browser::Navigate(¶ms); |
| 706 | 706 |
| 707 first_tab = false; | 707 first_tab = false; |
| 708 } | 708 } |
| 709 if (!browser->GetSelectedWebContents()) { | 709 if (!browser->GetActiveWebContents()) { |
| 710 // TODO: this is a work around for 110909. Figure out why it's needed. | 710 // TODO: this is a work around for 110909. Figure out why it's needed. |
| 711 if (!browser->tab_count()) | 711 if (!browser->tab_count()) |
| 712 browser->AddBlankTab(true); | 712 browser->AddBlankTab(true); |
| 713 else | 713 else |
| 714 browser->ActivateTabAt(0, false); | 714 browser->ActivateTabAt(0, false); |
| 715 } | 715 } |
| 716 | 716 |
| 717 browser->window()->Show(); | 717 browser->window()->Show(); |
| 718 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial | 718 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial |
| 719 // focus explicitly. | 719 // focus explicitly. |
| 720 browser->GetSelectedWebContents()->GetView()->SetInitialFocus(); | 720 browser->GetActiveWebContents()->GetView()->SetInitialFocus(); |
| 721 | 721 |
| 722 return browser; | 722 return browser; |
| 723 } | 723 } |
| 724 | 724 |
| 725 void StartupBrowserCreatorImpl::AddInfoBarsIfNecessary( | 725 void StartupBrowserCreatorImpl::AddInfoBarsIfNecessary( |
| 726 Browser* browser, | 726 Browser* browser, |
| 727 browser::startup::IsProcessStartup is_process_startup) { | 727 browser::startup::IsProcessStartup is_process_startup) { |
| 728 if (!browser || !profile_ || browser->tab_count() == 0) | 728 if (!browser || !profile_ || browser->tab_count() == 0) |
| 729 return; | 729 return; |
| 730 | 730 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 // New: | 856 // New: |
| 857 prefs->GetString(prefs::kHomePage), | 857 prefs->GetString(prefs::kHomePage), |
| 858 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), | 858 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), |
| 859 prefs->GetBoolean(prefs::kShowHomeButton), | 859 prefs->GetBoolean(prefs::kShowHomeButton), |
| 860 // Backup: | 860 // Backup: |
| 861 backup_homepage, | 861 backup_homepage, |
| 862 backup_homepage_is_ntp, | 862 backup_homepage_is_ntp, |
| 863 backup_show_home_button)); | 863 backup_show_home_button)); |
| 864 } | 864 } |
| 865 } | 865 } |
| OLD | NEW |