| 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 |
| 23 class ExtensionMessageBubbleController; | 24 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 | |
| 48 ~ExtensionMessageBubbleView() override; | 46 ~ExtensionMessageBubbleView() override; |
| 49 | 47 |
| 50 void ShowBubble(); | 48 void ShowBubble(); |
| 51 | 49 |
| 52 // views::BubbleDelegateView overrides: | 50 // views::BubbleDelegateView overrides: |
| 53 void Init() override; | 51 void Init() override; |
| 54 | 52 |
| 55 // views::ButtonListener implementation. | 53 // views::ButtonListener implementation. |
| 56 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 54 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 57 | 55 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 75 views::LabelButton* action_button_; | 73 views::LabelButton* action_button_; |
| 76 views::LabelButton* dismiss_button_; | 74 views::LabelButton* dismiss_button_; |
| 77 | 75 |
| 78 // 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 |
| 79 // 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. |
| 80 bool link_clicked_; | 78 bool link_clicked_; |
| 81 bool action_taken_; | 79 bool action_taken_; |
| 82 | 80 |
| 83 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_; | 81 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_; |
| 84 | 82 |
| 85 static ExtensionMessageBubbleView* active_bubble_for_testing_; | |
| 86 | |
| 87 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView); | 83 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView); |
| 88 }; | 84 }; |
| 89 | 85 |
| 90 } // namespace extensions | 86 } // namespace extensions |
| 91 | 87 |
| 92 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ | 88 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ |
| OLD | NEW |