OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SYNC_ONE_CLICK_SIGNIN_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_SYNC_ONE_CLICK_SIGNIN_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_SYNC_ONE_CLICK_SIGNIN_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_SYNC_ONE_CLICK_SIGNIN_BUBBLE_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
11 #include "base/string16.h" | 12 #include "base/string16.h" |
12 #include "ui/views/bubble/bubble_delegate.h" | 13 #include "ui/views/bubble/bubble_delegate.h" |
13 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/button.h" |
14 #include "ui/views/controls/link_listener.h" | 15 #include "ui/views/controls/link_listener.h" |
15 | 16 |
16 class Browser; | |
17 class MessageLoop; | 17 class MessageLoop; |
18 | 18 |
19 namespace views { | 19 namespace views { |
20 class TextButton; | 20 class TextButton; |
21 } | 21 } |
22 | 22 |
23 // OneClickSigninBubbleView is a view intended to be used as the content of an | 23 // OneClickSigninBubbleView is a view intended to be used as the content of an |
24 // Bubble. It provides simple and concise feedback to the user that sync'ing | 24 // Bubble. It provides simple and concise feedback to the user that sync'ing |
25 // has started after using the one-click singin infobar. | 25 // has started after using the one-click singin infobar. |
26 class OneClickSigninBubbleView : public views::BubbleDelegateView, | 26 class OneClickSigninBubbleView : public views::BubbleDelegateView, |
27 public views::LinkListener, | 27 public views::LinkListener, |
28 public views::ButtonListener { | 28 public views::ButtonListener { |
29 public: | 29 public: |
30 // Show the one-click signin bubble if not already showing. The bubble | 30 // Show the one-click signin bubble if not already showing. The bubble |
31 // will be placed visually beneath |anchor_view|. The |browser| is used | 31 // will be placed visually beneath |anchor_view|. The |browser| is used |
32 // to open links. | 32 // to open links. |
33 static void ShowBubble(views::View* anchor_view, Browser* browser); | 33 static void ShowBubble(views::View* anchor_view, |
| 34 const base::Closure& learn_more_callback, |
| 35 const base::Closure& advanced_callback); |
34 | 36 |
35 static bool IsShowing(); | 37 static bool IsShowing(); |
36 | 38 |
37 static void Hide(); | 39 static void Hide(); |
38 | 40 |
39 // Gets the global bubble view. If its not showing returns NULL. This | 41 // Gets the global bubble view. If its not showing returns NULL. This |
40 // method is meant to be called only from tests. | 42 // method is meant to be called only from tests. |
41 static OneClickSigninBubbleView* view_for_testing() { return bubble_view_; } | 43 static OneClickSigninBubbleView* view_for_testing() { return bubble_view_; } |
42 | 44 |
43 // The following accessor message should only be used for testing. | 45 // The following accessor message should only be used for testing. |
44 views::Link* learn_more_link_for_testing() const { return learn_more_link_; } | 46 views::Link* learn_more_link_for_testing() const { return learn_more_link_; } |
45 views::Link* advanced_link_for_testing() const { return advanced_link_; } | 47 views::Link* advanced_link_for_testing() const { return advanced_link_; } |
46 views::TextButton* close_button_for_testing() const { return close_button_; } | 48 views::TextButton* close_button_for_testing() const { return close_button_; } |
47 void set_message_loop_for_testing(MessageLoop* loop) { | 49 void set_message_loop_for_testing(MessageLoop* loop) { |
48 message_loop_for_testing_ = loop; | 50 message_loop_for_testing_ = loop; |
49 } | 51 } |
50 | 52 |
51 private: | 53 private: |
52 // Creates a BookmarkBubbleView. | 54 // Creates a BookmarkBubbleView. |
53 OneClickSigninBubbleView(views::View* anchor_view, Browser* browser); | 55 OneClickSigninBubbleView(views::View* anchor_view, |
| 56 const base::Closure& learn_more_callback, |
| 57 const base::Closure& advanced_callback); |
54 | 58 |
55 virtual ~OneClickSigninBubbleView(); | 59 virtual ~OneClickSigninBubbleView(); |
56 | 60 |
57 // views::BubbleDelegateView methods: | 61 // views::BubbleDelegateView methods: |
58 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 62 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
59 virtual void Init() OVERRIDE; | 63 virtual void Init() OVERRIDE; |
60 | 64 |
61 // views::WidgetDelegate method: | 65 // views::WidgetDelegate method: |
62 virtual void WindowClosing() OVERRIDE; | 66 virtual void WindowClosing() OVERRIDE; |
63 | 67 |
(...skipping 12 matching lines...) Expand all Loading... |
76 | 80 |
77 // Link to web page to learn more about sync. | 81 // Link to web page to learn more about sync. |
78 views::Link* learn_more_link_; | 82 views::Link* learn_more_link_; |
79 | 83 |
80 // Link to sync setup advanced page. | 84 // Link to sync setup advanced page. |
81 views::Link* advanced_link_; | 85 views::Link* advanced_link_; |
82 | 86 |
83 // Button to close the window. | 87 // Button to close the window. |
84 views::TextButton* close_button_; | 88 views::TextButton* close_button_; |
85 | 89 |
86 // The browser that contains this bubble. | 90 // The callbacks for the links. |
87 Browser* browser_; | 91 base::Closure learn_more_callback_; |
| 92 base::Closure advanced_callback_; |
88 | 93 |
89 // A message loop used only with unit tests. | 94 // A message loop used only with unit tests. |
90 MessageLoop* message_loop_for_testing_; | 95 MessageLoop* message_loop_for_testing_; |
91 | 96 |
92 DISALLOW_COPY_AND_ASSIGN(OneClickSigninBubbleView); | 97 DISALLOW_COPY_AND_ASSIGN(OneClickSigninBubbleView); |
93 }; | 98 }; |
94 | 99 |
95 #endif // CHROME_BROWSER_UI_VIEWS_SYNC_ONE_CLICK_SIGNIN_BUBBLE_VIEW_H_ | 100 #endif // CHROME_BROWSER_UI_VIEWS_SYNC_ONE_CLICK_SIGNIN_BUBBLE_VIEW_H_ |
OLD | NEW |