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

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

Issue 461633002: Refactor language detection logic to allow non-static CLD data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create a factory for test harnesses and use it Created 6 years, 2 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/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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 #include "chrome/installer/util/google_update_settings.h" 101 #include "chrome/installer/util/google_update_settings.h"
102 #include "components/component_updater/component_updater_service.h" 102 #include "components/component_updater/component_updater_service.h"
103 #include "components/google/core/browser/google_util.h" 103 #include "components/google/core/browser/google_util.h"
104 #include "components/language_usage_metrics/language_usage_metrics.h" 104 #include "components/language_usage_metrics/language_usage_metrics.h"
105 #include "components/metrics/metrics_service.h" 105 #include "components/metrics/metrics_service.h"
106 #include "components/metrics/profiler/tracking_synchronizer.h" 106 #include "components/metrics/profiler/tracking_synchronizer.h"
107 #include "components/nacl/browser/nacl_browser.h" 107 #include "components/nacl/browser/nacl_browser.h"
108 #include "components/rappor/rappor_service.h" 108 #include "components/rappor/rappor_service.h"
109 #include "components/signin/core/common/profile_management_switches.h" 109 #include "components/signin/core/common/profile_management_switches.h"
110 #include "components/startup_metric_utils/startup_metric_utils.h" 110 #include "components/startup_metric_utils/startup_metric_utils.h"
111 #include "components/translate/content/browser/browser_cld_data_provider_factory .h"
112 #include "components/translate/content/browser/static_browser_cld_data_provider. h"
113 #include "components/translate/content/browser/static_browser_cld_data_provider_ factory.h"
111 #include "components/translate/content/common/cld_data_source.h" 114 #include "components/translate/content/common/cld_data_source.h"
112 #include "components/translate/core/browser/translate_download_manager.h" 115 #include "components/translate/core/browser/translate_download_manager.h"
113 #include "components/variations/variations_http_header_provider.h" 116 #include "components/variations/variations_http_header_provider.h"
114 #include "content/public/browser/browser_thread.h" 117 #include "content/public/browser/browser_thread.h"
115 #include "content/public/browser/notification_observer.h" 118 #include "content/public/browser/notification_observer.h"
116 #include "content/public/browser/notification_registrar.h" 119 #include "content/public/browser/notification_registrar.h"
117 #include "content/public/browser/notification_service.h" 120 #include "content/public/browser/notification_service.h"
118 #include "content/public/browser/notification_types.h" 121 #include "content/public/browser/notification_types.h"
119 #include "content/public/browser/site_instance.h" 122 #include "content/public/browser/site_instance.h"
120 #include "content/public/common/content_client.h" 123 #include "content/public/common/content_client.h"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 403 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
401 RegisterRecoveryComponent(cus, g_browser_process->local_state()); 404 RegisterRecoveryComponent(cus, g_browser_process->local_state());
402 RegisterPepperFlashComponent(cus); 405 RegisterPepperFlashComponent(cus);
403 RegisterSwiftShaderComponent(cus); 406 RegisterSwiftShaderComponent(cus);
404 RegisterWidevineCdmComponent(cus); 407 RegisterWidevineCdmComponent(cus);
405 #if !defined(DISABLE_NACL) 408 #if !defined(DISABLE_NACL)
406 g_browser_process->pnacl_component_installer()->RegisterPnaclComponent(cus); 409 g_browser_process->pnacl_component_installer()->RegisterPnaclComponent(cus);
407 #endif 410 #endif
408 #endif 411 #endif
409 412
410 if (translate::CldDataSource::ShouldRegisterForComponentUpdates()) { 413 if (translate::CldDataSource::Get()->ShouldRegisterForComponentUpdates()) {
411 RegisterCldComponent(cus); 414 RegisterCldComponent(cus);
412 } 415 }
413 416
414 base::FilePath path; 417 base::FilePath path;
415 if (PathService::Get(chrome::DIR_USER_DATA, &path)) { 418 if (PathService::Get(chrome::DIR_USER_DATA, &path)) {
416 #if defined(OS_ANDROID) 419 #if defined(OS_ANDROID)
417 // The CRLSet component was enabled for some releases. This code attempts to 420 // The CRLSet component was enabled for some releases. This code attempts to
418 // delete it from the local disk of those how may have downloaded it. 421 // delete it from the local disk of those how may have downloaded it.
419 g_browser_process->crl_set_fetcher()->DeleteFromDisk(path); 422 g_browser_process->crl_set_fetcher()->DeleteFromDisk(path);
420 #elif !defined(OS_CHROMEOS) 423 #elif !defined(OS_CHROMEOS)
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 PrefMetricsService::Factory::GetForProfile(profile_); 1459 PrefMetricsService::Factory::GetForProfile(profile_);
1457 1460
1458 PreBrowserStart(); 1461 PreBrowserStart();
1459 1462
1460 // Instantiate the notification UI manager, as this triggers a perf timer 1463 // Instantiate the notification UI manager, as this triggers a perf timer
1461 // used to measure startup time. TODO(stevenjb): Figure out what is actually 1464 // used to measure startup time. TODO(stevenjb): Figure out what is actually
1462 // triggering the timer and call that explicitly in the approprate place. 1465 // triggering the timer and call that explicitly in the approprate place.
1463 // http://crbug.com/105065. 1466 // http://crbug.com/105065.
1464 browser_process_->notification_ui_manager(); 1467 browser_process_->notification_ui_manager();
1465 1468
1469 if (!translate::BrowserCldDataProviderFactory::IsInitialized()) {
1470 // Embedder hasn't specified an alternative factory, so we should set one.
1471 // This must happen before calling RegisterComponentsForUpdate, because
1472 // that code will register the CLD Component Updater if needed.
1473 // Maintainers: Customize the default data source here as desired.
1474 translate::CldDataSource::Set(translate::CldDataSource::STATIC(), false);
picksi1 2014/09/29 15:59:08 What does the 'false' here mean? Can we rename the
Andrew Hayden (chromium.org) 2014/10/30 14:25:14 I'm changing to two methods: Set and SetDefault. H
1475 translate::BrowserCldDataProviderFactory* factory =
1476 new translate::StaticBrowserCldDataProviderFactory();
1477 translate::BrowserCldDataProviderFactory::Set(factory, false);
1478 }
picksi1 2014/09/29 15:59:08 see comment about about 'false'.
Andrew Hayden (chromium.org) 2014/10/30 14:25:14 Similarly, this is now cleaned up. Now we explicit
1479
1466 if (!parsed_command_line().HasSwitch(switches::kDisableComponentUpdate)) 1480 if (!parsed_command_line().HasSwitch(switches::kDisableComponentUpdate))
1467 RegisterComponentsForUpdate(); 1481 RegisterComponentsForUpdate();
1468 1482
1469 #if defined(OS_ANDROID) 1483 #if defined(OS_ANDROID)
1470 chrome_variations::VariationsService* variations_service = 1484 chrome_variations::VariationsService* variations_service =
1471 browser_process_->variations_service(); 1485 browser_process_->variations_service();
1472 if (variations_service) { 1486 if (variations_service) {
1473 variations_service->set_policy_pref_service(profile_->GetPrefs()); 1487 variations_service->set_policy_pref_service(profile_->GetPrefs());
1474 variations_service->StartRepeatedVariationsSeedFetch(); 1488 variations_service->StartRepeatedVariationsSeedFetch();
1475 } 1489 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 chromeos::CrosSettings::Shutdown(); 1688 chromeos::CrosSettings::Shutdown();
1675 #endif 1689 #endif
1676 #endif 1690 #endif
1677 } 1691 }
1678 1692
1679 // Public members: 1693 // Public members:
1680 1694
1681 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1695 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1682 chrome_extra_parts_.push_back(parts); 1696 chrome_extra_parts_.push_back(parts);
1683 } 1697 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698