OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/auto_login_infobar_delegate.h" | 5 #include "chrome/browser/ui/auto_login_infobar_delegate.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.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 "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // If |web_contents| is hosted in a WebDialog, there may be no infobar | 129 // If |web_contents| is hosted in a WebDialog, there may be no infobar |
130 // service. | 130 // service. |
131 InfoBarService* infobar_service = | 131 InfoBarService* infobar_service = |
132 InfoBarService::FromWebContents(web_contents); | 132 InfoBarService::FromWebContents(web_contents); |
133 if (!infobar_service) | 133 if (!infobar_service) |
134 return false; | 134 return false; |
135 | 135 |
136 Profile* profile = | 136 Profile* profile = |
137 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 137 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
138 typedef AutoLoginInfoBarDelegate Delegate; | 138 typedef AutoLoginInfoBarDelegate Delegate; |
139 return !!infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 139 return !!infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
140 scoped_ptr<ConfirmInfoBarDelegate>(new Delegate(params, profile)))); | 140 scoped_ptr<ConfirmInfoBarDelegate>(new Delegate(params, profile)))); |
141 } | 141 } |
142 | 142 |
143 AutoLoginInfoBarDelegate::AutoLoginInfoBarDelegate(const Params& params, | 143 AutoLoginInfoBarDelegate::AutoLoginInfoBarDelegate(const Params& params, |
144 Profile* profile) | 144 Profile* profile) |
145 : ConfirmInfoBarDelegate(), | 145 : ConfirmInfoBarDelegate(), |
146 params_(params), | 146 params_(params), |
147 profile_(profile), | 147 profile_(profile), |
148 button_pressed_(false) { | 148 button_pressed_(false) { |
149 RecordHistogramAction(SHOWN); | 149 RecordHistogramAction(SHOWN); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 RecordHistogramAction(REJECTED); | 222 RecordHistogramAction(REJECTED); |
223 button_pressed_ = true; | 223 button_pressed_ = true; |
224 return true; | 224 return true; |
225 } | 225 } |
226 | 226 |
227 void AutoLoginInfoBarDelegate::GoogleSignedOut( | 227 void AutoLoginInfoBarDelegate::GoogleSignedOut( |
228 const std::string& account_id, | 228 const std::string& account_id, |
229 const std::string& username) { | 229 const std::string& username) { |
230 infobar()->RemoveSelf(); | 230 infobar()->RemoveSelf(); |
231 } | 231 } |
OLD | NEW |