Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: chrome/browser/ui/extensions/extension_installed_bubble.h

Issue 922523005: [Extensions UI] Share more code in ExtensionInstalledBubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "content/public/browser/notification_registrar.h" 11 #include "content/public/browser/notification_registrar.h"
12 #include "extensions/browser/extension_registry_observer.h" 12 #include "extensions/browser/extension_registry_observer.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
14 14
15 class Browser; 15 class Browser;
16 16
17 namespace extensions { 17 namespace extensions {
18 class Command;
18 class Extension; 19 class Extension;
19 class ExtensionRegistry; 20 class ExtensionRegistry;
20 } 21 }
21 22
22 // Provides feedback to the user upon successful installation of an 23 // Provides feedback to the user upon successful installation of an
23 // extension. Depending on the type of extension, the Bubble will 24 // extension. Depending on the type of extension, the Bubble will
24 // point to: 25 // point to:
25 // OMNIBOX_KEYWORD-> The omnibox. 26 // OMNIBOX_KEYWORD-> The omnibox.
26 // BROWSER_ACTION -> The browser action icon in the toolbar. 27 // BROWSER_ACTION -> The browser action icon in the toolbar.
27 // PAGE_ACTION -> A preview of the page action icon in the location 28 // PAGE_ACTION -> A preview of the page action icon in the location
(...skipping 29 matching lines...) Expand all
57 Browser *browser, 58 Browser *browser,
58 const SkBitmap& icon); 59 const SkBitmap& icon);
59 60
60 ~ExtensionInstalledBubble() override; 61 ~ExtensionInstalledBubble() override;
61 62
62 const extensions::Extension* extension() const { return extension_; } 63 const extensions::Extension* extension() const { return extension_; }
63 Browser* browser() { return browser_; } 64 Browser* browser() { return browser_; }
64 const Browser* browser() const { return browser_; } 65 const Browser* browser() const { return browser_; }
65 const SkBitmap& icon() const { return icon_; } 66 const SkBitmap& icon() const { return icon_; }
66 BubbleType type() const { return type_; } 67 BubbleType type() const { return type_; }
68 bool has_command_keybinding() const { return action_command_; }
67 69
68 // Stop listening to NOTIFICATION_BROWSER_CLOSING. 70 // Stop listening to NOTIFICATION_BROWSER_CLOSING.
69 void IgnoreBrowserClosing(); 71 void IgnoreBrowserClosing();
70 72
73 // Returns the string describing how to use the new extension.
74 base::string16 GetHowToUseDescription() const;
75
71 private: 76 private:
72 // Delegates showing the view to our |view_|. Called internally via PostTask. 77 // Delegates showing the view to our |view_|. Called internally via PostTask.
73 void ShowInternal(); 78 void ShowInternal();
74 79
75 // content::NotificationObserver: 80 // content::NotificationObserver:
76 void Observe(int type, 81 void Observe(int type,
77 const content::NotificationSource& source, 82 const content::NotificationSource& source,
78 const content::NotificationDetails& details) override; 83 const content::NotificationDetails& details) override;
79 84
80 // extensions::ExtensionRegistryObserver: 85 // extensions::ExtensionRegistryObserver:
81 void OnExtensionLoaded(content::BrowserContext* browser_context, 86 void OnExtensionLoaded(content::BrowserContext* browser_context,
82 const extensions::Extension* extension) override; 87 const extensions::Extension* extension) override;
83 void OnExtensionUnloaded( 88 void OnExtensionUnloaded(
84 content::BrowserContext* browser_context, 89 content::BrowserContext* browser_context,
85 const extensions::Extension* extension, 90 const extensions::Extension* extension,
86 extensions::UnloadedExtensionInfo::Reason reason) override; 91 extensions::UnloadedExtensionInfo::Reason reason) override;
87 92
88 // The view delegate that shows the bubble. Owns us. 93 // The view delegate that shows the bubble. Owns us.
89 Delegate* delegate_; 94 Delegate* delegate_;
90 95
91 // |extension_| is NULL when we are deleted. 96 // |extension_| is NULL when we are deleted.
92 const extensions::Extension* extension_; 97 const extensions::Extension* extension_;
93 Browser* browser_; 98 Browser* browser_;
94 const SkBitmap icon_; 99 const SkBitmap icon_;
95 BubbleType type_; 100 BubbleType type_;
96 content::NotificationRegistrar registrar_; 101 content::NotificationRegistrar registrar_;
97 102
103 // The command to execute the extension action, if one exists.
104 scoped_ptr<extensions::Command> action_command_;
105
98 // Listen to extension load, unloaded notifications. 106 // Listen to extension load, unloaded notifications.
99 ScopedObserver<extensions::ExtensionRegistry, 107 ScopedObserver<extensions::ExtensionRegistry,
100 extensions::ExtensionRegistryObserver> 108 extensions::ExtensionRegistryObserver>
101 extension_registry_observer_; 109 extension_registry_observer_;
102 110
103 // The number of times to retry showing the bubble if the browser action 111 // The number of times to retry showing the bubble if the browser action
104 // toolbar is animating. 112 // toolbar is animating.
105 int animation_wait_retries_; 113 int animation_wait_retries_;
106 114
107 base::WeakPtrFactory<ExtensionInstalledBubble> weak_factory_; 115 base::WeakPtrFactory<ExtensionInstalledBubble> weak_factory_;
108 116
109 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubble); 117 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubble);
110 }; 118 };
111 119
112 #endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ 120 #endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698