OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/test_extension_registry_observer.h" | 5 #include "extensions/browser/test_extension_registry_observer.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "extensions/browser/extension_registry.h" | 9 #include "extensions/browser/extension_registry.h" |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 void TestExtensionRegistryObserver::OnExtensionLoaded( | 92 void TestExtensionRegistryObserver::OnExtensionLoaded( |
93 content::BrowserContext* browser_context, | 93 content::BrowserContext* browser_context, |
94 const Extension* extension) { | 94 const Extension* extension) { |
95 if (extension_id_.empty() || extension->id() == extension_id_) | 95 if (extension_id_.empty() || extension->id() == extension_id_) |
96 loaded_waiter_->OnObserved(extension); | 96 loaded_waiter_->OnObserved(extension); |
97 } | 97 } |
98 | 98 |
99 void TestExtensionRegistryObserver::OnExtensionUnloaded( | 99 void TestExtensionRegistryObserver::OnExtensionUnloaded( |
100 content::BrowserContext* browser_context, | 100 content::BrowserContext* browser_context, |
101 const Extension* extension, | 101 const Extension* extension, |
102 UnloadedExtensionInfo::Reason reason) { | 102 UnloadedExtensionReason reason) { |
103 if (extension_id_.empty() || extension->id() == extension_id_) | 103 if (extension_id_.empty() || extension->id() == extension_id_) |
104 unloaded_waiter_->OnObserved(extension); | 104 unloaded_waiter_->OnObserved(extension); |
105 } | 105 } |
106 | 106 |
107 const Extension* TestExtensionRegistryObserver::Wait( | 107 const Extension* TestExtensionRegistryObserver::Wait( |
108 std::unique_ptr<Waiter>* waiter) { | 108 std::unique_ptr<Waiter>* waiter) { |
109 waiter->get()->Wait(); | 109 waiter->get()->Wait(); |
110 const Extension* extension = waiter->get()->extension(); | 110 const Extension* extension = waiter->get()->extension(); |
111 // Reset the waiter for future uses. | 111 // Reset the waiter for future uses. |
112 // We could have a Waiter::Reset method, but it would reset every field in the | 112 // We could have a Waiter::Reset method, but it would reset every field in the |
113 // class, so let's just reset the pointer. | 113 // class, so let's just reset the pointer. |
114 waiter->reset(new Waiter()); | 114 waiter->reset(new Waiter()); |
115 return extension; | 115 return extension; |
116 } | 116 } |
117 | 117 |
118 } // namespace extensions | 118 } // namespace extensions |
OLD | NEW |