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/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.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 AutoLoginRedirector::~AutoLoginRedirector() { | 102 AutoLoginRedirector::~AutoLoginRedirector() { |
103 } | 103 } |
104 | 104 |
105 void AutoLoginRedirector::Observe(int type, | 105 void AutoLoginRedirector::Observe(int type, |
106 const NotificationSource& source, | 106 const NotificationSource& source, |
107 const NotificationDetails& details) { | 107 const NotificationDetails& details) { |
108 DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED); | 108 DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED); |
109 // The WebContents that started this has been destroyed. The request must be | 109 // The WebContents that started this has been destroyed. The request must be |
110 // cancelled and this object must be deleted. | 110 // cancelled and this object must be deleted. |
111 ubertoken_fetcher_.reset(); | 111 ubertoken_fetcher_.reset(); |
112 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 112 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
113 } | 113 } |
114 | 114 |
115 void AutoLoginRedirector::OnUbertokenSuccess(const std::string& token) { | 115 void AutoLoginRedirector::OnUbertokenSuccess(const std::string& token) { |
116 RedirectToMergeSession(token); | 116 RedirectToMergeSession(token); |
117 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 117 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
118 } | 118 } |
119 | 119 |
120 void AutoLoginRedirector::OnUbertokenFailure( | 120 void AutoLoginRedirector::OnUbertokenFailure( |
121 const GoogleServiceAuthError& error) { | 121 const GoogleServiceAuthError& error) { |
122 LOG(WARNING) << "AutoLoginRedirector: token request failed"; | 122 LOG(WARNING) << "AutoLoginRedirector: token request failed"; |
123 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 123 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
124 } | 124 } |
125 | 125 |
126 void AutoLoginRedirector::RedirectToMergeSession(const std::string& token) { | 126 void AutoLoginRedirector::RedirectToMergeSession(const std::string& token) { |
127 // TODO(rogerta): what is the correct page transition? | 127 // TODO(rogerta): what is the correct page transition? |
128 navigation_controller_->LoadURL( | 128 navigation_controller_->LoadURL( |
129 GURL(GaiaUrls::GetInstance()->merge_session_url() + | 129 GURL(GaiaUrls::GetInstance()->merge_session_url() + |
130 "?source=chrome&uberauth=" + token + "&" + args_), | 130 "?source=chrome&uberauth=" + token + "&" + args_), |
131 content::Referrer(), content::PAGE_TRANSITION_AUTO_BOOKMARK, | 131 content::Referrer(), content::PAGE_TRANSITION_AUTO_BOOKMARK, |
132 std::string()); | 132 std::string()); |
133 } | 133 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 DCHECK_EQ(chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, type); | 228 DCHECK_EQ(chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, type); |
229 // owner() can be NULL when InfoBarService removes us. See | 229 // owner() can be NULL when InfoBarService removes us. See |
230 // |InfoBarDelegate::clear_owner|. | 230 // |InfoBarDelegate::clear_owner|. |
231 if (owner()) | 231 if (owner()) |
232 owner()->RemoveInfoBar(this); | 232 owner()->RemoveInfoBar(this); |
233 } | 233 } |
234 | 234 |
235 void AutoLoginInfoBarDelegate::RecordHistogramAction(Actions action) { | 235 void AutoLoginInfoBarDelegate::RecordHistogramAction(Actions action) { |
236 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Regular", action, HISTOGRAM_MAX); | 236 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Regular", action, HISTOGRAM_MAX); |
237 } | 237 } |
OLD | NEW |