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

Side by Side Diff: chrome/browser/ui/gtk/one_click_signin_bubble_gtk.cc

Issue 14258007: GTK: Display a native bubble (instead of the JS one) after the web signin flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ntpBubble
Patch Set: Rebase with master Created 7 years, 7 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
OLDNEW
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 #include "chrome/browser/ui/gtk/one_click_signin_bubble_gtk.h" 5 #include "chrome/browser/ui/gtk/one_click_signin_bubble_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 14 matching lines...) Expand all
25 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
26 #include "ui/base/gtk/gtk_hig_constants.h" 26 #include "ui/base/gtk/gtk_hig_constants.h"
27 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
28 28
29 static const int kModalDialogMessageWidth = 400; 29 static const int kModalDialogMessageWidth = 400;
30 30
31 OneClickSigninBubbleGtk::OneClickSigninBubbleGtk( 31 OneClickSigninBubbleGtk::OneClickSigninBubbleGtk(
32 BrowserWindowGtk* browser_window_gtk, 32 BrowserWindowGtk* browser_window_gtk,
33 BrowserWindow::OneClickSigninBubbleType type, 33 BrowserWindow::OneClickSigninBubbleType type,
34 const string16& email, 34 const string16& email,
35 const string16& error_message,
35 const BrowserWindow::StartSyncCallback& start_sync_callback) 36 const BrowserWindow::StartSyncCallback& start_sync_callback)
36 : bubble_(NULL), 37 : bubble_(NULL),
38 email_(email),
39 error_message_(error_message),
37 start_sync_callback_(start_sync_callback), 40 start_sync_callback_(start_sync_callback),
38 is_modal_(type != BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE), 41 is_sync_dialog_(type!=BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE),
39 email_(email),
40 message_label_(NULL), 42 message_label_(NULL),
41 advanced_link_(NULL), 43 advanced_link_(NULL),
42 ok_button_(NULL), 44 ok_button_(NULL),
43 undo_button_(NULL), 45 undo_button_(NULL),
44 learn_more_(NULL), 46 learn_more_(NULL),
45 header_label_(NULL), 47 header_label_(NULL),
46 clicked_learn_more_(false) { 48 clicked_learn_more_(false) {
47 InitializeWidgets(browser_window_gtk); 49 InitializeWidgets(browser_window_gtk);
48 ShowWidget(browser_window_gtk, LayoutWidgets()); 50 ShowWidget(browser_window_gtk, LayoutWidgets());
49 } 51 }
50 52
51 void OneClickSigninBubbleGtk::BubbleClosing( 53 void OneClickSigninBubbleGtk::BubbleClosing(
52 BubbleGtk* bubble, bool closed_by_escape) { 54 BubbleGtk* bubble, bool closed_by_escape) {
53 if (!start_sync_callback_.is_null()) { 55 if (is_sync_dialog_ && !start_sync_callback_.is_null()) {
54 base::ResetAndReturn(&start_sync_callback_).Run( 56 base::ResetAndReturn(&start_sync_callback_).Run(
55 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); 57 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS);
56 } 58 }
57 59
58 // The bubble needs to close and remove the widgets from the window before 60 // The bubble needs to close and remove the widgets from the window before
59 // |close_button_| (which is a CustomDrawButton) can be destroyed, because it 61 // |close_button_| (which is a CustomDrawButton) can be destroyed, because it
60 // depends on all references being cleared for the GtkWidget before it is 62 // depends on all references being cleared for the GtkWidget before it is
61 // destroyed. 63 // destroyed.
62 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, close_button_.release()); 64 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, close_button_.release());
63 65
64 delete this; 66 delete this;
65 } 67 }
66 68
67 void OneClickSigninBubbleGtk::OnClickAdvancedLink(GtkWidget* link) { 69 void OneClickSigninBubbleGtk::OnClickAdvancedLink(GtkWidget* link) {
68 OneClickSigninHelper::LogConfirmHistogramValue( 70 if (is_sync_dialog_) {
71 OneClickSigninHelper::LogConfirmHistogramValue(
69 clicked_learn_more_ ? 72 clicked_learn_more_ ?
70 one_click_signin::HISTOGRAM_CONFIRM_LEARN_MORE_ADVANCED : 73 one_click_signin::HISTOGRAM_CONFIRM_LEARN_MORE_ADVANCED :
71 one_click_signin::HISTOGRAM_CONFIRM_ADVANCED); 74 one_click_signin::HISTOGRAM_CONFIRM_ADVANCED);
72 base::ResetAndReturn(&start_sync_callback_).Run( 75
76 base::ResetAndReturn(&start_sync_callback_).Run(
73 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); 77 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST);
78 } else {
79 Browser* browser = chrome::FindBrowserWithWindow(
80 gtk_window_get_transient_for(bubble_->GetNativeWindow()));
81 DCHECK(browser);
82 chrome::NavigateParams params(browser, GURL(chrome::kChromeUISettingsURL),
83 content::PAGE_TRANSITION_LINK);
84 params.disposition = CURRENT_TAB;
85 chrome::Navigate(&params);
86 }
74 bubble_->Close(); 87 bubble_->Close();
75 } 88 }
76 89
77 void OneClickSigninBubbleGtk::OnClickOK(GtkWidget* link) { 90 void OneClickSigninBubbleGtk::OnClickOK(GtkWidget* link) {
78 OneClickSigninHelper::LogConfirmHistogramValue( 91 if (is_sync_dialog_) {
92 OneClickSigninHelper::LogConfirmHistogramValue(
79 clicked_learn_more_ ? 93 clicked_learn_more_ ?
80 one_click_signin::HISTOGRAM_CONFIRM_LEARN_MORE_OK : 94 one_click_signin::HISTOGRAM_CONFIRM_LEARN_MORE_OK :
81 one_click_signin::HISTOGRAM_CONFIRM_OK); 95 one_click_signin::HISTOGRAM_CONFIRM_OK);
82 96
83 base::ResetAndReturn(&start_sync_callback_).Run( 97 base::ResetAndReturn(&start_sync_callback_).Run(
84 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); 98 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS);
99 }
85 bubble_->Close(); 100 bubble_->Close();
86 } 101 }
87 102
88 void OneClickSigninBubbleGtk::OnClickUndo(GtkWidget* link) { 103 void OneClickSigninBubbleGtk::OnClickUndo(GtkWidget* link) {
89 OneClickSigninHelper::LogConfirmHistogramValue( 104 if (is_sync_dialog_) {
105 OneClickSigninHelper::LogConfirmHistogramValue(
90 clicked_learn_more_ ? 106 clicked_learn_more_ ?
91 one_click_signin::HISTOGRAM_CONFIRM_LEARN_MORE_UNDO : 107 one_click_signin::HISTOGRAM_CONFIRM_LEARN_MORE_UNDO :
92 one_click_signin::HISTOGRAM_CONFIRM_UNDO); 108 one_click_signin::HISTOGRAM_CONFIRM_UNDO);
93 109
94 base::ResetAndReturn(&start_sync_callback_).Run( 110 base::ResetAndReturn(&start_sync_callback_).Run(
95 OneClickSigninSyncStarter::UNDO_SYNC); 111 OneClickSigninSyncStarter::UNDO_SYNC);
112 }
96 bubble_->Close(); 113 bubble_->Close();
97 } 114 }
98 115
99 void OneClickSigninBubbleGtk::OnClickLearnMoreLink(GtkWidget* link) { 116 void OneClickSigninBubbleGtk::OnClickLearnMoreLink(GtkWidget* link) {
100 // We only want to log the Learn More click once per bubble instance. 117 // We only want to log the Learn More click once per modal dialog instance.
101 if (!clicked_learn_more_) { 118 if (is_sync_dialog_ && !clicked_learn_more_) {
102 OneClickSigninHelper::LogConfirmHistogramValue( 119 OneClickSigninHelper::LogConfirmHistogramValue(
103 one_click_signin::HISTOGRAM_CONFIRM_LEARN_MORE); 120 one_click_signin::HISTOGRAM_CONFIRM_LEARN_MORE);
104 clicked_learn_more_ = true; 121 clicked_learn_more_ = true;
105 } 122 }
106 Browser* browser = chrome::FindBrowserWithWindow( 123 Browser* browser = chrome::FindBrowserWithWindow(
107 gtk_window_get_transient_for(bubble_->GetNativeWindow())); 124 gtk_window_get_transient_for(bubble_->GetNativeWindow()));
108 DCHECK(browser); 125 DCHECK(browser);
109 chrome::NavigateParams params(browser, GURL(chrome::kChromeSyncLearnMoreURL), 126 chrome::NavigateParams params(browser, GURL(chrome::kChromeSyncLearnMoreURL),
110 content::PAGE_TRANSITION_LINK); 127 content::PAGE_TRANSITION_LINK);
111 params.disposition = NEW_WINDOW; 128 params.disposition = NEW_WINDOW;
112 chrome::Navigate(&params); 129 chrome::Navigate(&params);
130
131 if (!is_sync_dialog_) {
132 bubble_->Close();
133 }
113 } 134 }
114 135
115 void OneClickSigninBubbleGtk::OnClickCloseButton(GtkWidget* button) { 136 void OneClickSigninBubbleGtk::OnClickCloseButton(GtkWidget* button) {
116 OneClickSigninHelper::LogConfirmHistogramValue( 137 OneClickSigninHelper::LogConfirmHistogramValue(
117 clicked_learn_more_ ? 138 clicked_learn_more_ ?
118 one_click_signin::HISTOGRAM_CONFIRM_LEARN_MORE_CLOSE : 139 one_click_signin::HISTOGRAM_CONFIRM_LEARN_MORE_CLOSE :
119 one_click_signin::HISTOGRAM_CONFIRM_CLOSE); 140 one_click_signin::HISTOGRAM_CONFIRM_CLOSE);
120 start_sync_callback_.Reset(); 141 start_sync_callback_.Reset();
121 bubble_->Close(); 142 bubble_->Close();
122 } 143 }
123 144
124 OneClickSigninBubbleGtk::~OneClickSigninBubbleGtk() { 145 OneClickSigninBubbleGtk::~OneClickSigninBubbleGtk() {
125 } 146 }
126 147
127 void OneClickSigninBubbleGtk::InitializeWidgets( 148 void OneClickSigninBubbleGtk::InitializeWidgets(
128 BrowserWindowGtk* browser_window_gtk) { 149 BrowserWindowGtk* browser_window_gtk) {
129 // Message. 150 // Main dialog/bubble message.
130 std::string message; 151 std::string label_text;
131 if (is_modal_) { 152 if (is_sync_dialog_) {
132 message = email_.empty() ? 153 label_text = email_.empty() ?
133 l10n_util::GetStringUTF8(IDS_ONE_CLICK_SIGNIN_DIALOG_MESSAGE) : 154 l10n_util::GetStringUTF8(IDS_ONE_CLICK_SIGNIN_DIALOG_MESSAGE) :
134 l10n_util::GetStringFUTF8(IDS_ONE_CLICK_SIGNIN_DIALOG_MESSAGE_NEW, 155 l10n_util::GetStringFUTF8(IDS_ONE_CLICK_SIGNIN_DIALOG_MESSAGE_NEW,
135 email_); 156 email_);
136 } else { 157 } else {
137 message = l10n_util::GetStringUTF8(IDS_ONE_CLICK_SIGNIN_BUBBLE_MESSAGE); 158 label_text = !error_message_.empty() ? UTF16ToUTF8(error_message_):
159 l10n_util::GetStringUTF8(IDS_ONE_CLICK_SIGNIN_BUBBLE_MESSAGE);
138 } 160 }
139 161
140 message_label_ = gtk_label_new(message.c_str()); 162 message_label_ = gtk_label_new(label_text.c_str());
141 gtk_label_set_line_wrap(GTK_LABEL(message_label_), TRUE); 163 gtk_label_set_line_wrap(GTK_LABEL(message_label_), TRUE);
142 gtk_misc_set_alignment(GTK_MISC(message_label_), 0.0, 0.5); 164 gtk_misc_set_alignment(GTK_MISC(message_label_), 0.0, 0.5);
143 if (is_modal_) 165 if (is_sync_dialog_)
144 gtk_widget_set_size_request(message_label_, kModalDialogMessageWidth, -1); 166 gtk_widget_set_size_request(message_label_, kModalDialogMessageWidth, -1);
145 167
146 GtkThemeService* const theme_provider = GtkThemeService::GetFrom( 168 GtkThemeService* const theme_provider = GtkThemeService::GetFrom(
147 browser_window_gtk->browser()->profile()); 169 browser_window_gtk->browser()->profile());
148 170
149 // Advanced link. 171 // Advanced link.
150 advanced_link_ = theme_provider->BuildChromeLinkButton( 172 advanced_link_ = theme_provider->BuildChromeLinkButton(
151 l10n_util::GetStringUTF8( 173 l10n_util::GetStringUTF8(
152 is_modal_ ? IDS_ONE_CLICK_SIGNIN_DIALOG_ADVANCED : 174 IDS_ONE_CLICK_SIGNIN_DIALOG_ADVANCED));
153 IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED));
154 g_signal_connect(advanced_link_, "clicked", 175 g_signal_connect(advanced_link_, "clicked",
155 G_CALLBACK(OnClickAdvancedLinkThunk), this); 176 G_CALLBACK(OnClickAdvancedLinkThunk), this);
156 177
178 // The 'Learn More...' link
179 learn_more_ = theme_provider->BuildChromeLinkButton(
180 l10n_util::GetStringUTF8(IDS_LEARN_MORE));
181 g_signal_connect(learn_more_, "clicked",
182 G_CALLBACK(OnClickLearnMoreLinkThunk), this);
183
157 // Make the OK and Undo buttons the same size horizontally. 184 // Make the OK and Undo buttons the same size horizontally.
158 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); 185 GtkSizeGroup* size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
159 // OK Button. 186 // OK Button.
160 ok_button_ = gtk_button_new_with_label(l10n_util::GetStringUTF8( 187 ok_button_ = gtk_button_new_with_label(l10n_util::GetStringUTF8(
161 is_modal_ ? IDS_ONE_CLICK_SIGNIN_DIALOG_OK_BUTTON : IDS_OK).c_str()); 188 is_sync_dialog_ ? IDS_ONE_CLICK_SIGNIN_DIALOG_OK_BUTTON :
189 IDS_OK).c_str());
162 g_signal_connect(ok_button_, "clicked", 190 g_signal_connect(ok_button_, "clicked",
163 G_CALLBACK(OnClickOKThunk), this); 191 G_CALLBACK(OnClickOKThunk), this);
164 gtk_size_group_add_widget(size_group, ok_button_); 192 gtk_size_group_add_widget(size_group, ok_button_);
165 193
166 // Undo Button. 194 if (!is_sync_dialog_)
195 return;
196
197 // The undo button is only in the modal dialog
167 undo_button_ = gtk_button_new_with_label(l10n_util::GetStringUTF8( 198 undo_button_ = gtk_button_new_with_label(l10n_util::GetStringUTF8(
168 is_modal_? IDS_ONE_CLICK_SIGNIN_DIALOG_UNDO_BUTTON : 199 IDS_ONE_CLICK_SIGNIN_DIALOG_UNDO_BUTTON).c_str());
169 IDS_ONE_CLICK_BUBBLE_UNDO).c_str());
170 g_signal_connect(undo_button_, "clicked", 200 g_signal_connect(undo_button_, "clicked",
171 G_CALLBACK(OnClickUndoThunk), this); 201 G_CALLBACK(OnClickUndoThunk), this);
172 gtk_size_group_add_widget(size_group, undo_button_); 202 gtk_size_group_add_widget(size_group, undo_button_);
173 203
174 g_object_unref(size_group); 204 g_object_unref(size_group);
175 205
176 if (!is_modal_)
177 return;
178
179 // The close button and the 'Learn More...' link are only in the modal dialog.
180 learn_more_ = theme_provider->BuildChromeLinkButton(
181 l10n_util::GetStringUTF8(IDS_LEARN_MORE));
182 g_signal_connect(learn_more_, "clicked",
183 G_CALLBACK(OnClickLearnMoreLinkThunk), this);
184
185 header_label_ = theme_provider->BuildLabel(email_.empty() ? 206 header_label_ = theme_provider->BuildLabel(email_.empty() ?
186 l10n_util::GetStringUTF8(IDS_ONE_CLICK_SIGNIN_DIALOG_TITLE) : 207 l10n_util::GetStringUTF8(IDS_ONE_CLICK_SIGNIN_DIALOG_TITLE) :
187 l10n_util::GetStringFUTF8(IDS_ONE_CLICK_SIGNIN_DIALOG_TITLE_NEW, email_), 208 l10n_util::GetStringFUTF8(IDS_ONE_CLICK_SIGNIN_DIALOG_TITLE_NEW, email_),
188 ui::kGdkBlack); 209 ui::kGdkBlack);
189 210
190 PangoAttrList* attributes = pango_attr_list_new(); 211 PangoAttrList* attributes = pango_attr_list_new();
191 pango_attr_list_insert(attributes, 212 pango_attr_list_insert(attributes,
192 pango_attr_weight_new(PANGO_WEIGHT_BOLD)); 213 pango_attr_weight_new(PANGO_WEIGHT_BOLD));
193 gtk_label_set_attributes(GTK_LABEL(header_label_), attributes); 214 gtk_label_set_attributes(GTK_LABEL(header_label_), attributes);
194 pango_attr_list_unref(attributes); 215 pango_attr_list_unref(attributes);
(...skipping 15 matching lines...) Expand all
210 close_button_->widget(), FALSE, FALSE, 0); 231 close_button_->widget(), FALSE, FALSE, 0);
211 gtk_box_pack_start(GTK_BOX(content_widget), 232 gtk_box_pack_start(GTK_BOX(content_widget),
212 top_line, FALSE, FALSE, 0); 233 top_line, FALSE, FALSE, 0);
213 } 234 }
214 235
215 gtk_box_pack_start(GTK_BOX(content_widget), 236 gtk_box_pack_start(GTK_BOX(content_widget),
216 message_label_, FALSE, FALSE, 0); 237 message_label_, FALSE, FALSE, 0);
217 238
218 if (learn_more_) { 239 if (learn_more_) {
219 GtkWidget* box = gtk_hbox_new(FALSE, ui::kControlSpacing); 240 GtkWidget* box = gtk_hbox_new(FALSE, ui::kControlSpacing);
220 gtk_box_pack_end(GTK_BOX(box), 241 if (is_sync_dialog_){
242 gtk_box_pack_end(GTK_BOX(box),
221 learn_more_, FALSE, FALSE, 0); 243 learn_more_, FALSE, FALSE, 0);
244 } else {
245 gtk_box_pack_start(GTK_BOX(box),
246 learn_more_, FALSE, FALSE, 0);
247 }
222 gtk_box_pack_start(GTK_BOX(content_widget), 248 gtk_box_pack_start(GTK_BOX(content_widget),
223 box, TRUE, TRUE, 0); 249 box, TRUE, TRUE, 0);
224 } 250 }
225 251
226 GtkWidget* bottom_line = gtk_hbox_new(FALSE, ui::kControlSpacing); 252 GtkWidget* bottom_line = gtk_hbox_new(FALSE, ui::kControlSpacing);
227 gtk_box_pack_start(GTK_BOX(content_widget), 253 gtk_box_pack_start(GTK_BOX(content_widget),
228 bottom_line, FALSE, FALSE, 0); 254 bottom_line, FALSE, FALSE, 0);
229 255
230 gtk_box_pack_start(GTK_BOX(bottom_line), 256 gtk_box_pack_start(GTK_BOX(bottom_line),
231 advanced_link_, FALSE, FALSE, 0); 257 advanced_link_, FALSE, FALSE, 0);
232 gtk_box_pack_end(GTK_BOX(bottom_line), 258 gtk_box_pack_end(GTK_BOX(bottom_line),
233 ok_button_, FALSE, FALSE, 0); 259 ok_button_, FALSE, FALSE, 0);
234 gtk_box_pack_end(GTK_BOX(bottom_line), 260
235 undo_button_, FALSE, FALSE, 0); 261 if (is_sync_dialog_) {
262 gtk_box_pack_end(GTK_BOX(bottom_line),
263 undo_button_, FALSE, FALSE, 0);
264 }
236 return content_widget; 265 return content_widget;
237 } 266 }
238 267
239 void OneClickSigninBubbleGtk::ShowWidget(BrowserWindowGtk* browser_window_gtk, 268 void OneClickSigninBubbleGtk::ShowWidget(BrowserWindowGtk* browser_window_gtk,
240 GtkWidget* content_widget) { 269 GtkWidget* content_widget) {
241 OneClickSigninHelper::LogConfirmHistogramValue( 270 if (is_sync_dialog_) {
242 one_click_signin::HISTOGRAM_CONFIRM_SHOWN); 271 OneClickSigninHelper::LogConfirmHistogramValue(
272 one_click_signin::HISTOGRAM_CONFIRM_SHOWN);
273 }
274
243 GtkThemeService* const theme_provider = GtkThemeService::GetFrom( 275 GtkThemeService* const theme_provider = GtkThemeService::GetFrom(
244 browser_window_gtk->browser()->profile()); 276 browser_window_gtk->browser()->profile());
245 277
246 GtkWidget* parent_widget = is_modal_ ? 278 GtkWidget* parent_widget = is_sync_dialog_ ?
247 browser_window_gtk->GetToolbar()->widget() : 279 browser_window_gtk->GetToolbar()->widget() :
248 browser_window_gtk->GetToolbar()->GetAppMenuButton(); 280 browser_window_gtk->GetToolbar()->GetAppMenuButton();
249 gfx::Rect bounds = gtk_util::WidgetBounds(parent_widget); 281 gfx::Rect bounds = gtk_util::WidgetBounds(parent_widget);
250 int flags = (is_modal_ ? BubbleGtk::NO_ACCELERATORS : BubbleGtk::GRAB_INPUT) | 282 int flags = (is_sync_dialog_ ? BubbleGtk::NO_ACCELERATORS :
251 BubbleGtk::MATCH_SYSTEM_THEME | 283 BubbleGtk::GRAB_INPUT) |
252 BubbleGtk::POPUP_WINDOW; 284 BubbleGtk::MATCH_SYSTEM_THEME |
285 BubbleGtk::POPUP_WINDOW;
253 bubble_ = BubbleGtk::Show(parent_widget, &bounds, content_widget, 286 bubble_ = BubbleGtk::Show(parent_widget, &bounds, content_widget,
254 is_modal_ ? BubbleGtk::CENTER_OVER_RECT : 287 is_sync_dialog_ ? BubbleGtk::CENTER_OVER_RECT :
255 BubbleGtk::ANCHOR_TOP_RIGHT, 288 BubbleGtk::ANCHOR_TOP_RIGHT,
256 flags, 289 flags,
257 theme_provider, this); 290 theme_provider, this);
258 if (is_modal_) { 291
259 gtk_window_set_transient_for(bubble_->GetNativeWindow(), 292 gtk_window_set_transient_for(bubble_->GetNativeWindow(),
260 browser_window_gtk->GetNativeWindow()); 293 browser_window_gtk->GetNativeWindow());
294 if (is_sync_dialog_) {
261 gtk_window_set_modal(bubble_->GetNativeWindow(), true); 295 gtk_window_set_modal(bubble_->GetNativeWindow(), true);
262 gtk_window_set_focus(bubble_->GetNativeWindow(), ok_button_); 296 gtk_window_set_focus(bubble_->GetNativeWindow(), ok_button_);
263 } else { 297 } else {
264 gtk_widget_grab_focus(ok_button_); 298 gtk_widget_grab_focus(ok_button_);
265 } 299 }
266 } 300 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/one_click_signin_bubble_gtk.h ('k') | chrome/browser/ui/gtk/one_click_signin_bubble_gtk_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698