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

Side by Side Diff: chrome/browser/ui/views/sync/one_click_signin_bubble_view.cc

Issue 22743002: Convert OneClickSigninBubbleViewTest to browser_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove tabs Created 7 years, 3 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/views/sync/one_click_signin_bubble_view.h" 5 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "chrome/browser/google/google_util.h" 10 #include "chrome/browser/google/google_util.h"
(...skipping 28 matching lines...) Expand all
39 // to layout views. 39 // to layout views.
40 enum OneClickSigninBubbleColumnTypes { 40 enum OneClickSigninBubbleColumnTypes {
41 COLUMN_SET_FILL_ALIGN, 41 COLUMN_SET_FILL_ALIGN,
42 COLUMN_SET_CONTROLS, 42 COLUMN_SET_CONTROLS,
43 COLUMN_SET_TITLE_BAR 43 COLUMN_SET_TITLE_BAR
44 }; 44 };
45 } // namespace 45 } // namespace
46 46
47 // static 47 // static
48 OneClickSigninBubbleView* OneClickSigninBubbleView::bubble_view_ = NULL; 48 OneClickSigninBubbleView* OneClickSigninBubbleView::bubble_view_ = NULL;
49 bool OneClickSigninBubbleView::close_on_deactivate_for_testing_ = true;
49 50
50 // static 51 // static
51 void OneClickSigninBubbleView::ShowBubble( 52 void OneClickSigninBubbleView::ShowBubble(
52 BrowserWindow::OneClickSigninBubbleType type, 53 BrowserWindow::OneClickSigninBubbleType type,
53 const string16& email, 54 const string16& email,
54 const string16& error_message, 55 const string16& error_message,
55 scoped_ptr<OneClickSigninBubbleDelegate> delegate, 56 scoped_ptr<OneClickSigninBubbleDelegate> delegate,
56 views::View* anchor_view, 57 views::View* anchor_view,
57 const BrowserWindow::StartSyncCallback& start_sync) { 58 const BrowserWindow::StartSyncCallback& start_sync) {
58 if (IsShowing()) 59 if (IsShowing())
(...skipping 10 matching lines...) Expand all
69 string16(), string16(), delegate.Pass(), 70 string16(), string16(), delegate.Pass(),
70 anchor_view, start_sync, true); 71 anchor_view, start_sync, true);
71 break; 72 break;
72 case BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_SAML_MODAL_DIALOG: 73 case BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_SAML_MODAL_DIALOG:
73 bubble_view_ = new OneClickSigninBubbleView( 74 bubble_view_ = new OneClickSigninBubbleView(
74 string16(), email, delegate.Pass(), 75 string16(), email, delegate.Pass(),
75 anchor_view, start_sync, true); 76 anchor_view, start_sync, true);
76 break; 77 break;
77 } 78 }
78 79
79 views::BubbleDelegateView::CreateBubble(bubble_view_)->Show(); 80 views::BubbleDelegateView::CreateBubble(bubble_view_);
81 bubble_view_->set_close_on_deactivate(close_on_deactivate_for_testing_);
82 bubble_view_->GetWidget()->Show();
80 } 83 }
81 84
82 // static 85 // static
83 bool OneClickSigninBubbleView::IsShowing() { 86 bool OneClickSigninBubbleView::IsShowing() {
84 return bubble_view_ != NULL; 87 return bubble_view_ != NULL;
85 } 88 }
86 89
87 // static 90 // static
88 void OneClickSigninBubbleView::Hide() { 91 void OneClickSigninBubbleView::Hide() {
89 if (IsShowing()) 92 if (IsShowing())
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 // we'll be destroyed asynchronously and the shown state will be checked 401 // we'll be destroyed asynchronously and the shown state will be checked
399 // before then. 402 // before then.
400 DCHECK_EQ(bubble_view_, this); 403 DCHECK_EQ(bubble_view_, this);
401 bubble_view_ = NULL; 404 bubble_view_ = NULL;
402 405
403 if (is_sync_dialog_ && !start_sync_callback_.is_null()) { 406 if (is_sync_dialog_ && !start_sync_callback_.is_null()) {
404 base::ResetAndReturn(&start_sync_callback_).Run( 407 base::ResetAndReturn(&start_sync_callback_).Run(
405 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); 408 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS);
406 } 409 }
407 } 410 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698