| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_init.h" | 5 #include "chrome/browser/browser_init.h" |
| 6 | 6 |
| 7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "base/environment.h" | 11 #include "base/environment.h" |
| 12 #include "base/event_recorder.h" | 12 #include "base/event_recorder.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
| 18 #include "base/thread_restrictions.h" | 18 #include "base/thread_restrictions.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "chrome/browser/automation/automation_provider.h" | 20 #include "chrome/browser/automation/automation_provider.h" |
| 21 #include "chrome/browser/automation/automation_provider_list.h" | 21 #include "chrome/browser/automation/automation_provider_list.h" |
| 22 #include "chrome/browser/automation/chrome_frame_automation_provider.h" | 22 #include "chrome/browser/automation/chrome_frame_automation_provider.h" |
| 23 #include "chrome/browser/automation/testing_automation_provider.h" | 23 #include "chrome/browser/automation/testing_automation_provider.h" |
| 24 #include "chrome/browser/browser_list.h" | 24 #include "chrome/browser/browser_list.h" |
| 25 #include "chrome/browser/browser_navigator.h" |
| 25 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 26 #include "chrome/browser/browser_thread.h" | 27 #include "chrome/browser/browser_thread.h" |
| 27 #include "chrome/browser/browser_window.h" | 28 #include "chrome/browser/browser_window.h" |
| 28 #include "chrome/browser/child_process_security_policy.h" | 29 #include "chrome/browser/child_process_security_policy.h" |
| 29 #include "chrome/browser/defaults.h" | 30 #include "chrome/browser/defaults.h" |
| 30 #include "chrome/browser/extensions/extension_creator.h" | 31 #include "chrome/browser/extensions/extension_creator.h" |
| 31 #include "chrome/browser/extensions/extensions_service.h" | 32 #include "chrome/browser/extensions/extensions_service.h" |
| 32 #include "chrome/browser/extensions/pack_extension_job.h" | 33 #include "chrome/browser/extensions/pack_extension_job.h" |
| 33 #include "chrome/browser/first_run/first_run.h" | 34 #include "chrome/browser/first_run/first_run.h" |
| 34 #include "chrome/browser/net/predictor_api.h" | 35 #include "chrome/browser/net/predictor_api.h" |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 if (!process_startup && !URLRequest::IsHandledURL(tabs[i].url)) | 759 if (!process_startup && !URLRequest::IsHandledURL(tabs[i].url)) |
| 759 continue; | 760 continue; |
| 760 | 761 |
| 761 int add_types = first_tab ? TabStripModel::ADD_SELECTED : | 762 int add_types = first_tab ? TabStripModel::ADD_SELECTED : |
| 762 TabStripModel::ADD_NONE; | 763 TabStripModel::ADD_NONE; |
| 763 add_types |= TabStripModel::ADD_FORCE_INDEX; | 764 add_types |= TabStripModel::ADD_FORCE_INDEX; |
| 764 if (tabs[i].is_pinned) | 765 if (tabs[i].is_pinned) |
| 765 add_types |= TabStripModel::ADD_PINNED; | 766 add_types |= TabStripModel::ADD_PINNED; |
| 766 int index = browser->GetIndexForInsertionDuringRestore(i); | 767 int index = browser->GetIndexForInsertionDuringRestore(i); |
| 767 | 768 |
| 768 Browser::AddTabWithURLParams params(tabs[i].url, | 769 browser::NavigateParams params(browser, tabs[i].url, |
| 769 PageTransition::START_PAGE); | 770 PageTransition::START_PAGE); |
| 770 params.index = index; | 771 params.disposition = first_tab ? NEW_FOREGROUND_TAB : NEW_BACKGROUND_TAB; |
| 771 params.add_types = add_types; | 772 params.tabstrip_index = index; |
| 773 params.tabstrip_add_types = add_types; |
| 772 params.extension_app_id = tabs[i].app_id; | 774 params.extension_app_id = tabs[i].app_id; |
| 773 TabContents* tab = browser->AddTabWithURL(¶ms); | 775 browser::Navigate(¶ms); |
| 774 | 776 |
| 775 if (profile_ && first_tab && process_startup) { | 777 if (profile_ && first_tab && process_startup) { |
| 776 AddCrashedInfoBarIfNecessary(tab); | 778 AddCrashedInfoBarIfNecessary(params.target_contents); |
| 777 AddBadFlagsInfoBarIfNecessary(tab); | 779 AddBadFlagsInfoBarIfNecessary(params.target_contents); |
| 778 } | 780 } |
| 779 | 781 |
| 780 first_tab = false; | 782 first_tab = false; |
| 781 } | 783 } |
| 782 browser->window()->Show(); | 784 browser->window()->Show(); |
| 783 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial | 785 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial |
| 784 // focus explicitly. | 786 // focus explicitly. |
| 785 browser->GetSelectedTabContents()->view()->SetInitialFocus(); | 787 browser->GetSelectedTabContents()->view()->SetInitialFocus(); |
| 786 | 788 |
| 787 return browser; | 789 return browser; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 scoped_refptr<AutomationProviderClass> automation = | 1024 scoped_refptr<AutomationProviderClass> automation = |
| 1023 new AutomationProviderClass(profile); | 1025 new AutomationProviderClass(profile); |
| 1024 automation->ConnectToChannel(channel_id); | 1026 automation->ConnectToChannel(channel_id); |
| 1025 automation->SetExpectedTabCount(expected_tabs); | 1027 automation->SetExpectedTabCount(expected_tabs); |
| 1026 | 1028 |
| 1027 AutomationProviderList* list = | 1029 AutomationProviderList* list = |
| 1028 g_browser_process->InitAutomationProviderList(); | 1030 g_browser_process->InitAutomationProviderList(); |
| 1029 DCHECK(list); | 1031 DCHECK(list); |
| 1030 list->AddProvider(automation); | 1032 list->AddProvider(automation); |
| 1031 } | 1033 } |
| OLD | NEW |