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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_impl.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
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/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 26 matching lines...) Expand all
37 #include "chrome/browser/protector/protector_service.h" 37 #include "chrome/browser/protector/protector_service.h"
38 #include "chrome/browser/protector/protector_service_factory.h" 38 #include "chrome/browser/protector/protector_service_factory.h"
39 #include "chrome/browser/protector/protector_utils.h" 39 #include "chrome/browser/protector/protector_utils.h"
40 #include "chrome/browser/sessions/session_restore.h" 40 #include "chrome/browser/sessions/session_restore.h"
41 #include "chrome/browser/sessions/session_service.h" 41 #include "chrome/browser/sessions/session_service.h"
42 #include "chrome/browser/sessions/session_service_factory.h" 42 #include "chrome/browser/sessions/session_service_factory.h"
43 #include "chrome/browser/shell_integration.h" 43 #include "chrome/browser/shell_integration.h"
44 #include "chrome/browser/ui/browser_finder.h" 44 #include "chrome/browser/ui/browser_finder.h"
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_tabrestore.h"
48 #include "chrome/browser/ui/browser_tabstrip.h"
47 #include "chrome/browser/ui/browser_window.h" 49 #include "chrome/browser/ui/browser_window.h"
48 #include "chrome/browser/ui/extensions/application_launch.h" 50 #include "chrome/browser/ui/extensions/application_launch.h"
49 #include "chrome/browser/ui/startup/autolaunch_prompt.h" 51 #include "chrome/browser/ui/startup/autolaunch_prompt.h"
50 #include "chrome/browser/ui/startup/bad_flags_prompt.h" 52 #include "chrome/browser/ui/startup/bad_flags_prompt.h"
51 #include "chrome/browser/ui/startup/default_browser_prompt.h" 53 #include "chrome/browser/ui/startup/default_browser_prompt.h"
52 #include "chrome/browser/ui/startup/obsolete_os_prompt.h" 54 #include "chrome/browser/ui/startup/obsolete_os_prompt.h"
53 #include "chrome/browser/ui/startup/session_crashed_prompt.h" 55 #include "chrome/browser/ui/startup/session_crashed_prompt.h"
54 #include "chrome/browser/ui/startup/startup_browser_creator.h" 56 #include "chrome/browser/ui/startup/startup_browser_creator.h"
55 #include "chrome/browser/ui/tab_contents/tab_contents.h" 57 #include "chrome/browser/ui/tab_contents/tab_contents.h"
56 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" 58 #include "chrome/browser/ui/tabs/pinned_tab_codec.h"
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 (profile_ && profile_->GetProtocolHandlerRegistry()->IsHandledProtocol( 691 (profile_ && profile_->GetProtocolHandlerRegistry()->IsHandledProtocol(
690 tabs[i].url.scheme())); 692 tabs[i].url.scheme()));
691 if (!process_startup && !handled_by_chrome) 693 if (!process_startup && !handled_by_chrome)
692 continue; 694 continue;
693 695
694 int add_types = first_tab ? TabStripModel::ADD_ACTIVE : 696 int add_types = first_tab ? TabStripModel::ADD_ACTIVE :
695 TabStripModel::ADD_NONE; 697 TabStripModel::ADD_NONE;
696 add_types |= TabStripModel::ADD_FORCE_INDEX; 698 add_types |= TabStripModel::ADD_FORCE_INDEX;
697 if (tabs[i].is_pinned) 699 if (tabs[i].is_pinned)
698 add_types |= TabStripModel::ADD_PINNED; 700 add_types |= TabStripModel::ADD_PINNED;
699 int index = browser->GetIndexForInsertionDuringRestore(i); 701 int index = chrome::GetIndexForInsertionDuringRestore(browser, i);
700 702
701 browser::NavigateParams params(browser, tabs[i].url, 703 browser::NavigateParams params(browser, tabs[i].url,
702 content::PAGE_TRANSITION_START_PAGE); 704 content::PAGE_TRANSITION_START_PAGE);
703 params.disposition = first_tab ? NEW_FOREGROUND_TAB : 705 params.disposition = first_tab ? NEW_FOREGROUND_TAB :
704 NEW_BACKGROUND_TAB; 706 NEW_BACKGROUND_TAB;
705 params.tabstrip_index = index; 707 params.tabstrip_index = index;
706 params.tabstrip_add_types = add_types; 708 params.tabstrip_add_types = add_types;
707 params.extension_app_id = tabs[i].app_id; 709 params.extension_app_id = tabs[i].app_id;
708 browser::Navigate(&params); 710 browser::Navigate(&params);
709 711
710 first_tab = false; 712 first_tab = false;
711 } 713 }
712 if (!browser->GetActiveWebContents()) { 714 if (!chrome::GetActiveWebContents(browser)) {
713 // TODO: this is a work around for 110909. Figure out why it's needed. 715 // TODO: this is a work around for 110909. Figure out why it's needed.
714 if (!browser->tab_count()) 716 if (!browser->tab_count())
715 browser->AddBlankTab(true); 717 browser->AddBlankTab(true);
716 else 718 else
717 browser->ActivateTabAt(0, false); 719 chrome::ActivateTabAt(browser, 0, false);
718 } 720 }
719 721
720 browser->window()->Show(); 722 browser->window()->Show();
721 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial 723 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial
722 // focus explicitly. 724 // focus explicitly.
723 browser->GetActiveWebContents()->GetView()->SetInitialFocus(); 725 chrome::GetActiveWebContents(browser)->GetView()->SetInitialFocus();
724 726
725 return browser; 727 return browser;
726 } 728 }
727 729
728 void StartupBrowserCreatorImpl::AddInfoBarsIfNecessary( 730 void StartupBrowserCreatorImpl::AddInfoBarsIfNecessary(
729 Browser* browser, 731 Browser* browser,
730 browser::startup::IsProcessStartup is_process_startup) { 732 browser::startup::IsProcessStartup is_process_startup) {
731 if (!browser || !profile_ || browser->tab_count() == 0) 733 if (!browser || !profile_ || browser->tab_count() == 0)
732 return; 734 return;
733 735
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 // New: 861 // New:
860 prefs->GetString(prefs::kHomePage), 862 prefs->GetString(prefs::kHomePage),
861 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), 863 prefs->GetBoolean(prefs::kHomePageIsNewTabPage),
862 prefs->GetBoolean(prefs::kShowHomeButton), 864 prefs->GetBoolean(prefs::kShowHomeButton),
863 // Backup: 865 // Backup:
864 backup_homepage, 866 backup_homepage,
865 backup_homepage_is_ntp, 867 backup_homepage_is_ntp,
866 backup_show_home_button)); 868 backup_show_home_button));
867 } 869 }
868 } 870 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698