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

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

Issue 1858773006: [Extensions UI] Use the ExtensionMessageBubbleBridge for Views platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_MESSAGE_BUBBLE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "ui/views/bubble/bubble_delegate.h" 11 #include "ui/views/bubble/bubble_delegate.h"
12 #include "ui/views/controls/button/button.h" 12 #include "ui/views/controls/button/button.h"
13 #include "ui/views/controls/link_listener.h" 13 #include "ui/views/controls/link_listener.h"
14 14
15 class Profile; 15 class Profile;
16 class ToolbarActionsBarBubbleDelegate;
16 17
17 namespace views { 18 namespace views {
18 class Label; 19 class Label;
19 class LabelButton; 20 class LabelButton;
20 class View; 21 class View;
21 } 22 }
22 23
23 namespace extensions { 24 namespace extensions {
24 25
25 class ExtensionMessageBubbleController;
26
27 // This is a class that implements the UI for the bubble showing which 26 // This is a class that implements the UI for the bubble showing which
28 // extensions look suspicious and have therefore been automatically disabled. 27 // extensions look suspicious and have therefore been automatically disabled.
29 class ExtensionMessageBubbleView : public views::BubbleDelegateView, 28 class ExtensionMessageBubbleView : public views::BubbleDelegateView,
30 public views::ButtonListener, 29 public views::ButtonListener,
31 public views::LinkListener { 30 public views::LinkListener {
32 public: 31 public:
33 ExtensionMessageBubbleView( 32 ExtensionMessageBubbleView(
34 views::View* anchor_view, 33 views::View* anchor_view,
35 views::BubbleBorder::Arrow arrow_location, 34 views::BubbleBorder::Arrow arrow_location,
36 std::unique_ptr<ExtensionMessageBubbleController> controller); 35 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate);
37 36
38 // Shows the bubble after a five-second delay. 37 // Shows the bubble after a five-second delay.
39 void Show(); 38 void Show();
40 39
41 // WidgetObserver methods. 40 // WidgetObserver methods.
42 void OnWidgetDestroying(views::Widget* widget) override; 41 void OnWidgetDestroying(views::Widget* widget) override;
43 42
44 static void set_bubble_appearance_wait_time_for_testing(int time_in_seconds); 43 static void set_bubble_appearance_wait_time_for_testing(int time_in_seconds);
45 44
46 private: 45 private:
47 ~ExtensionMessageBubbleView() override; 46 ~ExtensionMessageBubbleView() override;
48 47
49 void ShowBubble(); 48 void ShowBubble();
50 49
51 // views::BubbleDelegateView overrides: 50 // views::BubbleDelegateView overrides:
52 void Init() override; 51 void Init() override;
53 52
54 // views::ButtonListener implementation. 53 // views::ButtonListener implementation.
55 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 54 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
56 55
57 // views::LinkListener implementation. 56 // views::LinkListener implementation.
58 void LinkClicked(views::Link* source, int event_flags) override; 57 void LinkClicked(views::Link* source, int event_flags) override;
59 58
60 // views::View implementation. 59 // views::View implementation.
61 void GetAccessibleState(ui::AXViewState* state) override; 60 void GetAccessibleState(ui::AXViewState* state) override;
62 void ViewHierarchyChanged( 61 void ViewHierarchyChanged(
63 const ViewHierarchyChangedDetails& details) override; 62 const ViewHierarchyChangedDetails& details) override;
64 63
65 // The controller for this bubble. 64 // The delegate for this bubble.
66 std::unique_ptr<ExtensionMessageBubbleController> controller_; 65 std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate_;
67 66
68 // The view this bubble is anchored against. 67 // The view this bubble is anchored against.
69 views::View* anchor_view_; 68 views::View* anchor_view_;
70 69
71 // The headline, labels and buttons on the bubble. 70 // The headline, labels and buttons on the bubble.
72 views::Label* headline_; 71 views::Label* headline_;
73 views::Link* learn_more_; 72 views::Link* learn_more_;
74 views::LabelButton* action_button_; 73 views::LabelButton* action_button_;
75 views::LabelButton* dismiss_button_; 74 views::LabelButton* dismiss_button_;
76 75
77 // All actions (link, button, esc) close the bubble, but we need to 76 // All actions (link, button, esc) close the bubble, but we need to
78 // make sure we don't send dismiss if the link was clicked. 77 // make sure we don't send dismiss if the link was clicked.
79 bool link_clicked_; 78 bool link_clicked_;
80 bool action_taken_; 79 bool action_taken_;
81 80
82 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_; 81 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_;
83 82
84 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView); 83 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView);
85 }; 84 };
86 85
87 } // namespace extensions 86 } // namespace extensions
88 87
89 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ 88 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698