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

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

Issue 376014: Reland Extension Installed InfoBubble (Closed)
Patch Set: Created 11 years, 1 month 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
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
6 #define CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
7
8 #include "base/ref_counted.h"
9 #include "chrome/browser/views/info_bubble.h"
10 #include "chrome/common/notification_observer.h"
11 #include "chrome/common/notification_registrar.h"
12 #include "third_party/skia/include/core/SkBitmap.h"
13
14 class Browser;
15 class Extension;
16 class SkBitmap;
17
18 // Provides feedback to the user upon successful installation of an
19 // extension. Depending on the type of extension, the InfoBubble will
20 // point to:
21 // BROWSER_ACTION -> The browserAction icon in the toolbar.
22 // PAGE_ACTION -> A preview of the pageAction icon in the location
23 // bar which is shown while the InfoBubble is shown.
24 // GENERIC -> The wrench menu. This case includes pageActions that
25 // don't specify a default icon.
26 //
27 // ExtensionInstallBubble manages its own lifetime.
28 class ExtensionInstalledBubble :
29 public InfoBubbleDelegate,
30 public NotificationObserver,
31 public base::RefCountedThreadSafe<ExtensionInstalledBubble> {
32 public:
33 // The behavior and content of this InfoBubble comes in three varieties.
34 enum BubbleType {
35 BROWSER_ACTION,
36 PAGE_ACTION,
37 GENERIC
38 };
39
40 // Creates the ExtensionInstalledBubble and schedules it to be shown once
41 // the extension has loaded. |extension| is the installed extension. |browser|
42 // is the browser window which will host the bubble. |icon| is the install
43 // icon of the extension.
44 static void Show(Extension *extension, Browser *browser, SkBitmap icon);
45
46 private:
47 friend class base::RefCountedThreadSafe<ExtensionInstalledBubble>;
48
49 // Private ctor. Registers a listener for EXTENSION_LOADED.
50 ExtensionInstalledBubble(Extension *extension, Browser *browser,
51 SkBitmap icon);
52
53 ~ExtensionInstalledBubble() {}
54
55 // Shows the bubble. Called internally via PostTask.
56 void ShowInternal();
57
58 // NotificationObserver
59 virtual void Observe(NotificationType type,
60 const NotificationSource& source,
61 const NotificationDetails& details);
62
63 // InfoBubbleDelegate
64 virtual void InfoBubbleClosing(InfoBubble* info_bubble,
65 bool closed_by_escape);
66 virtual bool CloseOnEscape() { return true; }
67
68 // Arrow subjects appear on the right side (for RTL), so do not prefer
69 // origin side anchor.
70 virtual bool PreferOriginSideAnchor() { return false; }
71
72 Extension *extension_;
73 Browser *browser_;
74 SkBitmap icon_;
75 NotificationRegistrar registrar_;
76 BubbleType type_;
77
78 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubble);
79 };
80
81 #endif // CHROME_BROWSER_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/browser_actions_container.cc ('k') | chrome/browser/views/extensions/extension_installed_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698