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

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: indent 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 "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/component_updater/component_updater_service.h" 16 #include "chrome/browser/component_updater/component_updater_service.h"
17 #include "chrome/browser/plugin_prefs.h"
17 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
18 #include "content/browser/browser_thread.h" 19 #include "content/browser/browser_thread.h"
19 #include "content/common/pepper_plugin_registry.h" 20 #include "content/common/pepper_plugin_registry.h"
20 #include "webkit/plugins/npapi/plugin_list.h" 21 #include "webkit/plugins/npapi/plugin_list.h"
21 #include "webkit/plugins/plugin_constants.h" 22 #include "webkit/plugins/plugin_constants.h"
22 #include "webkit/plugins/ppapi/plugin_module.h" 23 #include "webkit/plugins/ppapi/plugin_module.h"
23 24
24 namespace { 25 namespace {
25 26
26 // CRX hash. The extension id is: mimojjlkmoijpicakmndhoigimigcmbb. 27 // CRX hash. The extension id is: mimojjlkmoijpicakmndhoigimigcmbb.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 static webkit::ppapi::PluginModule::GetInterfaceFunc get_itf = 94 static webkit::ppapi::PluginModule::GetInterfaceFunc get_itf =
94 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(); 95 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc();
95 return get_itf(interface_name) != NULL; 96 return get_itf(interface_name) != NULL;
96 } 97 }
97 98
98 } // namespace 99 } // namespace
99 100
100 bool MakePepperFlashPluginInfo(const FilePath& flash_path, 101 bool MakePepperFlashPluginInfo(const FilePath& flash_path,
101 const Version& flash_version, 102 const Version& flash_version,
102 bool out_of_process, 103 bool out_of_process,
103 bool enabled,
104 PepperPluginInfo* plugin_info) { 104 PepperPluginInfo* plugin_info) {
105 if (!flash_version.IsValid()) 105 if (!flash_version.IsValid())
106 return false; 106 return false;
107 const std::vector<uint16> ver_nums = flash_version.components(); 107 const std::vector<uint16> ver_nums = flash_version.components();
108 if (ver_nums.size() < 3) 108 if (ver_nums.size() < 3)
109 return false; 109 return false;
110 110
111 plugin_info->is_internal = false; 111 plugin_info->is_internal = false;
112 plugin_info->is_out_of_process = out_of_process; 112 plugin_info->is_out_of_process = out_of_process;
113 plugin_info->path = flash_path; 113 plugin_info->path = flash_path;
114 plugin_info->name = kFlashPluginName; 114 plugin_info->name = kFlashPluginName;
115 plugin_info->enabled = enabled;
116 115
117 // The description is like "Shockwave Flash 10.2 r154". 116 // The description is like "Shockwave Flash 10.2 r154".
118 plugin_info->description = StringPrintf("%s %d.%d r%d", 117 plugin_info->description = StringPrintf("%s %d.%d r%d",
119 kFlashPluginName, ver_nums[0], ver_nums[1], ver_nums[2]); 118 kFlashPluginName, ver_nums[0], ver_nums[1], ver_nums[2]);
120 119
121 plugin_info->version = flash_version.GetString(); 120 plugin_info->version = flash_version.GetString();
122 121
123 webkit::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType, 122 webkit::WebPluginMimeType swf_mime_type(kFlashPluginSwfMimeType,
124 kFlashPluginSwfExtension, 123 kFlashPluginSwfExtension,
125 kFlashPluginName); 124 kFlashPluginName);
126 plugin_info->mime_types.push_back(swf_mime_type); 125 plugin_info->mime_types.push_back(swf_mime_type);
127 webkit::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType, 126 webkit::WebPluginMimeType spl_mime_type(kFlashPluginSplMimeType,
128 kFlashPluginSplExtension, 127 kFlashPluginSplExtension,
129 kFlashPluginName); 128 kFlashPluginName);
130 plugin_info->mime_types.push_back(spl_mime_type); 129 plugin_info->mime_types.push_back(spl_mime_type);
131 return true; 130 return true;
132 } 131 }
133 132
134 void RegisterPepperFlashWithChrome(const FilePath& path, 133 void RegisterPepperFlashWithChrome(const FilePath& path,
135 const Version& version) { 134 const Version& version) {
136 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
137 PepperPluginInfo plugin_info; 136 PepperPluginInfo plugin_info;
138 // Register it as out-of-process and disabled. 137 // Register it as out-of-process and disabled.
139 if (!MakePepperFlashPluginInfo(path, version, true, false, &plugin_info)) 138 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info))
140 return; 139 return;
140 PluginPrefs::EnablePluginDefault(false, plugin_info.path);
141 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( 141 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(
142 plugin_info.ToWebPluginInfo()); 142 plugin_info.ToWebPluginInfo());
143 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); 143 webkit::npapi::PluginList::Singleton()->RefreshPlugins();
144 } 144 }
145 145
146 class PepperFlashComponentInstaller : public ComponentInstaller { 146 class PepperFlashComponentInstaller : public ComponentInstaller {
147 public: 147 public:
148 explicit PepperFlashComponentInstaller(const Version& version); 148 explicit PepperFlashComponentInstaller(const Version& version);
149 149
150 virtual ~PepperFlashComponentInstaller() {} 150 virtual ~PepperFlashComponentInstaller() {}
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 NewRunnableFunction(&FinishPepperFlashUpdateRegistration, cus, version)); 250 NewRunnableFunction(&FinishPepperFlashUpdateRegistration, cus, version));
251 } 251 }
252 252
253 void RegisterPepperFlashComponent(ComponentUpdateService* cus) { 253 void RegisterPepperFlashComponent(ComponentUpdateService* cus) {
254 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) 254 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
255 // TODO(cpu): support Mac and Linux flash pepper. 255 // TODO(cpu): support Mac and Linux flash pepper.
256 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 256 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
257 NewRunnableFunction(&StartPepperFlashUpdateRegistration, cus)); 257 NewRunnableFunction(&StartPepperFlashUpdateRegistration, cus));
258 #endif 258 #endif
259 } 259 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698