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/flash_component_installer.h" | 5 #include "chrome/browser/component_updater/flash_component_installer.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 const char kNullVersion[] = "0.0.0.0"; | 77 const char kNullVersion[] = "0.0.0.0"; |
78 | 78 |
79 // The base directory on Windows looks like: | 79 // The base directory on Windows looks like: |
80 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\. | 80 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\. |
81 base::FilePath GetPepperFlashBaseDirectory() { | 81 base::FilePath GetPepperFlashBaseDirectory() { |
82 base::FilePath result; | 82 base::FilePath result; |
83 PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, &result); | 83 PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, &result); |
84 return result; | 84 return result; |
85 } | 85 } |
86 | 86 |
87 #if defined(GOOGLE_CHROME_BUILD) | 87 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) |
88 // Pepper Flash plugins have the version encoded in the path itself | 88 // Pepper Flash plugins have the version encoded in the path itself |
89 // so we need to enumerate the directories to find the full path. | 89 // so we need to enumerate the directories to find the full path. |
90 // On success, |latest_dir| returns something like: | 90 // On success, |latest_dir| returns something like: |
91 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\10.3.44.555\. | 91 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\10.3.44.555\. |
92 // |latest_version| returns the corresponding version number. |older_dirs| | 92 // |latest_version| returns the corresponding version number. |older_dirs| |
93 // returns directories of all older versions. | 93 // returns directories of all older versions. |
94 bool GetPepperFlashDirectory(base::FilePath* latest_dir, | 94 bool GetPepperFlashDirectory(base::FilePath* latest_dir, |
95 Version* latest_version, | 95 Version* latest_version, |
96 std::vector<base::FilePath>* older_dirs) { | 96 std::vector<base::FilePath>* older_dirs) { |
97 base::FilePath base_dir = GetPepperFlashBaseDirectory(); | 97 base::FilePath base_dir = GetPepperFlashBaseDirectory(); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 manifest->GetStringASCII("x-ppapi-arch", &arch); | 325 manifest->GetStringASCII("x-ppapi-arch", &arch); |
326 if (arch != kPepperFlashArch) | 326 if (arch != kPepperFlashArch) |
327 return false; | 327 return false; |
328 | 328 |
329 *version_out = version; | 329 *version_out = version; |
330 return true; | 330 return true; |
331 } | 331 } |
332 | 332 |
333 namespace { | 333 namespace { |
334 | 334 |
335 #if defined(GOOGLE_CHROME_BUILD) | 335 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) |
336 void FinishPepperFlashUpdateRegistration(ComponentUpdateService* cus, | 336 void FinishPepperFlashUpdateRegistration(ComponentUpdateService* cus, |
337 const Version& version) { | 337 const Version& version) { |
338 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 338 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
339 CrxComponent pepflash; | 339 CrxComponent pepflash; |
340 pepflash.name = "pepper_flash"; | 340 pepflash.name = "pepper_flash"; |
341 pepflash.installer = new PepperFlashComponentInstaller(version); | 341 pepflash.installer = new PepperFlashComponentInstaller(version); |
342 pepflash.version = version; | 342 pepflash.version = version; |
343 pepflash.pk_hash.assign(sha2_hash, &sha2_hash[sizeof(sha2_hash)]); | 343 pepflash.pk_hash.assign(sha2_hash, &sha2_hash[sizeof(sha2_hash)]); |
344 if (cus->RegisterComponent(pepflash) != ComponentUpdateService::kOk) { | 344 if (cus->RegisterComponent(pepflash) != ComponentUpdateService::kOk) { |
345 NOTREACHED() << "Pepper Flash component registration failed."; | 345 NOTREACHED() << "Pepper Flash component registration failed."; |
(...skipping 26 matching lines...) Expand all Loading... | |
372 BrowserThread::PostTask( | 372 BrowserThread::PostTask( |
373 BrowserThread::UI, FROM_HERE, | 373 BrowserThread::UI, FROM_HERE, |
374 base::Bind(&FinishPepperFlashUpdateRegistration, cus, version)); | 374 base::Bind(&FinishPepperFlashUpdateRegistration, cus, version)); |
375 | 375 |
376 // Remove older versions of Pepper Flash. | 376 // Remove older versions of Pepper Flash. |
377 for (std::vector<base::FilePath>::iterator iter = older_dirs.begin(); | 377 for (std::vector<base::FilePath>::iterator iter = older_dirs.begin(); |
378 iter != older_dirs.end(); ++iter) { | 378 iter != older_dirs.end(); ++iter) { |
379 file_util::Delete(*iter, true); | 379 file_util::Delete(*iter, true); |
380 } | 380 } |
381 } | 381 } |
382 #endif // defined(GOOGLE_CHROME_BUILD) | 382 #endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) |
383 | 383 |
384 } // namespace | 384 } // namespace |
385 | 385 |
386 void RegisterPepperFlashComponent(ComponentUpdateService* cus) { | 386 void RegisterPepperFlashComponent(ComponentUpdateService* cus) { |
387 #if defined(GOOGLE_CHROME_BUILD) | 387 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) |
cpu_(ooo_6.6-7.5)
2013/03/19 00:54:17
I think you only need to ifdef this function. Do y
yzshen1
2013/03/19 16:27:09
In CL https://chromiumcodereview.appspot.com/10977
| |
388 // Component updated flash supersedes bundled flash therefore if that one | 388 // Component updated flash supersedes bundled flash therefore if that one |
389 // is disabled then this one should never install. | 389 // is disabled then this one should never install. |
390 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 390 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
391 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) | 391 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) |
392 return; | 392 return; |
393 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 393 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
394 base::Bind(&StartPepperFlashUpdateRegistration, cus)); | 394 base::Bind(&StartPepperFlashUpdateRegistration, cus)); |
395 #endif | 395 #endif |
396 } | 396 } |
OLD | NEW |