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