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

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

Issue 134103002: Refactor the extension message bubbles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile errors on non-Win platform Created 6 years, 11 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 | Annotate | Revision Log
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 "chrome/browser/extensions/extension_message_bubble.h" 8 #include "chrome/browser/extensions/extension_message_bubble.h"
9 #include "chrome/browser/extensions/extension_message_bubble_controller.h" 9 #include "chrome/browser/extensions/extension_message_bubble_controller.h"
10 #include "ui/views/bubble/bubble_delegate.h" 10 #include "ui/views/bubble/bubble_delegate.h"
(...skipping 28 matching lines...) Expand all
39 virtual void OnDismissButtonClicked(const base::Closure& callback) OVERRIDE; 39 virtual void OnDismissButtonClicked(const base::Closure& callback) OVERRIDE;
40 virtual void OnLinkClicked(const base::Closure& callback) OVERRIDE; 40 virtual void OnLinkClicked(const base::Closure& callback) OVERRIDE;
41 virtual void Show() OVERRIDE; 41 virtual void Show() OVERRIDE;
42 42
43 // WidgetObserver methods. 43 // WidgetObserver methods.
44 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; 44 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
45 45
46 private: 46 private:
47 ExtensionMessageBubbleView( 47 ExtensionMessageBubbleView(
48 views::View* anchor_view, 48 views::View* anchor_view,
49 ExtensionMessageBubbleController::Delegate* delegate); 49 ExtensionMessageBubbleController* controller);
not at google - send to devlin 2014/01/10 21:28:43 take a scoped_ptr to indicate ownership
Finnur 2014/01/13 15:36:32 Done.
50 virtual ~ExtensionMessageBubbleView(); 50 virtual ~ExtensionMessageBubbleView();
51 51
52 // Shows the bubble and updates the counter for how often it has been shown. 52 // Shows the bubble and updates the counter for how often it has been shown.
53 void ShowBubble(); 53 void ShowBubble();
54 54
55 // views::BubbleDelegateView overrides: 55 // views::BubbleDelegateView overrides:
56 virtual void Init() OVERRIDE; 56 virtual void Init() OVERRIDE;
57 57
58 // views::ButtonListener implementation. 58 // views::ButtonListener implementation.
59 virtual void ButtonPressed(views::Button* sender, 59 virtual void ButtonPressed(views::Button* sender,
60 const ui::Event& event) OVERRIDE; 60 const ui::Event& event) OVERRIDE;
61 61
62 // views::LinkListener implementation. 62 // views::LinkListener implementation.
63 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; 63 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
64 64
65 // views::View implementation. 65 // views::View implementation.
66 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 66 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
67 virtual void ViewHierarchyChanged( 67 virtual void ViewHierarchyChanged(
68 const ViewHierarchyChangedDetails& details) OVERRIDE; 68 const ViewHierarchyChangedDetails& details) OVERRIDE;
69 69
70 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_; 70 base::WeakPtrFactory<ExtensionMessageBubbleView> weak_factory_;
71 71
72 // The controller for the bubble. Weak, not owned by us. 72 // The controller for this bubble.
73 ExtensionMessageBubbleController::Delegate* delegate_; 73 scoped_ptr<ExtensionMessageBubbleController> controller_;
74 74
75 // The headline, labels and buttons on the bubble. 75 // The headline, labels and buttons on the bubble.
76 views::Label* headline_; 76 views::Label* headline_;
77 views::Link* learn_more_; 77 views::Link* learn_more_;
78 views::LabelButton* action_button_; 78 views::LabelButton* action_button_;
79 views::LabelButton* dismiss_button_; 79 views::LabelButton* dismiss_button_;
80 80
81 // All actions (link, button, esc) close the bubble, but we need to 81 // All actions (link, button, esc) close the bubble, but we need to
82 // make sure we don't send dismiss if the link was clicked. 82 // make sure we don't send dismiss if the link was clicked.
83 bool link_clicked_; 83 bool link_clicked_;
84 bool action_taken_; 84 bool action_taken_;
85 85
86 // Callbacks into the controller. 86 // Callbacks into the controller.
87 base::Closure action_callback_; 87 base::Closure action_callback_;
88 base::Closure dismiss_callback_; 88 base::Closure dismiss_callback_;
89 base::Closure link_callback_; 89 base::Closure link_callback_;
90 90
91 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView); 91 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleView);
92 }; 92 };
93 93
94 } // namespace extensions 94 } // namespace extensions
95 95
96 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_ 96 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_MESSAGE_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698