OLD | NEW |
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 Loading... |
42 | 42 |
43 DefaultEventDelegate::DefaultEventDelegate(Profile* profile) | 43 DefaultEventDelegate::DefaultEventDelegate(Profile* profile) |
44 : profile_(profile) { | 44 : profile_(profile) { |
45 } | 45 } |
46 | 46 |
47 DefaultEventDelegate::~DefaultEventDelegate() { | 47 DefaultEventDelegate::~DefaultEventDelegate() { |
48 } | 48 } |
49 | 49 |
50 void DefaultEventDelegate::OnStateChanged(const std::string& extension_id, | 50 void DefaultEventDelegate::OnStateChanged(const std::string& extension_id, |
51 IdleState new_state) { | 51 IdleState new_state) { |
52 scoped_ptr<ListValue> args(new ListValue()); | 52 scoped_ptr<base::ListValue> args(new base::ListValue()); |
53 args->Append(IdleManager::CreateIdleValue(new_state)); | 53 args->Append(IdleManager::CreateIdleValue(new_state)); |
54 scoped_ptr<Event> event(new Event(keys::kOnStateChanged, args.Pass())); | 54 scoped_ptr<Event> event(new Event(keys::kOnStateChanged, args.Pass())); |
55 event->restrict_to_profile = profile_; | 55 event->restrict_to_profile = profile_; |
56 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension( | 56 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension( |
57 extension_id, event.Pass()); | 57 extension_id, event.Pass()); |
58 } | 58 } |
59 | 59 |
60 void DefaultEventDelegate::RegisterObserver( | 60 void DefaultEventDelegate::RegisterObserver( |
61 EventRouter::Observer* observer) { | 61 EventRouter::Observer* observer) { |
62 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( | 62 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 event_delegate_->OnStateChanged(it->first, new_state); | 272 event_delegate_->OnStateChanged(it->first, new_state); |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 if (listener_count == 0) { | 276 if (listener_count == 0) { |
277 StopPolling(); | 277 StopPolling(); |
278 } | 278 } |
279 } | 279 } |
280 | 280 |
281 } // namespace extensions | 281 } // namespace extensions |
OLD | NEW |