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 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "base/files/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" | 13 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
13 #include "chrome/browser/ui/webui/signin/inline_login_handler.h" | 14 #include "chrome/browser/ui/webui/signin/inline_login_handler.h" |
14 | 15 |
15 // Implementation for the inline login WebUI handler on desktop Chrome. Once | 16 // Implementation for the inline login WebUI handler on desktop Chrome. Once |
16 // CrOS migrates to the same webview approach as desktop Chrome, much of the | 17 // CrOS migrates to the same webview approach as desktop Chrome, much of the |
17 // code in this class should move to its base class |InlineLoginHandler|. | 18 // code in this class should move to its base class |InlineLoginHandler|. |
18 class InlineLoginHandlerImpl : public InlineLoginHandler, | 19 class InlineLoginHandlerImpl : public InlineLoginHandler, |
19 public content::WebContentsObserver { | 20 public content::WebContentsObserver { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 static bool CanOffer(Profile* profile, | 54 static bool CanOffer(Profile* profile, |
54 CanOfferFor can_offer_for, | 55 CanOfferFor can_offer_for, |
55 const std::string& gaia_id, | 56 const std::string& gaia_id, |
56 const std::string& email, | 57 const std::string& email, |
57 std::string* error_message); | 58 std::string* error_message); |
58 | 59 |
59 // InlineLoginHandler overrides: | 60 // InlineLoginHandler overrides: |
60 void SetExtraInitParams(base::DictionaryValue& params) override; | 61 void SetExtraInitParams(base::DictionaryValue& params) override; |
61 void CompleteLogin(const base::ListValue* args) override; | 62 void CompleteLogin(const base::ListValue* args) override; |
62 | 63 |
| 64 // This struct exists to pass paramters to the FinishCompleteLogin() method, |
| 65 // since the base::Bind() call does not support this many template args. |
| 66 struct FinishCompleteLoginParams { |
| 67 public: |
| 68 FinishCompleteLoginParams(InlineLoginHandlerImpl* handler, |
| 69 content::StoragePartition* partition, |
| 70 const GURL& url, |
| 71 const base::FilePath& profile_path, |
| 72 bool confirm_untrusted_signin, |
| 73 const std::string& email, |
| 74 const std::string& gaia_id, |
| 75 const std::string& password, |
| 76 const std::string& session_index, |
| 77 bool choose_what_to_sync); |
| 78 ~FinishCompleteLoginParams(); |
| 79 |
| 80 // Pointer to WebUI handler. May be nullptr. |
| 81 InlineLoginHandlerImpl* handler; |
| 82 // The isolate storage partition containing sign in cookies. |
| 83 content::StoragePartition* partition; |
| 84 // URL of sign in containing parameters such as email, source, etc. |
| 85 GURL url; |
| 86 // Path to profile being signed in. Non empty only when signing |
| 87 // in to the profile from the user manager. |
| 88 base::FilePath profile_path; |
| 89 // When true, an extra prompt will be shown to the user before sign in |
| 90 // completes. |
| 91 bool confirm_untrusted_signin; |
| 92 // Email address of the account used to sign in. |
| 93 std::string email; |
| 94 // Obfustcated gaia id of the account used to sign in. |
| 95 std::string gaia_id; |
| 96 // Password of the account used to sign in. |
| 97 std::string password; |
| 98 // Index within gaia cookie of the account used to sign in. |
| 99 std::string session_index; |
| 100 // True if the user wants to configure sync before signing in. |
| 101 bool choose_what_to_sync; |
| 102 }; |
| 103 |
| 104 static void FinishCompleteLogin(const FinishCompleteLoginParams& params, |
| 105 Profile* profile, |
| 106 Profile::CreateStatus status); |
| 107 |
63 // Overridden from content::WebContentsObserver overrides. | 108 // Overridden from content::WebContentsObserver overrides. |
64 void DidCommitProvisionalLoadForFrame( | 109 void DidCommitProvisionalLoadForFrame( |
65 content::RenderFrameHost* render_frame_host, | 110 content::RenderFrameHost* render_frame_host, |
66 const GURL& url, | 111 const GURL& url, |
67 ui::PageTransition transition_type) override; | 112 ui::PageTransition transition_type) override; |
68 | 113 |
69 // True if the user has navigated to untrusted domains during the signin | 114 // True if the user has navigated to untrusted domains during the signin |
70 // process. | 115 // process. |
71 bool confirm_untrusted_signin_; | 116 bool confirm_untrusted_signin_; |
72 | 117 |
73 base::WeakPtrFactory<InlineLoginHandlerImpl> weak_factory_; | 118 base::WeakPtrFactory<InlineLoginHandlerImpl> weak_factory_; |
74 | 119 |
75 DISALLOW_COPY_AND_ASSIGN(InlineLoginHandlerImpl); | 120 DISALLOW_COPY_AND_ASSIGN(InlineLoginHandlerImpl); |
76 }; | 121 }; |
77 | 122 |
78 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ | 123 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ |
OLD | NEW |