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

Side by Side Diff: chrome/browser/component_updater/cld_component_installer.cc

Issue 385013002: Componentize component_updater: Replace content::BrowserThread usage with task runners (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/component_updater/cld_component_installer.h" 5 #include "chrome/browser/component_updater/cld_component_installer.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "base/threading/sequenced_worker_pool.h"
17 #include "components/component_updater/component_updater_paths.h" 17 #include "components/component_updater/component_updater_paths.h"
18 #include "components/translate/content/browser/data_file_browser_cld_data_provid er.h" 18 #include "components/translate/content/browser/data_file_browser_cld_data_provid er.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "net/ssl/ssl_config_service.h" 20 #include "net/ssl/ssl_config_service.h"
21 21
22 using component_updater::ComponentUpdateService; 22 using component_updater::ComponentUpdateService;
23 using content::BrowserThread;
24 23
25 namespace { 24 namespace {
26 // TODO(andrewhayden): Make the data file path into a gyp/gn define 25 // TODO(andrewhayden): Make the data file path into a gyp/gn define
27 // If you change this, also update component_cld_data_harness.cc 26 // If you change this, also update component_cld_data_harness.cc
28 // and cld_component_installer_unittest.cc accordingly! 27 // and cld_component_installer_unittest.cc accordingly!
29 const base::FilePath::CharType kCldDataFileName[] = 28 const base::FilePath::CharType kCldDataFileName[] =
30 FILE_PATH_LITERAL("cld2_data.bin"); 29 FILE_PATH_LITERAL("cld2_data.bin");
31 } // namespace 30 } // namespace
32 31
33 namespace component_updater { 32 namespace component_updater {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 98 }
100 99
101 std::string CldComponentInstallerTraits::GetName() const { 100 std::string CldComponentInstallerTraits::GetName() const {
102 return kCldManifestName; 101 return kCldManifestName;
103 } 102 }
104 103
105 void RegisterCldComponent(ComponentUpdateService* cus) { 104 void RegisterCldComponent(ComponentUpdateService* cus) {
106 scoped_ptr<ComponentInstallerTraits> traits( 105 scoped_ptr<ComponentInstallerTraits> traits(
107 new CldComponentInstallerTraits()); 106 new CldComponentInstallerTraits());
108 // |cus| will take ownership of |installer| during installer->Register(cus). 107 // |cus| will take ownership of |installer| during installer->Register(cus).
109 DefaultComponentInstaller* installer = 108 DefaultComponentInstaller* installer = new DefaultComponentInstaller(
110 new DefaultComponentInstaller(traits.Pass()); 109 traits.Pass(),
110 content::BrowserThread::GetBlockingPool()
111 ->GetSequencedTaskRunnerWithShutdownBehavior(
112 content::BrowserThread::GetBlockingPool()->GetSequenceToken(),
blundell 2014/07/15 08:45:20 What logic is behind the choices on lines 112 and
tommycli 2014/07/15 18:58:25 I replicated the choices made here: https://code
113 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
111 installer->Register(cus); 114 installer->Register(cus);
112 } 115 }
113 116
114 void CldComponentInstallerTraits::SetLatestCldDataFile( 117 void CldComponentInstallerTraits::SetLatestCldDataFile(
115 const base::FilePath& path) { 118 const base::FilePath& path) {
116 VLOG(1) << "Setting CLD data file location: " << path.value(); 119 VLOG(1) << "Setting CLD data file location: " << path.value();
117 translate::DataFileBrowserCldDataProvider::SetCldDataFilePath(path); 120 translate::DataFileBrowserCldDataProvider::SetCldDataFilePath(path);
118 } 121 }
119 122
120 } // namespace component_updater 123 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698