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 #ifndef CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ |
6 #define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ | 6 #define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/scoped_observer.h" | 9 #include "base/scoped_observer.h" |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // if, because of animating (such as from adding a new browser action | 50 // if, because of animating (such as from adding a new browser action |
51 // to the toolbar), the bubble could not be shown immediately. | 51 // to the toolbar), the bubble could not be shown immediately. |
52 virtual bool MaybeShowNow() = 0; | 52 virtual bool MaybeShowNow() = 0; |
53 }; | 53 }; |
54 | 54 |
55 ExtensionInstalledBubble(Delegate* delegate, | 55 ExtensionInstalledBubble(Delegate* delegate, |
56 const extensions::Extension* extension, | 56 const extensions::Extension* extension, |
57 Browser *browser, | 57 Browser *browser, |
58 const SkBitmap& icon); | 58 const SkBitmap& icon); |
59 | 59 |
60 virtual ~ExtensionInstalledBubble(); | 60 ~ExtensionInstalledBubble() override; |
61 | 61 |
62 const extensions::Extension* extension() const { return extension_; } | 62 const extensions::Extension* extension() const { return extension_; } |
63 Browser* browser() { return browser_; } | 63 Browser* browser() { return browser_; } |
64 const Browser* browser() const { return browser_; } | 64 const Browser* browser() const { return browser_; } |
65 const SkBitmap& icon() const { return icon_; } | 65 const SkBitmap& icon() const { return icon_; } |
66 BubbleType type() const { return type_; } | 66 BubbleType type() const { return type_; } |
67 | 67 |
68 // Stop listening to NOTIFICATION_BROWSER_CLOSING. | 68 // Stop listening to NOTIFICATION_BROWSER_CLOSING. |
69 void IgnoreBrowserClosing(); | 69 void IgnoreBrowserClosing(); |
70 | 70 |
71 private: | 71 private: |
72 // Delegates showing the view to our |view_|. Called internally via PostTask. | 72 // Delegates showing the view to our |view_|. Called internally via PostTask. |
73 void ShowInternal(); | 73 void ShowInternal(); |
74 | 74 |
75 // content::NotificationObserver: | 75 // content::NotificationObserver: |
76 virtual void Observe(int type, | 76 void Observe(int type, |
77 const content::NotificationSource& source, | 77 const content::NotificationSource& source, |
78 const content::NotificationDetails& details) override; | 78 const content::NotificationDetails& details) override; |
79 | 79 |
80 // extensions::ExtensionRegistryObserver: | 80 // extensions::ExtensionRegistryObserver: |
81 virtual void OnExtensionLoaded( | 81 void OnExtensionLoaded(content::BrowserContext* browser_context, |
82 content::BrowserContext* browser_context, | 82 const extensions::Extension* extension) override; |
83 const extensions::Extension* extension) override; | 83 void OnExtensionUnloaded( |
84 virtual void OnExtensionUnloaded( | |
85 content::BrowserContext* browser_context, | 84 content::BrowserContext* browser_context, |
86 const extensions::Extension* extension, | 85 const extensions::Extension* extension, |
87 extensions::UnloadedExtensionInfo::Reason reason) override; | 86 extensions::UnloadedExtensionInfo::Reason reason) override; |
88 | 87 |
89 // The view delegate that shows the bubble. Owns us. | 88 // The view delegate that shows the bubble. Owns us. |
90 Delegate* delegate_; | 89 Delegate* delegate_; |
91 | 90 |
92 // |extension_| is NULL when we are deleted. | 91 // |extension_| is NULL when we are deleted. |
93 const extensions::Extension* extension_; | 92 const extensions::Extension* extension_; |
94 Browser* browser_; | 93 Browser* browser_; |
95 const SkBitmap icon_; | 94 const SkBitmap icon_; |
96 BubbleType type_; | 95 BubbleType type_; |
97 content::NotificationRegistrar registrar_; | 96 content::NotificationRegistrar registrar_; |
98 | 97 |
99 // Listen to extension load, unloaded notifications. | 98 // Listen to extension load, unloaded notifications. |
100 ScopedObserver<extensions::ExtensionRegistry, | 99 ScopedObserver<extensions::ExtensionRegistry, |
101 extensions::ExtensionRegistryObserver> | 100 extensions::ExtensionRegistryObserver> |
102 extension_registry_observer_; | 101 extension_registry_observer_; |
103 | 102 |
104 // The number of times to retry showing the bubble if the browser action | 103 // The number of times to retry showing the bubble if the browser action |
105 // toolbar is animating. | 104 // toolbar is animating. |
106 int animation_wait_retries_; | 105 int animation_wait_retries_; |
107 | 106 |
108 base::WeakPtrFactory<ExtensionInstalledBubble> weak_factory_; | 107 base::WeakPtrFactory<ExtensionInstalledBubble> weak_factory_; |
109 | 108 |
110 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubble); | 109 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubble); |
111 }; | 110 }; |
112 | 111 |
113 #endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ | 112 #endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ |
OLD | NEW |