OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_GTK_ONE_CLICK_SIGNIN_BUBBLE_GTK_H_ | |
6 #define CHROME_BROWSER_UI_GTK_ONE_CLICK_SIGNIN_BUBBLE_GTK_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/callback.h" | |
10 #include "base/compiler_specific.h" | |
11 #include "base/gtest_prod_util.h" | |
12 #include "chrome/browser/ui/browser_window.h" | |
13 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | |
14 | |
15 typedef struct _GtkWidget GtkWidget; | |
16 typedef struct _GtkWindow GtkWindow; | |
17 | |
18 class BrowserWindowGtk; | |
19 class CustomDrawButton; | |
20 | |
21 // Displays the one-click signin confirmation bubble (before syncing | |
22 // has started). | |
23 class OneClickSigninBubbleGtk : public BubbleDelegateGtk { | |
24 public: | |
25 // Deletes self on close. The given callback will be called if the | |
26 // user decides to start sync. | |
27 OneClickSigninBubbleGtk( | |
28 BrowserWindowGtk* browser_window_gtk, | |
29 BrowserWindow::OneClickSigninBubbleType type, | |
30 const base::string16& email, | |
31 const base::string16& error_message, | |
32 const BrowserWindow::StartSyncCallback& start_sync_callback); | |
33 | |
34 // BubbleDelegateGtk implementation. | |
35 virtual void BubbleClosing( | |
36 BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; | |
37 | |
38 private: | |
39 FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleGtkTest, DialogShowAndOK); | |
40 FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleGtkTest, DialogShowAndUndo); | |
41 FRIEND_TEST_ALL_PREFIXES( | |
42 OneClickSigninBubbleGtkTest, DialogShowAndClickAdvanced); | |
43 FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleGtkTest, DialogShowAndClose); | |
44 FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleGtkTest, BubbleShowAndOK); | |
45 FRIEND_TEST_ALL_PREFIXES( | |
46 OneClickSigninBubbleGtkTest, BubbleShowAndClickAdvanced); | |
47 FRIEND_TEST_ALL_PREFIXES(OneClickSigninBubbleGtkTest, BubbleShowAndClose); | |
48 | |
49 virtual ~OneClickSigninBubbleGtk(); | |
50 | |
51 void InitializeWidgets(BrowserWindowGtk* window); | |
52 GtkWidget* LayoutWidgets(); | |
53 void ShowWidget(BrowserWindowGtk* browser_window_gtk, | |
54 GtkWidget* content_widget); | |
55 | |
56 CHROMEGTK_CALLBACK_0(OneClickSigninBubbleGtk, void, OnClickAdvancedLink); | |
57 CHROMEGTK_CALLBACK_0(OneClickSigninBubbleGtk, void, OnClickOK); | |
58 CHROMEGTK_CALLBACK_0(OneClickSigninBubbleGtk, void, OnClickUndo); | |
59 CHROMEGTK_CALLBACK_0(OneClickSigninBubbleGtk, void, OnClickLearnMoreLink); | |
60 CHROMEGTK_CALLBACK_0(OneClickSigninBubbleGtk, void, OnClickCloseButton); | |
61 | |
62 BubbleGtk* bubble_; | |
63 | |
64 // The user's email address to be used for sync. | |
65 const base::string16 email_; | |
66 | |
67 // Alternate error message to be displayed. | |
68 const base::string16 error_message_; | |
69 | |
70 // This callback is nulled once its called, so that it is called only once. | |
71 // It will be called when the bubble is closed if it has not been called | |
72 // and nulled earlier. | |
73 BrowserWindow::StartSyncCallback start_sync_callback_; | |
74 | |
75 bool is_sync_dialog_; | |
76 | |
77 GtkWidget* message_label_; | |
78 GtkWidget* advanced_link_; | |
79 GtkWidget* ok_button_; | |
80 GtkWidget* undo_button_; | |
81 | |
82 // These widgets are only used in the modal dialog, and not in the bubble. | |
83 GtkWidget* learn_more_; | |
84 GtkWidget* header_label_; | |
85 scoped_ptr<CustomDrawButton> close_button_; | |
86 | |
87 bool clicked_learn_more_; | |
88 | |
89 DISALLOW_COPY_AND_ASSIGN(OneClickSigninBubbleGtk); | |
90 }; | |
91 | |
92 #endif // CHROME_BROWSER_UI_GTK_ONE_CLICK_SIGNIN_BUBBLE_GTK_H_ | |
OLD | NEW |