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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 // static | 49 // static |
50 OneClickSigninBubbleView* OneClickSigninBubbleView::bubble_view_ = NULL; | 50 OneClickSigninBubbleView* OneClickSigninBubbleView::bubble_view_ = NULL; |
51 | 51 |
52 // static | 52 // static |
53 void OneClickSigninBubbleView::ShowBubble( | 53 void OneClickSigninBubbleView::ShowBubble( |
54 BrowserWindow::OneClickSigninBubbleType type, | 54 BrowserWindow::OneClickSigninBubbleType type, |
55 const base::string16& email, | 55 const base::string16& email, |
56 const base::string16& error_message, | 56 const base::string16& error_message, |
57 scoped_ptr<OneClickSigninBubbleDelegate> delegate, | 57 std::unique_ptr<OneClickSigninBubbleDelegate> delegate, |
58 views::View* anchor_view, | 58 views::View* anchor_view, |
59 const BrowserWindow::StartSyncCallback& start_sync) { | 59 const BrowserWindow::StartSyncCallback& start_sync) { |
60 if (IsShowing()) | 60 if (IsShowing()) |
61 return; | 61 return; |
62 | 62 |
63 switch (type) { | 63 switch (type) { |
64 case BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE: | 64 case BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE: |
65 bubble_view_ = new OneClickSigninBubbleView( | 65 bubble_view_ = new OneClickSigninBubbleView( |
66 error_message, base::string16(), std::move(delegate), anchor_view, | 66 error_message, base::string16(), std::move(delegate), anchor_view, |
67 start_sync, false); | 67 start_sync, false); |
(...skipping 20 matching lines...) Expand all Loading... |
88 | 88 |
89 // static | 89 // static |
90 void OneClickSigninBubbleView::Hide() { | 90 void OneClickSigninBubbleView::Hide() { |
91 if (IsShowing()) | 91 if (IsShowing()) |
92 bubble_view_->GetWidget()->Close(); | 92 bubble_view_->GetWidget()->Close(); |
93 } | 93 } |
94 | 94 |
95 OneClickSigninBubbleView::OneClickSigninBubbleView( | 95 OneClickSigninBubbleView::OneClickSigninBubbleView( |
96 const base::string16& error_message, | 96 const base::string16& error_message, |
97 const base::string16& email, | 97 const base::string16& email, |
98 scoped_ptr<OneClickSigninBubbleDelegate> delegate, | 98 std::unique_ptr<OneClickSigninBubbleDelegate> delegate, |
99 views::View* anchor_view, | 99 views::View* anchor_view, |
100 const BrowserWindow::StartSyncCallback& start_sync_callback, | 100 const BrowserWindow::StartSyncCallback& start_sync_callback, |
101 bool is_sync_dialog) | 101 bool is_sync_dialog) |
102 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), | 102 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
103 delegate_(std::move(delegate)), | 103 delegate_(std::move(delegate)), |
104 error_message_(error_message), | 104 error_message_(error_message), |
105 email_(email), | 105 email_(email), |
106 start_sync_callback_(start_sync_callback), | 106 start_sync_callback_(start_sync_callback), |
107 is_sync_dialog_(is_sync_dialog), | 107 is_sync_dialog_(is_sync_dialog), |
108 advanced_link_(NULL), | 108 advanced_link_(NULL), |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 // we'll be destroyed asynchronously and the shown state will be checked | 408 // we'll be destroyed asynchronously and the shown state will be checked |
409 // before then. | 409 // before then. |
410 DCHECK_EQ(bubble_view_, this); | 410 DCHECK_EQ(bubble_view_, this); |
411 bubble_view_ = NULL; | 411 bubble_view_ = NULL; |
412 | 412 |
413 if (is_sync_dialog_ && !start_sync_callback_.is_null()) { | 413 if (is_sync_dialog_ && !start_sync_callback_.is_null()) { |
414 base::ResetAndReturn(&start_sync_callback_).Run( | 414 base::ResetAndReturn(&start_sync_callback_).Run( |
415 OneClickSigninSyncStarter::UNDO_SYNC); | 415 OneClickSigninSyncStarter::UNDO_SYNC); |
416 } | 416 } |
417 } | 417 } |
OLD | NEW |