| OLD | NEW |
| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/views/bubble/bubble_delegate.h" | 10 #include "ui/views/bubble/bubble_delegate.h" |
| 11 #include "ui/views/controls/button/button.h" | 11 #include "ui/views/controls/button/button.h" |
| 12 #include "ui/views/controls/link_listener.h" | 12 #include "ui/views/controls/link_listener.h" |
| 13 | 13 |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 class Label; | 17 class Label; |
| 18 class LabelButton; | 18 class LabelButton; |
| 19 class View; | 19 class View; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| 23 | |
| 24 class ExtensionMessageBubbleController; | 23 class ExtensionMessageBubbleController; |
| 24 class ExtensionMessageBubbleViewBrowserTest; |
| 25 | 25 |
| 26 // 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 |
| 27 // extensions look suspicious and have therefore been automatically disabled. | 27 // extensions look suspicious and have therefore been automatically disabled. |
| 28 class ExtensionMessageBubbleView : public views::BubbleDelegateView, | 28 class ExtensionMessageBubbleView : public views::BubbleDelegateView, |
| 29 public views::ButtonListener, | 29 public views::ButtonListener, |
| 30 public views::LinkListener { | 30 public views::LinkListener { |
| 31 public: | 31 public: |
| 32 ExtensionMessageBubbleView( | 32 ExtensionMessageBubbleView( |
| 33 views::View* anchor_view, | 33 views::View* anchor_view, |
| 34 views::BubbleBorder::Arrow arrow_location, | 34 views::BubbleBorder::Arrow arrow_location, |
| 35 scoped_ptr<ExtensionMessageBubbleController> controller); | 35 scoped_ptr<ExtensionMessageBubbleController> controller); |
| 36 | 36 |
| 37 // Shows the bubble after a five-second delay. | 37 // Shows the bubble after a five-second delay. |
| 38 void Show(); | 38 void Show(); |
| 39 | 39 |
| 40 // WidgetObserver methods. | 40 // WidgetObserver methods. |
| 41 void OnWidgetDestroying(views::Widget* widget) override; | 41 void OnWidgetDestroying(views::Widget* widget) override; |
| 42 | 42 |
| 43 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); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 friend class ExtensionMessageBubbleViewBrowserTest; |
| 47 |
| 46 ~ExtensionMessageBubbleView() override; | 48 ~ExtensionMessageBubbleView() override; |
| 47 | 49 |
| 48 void ShowBubble(); | 50 void ShowBubble(); |
| 49 | 51 |
| 50 // views::BubbleDelegateView overrides: | 52 // views::BubbleDelegateView overrides: |
| 51 void Init() override; | 53 void Init() override; |
| 52 | 54 |
| 53 // views::ButtonListener implementation. | 55 // views::ButtonListener implementation. |
| 54 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 56 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 55 | 57 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 73 views::LabelButton* action_button_; | 75 views::LabelButton* action_button_; |
| 74 views::LabelButton* dismiss_button_; | 76 views::LabelButton* dismiss_button_; |
| 75 | 77 |
| 76 // All actions (link, button, esc) close the bubble, but we need to | 78 // 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. | 79 // make sure we don't send dismiss if the link was clicked. |
| 78 bool link_clicked_; | 80 bool link_clicked_; |
| 79 bool action_taken_; | 81 bool action_taken_; |
| 80 | 82 |
| 81 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_; | 83 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_; |
| 82 | 84 |
| 85 static ExtensionMessageBubbleView* active_bubble_for_testing_; |
| 86 |
| 83 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView); | 87 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView); |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 } // namespace extensions | 90 } // namespace extensions |
| 87 | 91 |
| 88 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ | 92 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ |
| OLD | NEW |