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_api.h" | 5 #include "chrome/browser/extensions/api/idle/idle_api.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 idle_manager_->OnListenerAdded(details); | 112 idle_manager_->OnListenerAdded(details); |
113 } | 113 } |
114 | 114 |
115 ScopedListen::~ScopedListen() { | 115 ScopedListen::~ScopedListen() { |
116 const EventListenerInfo details(idle::OnStateChanged::kEventName, | 116 const EventListenerInfo details(idle::OnStateChanged::kEventName, |
117 extension_id_, | 117 extension_id_, |
118 NULL); | 118 NULL); |
119 idle_manager_->OnListenerRemoved(details); | 119 idle_manager_->OnListenerRemoved(details); |
120 } | 120 } |
121 | 121 |
122 BrowserContextKeyedService* IdleManagerTestFactory( | 122 KeyedService* IdleManagerTestFactory(content::BrowserContext* profile) { |
123 content::BrowserContext* profile) { | |
124 return new IdleManager(static_cast<Profile*>(profile)); | 123 return new IdleManager(static_cast<Profile*>(profile)); |
125 } | 124 } |
126 | 125 |
127 } // namespace | 126 } // namespace |
128 | 127 |
129 class IdleTest : public ExtensionApiUnittest { | 128 class IdleTest : public ExtensionApiUnittest { |
130 public: | 129 public: |
131 virtual void SetUp() OVERRIDE; | 130 virtual void SetUp() OVERRIDE; |
132 | 131 |
133 protected: | 132 protected: |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 ScopedListen listen(idle_manager_, extension()->id()); | 544 ScopedListen listen(idle_manager_, extension()->id()); |
546 UnloadedExtensionInfo details(extension(), | 545 UnloadedExtensionInfo details(extension(), |
547 UnloadedExtensionInfo::REASON_UNINSTALL); | 546 UnloadedExtensionInfo::REASON_UNINSTALL); |
548 idle_manager_->Observe( | 547 idle_manager_->Observe( |
549 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 548 chrome::NOTIFICATION_EXTENSION_UNLOADED, |
550 content::Source<Profile>(browser()->profile()), | 549 content::Source<Profile>(browser()->profile()), |
551 content::Details<UnloadedExtensionInfo>(&details)); | 550 content::Details<UnloadedExtensionInfo>(&details)); |
552 } | 551 } |
553 | 552 |
554 } // namespace extensions | 553 } // namespace extensions |
OLD | NEW |