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_GTK_ONE_CLICK_SIGNIN_BUBBLE_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_ONE_CLICK_SIGNIN_BUBBLE_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_ONE_CLICK_SIGNIN_BUBBLE_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_ONE_CLICK_SIGNIN_BUBBLE_GTK_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/callback.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" |
| 13 #include "chrome/browser/ui/base_window.h" |
| 14 #include "chrome/browser/ui/browser_window.h" |
12 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | 15 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
13 | 16 |
14 typedef struct _GtkWidget GtkWidget; | 17 typedef struct _GtkWidget GtkWidget; |
15 typedef struct _GtkWindow GtkWindow; | 18 typedef struct _GtkWindow GtkWindow; |
16 | 19 |
17 class BrowserWindowGtk; | 20 class BrowserWindowGtk; |
18 | 21 |
19 // Displays the one-click signin confirmation bubble (after syncing | 22 // Displays the one-click signin confirmation bubble (before syncing |
20 // has started). | 23 // has started). |
21 class OneClickSigninBubbleGtk : public BubbleDelegateGtk { | 24 class OneClickSigninBubbleGtk : public BubbleDelegateGtk { |
22 public: | 25 public: |
23 // Deletes self on close. The given callbacks will be called if the | 26 // Deletes self on close. The given callback will be called if the |
24 // user clicks the corresponding link. | 27 // user decides to start sync. |
25 OneClickSigninBubbleGtk(BrowserWindowGtk* browser_window_gtk, | 28 OneClickSigninBubbleGtk( |
26 const base::Closure& learn_more_callback, | 29 BrowserWindowGtk* browser_window_gtk, |
27 const base::Closure& advanced_callback); | 30 const BrowserWindow::StartSyncCallback& start_sync_callback); |
28 | 31 |
29 // BubbleDelegateGtk implementation. | 32 // BubbleDelegateGtk implementation. |
30 virtual void BubbleClosing( | 33 virtual void BubbleClosing( |
31 BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; | 34 BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; |
32 | 35 |
33 void ClickOKForTest(); | 36 private: |
34 void ClickLearnMoreForTest(); | 37 FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleGtkTest, ShowAndOK); |
35 void ClickAdvancedForTest(); | 38 FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleGtkTest, ShowAndUndo); |
| 39 FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleGtkTest, ShowAndClickAdvanced); |
| 40 FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleGtkTest, ShowAndClose); |
36 | 41 |
37 private: | |
38 virtual ~OneClickSigninBubbleGtk(); | 42 virtual ~OneClickSigninBubbleGtk(); |
39 | 43 |
40 CHROMEGTK_CALLBACK_0(OneClickSigninBubbleGtk, void, OnClickLearnMoreLink); | |
41 CHROMEGTK_CALLBACK_0(OneClickSigninBubbleGtk, void, OnClickAdvancedLink); | 44 CHROMEGTK_CALLBACK_0(OneClickSigninBubbleGtk, void, OnClickAdvancedLink); |
42 CHROMEGTK_CALLBACK_0(OneClickSigninBubbleGtk, void, OnClickOK); | 45 CHROMEGTK_CALLBACK_0(OneClickSigninBubbleGtk, void, OnClickOK); |
| 46 CHROMEGTK_CALLBACK_0(OneClickSigninBubbleGtk, void, OnClickUndo); |
43 | 47 |
44 BubbleGtk* bubble_; | 48 BubbleGtk* bubble_; |
45 const base::Closure learn_more_callback_; | 49 |
46 const base::Closure advanced_callback_; | 50 // This callback is nulled once its called, so that it is called only once. |
| 51 // It will be called when the bubble is closed if it has not been called |
| 52 // and nulled earlier. |
| 53 BrowserWindow::StartSyncCallback start_sync_callback_; |
47 | 54 |
48 DISALLOW_COPY_AND_ASSIGN(OneClickSigninBubbleGtk); | 55 DISALLOW_COPY_AND_ASSIGN(OneClickSigninBubbleGtk); |
49 }; | 56 }; |
50 | 57 |
51 #endif // CHROME_BROWSER_UI_GTK_ONE_CLICK_SIGNIN_BUBBLE_GTK_H_ | 58 #endif // CHROME_BROWSER_UI_GTK_ONE_CLICK_SIGNIN_BUBBLE_GTK_H_ |
OLD | NEW |