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/component_updater/pnacl/pnacl_component_installer.h" | 5 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
22 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
23 #include "base/values.h" | 23 #include "base/values.h" |
24 #include "base/version.h" | 24 #include "base/version.h" |
25 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
28 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
29 #include "components/component_updater/component_updater_service.h" | 29 #include "components/component_updater/component_updater_service.h" |
30 #include "components/nacl/common/nacl_switches.h" | 30 #include "components/nacl/common/nacl_switches.h" |
31 #include "components/omaha_client/omaha_query_params.h" | 31 #include "components/update_client/update_query_params.h" |
32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
33 | 33 |
34 using content::BrowserThread; | 34 using content::BrowserThread; |
35 using omaha_client::OmahaQueryParams; | 35 using update_client::UpdateQueryParams; |
36 | 36 |
37 namespace component_updater { | 37 namespace component_updater { |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 // Name of the Pnacl component specified in the manifest. | 41 // Name of the Pnacl component specified in the manifest. |
42 const char kPnaclManifestName[] = "PNaCl Translator"; | 42 const char kPnaclManifestName[] = "PNaCl Translator"; |
43 | 43 |
44 // Sanitize characters from Pnacl Arch value so that they can be used | 44 // Sanitize characters from Pnacl Arch value so that they can be used |
45 // in path names. This should only be characters in the set: [a-z0-9_]. | 45 // in path names. This should only be characters in the set: [a-z0-9_]. |
(...skipping 29 matching lines...) Expand all Loading... |
75 void CheckVersionCompatiblity(const base::Version& current_version) { | 75 void CheckVersionCompatiblity(const base::Version& current_version) { |
76 // Using NoBarrier, since needs_on_demand_update is standalone and does | 76 // Using NoBarrier, since needs_on_demand_update is standalone and does |
77 // not have other associated data. | 77 // not have other associated data. |
78 base::subtle::NoBarrier_Store(&needs_on_demand_update, | 78 base::subtle::NoBarrier_Store(&needs_on_demand_update, |
79 current_version.IsOlderThan(kMinPnaclVersion)); | 79 current_version.IsOlderThan(kMinPnaclVersion)); |
80 } | 80 } |
81 | 81 |
82 // PNaCl is packaged as a multi-CRX. This returns the platform-specific | 82 // PNaCl is packaged as a multi-CRX. This returns the platform-specific |
83 // subdirectory that is part of that multi-CRX. | 83 // subdirectory that is part of that multi-CRX. |
84 base::FilePath GetPlatformDir(const base::FilePath& base_path) { | 84 base::FilePath GetPlatformDir(const base::FilePath& base_path) { |
85 std::string arch = SanitizeForPath(OmahaQueryParams::GetNaclArch()); | 85 std::string arch = SanitizeForPath(UpdateQueryParams::GetNaclArch()); |
86 return base_path.AppendASCII("_platform_specific").AppendASCII(arch); | 86 return base_path.AppendASCII("_platform_specific").AppendASCII(arch); |
87 } | 87 } |
88 | 88 |
89 // Tell the rest of the world where to find the platform-specific PNaCl files. | 89 // Tell the rest of the world where to find the platform-specific PNaCl files. |
90 void OverrideDirPnaclComponent(const base::FilePath& base_path) { | 90 void OverrideDirPnaclComponent(const base::FilePath& base_path) { |
91 PathService::Override(chrome::DIR_PNACL_COMPONENT, GetPlatformDir(base_path)); | 91 PathService::Override(chrome::DIR_PNACL_COMPONENT, GetPlatformDir(base_path)); |
92 } | 92 } |
93 | 93 |
94 bool GetLatestPnaclDirectory(PnaclComponentInstaller* pci, | 94 bool GetLatestPnaclDirectory(PnaclComponentInstaller* pci, |
95 base::FilePath* latest_dir, | 95 base::FilePath* latest_dir, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 << version.GetString(); | 184 << version.GetString(); |
185 return false; | 185 return false; |
186 } | 186 } |
187 | 187 |
188 // Now check the |pnacl_manifest|. | 188 // Now check the |pnacl_manifest|. |
189 std::string arch; | 189 std::string arch; |
190 if (!pnacl_manifest.GetStringASCII("pnacl-arch", &arch)) { | 190 if (!pnacl_manifest.GetStringASCII("pnacl-arch", &arch)) { |
191 LOG(WARNING) << "'pnacl-arch' field is missing from pnacl-manifest!"; | 191 LOG(WARNING) << "'pnacl-arch' field is missing from pnacl-manifest!"; |
192 return false; | 192 return false; |
193 } | 193 } |
194 if (arch.compare(OmahaQueryParams::GetNaclArch()) != 0) { | 194 if (arch.compare(UpdateQueryParams::GetNaclArch()) != 0) { |
195 LOG(WARNING) << "'pnacl-arch' field in manifest is invalid (" << arch | 195 LOG(WARNING) << "'pnacl-arch' field in manifest is invalid (" << arch |
196 << " vs " << OmahaQueryParams::GetNaclArch() << ")"; | 196 << " vs " << UpdateQueryParams::GetNaclArch() << ")"; |
197 return false; | 197 return false; |
198 } | 198 } |
199 | 199 |
200 *version_out = version; | 200 *version_out = version; |
201 return true; | 201 return true; |
202 } | 202 } |
203 | 203 |
204 } // namespace | 204 } // namespace |
205 | 205 |
206 PnaclComponentInstaller::PnaclComponentInstaller() : cus_(NULL) { | 206 PnaclComponentInstaller::PnaclComponentInstaller() : cus_(NULL) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } // namespace component_updater | 372 } // namespace component_updater |
373 | 373 |
374 namespace pnacl { | 374 namespace pnacl { |
375 | 375 |
376 bool NeedsOnDemandUpdate() { | 376 bool NeedsOnDemandUpdate() { |
377 return base::subtle::NoBarrier_Load( | 377 return base::subtle::NoBarrier_Load( |
378 &component_updater::needs_on_demand_update) != 0; | 378 &component_updater::needs_on_demand_update) != 0; |
379 } | 379 } |
380 | 380 |
381 } // namespace pnacl | 381 } // namespace pnacl |
OLD | NEW |