| 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 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include <set> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/at_exit.h" | 15 #include "base/at_exit.h" |
| 15 #include "base/bind.h" | 16 #include "base/bind.h" |
| 16 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 17 #include "base/debug/crash_logging.h" | 18 #include "base/debug/crash_logging.h" |
| 18 #include "base/debug/debugger.h" | 19 #include "base/debug/debugger.h" |
| 19 #include "base/debug/trace_event.h" | 20 #include "base/debug/trace_event.h" |
| 20 #include "base/file_util.h" | 21 #include "base/file_util.h" |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 void InitializeAllPrefHashStores() { | 512 void InitializeAllPrefHashStores() { |
| 512 ProfileInfoCache& profile_info_cache = | 513 ProfileInfoCache& profile_info_cache = |
| 513 g_browser_process->profile_manager()->GetProfileInfoCache(); | 514 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 514 size_t n_profiles = profile_info_cache.GetNumberOfProfiles(); | 515 size_t n_profiles = profile_info_cache.GetNumberOfProfiles(); |
| 515 for (size_t i = 0; i < n_profiles; ++i) { | 516 for (size_t i = 0; i < n_profiles; ++i) { |
| 516 base::FilePath profile_path = | 517 base::FilePath profile_path = |
| 517 profile_info_cache.GetPathOfProfileAtIndex(i); | 518 profile_info_cache.GetPathOfProfileAtIndex(i); |
| 518 chrome_prefs::InitializePrefHashStoreIfRequired(profile_path); | 519 chrome_prefs::InitializePrefHashStoreIfRequired(profile_path); |
| 519 } | 520 } |
| 520 } | 521 } |
| 522 |
| 521 } // namespace | 523 } // namespace |
| 522 | 524 |
| 523 namespace chrome_browser { | 525 namespace chrome_browser { |
| 524 | 526 |
| 525 // This error message is not localized because we failed to load the | 527 // This error message is not localized because we failed to load the |
| 526 // localization data files. | 528 // localization data files. |
| 527 #if defined(OS_WIN) | 529 #if defined(OS_WIN) |
| 528 const char kMissingLocaleDataTitle[] = "Missing File Error"; | 530 const char kMissingLocaleDataTitle[] = "Missing File Error"; |
| 529 #endif | 531 #endif |
| 530 | 532 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 new base::FieldTrialList( | 597 new base::FieldTrialList( |
| 596 metrics->CreateEntropyProvider(reporting_state).release())); | 598 metrics->CreateEntropyProvider(reporting_state).release())); |
| 597 | 599 |
| 598 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 600 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 599 if (command_line->HasSwitch(switches::kEnableBenchmarking)) | 601 if (command_line->HasSwitch(switches::kEnableBenchmarking)) |
| 600 base::FieldTrial::EnableBenchmarking(); | 602 base::FieldTrial::EnableBenchmarking(); |
| 601 | 603 |
| 602 // Ensure any field trials specified on the command line are initialized. | 604 // Ensure any field trials specified on the command line are initialized. |
| 603 // Also stop the metrics service so that we don't pollute UMA. | 605 // Also stop the metrics service so that we don't pollute UMA. |
| 604 if (command_line->HasSwitch(switches::kForceFieldTrials)) { | 606 if (command_line->HasSwitch(switches::kForceFieldTrials)) { |
| 607 std::set<std::string> unforceable_field_trials; |
| 608 #if defined(OFFICIAL_BUILD) |
| 609 unforceable_field_trials.insert("SettingsEnforcement"); |
| 610 #endif // defined(OFFICIAL_BUILD) |
| 611 |
| 605 // Create field trials without activating them, so that this behaves in a | 612 // Create field trials without activating them, so that this behaves in a |
| 606 // consistent manner with field trials created from the server. | 613 // consistent manner with field trials created from the server. |
| 607 bool result = base::FieldTrialList::CreateTrialsFromString( | 614 bool result = base::FieldTrialList::CreateTrialsFromString( |
| 608 command_line->GetSwitchValueASCII(switches::kForceFieldTrials), | 615 command_line->GetSwitchValueASCII(switches::kForceFieldTrials), |
| 609 base::FieldTrialList::DONT_ACTIVATE_TRIALS); | 616 base::FieldTrialList::DONT_ACTIVATE_TRIALS, unforceable_field_trials); |
| 610 CHECK(result) << "Invalid --" << switches::kForceFieldTrials | 617 CHECK(result) << "Invalid --" << switches::kForceFieldTrials |
| 611 << " list specified."; | 618 << " list specified."; |
| 612 } | 619 } |
| 613 if (command_line->HasSwitch(switches::kForceVariationIds)) { | 620 if (command_line->HasSwitch(switches::kForceVariationIds)) { |
| 614 // Create default variation ids which will always be included in the | 621 // Create default variation ids which will always be included in the |
| 615 // X-Client-Data request header. | 622 // X-Client-Data request header. |
| 616 chrome_variations::VariationsHttpHeaderProvider* provider = | 623 chrome_variations::VariationsHttpHeaderProvider* provider = |
| 617 chrome_variations::VariationsHttpHeaderProvider::GetInstance(); | 624 chrome_variations::VariationsHttpHeaderProvider::GetInstance(); |
| 618 bool result = provider->SetDefaultVariationIds( | 625 bool result = provider->SetDefaultVariationIds( |
| 619 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); | 626 command_line->GetSwitchValueASCII(switches::kForceVariationIds)); |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 chromeos::CrosSettings::Shutdown(); | 1704 chromeos::CrosSettings::Shutdown(); |
| 1698 #endif | 1705 #endif |
| 1699 #endif | 1706 #endif |
| 1700 } | 1707 } |
| 1701 | 1708 |
| 1702 // Public members: | 1709 // Public members: |
| 1703 | 1710 |
| 1704 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1711 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1705 chrome_extra_parts_.push_back(parts); | 1712 chrome_extra_parts_.push_back(parts); |
| 1706 } | 1713 } |
| OLD | NEW |