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 11 matching lines...) Expand all Loading... |
22 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
23 #include "base/values.h" | 23 #include "base/values.h" |
24 #include "base/version.h" | 24 #include "base/version.h" |
25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
26 #include "chrome/browser/component_updater/component_updater_service.h" | 26 #include "chrome/browser/component_updater/component_updater_service.h" |
27 #include "chrome/browser/plugins/plugin_prefs.h" | 27 #include "chrome/browser/plugins/plugin_prefs.h" |
28 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
29 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/common/pepper_flash.h" | 31 #include "chrome/common/pepper_flash.h" |
32 #include "chrome/common/pepper_flash.h" | |
33 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/browser/plugin_service.h" | 33 #include "content/public/browser/plugin_service.h" |
35 #include "content/public/common/pepper_plugin_info.h" | 34 #include "content/public/common/pepper_plugin_info.h" |
36 #include "ppapi/c/private/ppb_pdf.h" | 35 #include "ppapi/c/private/ppb_pdf.h" |
37 #include "webkit/plugins/plugin_constants.h" | 36 #include "webkit/plugins/plugin_constants.h" |
38 #include "webkit/plugins/ppapi/plugin_module.h" | 37 #include "webkit/plugins/ppapi/plugin_module.h" |
39 | 38 |
40 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. | 39 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. |
41 | 40 |
42 using content::BrowserThread; | 41 using content::BrowserThread; |
43 using content::PluginService; | 42 using content::PluginService; |
44 | 43 |
45 namespace { | 44 namespace { |
46 | 45 |
47 // CRX hash. The extension id is: mimojjlkmoijpicakmndhoigimigcmbb. | 46 // CRX hash. The extension id is: mimojjlkmoijpicakmndhoigimigcmbb. |
48 const uint8 sha2_hash[] = {0xc8, 0xce, 0x99, 0xba, 0xce, 0x89, 0xf8, 0x20, | 47 const uint8 kSha2Hash[] = {0xc8, 0xce, 0x99, 0xba, 0xce, 0x89, 0xf8, 0x20, |
49 0xac, 0xd3, 0x7e, 0x86, 0x8c, 0x86, 0x2c, 0x11, | 48 0xac, 0xd3, 0x7e, 0x86, 0x8c, 0x86, 0x2c, 0x11, |
50 0xb9, 0x40, 0xc5, 0x55, 0xaf, 0x08, 0x63, 0x70, | 49 0xb9, 0x40, 0xc5, 0x55, 0xaf, 0x08, 0x63, 0x70, |
51 0x54, 0xf9, 0x56, 0xd3, 0xe7, 0x88, 0xba, 0x8c}; | 50 0x54, 0xf9, 0x56, 0xd3, 0xe7, 0x88, 0xba, 0x8c}; |
52 | 51 |
53 // File name of the Pepper Flash component manifest on different platforms. | 52 // File name of the Pepper Flash component manifest on different platforms. |
54 const char kPepperFlashManifestName[] = "Flapper"; | 53 const char kPepperFlashManifestName[] = "Flapper"; |
55 | 54 |
56 // Name of the Pepper Flash OS in the component manifest. | 55 // Name of the Pepper Flash OS in the component manifest. |
57 const char kPepperFlashOperatingSystem[] = | 56 const char kPepperFlashOperatingSystem[] = |
58 #if defined(OS_MACOSX) | 57 #if defined(OS_MACOSX) |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 namespace { | 332 namespace { |
334 | 333 |
335 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) | 334 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) |
336 void FinishPepperFlashUpdateRegistration(ComponentUpdateService* cus, | 335 void FinishPepperFlashUpdateRegistration(ComponentUpdateService* cus, |
337 const Version& version) { | 336 const Version& version) { |
338 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 337 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
339 CrxComponent pepflash; | 338 CrxComponent pepflash; |
340 pepflash.name = "pepper_flash"; | 339 pepflash.name = "pepper_flash"; |
341 pepflash.installer = new PepperFlashComponentInstaller(version); | 340 pepflash.installer = new PepperFlashComponentInstaller(version); |
342 pepflash.version = version; | 341 pepflash.version = version; |
343 pepflash.pk_hash.assign(sha2_hash, &sha2_hash[sizeof(sha2_hash)]); | 342 pepflash.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]); |
344 if (cus->RegisterComponent(pepflash) != ComponentUpdateService::kOk) { | 343 if (cus->RegisterComponent(pepflash) != ComponentUpdateService::kOk) { |
345 NOTREACHED() << "Pepper Flash component registration failed."; | 344 NOTREACHED() << "Pepper Flash component registration failed."; |
346 } | 345 } |
347 } | 346 } |
348 | 347 |
349 void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) { | 348 void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) { |
350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 349 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
351 base::FilePath path = GetPepperFlashBaseDirectory(); | 350 base::FilePath path = GetPepperFlashBaseDirectory(); |
352 if (!file_util::PathExists(path)) { | 351 if (!file_util::PathExists(path)) { |
353 if (!file_util::CreateDirectory(path)) { | 352 if (!file_util::CreateDirectory(path)) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) | 386 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) |
388 // Component updated flash supersedes bundled flash therefore if that one | 387 // Component updated flash supersedes bundled flash therefore if that one |
389 // is disabled then this one should never install. | 388 // is disabled then this one should never install. |
390 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 389 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
391 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) | 390 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) |
392 return; | 391 return; |
393 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 392 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
394 base::Bind(&StartPepperFlashUpdateRegistration, cus)); | 393 base::Bind(&StartPepperFlashUpdateRegistration, cus)); |
395 #endif | 394 #endif |
396 } | 395 } |
OLD | NEW |