| 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 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/views/toolbar_view.h" | 14 #include "chrome/browser/ui/views/toolbar_view.h" |
| 15 #include "ui/views/bubble/bubble_delegate.h" | 15 #include "ui/views/bubble/bubble_delegate.h" |
| 16 #include "ui/views/controls/button/button.h" | 16 #include "ui/views/controls/button/button.h" |
| 17 #include "ui/views/controls/link_listener.h" | 17 #include "ui/views/controls/link_listener.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class MessageLoop; | 20 class MessageLoop; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace views { | 23 namespace views { |
| 24 class GridLayout; | 24 class GridLayout; |
| 25 class TextButton; | 25 class LabelButton; |
| 26 } | 26 } |
| 27 | 27 |
| 28 // OneClickSigninBubbleView is a view intended to be used as the content of an | 28 // OneClickSigninBubbleView is a view intended to be used as the content of an |
| 29 // Bubble. It provides simple and concise feedback to the user that sync'ing | 29 // Bubble. It provides simple and concise feedback to the user that sync'ing |
| 30 // has started after using the one-click singin infobar. | 30 // has started after using the one-click singin infobar. |
| 31 class OneClickSigninBubbleView : public views::BubbleDelegateView, | 31 class OneClickSigninBubbleView : public views::BubbleDelegateView, |
| 32 public views::LinkListener, | 32 public views::LinkListener, |
| 33 public views::ButtonListener { | 33 public views::ButtonListener { |
| 34 public: | 34 public: |
| 35 // Show the one-click signin bubble if not already showing. The bubble | 35 // Show the one-click signin bubble if not already showing. The bubble |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 73 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 74 virtual void Init() OVERRIDE; | 74 virtual void Init() OVERRIDE; |
| 75 | 75 |
| 76 // Method to build the main part of the bubble. Derived classes should | 76 // Method to build the main part of the bubble. Derived classes should |
| 77 // reimplement this function. | 77 // reimplement this function. |
| 78 virtual void InitContent(views::GridLayout* layout); | 78 virtual void InitContent(views::GridLayout* layout); |
| 79 | 79 |
| 80 // Creates OK and Undo buttons to be used at the bottom of the bubble. | 80 // Creates OK and Undo buttons to be used at the bottom of the bubble. |
| 81 // Derived classes can reimplement to have buttons with different labels, | 81 // Derived classes can reimplement to have buttons with different labels, |
| 82 // colours, or sizes. The caller of this function owns the returned buttons. | 82 // colours, or sizes. The caller of this function owns the returned buttons. |
| 83 virtual void GetButtons(views::TextButton** ok_button, | 83 virtual void GetButtons(views::LabelButton** ok_button, |
| 84 views::TextButton** undo_button); | 84 views::LabelButton** undo_button); |
| 85 | 85 |
| 86 // Creates advanced link to be used at the bottom of the bubble. | 86 // Creates advanced link to be used at the bottom of the bubble. |
| 87 // Derived classes can reimplement. The caller of this function owns the | 87 // Derived classes can reimplement. The caller of this function owns the |
| 88 // returned link. | 88 // returned link. |
| 89 virtual views::Link* GetAdvancedLink(); | 89 virtual views::Link* GetAdvancedLink(); |
| 90 | 90 |
| 91 // views::WidgetDelegate method: | 91 // views::WidgetDelegate method: |
| 92 virtual void WindowClosing() OVERRIDE; | 92 virtual void WindowClosing() OVERRIDE; |
| 93 | 93 |
| 94 // views::View method: | 94 // views::View method: |
| 95 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 95 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| 96 | 96 |
| 97 // The bubble, if we're showing one. | 97 // The bubble, if we're showing one. |
| 98 static OneClickSigninBubbleView* bubble_view_; | 98 static OneClickSigninBubbleView* bubble_view_; |
| 99 | 99 |
| 100 // Link to sync setup advanced page. | 100 // Link to sync setup advanced page. |
| 101 views::Link* advanced_link_; | 101 views::Link* advanced_link_; |
| 102 | 102 |
| 103 // Controls at bottom of bubble. | 103 // Controls at bottom of bubble. |
| 104 views::TextButton* ok_button_; | 104 views::LabelButton* ok_button_; |
| 105 views::TextButton* undo_button_; | 105 views::LabelButton* undo_button_; |
| 106 | 106 |
| 107 // This callback is nulled once its called, so that it is called only once. | 107 // This callback is nulled once its called, so that it is called only once. |
| 108 // It will be called when the bubble is closed if it has not been called | 108 // It will be called when the bubble is closed if it has not been called |
| 109 // and nulled earlier. | 109 // and nulled earlier. |
| 110 BrowserWindow::StartSyncCallback start_sync_callback_; | 110 BrowserWindow::StartSyncCallback start_sync_callback_; |
| 111 | 111 |
| 112 // A message loop used only with unit tests. | 112 // A message loop used only with unit tests. |
| 113 base::MessageLoop* message_loop_for_testing_; | 113 base::MessageLoop* message_loop_for_testing_; |
| 114 | 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(OneClickSigninBubbleView); | 115 DISALLOW_COPY_AND_ASSIGN(OneClickSigninBubbleView); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 #endif // CHROME_BROWSER_UI_VIEWS_SYNC_ONE_CLICK_SIGNIN_BUBBLE_VIEW_H_ | 118 #endif // CHROME_BROWSER_UI_VIEWS_SYNC_ONE_CLICK_SIGNIN_BUBBLE_VIEW_H_ |
| OLD | NEW |