OLD | NEW |
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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "chrome/browser/plugin_data_remover.h" | 10 #include "chrome/browser/plugin_data_remover.h" |
11 #include "chrome/browser/plugin_prefs.h" | 11 #include "chrome/browser/plugin_prefs.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/common/chrome_notification_types.h" |
14 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
15 #include "content/common/notification_service.h" | 16 #include "content/common/notification_service.h" |
16 | 17 |
17 // The internal class is refcounted so it can outlive PluginDataRemoverHelper. | 18 // The internal class is refcounted so it can outlive PluginDataRemoverHelper. |
18 class PluginDataRemoverHelper::Internal | 19 class PluginDataRemoverHelper::Internal |
19 : public base::RefCountedThreadSafe<PluginDataRemoverHelper::Internal> { | 20 : public base::RefCountedThreadSafe<PluginDataRemoverHelper::Internal> { |
20 public: | 21 public: |
21 Internal(const char* pref_name, Profile* profile) | 22 Internal(const char* pref_name, Profile* profile) |
22 : pref_name_(pref_name), profile_(profile) {} | 23 : pref_name_(pref_name), profile_(profile) {} |
23 | 24 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 PluginDataRemoverHelper::~PluginDataRemoverHelper() { | 70 PluginDataRemoverHelper::~PluginDataRemoverHelper() { |
70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
71 if (internal_) | 72 if (internal_) |
72 internal_->Invalidate(); | 73 internal_->Invalidate(); |
73 } | 74 } |
74 | 75 |
75 void PluginDataRemoverHelper::Init(const char* pref_name, | 76 void PluginDataRemoverHelper::Init(const char* pref_name, |
76 Profile* profile, | 77 Profile* profile, |
77 NotificationObserver* observer) { | 78 NotificationObserver* observer) { |
78 pref_.Init(pref_name, profile->GetPrefs(), observer); | 79 pref_.Init(pref_name, profile->GetPrefs(), observer); |
79 registrar_.Add(this, content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, | 80 registrar_.Add(this, chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, |
80 NotificationService::AllSources()); | 81 NotificationService::AllSources()); |
81 internal_ = make_scoped_refptr(new Internal(pref_name, profile)); | 82 internal_ = make_scoped_refptr(new Internal(pref_name, profile)); |
82 internal_->StartUpdate(); | 83 internal_->StartUpdate(); |
83 } | 84 } |
84 | 85 |
85 void PluginDataRemoverHelper::Observe(int type, | 86 void PluginDataRemoverHelper::Observe(int type, |
86 const NotificationSource& source, | 87 const NotificationSource& source, |
87 const NotificationDetails& details) { | 88 const NotificationDetails& details) { |
88 if (type == content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED) { | 89 if (type == chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED) { |
89 internal_->StartUpdate(); | 90 internal_->StartUpdate(); |
90 } else { | 91 } else { |
91 NOTREACHED(); | 92 NOTREACHED(); |
92 } | 93 } |
93 } | 94 } |
OLD | NEW |