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

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

Issue 11440004: Remove deprecated extension EventRouter APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile Created 8 years 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/extensions/api/idle/idle_api_constants.h" 10 #include "chrome/browser/extensions/api/idle/idle_api_constants.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 : profile_(profile) { 42 : profile_(profile) {
43 } 43 }
44 44
45 DefaultEventDelegate::~DefaultEventDelegate() { 45 DefaultEventDelegate::~DefaultEventDelegate() {
46 } 46 }
47 47
48 void DefaultEventDelegate::OnStateChanged(const std::string& extension_id, 48 void DefaultEventDelegate::OnStateChanged(const std::string& extension_id,
49 IdleState new_state) { 49 IdleState new_state) {
50 scoped_ptr<ListValue> args(new ListValue()); 50 scoped_ptr<ListValue> args(new ListValue());
51 args->Append(IdleManager::CreateIdleValue(new_state)); 51 args->Append(IdleManager::CreateIdleValue(new_state));
52 scoped_ptr<Event> event(new Event(keys::kOnStateChanged, args.Pass()));
53 event->restrict_to_profile = profile_;
52 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension( 54 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension(
53 extension_id, keys::kOnStateChanged, args.Pass(), profile_, GURL()); 55 extension_id, event.Pass());
54 } 56 }
55 57
56 void DefaultEventDelegate::RegisterObserver( 58 void DefaultEventDelegate::RegisterObserver(
57 EventRouter::Observer* observer) { 59 EventRouter::Observer* observer) {
58 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( 60 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
59 observer, idle_api_constants::kOnStateChanged); 61 observer, idle_api_constants::kOnStateChanged);
60 } 62 }
61 63
62 void DefaultEventDelegate::UnregisterObserver(EventRouter::Observer* observer) { 64 void DefaultEventDelegate::UnregisterObserver(EventRouter::Observer* observer) {
63 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(observer); 65 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(observer);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 event_delegate_->OnStateChanged(it->first, new_state); 270 event_delegate_->OnStateChanged(it->first, new_state);
269 } 271 }
270 } 272 }
271 273
272 if (listener_count == 0) { 274 if (listener_count == 0) {
273 StopPolling(); 275 StopPolling();
274 } 276 }
275 } 277 }
276 278
277 } // namespace extensions 279 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api.cc ('k') | chrome/browser/extensions/api/input_ime/input_ime_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698