Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / views / extensions / extension_message_bubble_view.h
blob177673fad20e24eb7ea26787d0086124ea753bc1
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"
15 class Profile;
17 namespace views {
18 class Label;
19 class LabelButton;
20 class View;
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 {
33 public:
34 ExtensionMessageBubbleView(
35 views::View* anchor_view,
36 views::BubbleBorder::Arrow arrow_location,
37 scoped_ptr<ExtensionMessageBubbleController> controller);
39 // ExtensionMessageBubble methods.
40 void Show() override;
42 // WidgetObserver methods.
43 void OnWidgetDestroying(views::Widget* widget) override;
45 private:
46 ~ExtensionMessageBubbleView() override;
48 void ShowBubble();
50 // views::BubbleDelegateView overrides:
51 void Init() override;
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.
78 bool link_clicked_;
79 bool action_taken_;
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_