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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // This class is created by the AutoLoginInfoBarDelegate when the user wishes to | 43 // This class is created by the AutoLoginInfoBarDelegate when the user wishes to |
44 // auto-login. It holds context information needed while re-issuing service | 44 // auto-login. It holds context information needed while re-issuing service |
45 // tokens using the OAuth2TokenService, gets the browser cookies with the | 45 // tokens using the OAuth2TokenService, gets the browser cookies with the |
46 // TokenAuth API, and finally redirects the user to the correct page. | 46 // TokenAuth API, and finally redirects the user to the correct page. |
47 class AutoLoginRedirector : public UbertokenConsumer, | 47 class AutoLoginRedirector : public UbertokenConsumer, |
48 public content::WebContentsObserver { | 48 public content::WebContentsObserver { |
49 public: | 49 public: |
50 AutoLoginRedirector(content::WebContents* web_contents, | 50 AutoLoginRedirector(content::WebContents* web_contents, |
51 const std::string& args); | 51 const std::string& args); |
52 virtual ~AutoLoginRedirector(); | 52 ~AutoLoginRedirector() override; |
53 | 53 |
54 private: | 54 private: |
55 // Overriden from UbertokenConsumer: | 55 // Overriden from UbertokenConsumer: |
56 virtual void OnUbertokenSuccess(const std::string& token) override; | 56 void OnUbertokenSuccess(const std::string& token) override; |
57 virtual void OnUbertokenFailure(const GoogleServiceAuthError& error) override; | 57 void OnUbertokenFailure(const GoogleServiceAuthError& error) override; |
58 | 58 |
59 // Implementation of content::WebContentsObserver | 59 // Implementation of content::WebContentsObserver |
60 virtual void WebContentsDestroyed() override; | 60 void WebContentsDestroyed() override; |
61 | 61 |
62 // Redirect tab to MergeSession URL, logging the user in and navigating | 62 // Redirect tab to MergeSession URL, logging the user in and navigating |
63 // to the desired page. | 63 // to the desired page. |
64 void RedirectToMergeSession(const std::string& token); | 64 void RedirectToMergeSession(const std::string& token); |
65 | 65 |
66 const std::string args_; | 66 const std::string args_; |
67 scoped_ptr<UbertokenFetcher> ubertoken_fetcher_; | 67 scoped_ptr<UbertokenFetcher> ubertoken_fetcher_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(AutoLoginRedirector); | 69 DISALLOW_COPY_AND_ASSIGN(AutoLoginRedirector); |
70 }; | 70 }; |
(...skipping 151 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 |