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

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

Issue 8590047: Rebase ExtensionInstalledBubble on the new views bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase ExtensionInstalledBubble on the new views bubble. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "chrome/browser/ui/views/bubble/bubble.h"
11 #include "content/public/browser/notification_observer.h" 10 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 11 #include "content/public/browser/notification_registrar.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "views/bubble/bubble_delegate.h"
14 14
15 class Browser; 15 class Browser;
16 class Extension; 16 class Extension;
17 class InstalledBubbleContent; 17 class InstalledBubbleContent;
18 class SkBitmap; 18 class SkBitmap;
alicet1 2011/11/18 01:00:54 can remove this or the include above?
msw 2011/11/18 01:15:29 Done.
19 19
20 // Provides feedback to the user upon successful installation of an 20 // Provides feedback to the user upon successful installation of an
21 // extension. Depending on the type of extension, the Bubble will 21 // extension. Depending on the type of extension, the Bubble will
22 // point to: 22 // point to:
23 // OMNIBOX_KEYWORD-> The omnibox. 23 // OMNIBOX_KEYWORD-> The omnibox.
24 // BROWSER_ACTION -> The browserAction icon in the toolbar. 24 // BROWSER_ACTION -> The browserAction icon in the toolbar.
25 // PAGE_ACTION -> A preview of the pageAction icon in the location 25 // PAGE_ACTION -> A preview of the pageAction icon in the location
26 // bar which is shown while the Bubble is shown. 26 // bar which is shown while the Bubble is shown.
27 // APP -> The plus button in the tabstrip (for the New Tab Page). 27 // APP -> The plus button in the tabstrip (for the New Tab Page).
28 // GENERIC -> The wrench menu. This case includes pageActions that 28 // GENERIC -> The wrench menu. This case includes pageActions that
29 // don't specify a default icon. 29 // don't specify a default icon.
30 // 30 //
31 // ExtensionInstallBubble manages its own lifetime. 31 // ExtensionInstallBubble manages its own lifetime.
32 class ExtensionInstalledBubble 32 class ExtensionInstalledBubble
33 : public BubbleDelegate, 33 : public views::BubbleDelegateView,
34 public content::NotificationObserver, 34 public content::NotificationObserver,
35 public base::RefCountedThreadSafe<ExtensionInstalledBubble> { 35 public base::RefCountedThreadSafe<ExtensionInstalledBubble> {
36 public: 36 public:
37 // The behavior and content of this Bubble comes in these varieties: 37 // The behavior and content of this Bubble comes in these varieties:
38 enum BubbleType { 38 enum BubbleType {
39 OMNIBOX_KEYWORD, 39 OMNIBOX_KEYWORD,
40 BROWSER_ACTION, 40 BROWSER_ACTION,
41 PAGE_ACTION, 41 PAGE_ACTION,
42 APP, 42 APP,
43 GENERIC 43 GENERIC
44 }; 44 };
45 45
46 // Creates the ExtensionInstalledBubble and schedules it to be shown once 46 // Creates the ExtensionInstalledBubble and schedules it to be shown once
47 // the extension has loaded. |extension| is the installed extension. |browser| 47 // the extension has loaded. |extension| is the installed extension. |browser|
48 // is the browser window which will host the bubble. |icon| is the install 48 // is the browser window which will host the bubble. |icon| is the install
49 // icon of the extension. 49 // icon of the extension.
50 static void Show( 50 static void Show(
51 const Extension* extension, Browser *browser, const SkBitmap& icon); 51 const Extension* extension, Browser *browser, const SkBitmap& icon);
52 52
53 private: 53 private:
54 friend class base::RefCountedThreadSafe<ExtensionInstalledBubble>; 54 friend class base::RefCountedThreadSafe<ExtensionInstalledBubble>;
55 55
56 // Private ctor. Registers a listener for EXTENSION_LOADED. 56 // Private ctor. Registers a listener for EXTENSION_LOADED.
57 ExtensionInstalledBubble( 57 ExtensionInstalledBubble(const Extension* extension,
58 const Extension* extension, Browser *browser, const SkBitmap& icon); 58 Browser *browser,
59 const SkBitmap& icon);
59 60
60 virtual ~ExtensionInstalledBubble(); 61 virtual ~ExtensionInstalledBubble();
61 62
62 // Shows the bubble. Called internally via PostTask. 63 // Shows the bubble. Called internally via PostTask.
63 void ShowInternal(); 64 void ShowInternal();
64 65
65 // content::NotificationObserver 66 // content::NotificationObserver
66 virtual void Observe(int type, 67 virtual void Observe(int type,
67 const content::NotificationSource& source, 68 const content::NotificationSource& source,
68 const content::NotificationDetails& details) OVERRIDE; 69 const content::NotificationDetails& details) OVERRIDE;
69 70
70 // BubbleDelegate 71 // views::WidgetDelegate
71 virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE; 72 virtual void WindowClosing() OVERRIDE;
72 virtual bool CloseOnEscape() OVERRIDE; 73
73 virtual bool FadeInOnShow() OVERRIDE; 74 // views::BubbleDelegate
75 virtual gfx::Point GetAnchorPoint() OVERRIDE;
76 virtual views::BubbleBorder::ArrowLocation GetArrowLocation() const OVERRIDE;
74 77
75 const Extension* extension_; 78 const Extension* extension_;
76 Browser* browser_; 79 Browser* browser_;
77 SkBitmap icon_; 80 SkBitmap icon_;
78 content::NotificationRegistrar registrar_; 81 content::NotificationRegistrar registrar_;
79 InstalledBubbleContent* bubble_content_;
80 BubbleType type_; 82 BubbleType type_;
81 83
82 // How many times we've deferred due to animations being in progress. 84 // How many times we've deferred due to animations being in progress.
83 int animation_wait_retries_; 85 int animation_wait_retries_;
84 86
85 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubble); 87 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubble);
86 }; 88 };
87 89
88 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ 90 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/browser_actions_container.h ('k') | chrome/browser/ui/views/extensions/extension_installed_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698