OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/webui/signin/inline_login_handler_impl.h" | 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "content/public/browser/storage_partition.h" | 31 #include "content/public/browser/storage_partition.h" |
32 #include "content/public/browser/web_ui.h" | 32 #include "content/public/browser/web_ui.h" |
33 #include "google_apis/gaia/gaia_auth_fetcher.h" | 33 #include "google_apis/gaia/gaia_auth_fetcher.h" |
34 #include "google_apis/gaia/gaia_auth_util.h" | 34 #include "google_apis/gaia/gaia_auth_util.h" |
35 #include "google_apis/gaia/gaia_constants.h" | 35 #include "google_apis/gaia/gaia_constants.h" |
36 #include "google_apis/gaia/gaia_urls.h" | 36 #include "google_apis/gaia/gaia_urls.h" |
37 #include "net/base/url_util.h" | 37 #include "net/base/url_util.h" |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 class InlineSigninHelper : public SigninOAuthHelper, | 41 class InlineSigninHelper : public SigninOAuthHelper::Consumer { |
42 public SigninOAuthHelper::Consumer { | |
43 public: | 42 public: |
44 InlineSigninHelper( | 43 InlineSigninHelper( |
45 base::WeakPtr<InlineLoginHandlerImpl> handler, | 44 base::WeakPtr<InlineLoginHandlerImpl> handler, |
46 net::URLRequestContextGetter* getter, | 45 net::URLRequestContextGetter* getter, |
47 Profile* profile, | 46 Profile* profile, |
48 const GURL& current_url, | 47 const GURL& current_url, |
49 const std::string& email, | 48 const std::string& email, |
50 const std::string& password, | 49 const std::string& password, |
51 const std::string& session_index, | 50 const std::string& session_index, |
52 const std::string& signin_scoped_device_id, | 51 const std::string& signin_scoped_device_id, |
53 bool choose_what_to_sync); | 52 bool choose_what_to_sync); |
54 | 53 |
55 private: | 54 private: |
56 // Overriden from SigninOAuthHelper::Consumer. | 55 // Overriden from SigninOAuthHelper::Consumer. |
57 virtual void OnSigninOAuthInformationAvailable( | 56 virtual void OnSigninOAuthInformationAvailable( |
58 const std::string& email, | 57 const std::string& email, |
59 const std::string& display_email, | 58 const std::string& display_email, |
60 const std::string& refresh_token) OVERRIDE; | 59 const std::string& refresh_token) OVERRIDE; |
61 virtual void OnSigninOAuthInformationFailure( | 60 virtual void OnSigninOAuthInformationFailure( |
62 const GoogleServiceAuthError& error) OVERRIDE; | 61 const GoogleServiceAuthError& error) OVERRIDE; |
63 | 62 |
| 63 SigninOAuthHelper signin_oauth_helper_; |
64 base::WeakPtr<InlineLoginHandlerImpl> handler_; | 64 base::WeakPtr<InlineLoginHandlerImpl> handler_; |
65 Profile* profile_; | 65 Profile* profile_; |
66 GURL current_url_; | 66 GURL current_url_; |
67 std::string email_; | 67 std::string email_; |
68 std::string password_; | 68 std::string password_; |
69 std::string session_index_; | 69 std::string session_index_; |
70 bool choose_what_to_sync_; | 70 bool choose_what_to_sync_; |
71 | 71 |
72 DISALLOW_COPY_AND_ASSIGN(InlineSigninHelper); | 72 DISALLOW_COPY_AND_ASSIGN(InlineSigninHelper); |
73 }; | 73 }; |
74 | 74 |
75 InlineSigninHelper::InlineSigninHelper( | 75 InlineSigninHelper::InlineSigninHelper( |
76 base::WeakPtr<InlineLoginHandlerImpl> handler, | 76 base::WeakPtr<InlineLoginHandlerImpl> handler, |
77 net::URLRequestContextGetter* getter, | 77 net::URLRequestContextGetter* getter, |
78 Profile* profile, | 78 Profile* profile, |
79 const GURL& current_url, | 79 const GURL& current_url, |
80 const std::string& email, | 80 const std::string& email, |
81 const std::string& password, | 81 const std::string& password, |
82 const std::string& session_index, | 82 const std::string& session_index, |
83 const std::string& signin_scoped_device_id, | 83 const std::string& signin_scoped_device_id, |
84 bool choose_what_to_sync) | 84 bool choose_what_to_sync) |
85 : SigninOAuthHelper(getter, session_index, signin_scoped_device_id, this), | 85 : signin_oauth_helper_(getter, session_index, signin_scoped_device_id, |
| 86 this), |
86 handler_(handler), | 87 handler_(handler), |
87 profile_(profile), | 88 profile_(profile), |
88 current_url_(current_url), | 89 current_url_(current_url), |
89 email_(email), | 90 email_(email), |
90 password_(password), | 91 password_(password), |
91 choose_what_to_sync_(choose_what_to_sync) { | 92 choose_what_to_sync_(choose_what_to_sync) { |
92 DCHECK(profile_); | 93 DCHECK(profile_); |
93 DCHECK(!email_.empty()); | 94 DCHECK(!email_.empty()); |
94 } | 95 } |
95 | 96 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 } | 388 } |
388 } | 389 } |
389 | 390 |
390 if (show_account_management) { | 391 if (show_account_management) { |
391 browser->window()->ShowAvatarBubbleFromAvatarButton( | 392 browser->window()->ShowAvatarBubbleFromAvatarButton( |
392 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 393 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
393 signin::ManageAccountsParams()); | 394 signin::ManageAccountsParams()); |
394 } | 395 } |
395 } | 396 } |
396 } | 397 } |
OLD | NEW |