| OLD | NEW |
| 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/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 15 matching lines...) Expand all Loading... |
| 26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 27 #include "chrome/browser/component_updater/component_updater_service.h" | 27 #include "chrome/browser/component_updater/component_updater_service.h" |
| 28 #include "chrome/browser/component_updater/ppapi_utils.h" | 28 #include "chrome/browser/component_updater/ppapi_utils.h" |
| 29 #include "chrome/browser/plugins/plugin_prefs.h" | 29 #include "chrome/browser/plugins/plugin_prefs.h" |
| 30 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 31 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
| 32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/pepper_flash.h" | 33 #include "chrome/common/pepper_flash.h" |
| 34 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| 35 #include "content/public/browser/plugin_service.h" | 35 #include "content/public/browser/plugin_service.h" |
| 36 #include "content/public/common/content_constants.h" |
| 36 #include "content/public/common/pepper_plugin_info.h" | 37 #include "content/public/common/pepper_plugin_info.h" |
| 37 #include "ppapi/c/private/ppb_pdf.h" | 38 #include "ppapi/c/private/ppb_pdf.h" |
| 38 #include "ppapi/shared_impl/ppapi_permissions.h" | 39 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 39 #include "webkit/plugins/plugin_constants.h" | |
| 40 | 40 |
| 41 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. | 41 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 42 | 42 |
| 43 using content::BrowserThread; | 43 using content::BrowserThread; |
| 44 using content::PluginService; | 44 using content::PluginService; |
| 45 | 45 |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 // CRX hash. The extension id is: mimojjlkmoijpicakmndhoigimigcmbb. | 48 // CRX hash. The extension id is: mimojjlkmoijpicakmndhoigimigcmbb. |
| 49 const uint8 kSha2Hash[] = {0xc8, 0xce, 0x99, 0xba, 0xce, 0x89, 0xf8, 0x20, | 49 const uint8 kSha2Hash[] = {0xc8, 0xce, 0x99, 0xba, 0xce, 0x89, 0xf8, 0x20, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 content::PepperPluginInfo* plugin_info) { | 140 content::PepperPluginInfo* plugin_info) { |
| 141 if (!flash_version.IsValid()) | 141 if (!flash_version.IsValid()) |
| 142 return false; | 142 return false; |
| 143 const std::vector<uint16> ver_nums = flash_version.components(); | 143 const std::vector<uint16> ver_nums = flash_version.components(); |
| 144 if (ver_nums.size() < 3) | 144 if (ver_nums.size() < 3) |
| 145 return false; | 145 return false; |
| 146 | 146 |
| 147 plugin_info->is_internal = false; | 147 plugin_info->is_internal = false; |
| 148 plugin_info->is_out_of_process = out_of_process; | 148 plugin_info->is_out_of_process = out_of_process; |
| 149 plugin_info->path = flash_path; | 149 plugin_info->path = flash_path; |
| 150 plugin_info->name = kFlashPluginName; | 150 plugin_info->name = content::kFlashPluginName; |
| 151 plugin_info->permissions = kPepperFlashPermissions; | 151 plugin_info->permissions = kPepperFlashPermissions; |
| 152 | 152 |
| 153 // The description is like "Shockwave Flash 10.2 r154". | 153 // The description is like "Shockwave Flash 10.2 r154". |
| 154 plugin_info->description = base::StringPrintf("%s %d.%d r%d", | 154 plugin_info->description = base::StringPrintf("%s %d.%d r%d", |
| 155 kFlashPluginName, ver_nums[0], ver_nums[1], ver_nums[2]); | 155 content::kFlashPluginName, ver_nums[0], ver_nums[1], ver_nums[2]); |
| 156 | 156 |
| 157 plugin_info->version = flash_version.GetString(); | 157 plugin_info->version = flash_version.GetString(); |
| 158 | 158 |
| 159 content::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType, | 159 content::WebPluginMimeType swf_mime_type(content::kFlashPluginSwfMimeType, |
| 160 kFlashPluginSwfExtension, | 160 content::kFlashPluginSwfExtension, |
| 161 kFlashPluginName); | 161 content::kFlashPluginName); |
| 162 plugin_info->mime_types.push_back(swf_mime_type); | 162 plugin_info->mime_types.push_back(swf_mime_type); |
| 163 content::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType, | 163 content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType, |
| 164 kFlashPluginSplExtension, | 164 content::kFlashPluginSplExtension, |
| 165 kFlashPluginName); | 165 content::kFlashPluginName); |
| 166 plugin_info->mime_types.push_back(spl_mime_type); | 166 plugin_info->mime_types.push_back(spl_mime_type); |
| 167 return true; | 167 return true; |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool IsPepperFlash(const content::WebPluginInfo& plugin) { | 170 bool IsPepperFlash(const content::WebPluginInfo& plugin) { |
| 171 // We try to recognize Pepper Flash by the following criteria: | 171 // We try to recognize Pepper Flash by the following criteria: |
| 172 // * It is a Pepper plug-in. | 172 // * It is a Pepper plug-in. |
| 173 // * It has the special Flash permissions. | 173 // * It has the special Flash permissions. |
| 174 return plugin.is_pepper_plugin() && | 174 return plugin.is_pepper_plugin() && |
| 175 (plugin.pepper_permissions & ppapi::PERMISSION_FLASH); | 175 (plugin.pepper_permissions & ppapi::PERMISSION_FLASH); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) | 397 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) |
| 398 // Component updated flash supersedes bundled flash therefore if that one | 398 // Component updated flash supersedes bundled flash therefore if that one |
| 399 // is disabled then this one should never install. | 399 // is disabled then this one should never install. |
| 400 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 400 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 401 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) | 401 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) |
| 402 return; | 402 return; |
| 403 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 403 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 404 base::Bind(&StartPepperFlashUpdateRegistration, cus)); | 404 base::Bind(&StartPepperFlashUpdateRegistration, cus)); |
| 405 #endif | 405 #endif |
| 406 } | 406 } |
| OLD | NEW |