OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extension_registry.h" | 5 #include "extensions/browser/extension_registry.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 uninstalled_.clear(); | 42 uninstalled_.clear(); |
43 } | 43 } |
44 | 44 |
45 const ExtensionList& loaded() { return loaded_; } | 45 const ExtensionList& loaded() { return loaded_; } |
46 const ExtensionList& unloaded() { return unloaded_; } | 46 const ExtensionList& unloaded() { return unloaded_; } |
47 const ExtensionList& installed() { return installed_; } | 47 const ExtensionList& installed() { return installed_; } |
48 const ExtensionList& uninstalled() { return uninstalled_; } | 48 const ExtensionList& uninstalled() { return uninstalled_; } |
49 | 49 |
50 private: | 50 private: |
51 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, | 51 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, |
52 const Extension* extension) OVERRIDE { | 52 const Extension* extension) override { |
53 loaded_.push_back(extension); | 53 loaded_.push_back(extension); |
54 } | 54 } |
55 | 55 |
56 virtual void OnExtensionUnloaded(content::BrowserContext* browser_context, | 56 virtual void OnExtensionUnloaded(content::BrowserContext* browser_context, |
57 const Extension* extension, | 57 const Extension* extension, |
58 UnloadedExtensionInfo::Reason reason) | 58 UnloadedExtensionInfo::Reason reason) |
59 OVERRIDE { | 59 override { |
60 unloaded_.push_back(extension); | 60 unloaded_.push_back(extension); |
61 } | 61 } |
62 | 62 |
63 virtual void OnExtensionWillBeInstalled( | 63 virtual void OnExtensionWillBeInstalled( |
64 content::BrowserContext* browser_context, | 64 content::BrowserContext* browser_context, |
65 const Extension* extension, | 65 const Extension* extension, |
66 bool is_update, | 66 bool is_update, |
67 bool from_ephemeral, | 67 bool from_ephemeral, |
68 const std::string& old_name) OVERRIDE { | 68 const std::string& old_name) override { |
69 installed_.push_back(extension); | 69 installed_.push_back(extension); |
70 } | 70 } |
71 | 71 |
72 virtual void OnExtensionUninstalled( | 72 virtual void OnExtensionUninstalled( |
73 content::BrowserContext* browser_context, | 73 content::BrowserContext* browser_context, |
74 const Extension* extension, | 74 const Extension* extension, |
75 extensions::UninstallReason reason) OVERRIDE { | 75 extensions::UninstallReason reason) override { |
76 uninstalled_.push_back(extension); | 76 uninstalled_.push_back(extension); |
77 } | 77 } |
78 | 78 |
79 virtual void OnShutdown(extensions::ExtensionRegistry* registry) OVERRIDE { | 79 virtual void OnShutdown(extensions::ExtensionRegistry* registry) override { |
80 Reset(); | 80 Reset(); |
81 } | 81 } |
82 | 82 |
83 ExtensionList loaded_; | 83 ExtensionList loaded_; |
84 ExtensionList unloaded_; | 84 ExtensionList unloaded_; |
85 ExtensionList installed_; | 85 ExtensionList installed_; |
86 ExtensionList uninstalled_; | 86 ExtensionList uninstalled_; |
87 }; | 87 }; |
88 | 88 |
89 TEST_F(ExtensionRegistryTest, FillAndClearRegistry) { | 89 TEST_F(ExtensionRegistryTest, FillAndClearRegistry) { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 registry.TriggerOnUninstalled(extension.get(), | 270 registry.TriggerOnUninstalled(extension.get(), |
271 extensions::UNINSTALL_REASON_FOR_TESTING); | 271 extensions::UNINSTALL_REASON_FOR_TESTING); |
272 EXPECT_TRUE(observer.installed().empty()); | 272 EXPECT_TRUE(observer.installed().empty()); |
273 EXPECT_TRUE(HasSingleExtension(observer.uninstalled(), extension.get())); | 273 EXPECT_TRUE(HasSingleExtension(observer.uninstalled(), extension.get())); |
274 | 274 |
275 registry.RemoveObserver(&observer); | 275 registry.RemoveObserver(&observer); |
276 } | 276 } |
277 | 277 |
278 } // namespace | 278 } // namespace |
279 } // namespace extensions | 279 } // namespace extensions |
OLD | NEW |