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

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

Issue 2305433003: Revert of Disallow non-namespaced use of base::Version. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « base/version.h ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/pepper_flash_component_installer.h" 5 #include "chrome/browser/component_updater/pepper_flash_component_installer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #if defined(GOOGLE_CHROME_BUILD) 56 #if defined(GOOGLE_CHROME_BUILD)
57 // CRX hash. The extension id is: mimojjlkmoijpicakmndhoigimigcmbb. 57 // CRX hash. The extension id is: mimojjlkmoijpicakmndhoigimigcmbb.
58 const uint8_t kSha2Hash[] = {0xc8, 0xce, 0x99, 0xba, 0xce, 0x89, 0xf8, 0x20, 58 const uint8_t kSha2Hash[] = {0xc8, 0xce, 0x99, 0xba, 0xce, 0x89, 0xf8, 0x20,
59 0xac, 0xd3, 0x7e, 0x86, 0x8c, 0x86, 0x2c, 0x11, 59 0xac, 0xd3, 0x7e, 0x86, 0x8c, 0x86, 0x2c, 0x11,
60 0xb9, 0x40, 0xc5, 0x55, 0xaf, 0x08, 0x63, 0x70, 60 0xb9, 0x40, 0xc5, 0x55, 0xaf, 0x08, 0x63, 0x70,
61 0x54, 0xf9, 0x56, 0xd3, 0xe7, 0x88, 0xba, 0x8c}; 61 0x54, 0xf9, 0x56, 0xd3, 0xe7, 0x88, 0xba, 0x8c};
62 #endif // defined(GOOGLE_CHROME_BUILD) 62 #endif // defined(GOOGLE_CHROME_BUILD)
63 63
64 #if !defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) 64 #if !defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD)
65 bool MakePepperFlashPluginInfo(const base::FilePath& flash_path, 65 bool MakePepperFlashPluginInfo(const base::FilePath& flash_path,
66 const base::Version& flash_version, 66 const Version& flash_version,
67 bool out_of_process, 67 bool out_of_process,
68 content::PepperPluginInfo* plugin_info) { 68 content::PepperPluginInfo* plugin_info) {
69 if (!flash_version.IsValid()) 69 if (!flash_version.IsValid())
70 return false; 70 return false;
71 const std::vector<uint32_t> ver_nums = flash_version.components(); 71 const std::vector<uint32_t> ver_nums = flash_version.components();
72 if (ver_nums.size() < 3) 72 if (ver_nums.size() < 3)
73 return false; 73 return false;
74 74
75 plugin_info->is_internal = false; 75 plugin_info->is_internal = false;
76 plugin_info->is_out_of_process = out_of_process; 76 plugin_info->is_out_of_process = out_of_process;
(...skipping 18 matching lines...) Expand all
95 content::kFlashPluginSplExtension, 95 content::kFlashPluginSplExtension,
96 content::kFlashPluginName); 96 content::kFlashPluginName);
97 plugin_info->mime_types.push_back(spl_mime_type); 97 plugin_info->mime_types.push_back(spl_mime_type);
98 return true; 98 return true;
99 } 99 }
100 100
101 // |path| is the path to the latest Chrome-managed Flash installation (bundled 101 // |path| is the path to the latest Chrome-managed Flash installation (bundled
102 // or component updated). 102 // or component updated).
103 // |version| is the version of that Flash implementation. 103 // |version| is the version of that Flash implementation.
104 void RegisterPepperFlashWithChrome(const base::FilePath& path, 104 void RegisterPepperFlashWithChrome(const base::FilePath& path,
105 const base::Version& version) { 105 const Version& version) {
106 DCHECK_CURRENTLY_ON(BrowserThread::UI); 106 DCHECK_CURRENTLY_ON(BrowserThread::UI);
107 content::PepperPluginInfo plugin_info; 107 content::PepperPluginInfo plugin_info;
108 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) 108 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info))
109 return; 109 return;
110 content::WebPluginInfo web_plugin = plugin_info.ToWebPluginInfo(); 110 content::WebPluginInfo web_plugin = plugin_info.ToWebPluginInfo();
111 111
112 base::FilePath system_flash_path; 112 base::FilePath system_flash_path;
113 PathService::Get(chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN, &system_flash_path); 113 PathService::Get(chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN, &system_flash_path);
114 114
115 std::vector<content::WebPluginInfo> plugins; 115 std::vector<content::WebPluginInfo> plugins;
116 PluginService::GetInstance()->GetInternalPlugins(&plugins); 116 PluginService::GetInstance()->GetInternalPlugins(&plugins);
117 base::FilePath placeholder_path = 117 base::FilePath placeholder_path =
118 base::FilePath::FromUTF8Unsafe(ChromeContentClient::kNotPresent); 118 base::FilePath::FromUTF8Unsafe(ChromeContentClient::kNotPresent);
119 for (const auto& plugin : plugins) { 119 for (const auto& plugin : plugins) {
120 if (!plugin.is_pepper_plugin() || plugin.name != web_plugin.name) 120 if (!plugin.is_pepper_plugin() || plugin.name != web_plugin.name)
121 continue; 121 continue;
122 122
123 if (plugin.path == placeholder_path) { 123 if (plugin.path == placeholder_path) {
124 // This is the Flash placeholder; replace it regardless of version or 124 // This is the Flash placeholder; replace it regardless of version or
125 // other considerations. 125 // other considerations.
126 PluginService::GetInstance()->UnregisterInternalPlugin(plugin.path); 126 PluginService::GetInstance()->UnregisterInternalPlugin(plugin.path);
127 break; 127 break;
128 } 128 }
129 129
130 base::Version registered_version(base::UTF16ToUTF8(plugin.version)); 130 Version registered_version(base::UTF16ToUTF8(plugin.version));
131 131
132 // If lower version, never register. 132 // If lower version, never register.
133 if (registered_version.IsValid() && 133 if (registered_version.IsValid() &&
134 version.CompareTo(registered_version) < 0) { 134 version.CompareTo(registered_version) < 0) {
135 return; 135 return;
136 } 136 }
137 137
138 bool registered_is_debug_system = 138 bool registered_is_debug_system =
139 !system_flash_path.empty() && 139 !system_flash_path.empty() &&
140 base::FilePath::CompareEqualIgnoreCase(plugin.path.value(), 140 base::FilePath::CompareEqualIgnoreCase(plugin.path.value(),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 RegisterPepperFlashWithChrome(path.Append(chrome::kPepperFlashPluginFilename), 235 RegisterPepperFlashWithChrome(path.Append(chrome::kPepperFlashPluginFilename),
236 version); 236 version);
237 BrowserThread::GetBlockingPool()->PostTask( 237 BrowserThread::GetBlockingPool()->PostTask(
238 FROM_HERE, base::Bind(&UpdatePathService, path)); 238 FROM_HERE, base::Bind(&UpdatePathService, path));
239 #endif // !defined(OS_LINUX) 239 #endif // !defined(OS_LINUX)
240 } 240 }
241 241
242 bool FlashComponentInstallerTraits::VerifyInstallation( 242 bool FlashComponentInstallerTraits::VerifyInstallation(
243 const base::DictionaryValue& manifest, 243 const base::DictionaryValue& manifest,
244 const base::FilePath& install_dir) const { 244 const base::FilePath& install_dir) const {
245 base::Version unused; 245 Version unused;
246 return chrome::CheckPepperFlashManifest(manifest, &unused); 246 return chrome::CheckPepperFlashManifest(manifest, &unused);
247 } 247 }
248 248
249 // The base directory on Windows looks like: 249 // The base directory on Windows looks like:
250 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\. 250 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\.
251 base::FilePath FlashComponentInstallerTraits::GetRelativeInstallDir() const { 251 base::FilePath FlashComponentInstallerTraits::GetRelativeInstallDir() const {
252 return base::FilePath(FILE_PATH_LITERAL("PepperFlash")); 252 return base::FilePath(FILE_PATH_LITERAL("PepperFlash"));
253 } 253 }
254 254
255 void FlashComponentInstallerTraits::GetHash(std::vector<uint8_t>* hash) const { 255 void FlashComponentInstallerTraits::GetHash(std::vector<uint8_t>* hash) const {
(...skipping 29 matching lines...) Expand all
285 std::unique_ptr<ComponentInstallerTraits> traits( 285 std::unique_ptr<ComponentInstallerTraits> traits(
286 new FlashComponentInstallerTraits); 286 new FlashComponentInstallerTraits);
287 // |cus| will take ownership of |installer| during installer->Register(cus). 287 // |cus| will take ownership of |installer| during installer->Register(cus).
288 DefaultComponentInstaller* installer = 288 DefaultComponentInstaller* installer =
289 new DefaultComponentInstaller(std::move(traits)); 289 new DefaultComponentInstaller(std::move(traits));
290 installer->Register(cus, base::Closure()); 290 installer->Register(cus, base::Closure());
291 #endif // defined(GOOGLE_CHROME_BUILD) 291 #endif // defined(GOOGLE_CHROME_BUILD)
292 } 292 }
293 293
294 } // namespace component_updater 294 } // namespace component_updater
OLDNEW
« no previous file with comments | « base/version.h ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698