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

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

Issue 11151006: Revert 161615 - Merge 161210 - Only register the newer one of {bundled, component} Pepper Flash. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1271/src/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/plugin_service_impl.h » ('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) 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
11 #include "base/base_paths.h" 11 #include "base/base_paths.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/string_split.h" 18 #include "base/string_split.h"
19 #include "base/string_util.h" 19 #include "base/string_util.h"
20 #include "base/stringprintf.h" 20 #include "base/stringprintf.h"
21 #include "base/utf_string_conversions.h"
22 #include "base/values.h" 21 #include "base/values.h"
23 #include "base/version.h" 22 #include "base/version.h"
24 #include "build/build_config.h" 23 #include "build/build_config.h"
25 #include "chrome/browser/component_updater/component_updater_service.h" 24 #include "chrome/browser/component_updater/component_updater_service.h"
26 #include "chrome/browser/plugin_prefs.h" 25 #include "chrome/browser/plugin_prefs.h"
27 #include "chrome/common/pepper_flash.h" 26 #include "chrome/common/pepper_flash.h"
28 #include "chrome/common/chrome_constants.h" 27 #include "chrome/common/chrome_constants.h"
29 #include "chrome/common/chrome_paths.h" 28 #include "chrome/common/chrome_paths.h"
30 #include "chrome/common/pepper_flash.h" 29 #include "chrome/common/pepper_flash.h"
31 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 kFlashPluginSwfExtension, 158 kFlashPluginSwfExtension,
160 kFlashPluginName); 159 kFlashPluginName);
161 plugin_info->mime_types.push_back(swf_mime_type); 160 plugin_info->mime_types.push_back(swf_mime_type);
162 webkit::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType, 161 webkit::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType,
163 kFlashPluginSplExtension, 162 kFlashPluginSplExtension,
164 kFlashPluginName); 163 kFlashPluginName);
165 plugin_info->mime_types.push_back(spl_mime_type); 164 plugin_info->mime_types.push_back(spl_mime_type);
166 return true; 165 return true;
167 } 166 }
168 167
169 bool IsPepperFlash(const webkit::WebPluginInfo& plugin) {
170 // We try to recognize Pepper Flash by the following criteria:
171 // * It is a Pepper plug-in.
172 // * It has the special Flash permissions.
173 return webkit::IsPepperPlugin(plugin) &&
174 (plugin.pepper_permissions & ppapi::PERMISSION_FLASH);
175 }
176
177 void RegisterPepperFlashWithChrome(const FilePath& path, 168 void RegisterPepperFlashWithChrome(const FilePath& path,
178 const Version& version) { 169 const Version& version) {
179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 170 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
180 content::PepperPluginInfo plugin_info; 171 content::PepperPluginInfo plugin_info;
181 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) 172 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info))
182 return; 173 return;
183
184 std::vector<webkit::WebPluginInfo> plugins;
185 PluginService::GetInstance()->GetInternalPlugins(&plugins);
186 for (std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin();
187 it != plugins.end(); ++it) {
188 if (!IsPepperFlash(*it))
189 continue;
190
191 // If the version we're trying to register is older than the existing one,
192 // don't do it.
193 if (version.IsOlderThan(UTF16ToUTF8(it->version)))
194 return;
195
196 // If the version is newer, remove the old one first.
197 PluginService::GetInstance()->UnregisterInternalPlugin(it->path);
198 break;
199 }
200
201 bool add_to_front = IsPepperFlashEnabledByDefault(); 174 bool add_to_front = IsPepperFlashEnabledByDefault();
202 PluginService::GetInstance()->RegisterInternalPlugin( 175 PluginService::GetInstance()->RegisterInternalPlugin(
203 plugin_info.ToWebPluginInfo(), add_to_front); 176 plugin_info.ToWebPluginInfo(), add_to_front);
204 PluginService::GetInstance()->RefreshPlugins(); 177 PluginService::GetInstance()->RefreshPlugins();
205 } 178 }
206 179
207 // Returns true if this browser implements one of the interfaces given in 180 // Returns true if this browser implements one of the interfaces given in
208 // |interface_string|, which is a '|'-separated string of interface names. 181 // |interface_string|, which is a '|'-separated string of interface names.
209 bool CheckPepperFlashInterfaceString(const std::string& interface_string) { 182 bool CheckPepperFlashInterfaceString(const std::string& interface_string) {
210 std::vector<std::string> interface_names; 183 std::vector<std::string> interface_names;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 } 352 }
380 353
381 } // namespace 354 } // namespace
382 355
383 void RegisterPepperFlashComponent(ComponentUpdateService* cus) { 356 void RegisterPepperFlashComponent(ComponentUpdateService* cus) {
384 #if defined(GOOGLE_CHROME_BUILD) 357 #if defined(GOOGLE_CHROME_BUILD)
385 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 358 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
386 base::Bind(&StartPepperFlashUpdateRegistration, cus)); 359 base::Bind(&StartPepperFlashUpdateRegistration, cus));
387 #endif 360 #endif
388 } 361 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/plugin_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698