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

Side by Side Diff: chrome/browser/plugin_data_remover_helper.cc

Issue 8071013: Finish moving plugin probing out of process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 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 | « chrome/browser/plugin_data_remover.cc ('k') | chrome/browser/plugin_prefs.cc » ('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) 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/plugin_data_remover_helper.h" 5 #include "chrome/browser/plugin_data_remover_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h"
10 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/plugin_data_remover.h" 12 #include "chrome/browser/plugin_data_remover.h"
12 #include "chrome/browser/plugin_prefs.h" 13 #include "chrome/browser/plugin_prefs.h"
13 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
16 #include "content/browser/browser_thread.h" 17 #include "content/browser/browser_thread.h"
18 #include "content/browser/plugin_service.h"
17 #include "content/common/notification_service.h" 19 #include "content/common/notification_service.h"
18 20
19 // The internal class is refcounted so it can outlive PluginDataRemoverHelper. 21 // The internal class is refcounted so it can outlive PluginDataRemoverHelper.
22 // TODO(bauerb): Replace with a WeakPtrFactory now that plugin callbacks run on
23 // the UI thread.
20 class PluginDataRemoverHelper::Internal 24 class PluginDataRemoverHelper::Internal
21 : public base::RefCountedThreadSafe<PluginDataRemoverHelper::Internal> { 25 : public base::RefCountedThreadSafe<PluginDataRemoverHelper::Internal> {
22 public: 26 public:
23 Internal(const char* pref_name, Profile* profile) 27 Internal(const char* pref_name, Profile* profile)
24 : pref_name_(pref_name), profile_(profile) {} 28 : pref_name_(pref_name), profile_(profile) {}
25 29
26 void StartUpdate() { 30 void StartUpdate() {
27 BrowserThread::PostTask( 31 PluginService::GetInstance()->GetPlugins(
28 BrowserThread::FILE, 32 base::Bind(&PluginDataRemoverHelper::Internal::GotPlugins, this,
29 FROM_HERE, 33 make_scoped_refptr(PluginPrefs::GetForProfile(profile_))));
30 base::Bind(&PluginDataRemoverHelper::Internal::UpdateOnFileThread,
31 this,
32 make_scoped_refptr(PluginPrefs::GetForProfile(profile_))));
33 } 34 }
34 35
35 void Invalidate() { 36 void Invalidate() {
36 profile_ = NULL; 37 profile_ = NULL;
37 } 38 }
38 39
39 private: 40 private:
40 friend class base::RefCountedThreadSafe<Internal>; 41 friend class base::RefCountedThreadSafe<Internal>;
41 42
42 ~Internal() {} 43 ~Internal() {}
43 44
44 void UpdateOnFileThread(scoped_refptr<PluginPrefs> plugin_prefs) { 45 void GotPlugins(scoped_refptr<PluginPrefs> plugin_prefs,
45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 46 const std::vector<webkit::WebPluginInfo>& plugins) {
46 bool result = PluginDataRemover::IsSupported(plugin_prefs); 47 bool result = PluginDataRemover::IsSupported(plugin_prefs);
47 BrowserThread::PostTask( 48 BrowserThread::PostTask(
48 BrowserThread::UI, 49 BrowserThread::UI,
49 FROM_HERE, 50 FROM_HERE,
50 base::Bind(&PluginDataRemoverHelper::Internal::SetPrefOnUIThread, 51 base::Bind(&PluginDataRemoverHelper::Internal::SetPrefOnUIThread,
51 this, 52 this,
52 result)); 53 result));
53 } 54 }
54 55
55 void SetPrefOnUIThread(bool value) { 56 void SetPrefOnUIThread(bool value) {
(...skipping 29 matching lines...) Expand all
85 86
86 void PluginDataRemoverHelper::Observe(int type, 87 void PluginDataRemoverHelper::Observe(int type,
87 const NotificationSource& source, 88 const NotificationSource& source,
88 const NotificationDetails& details) { 89 const NotificationDetails& details) {
89 if (type == chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED) { 90 if (type == chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED) {
90 internal_->StartUpdate(); 91 internal_->StartUpdate();
91 } else { 92 } else {
92 NOTREACHED(); 93 NOTREACHED();
93 } 94 }
94 } 95 }
OLDNEW
« no previous file with comments | « chrome/browser/plugin_data_remover.cc ('k') | chrome/browser/plugin_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698