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

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

Issue 7848025: Store plug-in enabled/disabled state in PluginPrefs instead of WebPluginInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 9 years, 3 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/component_updater/component_updater_service.h" 18 #include "chrome/browser/component_updater/component_updater_service.h"
19 #include "chrome/browser/plugin_prefs.h"
19 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
20 #include "content/browser/browser_thread.h" 21 #include "content/browser/browser_thread.h"
21 #include "content/common/pepper_plugin_registry.h" 22 #include "content/common/pepper_plugin_registry.h"
22 #include "ppapi/c/private/ppb_pdf.h" 23 #include "ppapi/c/private/ppb_pdf.h"
23 #include "webkit/plugins/npapi/plugin_list.h" 24 #include "webkit/plugins/npapi/plugin_list.h"
24 #include "webkit/plugins/plugin_constants.h" 25 #include "webkit/plugins/plugin_constants.h"
25 #include "webkit/plugins/ppapi/plugin_module.h" 26 #include "webkit/plugins/ppapi/plugin_module.h"
26 27
27 namespace { 28 namespace {
28 29
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // It might be that flapper is using as a temporary hack the PDF interface 101 // It might be that flapper is using as a temporary hack the PDF interface
101 // so we need to check for that as well. TODO(cpu): make this more sane. 102 // so we need to check for that as well. TODO(cpu): make this more sane.
102 return (strcmp(interface_name, PPB_PDF_INTERFACE) == 0); 103 return (strcmp(interface_name, PPB_PDF_INTERFACE) == 0);
103 } 104 }
104 105
105 } // namespace 106 } // namespace
106 107
107 bool MakePepperFlashPluginInfo(const FilePath& flash_path, 108 bool MakePepperFlashPluginInfo(const FilePath& flash_path,
108 const Version& flash_version, 109 const Version& flash_version,
109 bool out_of_process, 110 bool out_of_process,
110 bool enabled,
111 PepperPluginInfo* plugin_info) { 111 PepperPluginInfo* plugin_info) {
112 if (!flash_version.IsValid()) 112 if (!flash_version.IsValid())
113 return false; 113 return false;
114 const std::vector<uint16> ver_nums = flash_version.components(); 114 const std::vector<uint16> ver_nums = flash_version.components();
115 if (ver_nums.size() < 3) 115 if (ver_nums.size() < 3)
116 return false; 116 return false;
117 117
118 plugin_info->is_internal = false; 118 plugin_info->is_internal = false;
119 plugin_info->is_out_of_process = out_of_process; 119 plugin_info->is_out_of_process = out_of_process;
120 plugin_info->path = flash_path; 120 plugin_info->path = flash_path;
121 plugin_info->name = kFlashPluginName; 121 plugin_info->name = kFlashPluginName;
122 plugin_info->enabled = enabled;
123 122
124 // The description is like "Shockwave Flash 10.2 r154". 123 // The description is like "Shockwave Flash 10.2 r154".
125 plugin_info->description = StringPrintf("%s %d.%d r%d", 124 plugin_info->description = StringPrintf("%s %d.%d r%d",
126 kFlashPluginName, ver_nums[0], ver_nums[1], ver_nums[2]); 125 kFlashPluginName, ver_nums[0], ver_nums[1], ver_nums[2]);
127 126
128 plugin_info->version = flash_version.GetString(); 127 plugin_info->version = flash_version.GetString();
129 128
130 webkit::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType, 129 webkit::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType,
131 kFlashPluginSwfExtension, 130 kFlashPluginSwfExtension,
132 kFlashPluginName); 131 kFlashPluginName);
133 plugin_info->mime_types.push_back(swf_mime_type); 132 plugin_info->mime_types.push_back(swf_mime_type);
134 webkit::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType, 133 webkit::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType,
135 kFlashPluginSplExtension, 134 kFlashPluginSplExtension,
136 kFlashPluginName); 135 kFlashPluginName);
137 plugin_info->mime_types.push_back(spl_mime_type); 136 plugin_info->mime_types.push_back(spl_mime_type);
138 return true; 137 return true;
139 } 138 }
140 139
141 void RegisterPepperFlashWithChrome(const FilePath& path, 140 void RegisterPepperFlashWithChrome(const FilePath& path,
142 const Version& version) { 141 const Version& version) {
143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
144 PepperPluginInfo plugin_info; 143 PepperPluginInfo plugin_info;
145 // Register it as out-of-process and disabled. 144 // Register it as out-of-process and disabled.
146 if (!MakePepperFlashPluginInfo(path, version, true, false, &plugin_info)) 145 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info))
147 return; 146 return;
147 PluginPrefs::EnablePluginGlobally(false, plugin_info.path);
148 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( 148 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(
149 plugin_info.ToWebPluginInfo()); 149 plugin_info.ToWebPluginInfo());
150 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); 150 webkit::npapi::PluginList::Singleton()->RefreshPlugins();
151 } 151 }
152 152
153 class PepperFlashComponentInstaller : public ComponentInstaller { 153 class PepperFlashComponentInstaller : public ComponentInstaller {
154 public: 154 public:
155 explicit PepperFlashComponentInstaller(const Version& version); 155 explicit PepperFlashComponentInstaller(const Version& version);
156 156
157 virtual ~PepperFlashComponentInstaller() {} 157 virtual ~PepperFlashComponentInstaller() {}
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 NewRunnableFunction(&FinishPepperFlashUpdateRegistration, cus, version)); 257 NewRunnableFunction(&FinishPepperFlashUpdateRegistration, cus, version));
258 } 258 }
259 259
260 void RegisterPepperFlashComponent(ComponentUpdateService* cus) { 260 void RegisterPepperFlashComponent(ComponentUpdateService* cus) {
261 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) 261 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
262 // TODO(cpu): support Mac and Linux flash pepper. 262 // TODO(cpu): support Mac and Linux flash pepper.
263 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 263 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
264 NewRunnableFunction(&StartPepperFlashUpdateRegistration, cus)); 264 NewRunnableFunction(&StartPepperFlashUpdateRegistration, cus));
265 #endif 265 #endif
266 } 266 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/pdf_unsupported_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698