| 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "base/threading/platform_thread.h" | 35 #include "base/threading/platform_thread.h" |
| 36 #include "base/time/time.h" | 36 #include "base/time/time.h" |
| 37 #include "base/values.h" | 37 #include "base/values.h" |
| 38 #include "build/build_config.h" | 38 #include "build/build_config.h" |
| 39 #include "chrome/browser/about_flags.h" | 39 #include "chrome/browser/about_flags.h" |
| 40 #include "chrome/browser/browser_process.h" | 40 #include "chrome/browser/browser_process.h" |
| 41 #include "chrome/browser/browser_process_impl.h" | 41 #include "chrome/browser/browser_process_impl.h" |
| 42 #include "chrome/browser/browser_process_platform_part.h" | 42 #include "chrome/browser/browser_process_platform_part.h" |
| 43 #include "chrome/browser/browser_shutdown.h" | 43 #include "chrome/browser/browser_shutdown.h" |
| 44 #include "chrome/browser/chrome_browser_main_extra_parts.h" | 44 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
| 45 #include "chrome/browser/chrome_browser_metrics_service_observer.h" |
| 45 #include "chrome/browser/component_updater/cld_component_installer.h" | 46 #include "chrome/browser/component_updater/cld_component_installer.h" |
| 46 #include "chrome/browser/component_updater/component_updater_service.h" | 47 #include "chrome/browser/component_updater/component_updater_service.h" |
| 47 #include "chrome/browser/component_updater/flash_component_installer.h" | 48 #include "chrome/browser/component_updater/flash_component_installer.h" |
| 48 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" | 49 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" |
| 49 #include "chrome/browser/component_updater/recovery_component_installer.h" | 50 #include "chrome/browser/component_updater/recovery_component_installer.h" |
| 50 #include "chrome/browser/component_updater/swiftshader_component_installer.h" | 51 #include "chrome/browser/component_updater/swiftshader_component_installer.h" |
| 51 #include "chrome/browser/component_updater/widevine_cdm_component_installer.h" | 52 #include "chrome/browser/component_updater/widevine_cdm_component_installer.h" |
| 52 #include "chrome/browser/defaults.h" | 53 #include "chrome/browser/defaults.h" |
| 53 #include "chrome/browser/extensions/extension_service.h" | 54 #include "chrome/browser/extensions/extension_service.h" |
| 54 #include "chrome/browser/extensions/startup_helper.h" | 55 #include "chrome/browser/extensions/startup_helper.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 // This will be called after the command-line has been mutated by about:flags | 553 // This will be called after the command-line has been mutated by about:flags |
| 553 void ChromeBrowserMainParts::SetupMetricsAndFieldTrials() { | 554 void ChromeBrowserMainParts::SetupMetricsAndFieldTrials() { |
| 554 TRACE_EVENT0("startup", "ChromeBrowserMainParts::SetupMetricsAndFieldTrials"); | 555 TRACE_EVENT0("startup", "ChromeBrowserMainParts::SetupMetricsAndFieldTrials"); |
| 555 // Must initialize metrics after labs have been converted into switches, | 556 // Must initialize metrics after labs have been converted into switches, |
| 556 // but before field trials are set up (so that client ID is available for | 557 // but before field trials are set up (so that client ID is available for |
| 557 // one-time randomized field trials). | 558 // one-time randomized field trials). |
| 558 #if defined(ARCH_CPU_64_BITS) | 559 #if defined(ARCH_CPU_64_BITS) |
| 559 MetricsLog::set_version_extension("-64"); | 560 MetricsLog::set_version_extension("-64"); |
| 560 #endif // defined(ARCH_CPU_64_BITS) | 561 #endif // defined(ARCH_CPU_64_BITS) |
| 561 | 562 |
| 563 MetricsService* metrics = browser_process_->metrics_service(); |
| 564 // Create the metrics log observer. |
| 565 metrics_service_observer_.reset(new ChromeBrowserMetricsServiceObserver()); |
| 562 // Initialize FieldTrialList to support FieldTrials that use one-time | 566 // Initialize FieldTrialList to support FieldTrials that use one-time |
| 563 // randomization. | 567 // randomization. |
| 564 MetricsService* metrics = browser_process_->metrics_service(); | |
| 565 field_trial_list_.reset( | 568 field_trial_list_.reset( |
| 566 new base::FieldTrialList(metrics->CreateEntropyProvider().release())); | 569 new base::FieldTrialList(metrics->CreateEntropyProvider().release())); |
| 567 | 570 |
| 568 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 571 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 569 if (command_line->HasSwitch(switches::kEnableBenchmarking)) | 572 if (command_line->HasSwitch(switches::kEnableBenchmarking)) |
| 570 base::FieldTrial::EnableBenchmarking(); | 573 base::FieldTrial::EnableBenchmarking(); |
| 571 | 574 |
| 572 // Ensure any field trials specified on the command line are initialized. | 575 // Ensure any field trials specified on the command line are initialized. |
| 573 // Also stop the metrics service so that we don't pollute UMA. | 576 // Also stop the metrics service so that we don't pollute UMA. |
| 574 if (command_line->HasSwitch(switches::kForceFieldTrials)) { | 577 if (command_line->HasSwitch(switches::kForceFieldTrials)) { |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 chromeos::CrosSettings::Shutdown(); | 1656 chromeos::CrosSettings::Shutdown(); |
| 1654 #endif | 1657 #endif |
| 1655 #endif | 1658 #endif |
| 1656 } | 1659 } |
| 1657 | 1660 |
| 1658 // Public members: | 1661 // Public members: |
| 1659 | 1662 |
| 1660 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1663 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1661 chrome_extra_parts_.push_back(parts); | 1664 chrome_extra_parts_.push_back(parts); |
| 1662 } | 1665 } |
| OLD | NEW |