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

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

Issue 424053002: Add a new "Configure" mechanism to CLD browser-side data interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments, simplify configuration mechanism Created 6 years, 4 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 "components/component_updater/component_updater_paths.h" 16 #include "components/component_updater/component_updater_paths.h"
17 #include "components/translate/content/browser/data_file_browser_cld_data_provid er.h" 17 #include "components/translate/content/browser/browser_cld_data_provider.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "net/ssl/ssl_config_service.h" 19 #include "net/ssl/ssl_config_service.h"
20 20
21 using component_updater::ComponentUpdateService; 21 using component_updater::ComponentUpdateService;
22 22
23 namespace { 23 namespace {
24 // TODO(andrewhayden): Make the data file path into a gyp/gn define 24 // TODO(andrewhayden): Make the data file path into a gyp/gn define
25 // If you change this, also update component_cld_data_harness.cc 25 // If you change this, also update component_cld_data_harness.cc
26 // and cld_component_installer_unittest.cc accordingly! 26 // and cld_component_installer_unittest.cc accordingly!
27 const base::FilePath::CharType kCldDataFileName[] = 27 const base::FilePath::CharType kCldDataFileName[] =
28 FILE_PATH_LITERAL("cld2_data.bin"); 28 FILE_PATH_LITERAL("cld2_data.bin");
29
30 // Tracks the last value seen in SetLatestCldDataFile, for testing purposes.
31 base::LazyInstance<base::FilePath>::Leaky g_latest_cld_data_file_for_test =
Sorin Jianu 2014/07/29 22:42:36 Is this still test code?
32 LAZY_INSTANCE_INITIALIZER;
29 } // namespace 33 } // namespace
30 34
31 namespace component_updater { 35 namespace component_updater {
32 36
33 // The SHA256 of the SubjectPublicKeyInfo used to sign the extension. 37 // The SHA256 of the SubjectPublicKeyInfo used to sign the extension.
34 // The extension id is: dpedmmgabcgnikllifiidmijgoiihfgf 38 // The extension id is: dpedmmgabcgnikllifiidmijgoiihfgf
35 const uint8 kPublicKeySHA256[32] = { 39 const uint8 kPublicKeySHA256[32] = {
36 0x3f, 0x43, 0xcc, 0x60, 0x12, 0x6d, 0x8a, 0xbb, 40 0x3f, 0x43, 0xcc, 0x60, 0x12, 0x6d, 0x8a, 0xbb,
37 0x85, 0x88, 0x3c, 0x89, 0x6e, 0x88, 0x75, 0x65, 41 0x85, 0x88, 0x3c, 0x89, 0x6e, 0x88, 0x75, 0x65,
38 0xb9, 0x46, 0x09, 0xe8, 0xca, 0x92, 0xdd, 0x82, 42 0xb9, 0x46, 0x09, 0xe8, 0xca, 0x92, 0xdd, 0x82,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 new CldComponentInstallerTraits()); 113 new CldComponentInstallerTraits());
110 // |cus| will take ownership of |installer| during installer->Register(cus). 114 // |cus| will take ownership of |installer| during installer->Register(cus).
111 DefaultComponentInstaller* installer = 115 DefaultComponentInstaller* installer =
112 new DefaultComponentInstaller(traits.Pass()); 116 new DefaultComponentInstaller(traits.Pass());
113 installer->Register(cus); 117 installer->Register(cus);
114 } 118 }
115 119
116 void CldComponentInstallerTraits::SetLatestCldDataFile( 120 void CldComponentInstallerTraits::SetLatestCldDataFile(
117 const base::FilePath& path) { 121 const base::FilePath& path) {
118 VLOG(1) << "Setting CLD data file location: " << path.value(); 122 VLOG(1) << "Setting CLD data file location: " << path.value();
119 translate::DataFileBrowserCldDataProvider::SetCldDataFilePath(path); 123 *g_latest_cld_data_file_for_test.Pointer() = path;
124 translate::SetCldDataFilePath(path);
125 }
126
127 base::FilePath CldComponentInstallerTraits::GetLatestCldDataFile() {
128 return *g_latest_cld_data_file_for_test.Pointer();
120 } 129 }
121 130
122 } // namespace component_updater 131 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698