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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/extensions/extension_message_bubble.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"
23 namespace extensions
{
25 class ExtensionMessageBubbleController
;
27 // This is a class that implements the UI for the bubble showing which
28 // extensions look suspicious and have therefore been automatically disabled.
29 class ExtensionMessageBubbleView
: public ExtensionMessageBubble
,
30 public views::BubbleDelegateView
,
31 public views::ButtonListener
,
32 public views::LinkListener
{
34 ExtensionMessageBubbleView(
35 views::View
* anchor_view
,
36 views::BubbleBorder::Arrow arrow_location
,
37 scoped_ptr
<ExtensionMessageBubbleController
> controller
);
39 // ExtensionMessageBubble methods.
42 // WidgetObserver methods.
43 void OnWidgetDestroying(views::Widget
* widget
) override
;
46 ~ExtensionMessageBubbleView() override
;
50 // views::BubbleDelegateView overrides:
53 // views::ButtonListener implementation.
54 void ButtonPressed(views::Button
* sender
, const ui::Event
& event
) override
;
56 // views::LinkListener implementation.
57 void LinkClicked(views::Link
* source
, int event_flags
) override
;
59 // views::View implementation.
60 void GetAccessibleState(ui::AXViewState
* state
) override
;
61 void ViewHierarchyChanged(
62 const ViewHierarchyChangedDetails
& details
) override
;
64 // The controller for this bubble.
65 scoped_ptr
<ExtensionMessageBubbleController
> controller_
;
67 // The view this bubble is anchored against.
68 views::View
* anchor_view_
;
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_
;
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.
81 base::WeakPtrFactory
<ExtensionMessageBubbleView
> weak_factory_
;
83 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView
);
86 } // namespace extensions
88 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_