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_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" | 9 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" |
10 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" | |
10 #include "components/bubble/bubble_reference.h" | 11 #include "components/bubble/bubble_reference.h" |
11 #include "ui/views/bubble/bubble_delegate.h" | 12 #include "ui/views/bubble/bubble_delegate.h" |
13 #include "ui/views/controls/button/button.h" | |
14 #include "ui/views/controls/link_listener.h" | |
12 | 15 |
13 class Browser; | 16 class Browser; |
17 class BubbleSyncPromoView; | |
14 | 18 |
15 namespace extensions { | 19 namespace extensions { |
16 class Extension; | 20 class Extension; |
17 } | 21 } |
18 | 22 |
23 namespace views { | |
24 class LabelButton; | |
25 class Link; | |
26 } | |
27 | |
19 // Provides feedback to the user upon successful installation of an | 28 // Provides feedback to the user upon successful installation of an |
20 // extension. Depending on the type of extension, the Bubble will | 29 // extension. Depending on the type of extension, the Bubble will |
21 // point to: | 30 // point to: |
22 // OMNIBOX_KEYWORD-> The omnibox. | 31 // OMNIBOX_KEYWORD-> The omnibox. |
23 // BROWSER_ACTION -> The browserAction icon in the toolbar. | 32 // BROWSER_ACTION -> The browserAction icon in the toolbar. |
24 // PAGE_ACTION -> A preview of the pageAction icon in the location | 33 // PAGE_ACTION -> A preview of the pageAction icon in the location |
25 // bar which is shown while the Bubble is shown. | 34 // bar which is shown while the Bubble is shown. |
26 // GENERIC -> The app menu. This case includes pageActions that don't | 35 // GENERIC -> The app menu. This case includes pageActions that don't |
27 // specify a default icon. | 36 // specify a default icon. |
28 class ExtensionInstalledBubbleView : public views::BubbleDelegateView { | 37 class ExtensionInstalledBubbleView |
38 : public BubbleSyncPromoDelegate, | |
39 public views::BubbleDelegateView, | |
40 public views::ButtonListener, | |
41 public views::LinkListener { | |
29 public: | 42 public: |
30 ExtensionInstalledBubbleView(ExtensionInstalledBubble* bubble, | 43 ExtensionInstalledBubbleView(ExtensionInstalledBubble* bubble, |
31 BubbleReference bubble_reference); | 44 BubbleReference bubble_reference); |
32 ~ExtensionInstalledBubbleView() override; | 45 ~ExtensionInstalledBubbleView() override; |
33 | 46 |
34 // Recalculate the anchor position for this bubble. | 47 // Recalculate the anchor position for this bubble. |
35 void UpdateAnchorView(); | 48 void UpdateAnchorView(); |
36 | 49 |
50 void InitLayout(const ExtensionInstalledBubble& bubble); | |
51 | |
52 private: | |
53 // The different options to show in the installed bubble. | |
54 enum Flavors { | |
sky
2015/12/04 23:41:06
nit: your description says options, which IMO is a
Devlin
2015/12/05 01:10:15
Carried over flavors from the old code. Replaced
| |
55 NONE = 0, | |
56 HOW_TO_USE = 1 << 0, | |
57 HOW_TO_MANAGE = 1 << 1, | |
58 SHOW_KEYBINDING = 1 << 2, | |
59 SIGN_IN_PROMO = 1 << 3, | |
60 }; | |
61 | |
37 // views::BubbleDelegateView: | 62 // views::BubbleDelegateView: |
38 void WindowClosing() override; | 63 void WindowClosing() override; |
39 gfx::Rect GetAnchorRect() const override; | 64 gfx::Rect GetAnchorRect() const override; |
40 void OnWidgetClosing(views::Widget* widget) override; | 65 void OnWidgetClosing(views::Widget* widget) override; |
41 void OnWidgetActivationChanged(views::Widget* widget, bool active) override; | 66 void OnWidgetActivationChanged(views::Widget* widget, bool active) override; |
42 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 67 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
43 | 68 |
44 private: | 69 // BubbleSyncPromoDelegate: |
70 void OnSignInLinkClicked() override; | |
71 | |
72 // views::LinkListener: | |
73 void LinkClicked(views::Link* source, int event_flags) override; | |
74 | |
75 // views::ButtonListener: | |
76 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
77 | |
45 BubbleReference bubble_reference_; | 78 BubbleReference bubble_reference_; |
46 const extensions::Extension* extension_; | 79 const extensions::Extension* extension_; |
47 Browser* browser_; | 80 Browser* browser_; |
48 ExtensionInstalledBubble::BubbleType type_; | 81 ExtensionInstalledBubble::BubbleType type_; |
49 | 82 |
83 // A bitmask containing the various flavors of bubble sections to show. | |
84 int flavors_; | |
85 | |
86 // The sync promo section of the bubble. | |
87 BubbleSyncPromoView* sync_promo_; | |
88 | |
89 views::LabelButton* close_; | |
90 | |
91 views::Link* manage_shortcut_; | |
92 | |
50 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleView); | 93 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleView); |
51 }; | 94 }; |
52 | 95 |
53 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ | 96 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ |
OLD | NEW |