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

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 1561673002: Revert of Activating code to start Chrome UI in Android Aura Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 // Don't record any metrics if UI was displayed before this point e.g. 789 // Don't record any metrics if UI was displayed before this point e.g.
790 // warning dialogs. 790 // warning dialogs.
791 if (startup_metric_utils::WasNonBrowserUIDisplayed()) 791 if (startup_metric_utils::WasNonBrowserUIDisplayed())
792 return; 792 return;
793 793
794 bool is_first_run = false; 794 bool is_first_run = false;
795 #if !defined(OS_ANDROID) 795 #if !defined(OS_ANDROID)
796 // On Android, first run is handled in Java code, and the C++ side of Chrome 796 // On Android, first run is handled in Java code, and the C++ side of Chrome
797 // doesn't know if this is the first run. This will cause some inaccuracy in 797 // doesn't know if this is the first run. This will cause some inaccuracy in
798 // the UMA statistics, but this should be minor (first runs are rare). 798 // the UMA statistics, but this should be minor (first runs are rare).
799 // TODO(bshe): Figure out which first run code to use for Aura Android. See
800 // crbug.com/560498
801 is_first_run = first_run::IsChromeFirstRun(); 799 is_first_run = first_run::IsChromeFirstRun();
802 #endif // defined(OS_ANDROID) 800 #endif // defined(OS_ANDROID)
803 801
804 // Record collected startup metrics. 802 // Record collected startup metrics.
805 startup_metric_utils::RecordBrowserMainMessageLoopStart( 803 startup_metric_utils::RecordBrowserMainMessageLoopStart(
806 base::TimeTicks::Now(), is_first_run); 804 base::TimeTicks::Now(), is_first_run);
807 } 805 }
808 806
809 // ----------------------------------------------------------------------------- 807 // -----------------------------------------------------------------------------
810 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. 808 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 862
865 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) 863 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
866 chrome_extra_parts_[i]->PostMainMessageLoopStart(); 864 chrome_extra_parts_[i]->PostMainMessageLoopStart();
867 } 865 }
868 866
869 int ChromeBrowserMainParts::PreCreateThreads() { 867 int ChromeBrowserMainParts::PreCreateThreads() {
870 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreCreateThreads"); 868 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreCreateThreads");
871 result_code_ = PreCreateThreadsImpl(); 869 result_code_ = PreCreateThreadsImpl();
872 870
873 if (result_code_ == content::RESULT_CODE_NORMAL_EXIT) { 871 if (result_code_ == content::RESULT_CODE_NORMAL_EXIT) {
874 // TODO(bshe): Use !defined(ANDROID_JAVA_UI) once 872 #if !defined(OS_ANDROID)
875 // codereview.chromium.org/1459793002 landed.
876 #if !defined(OS_ANDROID) || defined(USE_AURA)
877 // These members must be initialized before exiting this function normally. 873 // These members must be initialized before exiting this function normally.
878 DCHECK(master_prefs_.get()); 874 DCHECK(master_prefs_.get());
879 DCHECK(browser_creator_.get()); 875 DCHECK(browser_creator_.get());
880 #endif // !defined(OS_ANDROID) || defined(USE_AURA) 876 #endif // !defined(OS_ANDROID)
881 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) 877 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
882 chrome_extra_parts_[i]->PreCreateThreads(); 878 chrome_extra_parts_[i]->PreCreateThreads();
883 } 879 }
884 880
885 return result_code_; 881 return result_code_;
886 } 882 }
887 883
888 int ChromeBrowserMainParts::PreCreateThreadsImpl() { 884 int ChromeBrowserMainParts::PreCreateThreadsImpl() {
889 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreCreateThreadsImpl") 885 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreCreateThreadsImpl")
890 run_message_loop_ = false; 886 run_message_loop_ = false;
891 #if !defined(OS_ANDROID) 887 #if !defined(OS_ANDROID)
892 chrome::MaybeShowInvalidUserDataDirWarningDialog(); 888 chrome::MaybeShowInvalidUserDataDirWarningDialog();
893 #endif // !defined(OS_ANDROID) 889 #endif // !defined(OS_ANDROID)
894 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)) 890 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_))
895 return chrome::RESULT_CODE_MISSING_DATA; 891 return chrome::RESULT_CODE_MISSING_DATA;
896 892
897 // Force MediaCaptureDevicesDispatcher to be created on UI thread. 893 // Force MediaCaptureDevicesDispatcher to be created on UI thread.
898 MediaCaptureDevicesDispatcher::GetInstance(); 894 MediaCaptureDevicesDispatcher::GetInstance();
899 895
900 // Android's first run is done in Java instead of native. 896 // Android's first run is done in Java instead of native.
901 // TODO(bshe): Figure out which first run code to use for Aura Android. See
902 // crbug.com/560498
903 #if !defined(OS_ANDROID) 897 #if !defined(OS_ANDROID)
904 process_singleton_.reset(new ChromeProcessSingleton( 898 process_singleton_.reset(new ChromeProcessSingleton(
905 user_data_dir_, base::Bind(&ProcessSingletonNotificationCallback))); 899 user_data_dir_, base::Bind(&ProcessSingletonNotificationCallback)));
906 900
907 // Cache first run state early. 901 // Cache first run state early.
908 first_run::IsChromeFirstRun(); 902 first_run::IsChromeFirstRun();
909 #endif // !defined(OS_ANDROID) 903 #endif // !defined(OS_ANDROID)
910 904
911 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner = 905 scoped_refptr<base::SequencedTaskRunner> local_state_task_runner =
912 JsonPrefStore::GetTaskRunnerForFile( 906 JsonPrefStore::GetTaskRunnerForFile(
(...skipping 17 matching lines...) Expand all
930 tracked_objects::ThreadData::Status status = 924 tracked_objects::ThreadData::Status status =
931 tracked_objects::ThreadData::PROFILING_ACTIVE; 925 tracked_objects::ThreadData::PROFILING_ACTIVE;
932 if (flag.compare("0") != 0) 926 if (flag.compare("0") != 0)
933 status = tracked_objects::ThreadData::DEACTIVATED; 927 status = tracked_objects::ThreadData::DEACTIVATED;
934 tracked_objects::ThreadData::InitializeAndSetTrackingStatus(status); 928 tracked_objects::ThreadData::InitializeAndSetTrackingStatus(status);
935 } 929 }
936 930
937 local_state_ = InitializeLocalState( 931 local_state_ = InitializeLocalState(
938 local_state_task_runner.get(), parsed_command_line()); 932 local_state_task_runner.get(), parsed_command_line());
939 933
940 // TODO(bshe): Use !defined(ANDROID_JAVA_UI) once 934 #if !defined(OS_ANDROID)
941 // codereview.chromium.org/1459793002 landed.
942 #if !defined(OS_ANDROID) || defined(USE_AURA)
943 // These members must be initialized before returning from this function. 935 // These members must be initialized before returning from this function.
944 master_prefs_.reset(new first_run::MasterPrefs); 936 master_prefs_.reset(new first_run::MasterPrefs);
945 // Android doesn't use StartupBrowserCreator. 937 // Android doesn't use StartupBrowserCreator.
946 browser_creator_.reset(new StartupBrowserCreator); 938 browser_creator_.reset(new StartupBrowserCreator);
947 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver 939 // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver
948 chrome::UMABrowsingActivityObserver::Init(); 940 chrome::UMABrowsingActivityObserver::Init();
949 #endif // !defined(OS_ANDROID) || defined(USE_AURA) 941 #endif // !defined(OS_ANDROID)
950 942
951 #if !defined(OS_CHROMEOS) 943 #if !defined(OS_CHROMEOS)
952 // Convert active labs into switches. This needs to be done before 944 // Convert active labs into switches. This needs to be done before
953 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are 945 // ResourceBundle::InitSharedInstanceWithLocale as some loaded resources are
954 // affected by experiment flags (--touch-optimized-ui in particular). 946 // affected by experiment flags (--touch-optimized-ui in particular).
955 // On ChromeOS system level flags are applied from the device settings from 947 // On ChromeOS system level flags are applied from the device settings from
956 // the session manager. 948 // the session manager.
957 { 949 {
958 TRACE_EVENT0("startup", 950 TRACE_EVENT0("startup",
959 "ChromeBrowserMainParts::PreCreateThreadsImpl:ConvertFlags"); 951 "ChromeBrowserMainParts::PreCreateThreadsImpl:ConvertFlags");
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 } 1006 }
1015 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale; 1007 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale;
1016 browser_process_->SetApplicationLocale(loaded_locale); 1008 browser_process_->SetApplicationLocale(loaded_locale);
1017 1009
1018 { 1010 {
1019 TRACE_EVENT0("startup", 1011 TRACE_EVENT0("startup",
1020 "ChromeBrowserMainParts::PreCreateThreadsImpl:AddDataPack"); 1012 "ChromeBrowserMainParts::PreCreateThreadsImpl:AddDataPack");
1021 base::FilePath resources_pack_path; 1013 base::FilePath resources_pack_path;
1022 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); 1014 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path);
1023 #if defined(OS_ANDROID) 1015 #if defined(OS_ANDROID)
1024 // Uses Android resources even without ANDROID_JAVA_UI.
1025 ui::LoadMainAndroidPackFile("assets/resources.pak", resources_pack_path); 1016 ui::LoadMainAndroidPackFile("assets/resources.pak", resources_pack_path);
1026 #else 1017 #else
1027 ResourceBundle::GetSharedInstance().AddDataPackFromPath( 1018 ResourceBundle::GetSharedInstance().AddDataPackFromPath(
1028 resources_pack_path, ui::SCALE_FACTOR_NONE); 1019 resources_pack_path, ui::SCALE_FACTOR_NONE);
1029 #endif // defined(OS_ANDROID) 1020 #endif // defined(OS_ANDROID)
1030 } 1021 }
1031 #endif // defined(OS_MACOSX) 1022 #endif // defined(OS_MACOSX)
1032 1023
1033 // Android does first run in Java instead of native. 1024 // Android does first run in Java instead of native.
1034 // Chrome OS has its own out-of-box-experience code. 1025 // Chrome OS has its own out-of-box-experience code.
1035 // TODO(bshe): Figure out which first run code to use for Aura Android. See
1036 // crbug.com/560498
1037 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 1026 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
1038 // On first run, we need to process the predictor preferences before the 1027 // On first run, we need to process the predictor preferences before the
1039 // browser's profile_manager object is created, but after ResourceBundle 1028 // browser's profile_manager object is created, but after ResourceBundle
1040 // is initialized. 1029 // is initialized.
1041 if (first_run::IsChromeFirstRun()) { 1030 if (first_run::IsChromeFirstRun()) {
1042 first_run::ProcessMasterPreferencesResult pmp_result = 1031 first_run::ProcessMasterPreferencesResult pmp_result =
1043 first_run::ProcessMasterPreferences(user_data_dir_, 1032 first_run::ProcessMasterPreferences(user_data_dir_,
1044 master_prefs_.get()); 1033 master_prefs_.get());
1045 if (pmp_result == first_run::EULA_EXIT_NOW) 1034 if (pmp_result == first_run::EULA_EXIT_NOW)
1046 return chrome::RESULT_CODE_EULA_REFUSED; 1035 return chrome::RESULT_CODE_EULA_REFUSED;
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 base::TimeTicks::Now() - start_time_step1); 1449 base::TimeTicks::Now() - start_time_step1);
1461 1450
1462 // This step is costly and is already measured in Startup.CreateFirstProfile 1451 // This step is costly and is already measured in Startup.CreateFirstProfile
1463 // and more directly Profile.CreateAndInitializeProfile. 1452 // and more directly Profile.CreateAndInitializeProfile.
1464 profile_ = CreatePrimaryProfile(parameters(), 1453 profile_ = CreatePrimaryProfile(parameters(),
1465 user_data_dir_, 1454 user_data_dir_,
1466 parsed_command_line()); 1455 parsed_command_line());
1467 if (!profile_) 1456 if (!profile_)
1468 return content::RESULT_CODE_NORMAL_EXIT; 1457 return content::RESULT_CODE_NORMAL_EXIT;
1469 1458
1470 // TODO(bshe): Use !defined(ANDROID_JAVA_UI) once 1459 #if !defined(OS_ANDROID)
1471 // codereview.chromium.org/1459793002 landed.
1472 #if !defined(OS_ANDROID) || defined(USE_AURA)
1473 const base::TimeTicks start_time_step2 = base::TimeTicks::Now(); 1460 const base::TimeTicks start_time_step2 = base::TimeTicks::Now();
1474 // The first run sentinel must be created after the process singleton was 1461 // The first run sentinel must be created after the process singleton was
1475 // grabbed and no early return paths were otherwise hit above. 1462 // grabbed and no early return paths were otherwise hit above.
1476 first_run::CreateSentinelIfNeeded(); 1463 first_run::CreateSentinelIfNeeded();
1477 #endif // !defined(OS_ANDROID) || defined(USE_AURA) 1464 #endif // !defined(OS_ANDROID)
1478 1465
1479 #if defined(ENABLE_BACKGROUND) 1466 #if defined(ENABLE_BACKGROUND)
1480 // Autoload any profiles which are running background apps. 1467 // Autoload any profiles which are running background apps.
1481 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075. 1468 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075.
1482 browser_process_->profile_manager()->AutoloadProfiles(); 1469 browser_process_->profile_manager()->AutoloadProfiles();
1483 #endif // defined(ENABLE_BACKGROUND) 1470 #endif // defined(ENABLE_BACKGROUND)
1484 // Post-profile init --------------------------------------------------------- 1471 // Post-profile init ---------------------------------------------------------
1485 1472
1486 TranslateService::Initialize(); 1473 TranslateService::Initialize();
1487 1474
(...skipping 21 matching lines...) Expand all
1509 1496
1510 // Create an instance of GpuModeManager to watch gpu mode pref change. 1497 // Create an instance of GpuModeManager to watch gpu mode pref change.
1511 g_browser_process->gpu_mode_manager(); 1498 g_browser_process->gpu_mode_manager();
1512 1499
1513 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 1500 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
1514 // Show the First Run UI if this is the first time Chrome has been run on 1501 // Show the First Run UI if this is the first time Chrome has been run on
1515 // this computer, or we're being compelled to do so by a command line flag. 1502 // this computer, or we're being compelled to do so by a command line flag.
1516 // Note that this be done _after_ the PrefService is initialized and all 1503 // Note that this be done _after_ the PrefService is initialized and all
1517 // preferences are registered, since some of the code that the importer 1504 // preferences are registered, since some of the code that the importer
1518 // touches reads preferences. 1505 // touches reads preferences.
1519 // TODO(bshe): Figure out which first run code to use for Aura Android. See
1520 // crbug.com/560498
1521 if (first_run::IsChromeFirstRun()) { 1506 if (first_run::IsChromeFirstRun()) {
1522 first_run::AutoImport(profile_, 1507 first_run::AutoImport(profile_,
1523 master_prefs_->homepage_defined, 1508 master_prefs_->homepage_defined,
1524 master_prefs_->do_import_items, 1509 master_prefs_->do_import_items,
1525 master_prefs_->dont_import_items, 1510 master_prefs_->dont_import_items,
1526 master_prefs_->import_bookmarks_path); 1511 master_prefs_->import_bookmarks_path);
1527 1512
1528 // Note: this can pop the first run consent dialog on linux. 1513 // Note: this can pop the first run consent dialog on linux.
1529 first_run::DoPostImportTasks(profile_, 1514 first_run::DoPostImportTasks(profile_,
1530 master_prefs_->make_chrome_default_for_user); 1515 master_prefs_->make_chrome_default_for_user);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 // instead? 1630 // instead?
1646 CloudPrintProxyServiceFactory::GetForProfile(profile_); 1631 CloudPrintProxyServiceFactory::GetForProfile(profile_);
1647 #endif // defined(ENABLE_PRINT_PREVIEW) 1632 #endif // defined(ENABLE_PRINT_PREVIEW)
1648 1633
1649 // Start watching all browser threads for responsiveness. 1634 // Start watching all browser threads for responsiveness.
1650 metrics::MetricsService::SetExecutionPhase( 1635 metrics::MetricsService::SetExecutionPhase(
1651 metrics::MetricsService::THREAD_WATCHER_START, 1636 metrics::MetricsService::THREAD_WATCHER_START,
1652 g_browser_process->local_state()); 1637 g_browser_process->local_state());
1653 ThreadWatcherList::StartWatchingAll(parsed_command_line()); 1638 ThreadWatcherList::StartWatchingAll(parsed_command_line());
1654 1639
1655 // TODO(bshe): Aura Android may need this call. See crbug.com/565317. 1640 #if defined(OS_ANDROID)
1656 #if defined(OS_ANDROID) && !defined(USE_AURA)
1657 ThreadWatcherAndroid::RegisterApplicationStatusListener(); 1641 ThreadWatcherAndroid::RegisterApplicationStatusListener();
1658 #endif // defined(OS_ANDROID) && !defined(USE_AURA) 1642 #endif // defined(OS_ANDROID)
1659 1643
1660 #if !defined(DISABLE_NACL) 1644 #if !defined(DISABLE_NACL)
1661 BrowserThread::PostTask( 1645 BrowserThread::PostTask(
1662 BrowserThread::IO, 1646 BrowserThread::IO,
1663 FROM_HERE, 1647 FROM_HERE,
1664 base::Bind(nacl::NaClProcessHost::EarlyStartup)); 1648 base::Bind(nacl::NaClProcessHost::EarlyStartup));
1665 #endif // !defined(DISABLE_NACL) 1649 #endif // !defined(DISABLE_NACL)
1666 1650
1667 // Make sure initial prefs are recorded 1651 // Make sure initial prefs are recorded
1668 PrefMetricsService::Factory::GetForProfile(profile_); 1652 PrefMetricsService::Factory::GetForProfile(profile_);
1669 1653
1670 PreBrowserStart(); 1654 PreBrowserStart();
1671 1655
1672 // Instantiate the notification UI manager, as this triggers a perf timer 1656 // Instantiate the notification UI manager, as this triggers a perf timer
1673 // used to measure startup time. TODO(stevenjb): Figure out what is actually 1657 // used to measure startup time. TODO(stevenjb): Figure out what is actually
1674 // triggering the timer and call that explicitly in the approprate place. 1658 // triggering the timer and call that explicitly in the approprate place.
1675 // http://crbug.com/105065. 1659 // http://crbug.com/105065.
1676 browser_process_->notification_ui_manager(); 1660 browser_process_->notification_ui_manager();
1677 1661
1678 // This must be called prior to RegisterComponentsForUpdate, in case the CLD 1662 // This must be called prior to RegisterComponentsForUpdate, in case the CLD
1679 // data source is based on the Component Updater. 1663 // data source is based on the Component Updater.
1680 translate::BrowserCldUtils::ConfigureDefaultDataProvider(); 1664 translate::BrowserCldUtils::ConfigureDefaultDataProvider();
1681 1665
1682 if (!parsed_command_line().HasSwitch(switches::kDisableComponentUpdate)) 1666 if (!parsed_command_line().HasSwitch(switches::kDisableComponentUpdate))
1683 RegisterComponentsForUpdate(); 1667 RegisterComponentsForUpdate();
1684 1668
1685 // TODO(bshe): Use defined(ANDROID_JAVA_UI) once 1669 #if defined(OS_ANDROID)
1686 // codereview.chromium.org/1459793002 landed.
1687 #if defined(OS_ANDROID) && !defined(USE_AURA)
1688 variations::VariationsService* variations_service = 1670 variations::VariationsService* variations_service =
1689 browser_process_->variations_service(); 1671 browser_process_->variations_service();
1690 if (variations_service) { 1672 if (variations_service) {
1691 // Just initialize the policy prefs service here. Variations seed fetching 1673 // Just initialize the policy prefs service here. Variations seed fetching
1692 // will be initialized when the app enters foreground mode. 1674 // will be initialized when the app enters foreground mode.
1693 variations_service->set_policy_pref_service(profile_->GetPrefs()); 1675 variations_service->set_policy_pref_service(profile_->GetPrefs());
1694 } 1676 }
1695 translate::TranslateDownloadManager::RequestLanguageList( 1677 translate::TranslateDownloadManager::RequestLanguageList(
1696 profile_->GetPrefs()); 1678 profile_->GetPrefs());
1679
1697 #else 1680 #else
1698 // Most general initialization is behind us, but opening a 1681 // Most general initialization is behind us, but opening a
1699 // tab and/or session restore and such is still to be done. 1682 // tab and/or session restore and such is still to be done.
1700 base::TimeTicks browser_open_start = base::TimeTicks::Now(); 1683 base::TimeTicks browser_open_start = base::TimeTicks::Now();
1701 1684
1702 // We are in regular browser boot sequence. Open initial tabs and enter the 1685 // We are in regular browser boot sequence. Open initial tabs and enter the
1703 // main message loop. 1686 // main message loop.
1704 std::vector<Profile*> last_opened_profiles; 1687 std::vector<Profile*> last_opened_profiles;
1705 #if !defined(OS_CHROMEOS) 1688 #if !defined(OS_CHROMEOS)
1706 // On ChromeOS multiple profiles doesn't apply, and will break if we load 1689 // On ChromeOS multiple profiles doesn't apply, and will break if we load
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 } 1746 }
1764 } 1747 }
1765 run_message_loop_ = started; 1748 run_message_loop_ = started;
1766 browser_creator_.reset(); 1749 browser_creator_.reset();
1767 1750
1768 #if !defined(OS_LINUX) || defined(OS_CHROMEOS) // http://crbug.com/426393 1751 #if !defined(OS_LINUX) || defined(OS_CHROMEOS) // http://crbug.com/426393
1769 if (g_browser_process->metrics_service()->reporting_active()) 1752 if (g_browser_process->metrics_service()->reporting_active())
1770 content::StartPowerUsageMonitor(); 1753 content::StartPowerUsageMonitor();
1771 #endif // !defined(OS_LINUX) || defined(OS_CHROMEOS) 1754 #endif // !defined(OS_LINUX) || defined(OS_CHROMEOS)
1772 1755
1773 #if !defined(OS_ANDROID)
1774 process_power_collector_.reset(new ProcessPowerCollector); 1756 process_power_collector_.reset(new ProcessPowerCollector);
1775 process_power_collector_->Initialize(); 1757 process_power_collector_->Initialize();
1776 #endif // !defined(OS_ANDROID) 1758 #endif // !defined(OS_ANDROID)
1777 #endif // defined(OS_ANDROID) && !defined(USE_AURA)
1778 1759
1779 PostBrowserStart(); 1760 PostBrowserStart();
1780 1761
1781 if (parameters().ui_task) { 1762 if (parameters().ui_task) {
1782 parameters().ui_task->Run(); 1763 parameters().ui_task->Run();
1783 delete parameters().ui_task; 1764 delete parameters().ui_task;
1784 run_message_loop_ = false; 1765 run_message_loop_ = false;
1785 } 1766 }
1786 #if defined(OS_ANDROID) 1767 #if defined(OS_ANDROID)
1787 // We never run the C++ main loop on Android, since the UI thread message 1768 // We never run the C++ main loop on Android, since the UI thread message
1788 // loop is controlled by the OS, so this is as close as we can get to 1769 // loop is controlled by the OS, so this is as close as we can get to
1789 // the start of the main loop. 1770 // the start of the main loop.
1790 if (result_code_ <= 0) { 1771 if (result_code_ <= 0) {
1791 RecordBrowserStartupTime(); 1772 RecordBrowserStartupTime();
1792 } 1773 }
1793 #endif // defined(OS_ANDROID) 1774 #endif // defined(OS_ANDROID)
1794 1775
1795 // TODO(bshe): Use !defined(ANDROID_JAVA_UI) once 1776 #if !defined(OS_ANDROID)
1796 // codereview.chromium.org/1459793002 landed.
1797 #if !defined(OS_ANDROID) || defined(USE_AURA)
1798 UMA_HISTOGRAM_TIMES("Startup.PreMainMessageLoopRunImplStep3Time", 1777 UMA_HISTOGRAM_TIMES("Startup.PreMainMessageLoopRunImplStep3Time",
1799 base::TimeTicks::Now() - start_time_step3); 1778 base::TimeTicks::Now() - start_time_step3);
1800 #endif // !defined(OS_ANDROID) || defined(USE_AURA) 1779 #endif // !defined(OS_ANDROID)
1801 1780
1802 return result_code_; 1781 return result_code_;
1803 } 1782 }
1804 1783
1805 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { 1784 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) {
1806 // Trace the entry and exit of this method. We don't use the TRACE_EVENT0 1785 // Trace the entry and exit of this method. We don't use the TRACE_EVENT0
1807 // macro because the tracing infrastructure doesn't expect a synchronous event 1786 // macro because the tracing infrastructure doesn't expect a synchronous event
1808 // around the main loop of a thread. 1787 // around the main loop of a thread.
1809 ScopedMainMessageLoopRunEvent scoped_main_message_loop_run_event; 1788 ScopedMainMessageLoopRunEvent scoped_main_message_loop_run_event;
1810 #if defined(OS_ANDROID) 1789 #if defined(OS_ANDROID)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 chromeos::CrosSettings::Shutdown(); 1889 chromeos::CrosSettings::Shutdown();
1911 #endif // defined(OS_CHROMEOS) 1890 #endif // defined(OS_CHROMEOS)
1912 #endif // defined(OS_ANDROID) 1891 #endif // defined(OS_ANDROID)
1913 } 1892 }
1914 1893
1915 // Public members: 1894 // Public members:
1916 1895
1917 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1896 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1918 chrome_extra_parts_.push_back(parts); 1897 chrome_extra_parts_.push_back(parts);
1919 } 1898 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698