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

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

Issue 8493026: Revert r108760 / reland r108744, r108753 w/ fix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename plugin list accessor to plugin_list() Created 9 years, 1 month 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/bind.h" 8 #include "base/bind.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/string_util.h" 14 #include "base/string_util.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/browser/plugin_prefs.h"
18 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
19 #include "content/browser/plugin_service.h" 19 #include "content/browser/plugin_service.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "webkit/plugins/npapi/plugin_list.h"
22 #include "webkit/plugins/webplugininfo.h" 21 #include "webkit/plugins/webplugininfo.h"
23 22
24 using content::BrowserThread; 23 using content::BrowserThread;
25 24
26 namespace { 25 namespace {
27 26
28 // CRX hash. The extension id is: immdilkhigodmjbnngapbehchmihabbg. 27 // CRX hash. The extension id is: immdilkhigodmjbnngapbehchmihabbg.
29 const uint8 sha2_hash[] = {0x8c, 0xc3, 0x8b, 0xa7, 0x86, 0xe3, 0xc9, 0x1d, 28 const uint8 sha2_hash[] = {0x8c, 0xc3, 0x8b, 0xa7, 0x86, 0xe3, 0xc9, 0x1d,
30 0xd6, 0x0f, 0x14, 0x72, 0x7c, 0x87, 0x01, 0x16, 29 0xd6, 0x0f, 0x14, 0x72, 0x7c, 0x87, 0x01, 0x16,
31 0xe2, 0x00, 0x6c, 0x98, 0xbc, 0xfb, 0x14, 0x1b, 30 0xe2, 0x00, 0x6c, 0x98, 0xbc, 0xfb, 0x14, 0x1b,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return false; 99 return false;
101 if (current_version_.CompareTo(version) >= 0) 100 if (current_version_.CompareTo(version) >= 0)
102 return false; 101 return false;
103 if (!file_util::PathExists(unpack_path.Append(kFlashPluginFileName))) 102 if (!file_util::PathExists(unpack_path.Append(kFlashPluginFileName)))
104 return false; 103 return false;
105 // Passed the basic tests. Time to install it. 104 // Passed the basic tests. Time to install it.
106 if (!file_util::Move(unpack_path, GetNPAPIFlashBaseDirectory())) 105 if (!file_util::Move(unpack_path, GetNPAPIFlashBaseDirectory()))
107 return false; 106 return false;
108 // Installation is done. Now tell the rest of chrome. 107 // Installation is done. Now tell the rest of chrome.
109 current_version_ = version; 108 current_version_ = version;
110 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); 109 PluginService::GetInstance()->RefreshPlugins();
111 return true; 110 return true;
112 } 111 }
113 112
114 void FinishFlashUpdateRegistration(ComponentUpdateService* cus, 113 void FinishFlashUpdateRegistration(ComponentUpdateService* cus,
115 const webkit::WebPluginInfo& info) { 114 const webkit::WebPluginInfo& info) {
116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
117 116
118 // todo(cpu): Add PluginPrefs code here to determine if what we update 117 // todo(cpu): Add PluginPrefs code here to determine if what we update
119 // is actually going to be used. 118 // is actually going to be used.
120 119
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // you don't see version comparison in this code. 196 // you don't see version comparison in this code.
198 // 197 //
199 // So to kick off the magic we add the updated flash path here, even though 198 // So to kick off the magic we add the updated flash path here, even though
200 // there might not be a flash player in that location. If there is and it is 199 // there might not be a flash player in that location. If there is and it is
201 // newer, it will take its place then we fire StartFlashUpdateRegistration 200 // newer, it will take its place then we fire StartFlashUpdateRegistration
202 // on the IO thread to learn which one won. Since we do it in a delayed task 201 // on the IO thread to learn which one won. Since we do it in a delayed task
203 // probably somebody (unknowingly) will pay for the file IO, so usually get 202 // probably somebody (unknowingly) will pay for the file IO, so usually get
204 // the information for free. 203 // the information for free.
205 void RegisterNPAPIFlashComponent(ComponentUpdateService* cus) { 204 void RegisterNPAPIFlashComponent(ComponentUpdateService* cus) {
206 #if !defined(OS_CHROMEOS) 205 #if !defined(OS_CHROMEOS)
207 webkit::npapi::PluginList* plugins = webkit::npapi::PluginList::Singleton();
208 FilePath path = GetNPAPIFlashBaseDirectory().Append(kFlashPluginFileName); 206 FilePath path = GetNPAPIFlashBaseDirectory().Append(kFlashPluginFileName);
209 plugins->AddExtraPluginPath(path); 207 PluginService::GetInstance()->AddExtraPluginPath(path);
210 plugins->RefreshPlugins(); 208 PluginService::GetInstance()->RefreshPlugins();
211 209
212 // Post the task to the FILE thread because IO may be done once the plugins 210 // Post the task to the FILE thread because IO may be done once the plugins
213 // are loaded. 211 // are loaded.
214 BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE, 212 BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE,
215 base::Bind(&PluginService::GetPlugins, 213 base::Bind(&PluginService::GetPlugins,
216 base::Unretained(PluginService::GetInstance()), 214 base::Unretained(PluginService::GetInstance()),
217 base::Bind(&StartFlashUpdateRegistration, cus)), 215 base::Bind(&StartFlashUpdateRegistration, cus)),
218 8000); 216 8000);
219 #endif 217 #endif
220 } 218 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698