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

Side by Side Diff: chrome/browser/plugins/plugin_observer.cc

Issue 10917189: Remove PluginFinder async interface (Closed) Base URL: http://git.chromium.org/chromium/src.git@separate_finder_thread_safety
Patch Set: .. Created 8 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
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/plugins/plugin_observer.h" 5 #include "chrome/browser/plugins/plugin_observer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 infobar_helper->AddInfoBar( 222 infobar_helper->AddInfoBar(
223 new UnauthorizedPluginInfoBarDelegate( 223 new UnauthorizedPluginInfoBarDelegate(
224 infobar_helper, 224 infobar_helper,
225 tab_contents_->profile()->GetHostContentSettingsMap(), 225 tab_contents_->profile()->GetHostContentSettingsMap(),
226 name, identifier)); 226 name, identifier));
227 } 227 }
228 228
229 void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id, 229 void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id,
230 const std::string& identifier) { 230 const std::string& identifier) {
231 #if defined(ENABLE_PLUGIN_INSTALLATION) 231 #if defined(ENABLE_PLUGIN_INSTALLATION)
232 PluginFinder::Get(base::Bind(&PluginObserver::FindPluginToUpdate, 232 // Find plugin to update.
233 weak_ptr_factory_.GetWeakPtr(),
234 placeholder_id, identifier));
235 #else
236 // If we don't support third-party plug-in installation, we shouldn't have
237 // outdated plug-ins.
238 NOTREACHED();
239 #endif // defined(ENABLE_PLUGIN_INSTALLATION)
240 }
241
242 #if defined(ENABLE_PLUGIN_INSTALLATION)
243 void PluginObserver::FindPluginToUpdate(int placeholder_id,
244 const std::string& identifier,
245 PluginFinder* plugin_finder) {
246 PluginInstaller* installer = 233 PluginInstaller* installer =
247 plugin_finder->FindPluginWithIdentifier(identifier); 234 PluginFinder::GetInstance()->FindPluginWithIdentifier(identifier);
248 DCHECK(installer) << "Couldn't find PluginInstaller for identifier " 235 DCHECK(installer) << "Couldn't find PluginInstaller for identifier "
249 << identifier; 236 << identifier;
250 plugin_placeholders_[placeholder_id] = 237 plugin_placeholders_[placeholder_id] =
251 new PluginPlaceholderHost(this, placeholder_id, installer); 238 new PluginPlaceholderHost(this, placeholder_id, installer);
252 InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper(); 239 InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper();
253 infobar_helper->AddInfoBar( 240 infobar_helper->AddInfoBar(
254 OutdatedPluginInfoBarDelegate::Create(this, installer)); 241 OutdatedPluginInfoBarDelegate::Create(this, installer));
242 #else
243 // If we don't support third-party plug-in installation, we shouldn't have
244 // outdated plug-ins.
245 NOTREACHED();
246 #endif // defined(ENABLE_PLUGIN_INSTALLATION)
255 } 247 }
256 248
249 #if defined(ENABLE_PLUGIN_INSTALLATION)
257 void PluginObserver::OnFindMissingPlugin(int placeholder_id, 250 void PluginObserver::OnFindMissingPlugin(int placeholder_id,
258 const std::string& mime_type) { 251 const std::string& mime_type) {
259 PluginFinder::Get(base::Bind(&PluginObserver::FindMissingPlugin,
260 weak_ptr_factory_.GetWeakPtr(),
261 placeholder_id, mime_type));
262 }
263
264 void PluginObserver::FindMissingPlugin(int placeholder_id,
265 const std::string& mime_type,
266 PluginFinder* plugin_finder) {
267 std::string lang = "en-US"; // Oh yes. 252 std::string lang = "en-US"; // Oh yes.
268 PluginInstaller* installer = plugin_finder->FindPlugin(mime_type, lang); 253 PluginInstaller* installer =
254 PluginFinder::GetInstance()->FindPlugin(mime_type, lang);
269 if (!installer) { 255 if (!installer) {
270 Send(new ChromeViewMsg_DidNotFindMissingPlugin(placeholder_id)); 256 Send(new ChromeViewMsg_DidNotFindMissingPlugin(placeholder_id));
271 return; 257 return;
272 } 258 }
273 259
274 plugin_placeholders_[placeholder_id] = 260 plugin_placeholders_[placeholder_id] =
275 new PluginPlaceholderHost(this, placeholder_id, installer); 261 new PluginPlaceholderHost(this, placeholder_id, installer);
276 InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper(); 262 InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper();
277 InfoBarDelegate* delegate; 263 InfoBarDelegate* delegate;
278 #if !defined(OS_WIN) 264 #if !defined(OS_WIN)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper(); 315 InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper();
330 infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( 316 infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate(
331 infobar_helper, 317 infobar_helper,
332 &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 318 &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
333 IDR_INFOBAR_PLUGIN_CRASHED), 319 IDR_INFOBAR_PLUGIN_CRASHED),
334 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, 320 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT,
335 plugin_name), 321 plugin_name),
336 true /* auto_expire */)); 322 true /* auto_expire */));
337 } 323 }
338 324
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698