| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 plugin_info->path = flash_path; | 148 plugin_info->path = flash_path; |
| 149 plugin_info->name = kFlashPluginName; | 149 plugin_info->name = kFlashPluginName; |
| 150 plugin_info->permissions = kPepperFlashPermissions; | 150 plugin_info->permissions = kPepperFlashPermissions; |
| 151 | 151 |
| 152 // The description is like "Shockwave Flash 10.2 r154". | 152 // The description is like "Shockwave Flash 10.2 r154". |
| 153 plugin_info->description = base::StringPrintf("%s %d.%d r%d", | 153 plugin_info->description = base::StringPrintf("%s %d.%d r%d", |
| 154 kFlashPluginName, ver_nums[0], ver_nums[1], ver_nums[2]); | 154 kFlashPluginName, ver_nums[0], ver_nums[1], ver_nums[2]); |
| 155 | 155 |
| 156 plugin_info->version = flash_version.GetString(); | 156 plugin_info->version = flash_version.GetString(); |
| 157 | 157 |
| 158 webkit::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType, | 158 content::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType, |
| 159 kFlashPluginSwfExtension, | 159 kFlashPluginSwfExtension, |
| 160 kFlashPluginName); | 160 kFlashPluginName); |
| 161 plugin_info->mime_types.push_back(swf_mime_type); | 161 plugin_info->mime_types.push_back(swf_mime_type); |
| 162 webkit::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType, | 162 content::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType, |
| 163 kFlashPluginSplExtension, | 163 kFlashPluginSplExtension, |
| 164 kFlashPluginName); | 164 kFlashPluginName); |
| 165 plugin_info->mime_types.push_back(spl_mime_type); | 165 plugin_info->mime_types.push_back(spl_mime_type); |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| 168 | 168 |
| 169 bool IsPepperFlash(const webkit::WebPluginInfo& plugin) { | 169 bool IsPepperFlash(const content::WebPluginInfo& plugin) { |
| 170 // We try to recognize Pepper Flash by the following criteria: | 170 // We try to recognize Pepper Flash by the following criteria: |
| 171 // * It is a Pepper plug-in. | 171 // * It is a Pepper plug-in. |
| 172 // * It has the special Flash permissions. | 172 // * It has the special Flash permissions. |
| 173 return plugin.is_pepper_plugin() && | 173 return plugin.is_pepper_plugin() && |
| 174 (plugin.pepper_permissions & ppapi::PERMISSION_FLASH); | 174 (plugin.pepper_permissions & ppapi::PERMISSION_FLASH); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void RegisterPepperFlashWithChrome(const base::FilePath& path, | 177 void RegisterPepperFlashWithChrome(const base::FilePath& path, |
| 178 const Version& version) { | 178 const Version& version) { |
| 179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 180 content::PepperPluginInfo plugin_info; | 180 content::PepperPluginInfo plugin_info; |
| 181 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) | 181 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) |
| 182 return; | 182 return; |
| 183 | 183 |
| 184 std::vector<webkit::WebPluginInfo> plugins; | 184 std::vector<content::WebPluginInfo> plugins; |
| 185 PluginService::GetInstance()->GetInternalPlugins(&plugins); | 185 PluginService::GetInstance()->GetInternalPlugins(&plugins); |
| 186 for (std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin(); | 186 for (std::vector<content::WebPluginInfo>::const_iterator it = plugins.begin(); |
| 187 it != plugins.end(); ++it) { | 187 it != plugins.end(); ++it) { |
| 188 if (!IsPepperFlash(*it)) | 188 if (!IsPepperFlash(*it)) |
| 189 continue; | 189 continue; |
| 190 | 190 |
| 191 // Do it only if the version we're trying to register is newer. | 191 // Do it only if the version we're trying to register is newer. |
| 192 Version registered_version(UTF16ToUTF8(it->version)); | 192 Version registered_version(UTF16ToUTF8(it->version)); |
| 193 if (registered_version.IsValid() && | 193 if (registered_version.IsValid() && |
| 194 version.CompareTo(registered_version) <= 0) { | 194 version.CompareTo(registered_version) <= 0) { |
| 195 return; | 195 return; |
| 196 } | 196 } |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) | 396 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX) |
| 397 // Component updated flash supersedes bundled flash therefore if that one | 397 // Component updated flash supersedes bundled flash therefore if that one |
| 398 // is disabled then this one should never install. | 398 // is disabled then this one should never install. |
| 399 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 399 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 400 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) | 400 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) |
| 401 return; | 401 return; |
| 402 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 402 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 403 base::Bind(&StartPepperFlashUpdateRegistration, cus)); | 403 base::Bind(&StartPepperFlashUpdateRegistration, cus)); |
| 404 #endif | 404 #endif |
| 405 } | 405 } |
| OLD | NEW |