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 #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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |