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

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

Issue 1807793003: Convert ExtensionInstalledBubble to BubbleDialogDelegateView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restore omnibox anchor support Created 4 years, 8 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.
Evan Stade 2016/04/07 22:43:17 moved this whole file into the .cc
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 "chrome/browser/ui/sync/bubble_sync_promo_delegate.h"
11 #include "components/bubble/bubble_reference.h" 11 #include "components/bubble/bubble_reference.h"
msw 2016/04/07 21:48:58 nit: remove
Evan Stade 2016/04/07 22:43:17 Done.
12 #include "ui/views/bubble/bubble_delegate.h" 12 #include "ui/views/bubble/bubble_dialog_delegate.h"
13 #include "ui/views/controls/button/button.h" 13 #include "ui/views/controls/button/button.h"
14 #include "ui/views/controls/link_listener.h" 14 #include "ui/views/controls/link_listener.h"
15 15
16 class Browser; 16 class Browser;
17 class BubbleSyncPromoView; 17 class BubbleSyncPromoView;
18 18
19 namespace extensions { 19 namespace extensions {
20 class Extension; 20 class Extension;
msw 2016/04/07 21:48:58 nit: remove
Evan Stade 2016/04/07 22:43:17 Done.
21 } 21 }
22 22
23 namespace views { 23 namespace views {
24 class LabelButton; 24 class LabelButton;
25 class Link; 25 class Link;
26 } 26 }
27 27
28 // Provides feedback to the user upon successful installation of an 28 // Provides feedback to the user upon successful installation of an
29 // extension. Depending on the type of extension, the Bubble will 29 // extension. Depending on the type of extension, the Bubble will
30 // point to: 30 // point to:
31 // OMNIBOX_KEYWORD-> The omnibox. 31 // OMNIBOX_KEYWORD-> The omnibox.
32 // BROWSER_ACTION -> The browserAction icon in the toolbar. 32 // BROWSER_ACTION -> The browserAction icon in the toolbar.
33 // PAGE_ACTION -> A preview of the pageAction icon in the location 33 // PAGE_ACTION -> A preview of the pageAction icon in the location
34 // bar which is shown while the Bubble is shown. 34 // bar which is shown while the Bubble is shown.
35 // GENERIC -> The app menu. This case includes pageActions that don't 35 // GENERIC -> The app menu. This case includes pageActions that don't
36 // specify a default icon. 36 // specify a default icon.
37 class ExtensionInstalledBubbleView : public BubbleSyncPromoDelegate, 37 class ExtensionInstalledBubbleView : public BubbleSyncPromoDelegate,
38 public views::BubbleDelegateView, 38 public views::BubbleDialogDelegateView,
39 public views::ButtonListener, 39 public views::ButtonListener,
40 public views::LinkListener { 40 public views::LinkListener {
41 public: 41 public:
42 ExtensionInstalledBubbleView(ExtensionInstalledBubble* bubble, 42 explicit ExtensionInstalledBubbleView(ExtensionInstalledBubble* bubble);
43 BubbleReference bubble_reference);
44 ~ExtensionInstalledBubbleView() override; 43 ~ExtensionInstalledBubbleView() override;
45 44
46 // Recalculate the anchor position for this bubble. 45 // Recalculate the anchor position for this bubble.
47 void UpdateAnchorView(); 46 void UpdateAnchorView();
48 47
49 void InitLayout(); 48 private:
49 Browser* browser() { return controller_->browser(); }
50 50
51 private: 51 // views::BubbleDialogDelegateView:
52 // views::BubbleDelegateView: 52 void Init() override;
53 View* CreateFootnoteView() override; 53 View* CreateFootnoteView() override;
54 int GetDialogButtons() const override;
54 void WindowClosing() override; 55 void WindowClosing() override;
55 gfx::Rect GetAnchorRect() const override;
56 void OnWidgetClosing(views::Widget* widget) override;
57 void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
58 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
59 56
60 // BubbleSyncPromoDelegate: 57 // BubbleSyncPromoDelegate:
61 void OnSignInLinkClicked() override; 58 void OnSignInLinkClicked() override;
62 59
63 // views::LinkListener: 60 // views::LinkListener:
64 void LinkClicked(views::Link* source, int event_flags) override; 61 void LinkClicked(views::Link* source, int event_flags) override;
65 62
66 // views::ButtonListener: 63 // views::ButtonListener:
67 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 64 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
68 65
69 const ExtensionInstalledBubble* bubble_; 66 ExtensionInstalledBubble* controller_;
70 BubbleReference bubble_reference_;
71 const extensions::Extension* extension_;
72 Browser* browser_;
73 ExtensionInstalledBubble::BubbleType type_; 67 ExtensionInstalledBubble::BubbleType type_;
74 ExtensionInstalledBubble::AnchorPosition anchor_position_; 68 ExtensionInstalledBubble::AnchorPosition anchor_position_;
75 69
76 // The button to close the bubble. 70 // The button to close the bubble.
77 views::LabelButton* close_; 71 views::LabelButton* close_;
78 72
79 // The shortcut to open the manage shortcuts page. 73 // The shortcut to open the manage shortcuts page.
80 views::Link* manage_shortcut_; 74 views::Link* manage_shortcut_;
81 75
82 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleView); 76 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleView);
83 }; 77 };
84 78
85 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_ 79 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698