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

Side by Side Diff: chrome/browser/extensions/api/idle/idle_manager.cc

Issue 204703002: Rename NOTIFICATION_EXTENSION_UNLOADED to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maybe upload wont do something bizarre this time Created 6 years, 9 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) 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/extensions/api/idle/idle_manager.h" 5 #include "chrome/browser/extensions/api/idle/idle_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 last_state_(IDLE_STATE_ACTIVE), 127 last_state_(IDLE_STATE_ACTIVE),
128 weak_factory_(this), 128 weak_factory_(this),
129 idle_time_provider_(new DefaultIdleProvider()), 129 idle_time_provider_(new DefaultIdleProvider()),
130 event_delegate_(new DefaultEventDelegate(profile)) { 130 event_delegate_(new DefaultEventDelegate(profile)) {
131 } 131 }
132 132
133 IdleManager::~IdleManager() { 133 IdleManager::~IdleManager() {
134 } 134 }
135 135
136 void IdleManager::Init() { 136 void IdleManager::Init() {
137 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 137 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
138 content::Source<Profile>(profile_->GetOriginalProfile())); 138 content::Source<Profile>(profile_->GetOriginalProfile()));
139 event_delegate_->RegisterObserver(this); 139 event_delegate_->RegisterObserver(this);
140 } 140 }
141 141
142 void IdleManager::Shutdown() { 142 void IdleManager::Shutdown() {
143 DCHECK(thread_checker_.CalledOnValidThread()); 143 DCHECK(thread_checker_.CalledOnValidThread());
144 event_delegate_->UnregisterObserver(this); 144 event_delegate_->UnregisterObserver(this);
145 } 145 }
146 146
147 void IdleManager::Observe(int type, 147 void IdleManager::Observe(int type,
148 const content::NotificationSource& source, 148 const content::NotificationSource& source,
149 const content::NotificationDetails& details) { 149 const content::NotificationDetails& details) {
150 DCHECK(thread_checker_.CalledOnValidThread()); 150 DCHECK(thread_checker_.CalledOnValidThread());
151 151
152 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { 152 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) {
153 const Extension* extension = 153 const Extension* extension =
154 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; 154 content::Details<extensions::UnloadedExtensionInfo>(details)->extension;
155 monitors_.erase(extension->id()); 155 monitors_.erase(extension->id());
156 } else { 156 } else {
157 NOTREACHED(); 157 NOTREACHED();
158 } 158 }
159 } 159 }
160 160
161 void IdleManager::OnListenerAdded(const EventListenerInfo& details) { 161 void IdleManager::OnListenerAdded(const EventListenerInfo& details) {
162 DCHECK(thread_checker_.CalledOnValidThread()); 162 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 event_delegate_->OnStateChanged(it->first, new_state); 275 event_delegate_->OnStateChanged(it->first, new_state);
276 } 276 }
277 } 277 }
278 278
279 if (listener_count == 0) { 279 if (listener_count == 0) {
280 StopPolling(); 280 StopPolling();
281 } 281 }
282 } 282 }
283 283
284 } // namespace extensions 284 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698