OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/scoped_observer.h" | |
9 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
10 #include "content/public/browser/notification_observer.h" | 11 #include "extensions/browser/extension_registry_observer.h" |
11 #include "content/public/browser/notification_registrar.h" | 12 |
13 #if !BUILDFLAG(ENABLE_EXTENSIONS) | |
Peter Kasting
2017/03/30 23:35:31
Nit: I'd omit this as I'm not sure it buys much?
limasdf
2017/03/31 03:26:27
Done.
| |
14 #error "Should not be included when extensions are disabled" | |
15 #endif | |
12 | 16 |
13 class Profile; | 17 class Profile; |
14 | 18 |
19 namespace extensions { | |
20 class ExtensionRegistry; | |
21 } | |
22 | |
15 // This class manages the removal of shortcuts associated with an extension when | 23 // This class manages the removal of shortcuts associated with an extension when |
16 // that extension is unloaded. | 24 // that extension is unloaded. |
17 class ShortcutsExtensionsManager : public base::SupportsUserData::Data, | 25 class ShortcutsExtensionsManager |
18 public content::NotificationObserver { | 26 : public base::SupportsUserData::Data, |
27 public extensions::ExtensionRegistryObserver { | |
19 public: | 28 public: |
20 explicit ShortcutsExtensionsManager(Profile* profile); | 29 explicit ShortcutsExtensionsManager(Profile* profile); |
21 ~ShortcutsExtensionsManager() override; | 30 ~ShortcutsExtensionsManager() override; |
22 | 31 |
32 // extensions::ExtensionRegistryObserver: | |
33 void OnExtensionUnloaded( | |
34 content::BrowserContext* browser_context, | |
35 const extensions::Extension* extension, | |
36 extensions::UnloadedExtensionInfo::Reason reason) override; | |
37 void OnShutdown(extensions::ExtensionRegistry* registry) override; | |
38 | |
23 private: | 39 private: |
24 // content::NotificationObserver: | 40 ScopedObserver<extensions::ExtensionRegistry, |
25 void Observe(int type, | 41 extensions::ExtensionRegistryObserver> |
26 const content::NotificationSource& source, | 42 registry_observer_; |
27 const content::NotificationDetails& details) override; | |
28 | 43 |
Peter Kasting
2017/03/30 23:35:31
Nit: Blank line optional
limasdf
2017/03/31 03:26:27
Done.
| |
29 Profile* profile_; | 44 Profile* profile_; |
30 content::NotificationRegistrar notification_registrar_; | |
31 | 45 |
32 DISALLOW_COPY_AND_ASSIGN(ShortcutsExtensionsManager); | 46 DISALLOW_COPY_AND_ASSIGN(ShortcutsExtensionsManager); |
33 }; | 47 }; |
34 | 48 |
35 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ | 49 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_EXTENSIONS_MANAGER_H_ |
OLD | NEW |