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::Consumer { | 41 class InlineSigninHelper : public SigninOAuthHelper, |
| 42 public SigninOAuthHelper::Consumer { |
42 public: | 43 public: |
43 InlineSigninHelper( | 44 InlineSigninHelper( |
44 base::WeakPtr<InlineLoginHandlerImpl> handler, | 45 base::WeakPtr<InlineLoginHandlerImpl> handler, |
45 net::URLRequestContextGetter* getter, | 46 net::URLRequestContextGetter* getter, |
46 Profile* profile, | 47 Profile* profile, |
47 const GURL& current_url, | 48 const GURL& current_url, |
48 const std::string& email, | 49 const std::string& email, |
49 const std::string& password, | 50 const std::string& password, |
50 const std::string& session_index, | 51 const std::string& session_index, |
51 const std::string& signin_scoped_device_id, | 52 const std::string& signin_scoped_device_id, |
52 bool choose_what_to_sync); | 53 bool choose_what_to_sync); |
53 | 54 |
54 private: | 55 private: |
55 // Overriden from SigninOAuthHelper::Consumer. | 56 // Overriden from SigninOAuthHelper::Consumer. |
56 virtual void OnSigninOAuthInformationAvailable( | 57 virtual void OnSigninOAuthInformationAvailable( |
57 const std::string& email, | 58 const std::string& email, |
58 const std::string& display_email, | 59 const std::string& display_email, |
59 const std::string& refresh_token) OVERRIDE; | 60 const std::string& refresh_token) OVERRIDE; |
60 virtual void OnSigninOAuthInformationFailure( | 61 virtual void OnSigninOAuthInformationFailure( |
61 const GoogleServiceAuthError& error) OVERRIDE; | 62 const GoogleServiceAuthError& error) OVERRIDE; |
62 | 63 |
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 : signin_oauth_helper_(getter, session_index, signin_scoped_device_id, | 85 : SigninOAuthHelper(getter, session_index, signin_scoped_device_id, this), |
86 this), | |
87 handler_(handler), | 86 handler_(handler), |
88 profile_(profile), | 87 profile_(profile), |
89 current_url_(current_url), | 88 current_url_(current_url), |
90 email_(email), | 89 email_(email), |
91 password_(password), | 90 password_(password), |
92 choose_what_to_sync_(choose_what_to_sync) { | 91 choose_what_to_sync_(choose_what_to_sync) { |
93 DCHECK(profile_); | 92 DCHECK(profile_); |
94 DCHECK(!email_.empty()); | 93 DCHECK(!email_.empty()); |
95 } | 94 } |
96 | 95 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 } | 387 } |
389 } | 388 } |
390 | 389 |
391 if (show_account_management) { | 390 if (show_account_management) { |
392 browser->window()->ShowAvatarBubbleFromAvatarButton( | 391 browser->window()->ShowAvatarBubbleFromAvatarButton( |
393 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 392 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
394 signin::ManageAccountsParams()); | 393 signin::ManageAccountsParams()); |
395 } | 394 } |
396 } | 395 } |
397 } | 396 } |
OLD | NEW |