Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: chrome/browser/ui/views/extensions/extension_message_bubble_view.h

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/views/bubble/bubble_delegate.h" 11 #include "ui/views/bubble/bubble_delegate.h"
11 #include "ui/views/controls/button/button.h" 12 #include "ui/views/controls/button/button.h"
12 #include "ui/views/controls/link_listener.h" 13 #include "ui/views/controls/link_listener.h"
13 14
14 class Profile; 15 class Profile;
15 16
16 namespace views { 17 namespace views {
17 class Label; 18 class Label;
18 class LabelButton; 19 class LabelButton;
19 class View; 20 class View;
20 } 21 }
21 22
22 namespace extensions { 23 namespace extensions {
23 24
24 class ExtensionMessageBubbleController; 25 class ExtensionMessageBubbleController;
25 26
26 // This is a class that implements the UI for the bubble showing which 27 // This is a class that implements the UI for the bubble showing which
27 // extensions look suspicious and have therefore been automatically disabled. 28 // extensions look suspicious and have therefore been automatically disabled.
28 class ExtensionMessageBubbleView : public views::BubbleDelegateView, 29 class ExtensionMessageBubbleView : public views::BubbleDelegateView,
29 public views::ButtonListener, 30 public views::ButtonListener,
30 public views::LinkListener { 31 public views::LinkListener {
31 public: 32 public:
32 ExtensionMessageBubbleView( 33 ExtensionMessageBubbleView(
33 views::View* anchor_view, 34 views::View* anchor_view,
34 views::BubbleBorder::Arrow arrow_location, 35 views::BubbleBorder::Arrow arrow_location,
35 scoped_ptr<ExtensionMessageBubbleController> controller); 36 std::unique_ptr<ExtensionMessageBubbleController> controller);
36 37
37 // Shows the bubble after a five-second delay. 38 // Shows the bubble after a five-second delay.
38 void Show(); 39 void Show();
39 40
40 // WidgetObserver methods. 41 // WidgetObserver methods.
41 void OnWidgetDestroying(views::Widget* widget) override; 42 void OnWidgetDestroying(views::Widget* widget) override;
42 43
43 static void set_bubble_appearance_wait_time_for_testing(int time_in_seconds); 44 static void set_bubble_appearance_wait_time_for_testing(int time_in_seconds);
44 45
45 private: 46 private:
46 ~ExtensionMessageBubbleView() override; 47 ~ExtensionMessageBubbleView() override;
47 48
48 void ShowBubble(); 49 void ShowBubble();
49 50
50 // views::BubbleDelegateView overrides: 51 // views::BubbleDelegateView overrides:
51 void Init() override; 52 void Init() override;
52 53
53 // views::ButtonListener implementation. 54 // views::ButtonListener implementation.
54 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 55 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
55 56
56 // views::LinkListener implementation. 57 // views::LinkListener implementation.
57 void LinkClicked(views::Link* source, int event_flags) override; 58 void LinkClicked(views::Link* source, int event_flags) override;
58 59
59 // views::View implementation. 60 // views::View implementation.
60 void GetAccessibleState(ui::AXViewState* state) override; 61 void GetAccessibleState(ui::AXViewState* state) override;
61 void ViewHierarchyChanged( 62 void ViewHierarchyChanged(
62 const ViewHierarchyChangedDetails& details) override; 63 const ViewHierarchyChangedDetails& details) override;
63 64
64 // The controller for this bubble. 65 // The controller for this bubble.
65 scoped_ptr<ExtensionMessageBubbleController> controller_; 66 std::unique_ptr<ExtensionMessageBubbleController> controller_;
66 67
67 // The view this bubble is anchored against. 68 // The view this bubble is anchored against.
68 views::View* anchor_view_; 69 views::View* anchor_view_;
69 70
70 // The headline, labels and buttons on the bubble. 71 // The headline, labels and buttons on the bubble.
71 views::Label* headline_; 72 views::Label* headline_;
72 views::Link* learn_more_; 73 views::Link* learn_more_;
73 views::LabelButton* action_button_; 74 views::LabelButton* action_button_;
74 views::LabelButton* dismiss_button_; 75 views::LabelButton* dismiss_button_;
75 76
76 // All actions (link, button, esc) close the bubble, but we need to 77 // 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 // make sure we don't send dismiss if the link was clicked.
78 bool link_clicked_; 79 bool link_clicked_;
79 bool action_taken_; 80 bool action_taken_;
80 81
81 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_; 82 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_;
82 83
83 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView); 84 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView);
84 }; 85 };
85 86
86 } // namespace extensions 87 } // namespace extensions
87 88
88 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ 89 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698