| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" | 12 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
| 13 #include "chrome/browser/ui/webui/signin/inline_login_handler.h" | 13 #include "chrome/browser/ui/webui/signin/inline_login_handler.h" |
| 14 #include "content/public/browser/web_contents_delegate.h" | |
| 15 | 14 |
| 16 class GaiaAuthFetcher; | 15 class GaiaAuthFetcher; |
| 17 | 16 |
| 18 // Implementation for the inline login WebUI handler on desktop Chrome. Once | 17 // Implementation for the inline login WebUI handler on desktop Chrome. Once |
| 19 // CrOS migrates to the same webview approach as desktop Chrome, much of the | 18 // CrOS migrates to the same webview approach as desktop Chrome, much of the |
| 20 // code in this class should move to its base class |InlineLoginHandler|. | 19 // code in this class should move to its base class |InlineLoginHandler|. |
| 21 class InlineLoginHandlerImpl : public InlineLoginHandler, | 20 class InlineLoginHandlerImpl : public InlineLoginHandler, |
| 22 public content::WebContentsDelegate, | |
| 23 public content::WebContentsObserver { | 21 public content::WebContentsObserver { |
| 24 public: | 22 public: |
| 25 InlineLoginHandlerImpl(); | 23 InlineLoginHandlerImpl(); |
| 26 ~InlineLoginHandlerImpl() override; | 24 ~InlineLoginHandlerImpl() override; |
| 27 | 25 |
| 28 using InlineLoginHandler::web_ui; | 26 using InlineLoginHandler::web_ui; |
| 29 | 27 |
| 30 base::WeakPtr<InlineLoginHandlerImpl> GetWeakPtr() { | 28 base::WeakPtr<InlineLoginHandlerImpl> GetWeakPtr() { |
| 31 return weak_factory_.GetWeakPtr(); | 29 return weak_factory_.GetWeakPtr(); |
| 32 } | 30 } |
| 33 | 31 |
| 34 Browser* GetDesktopBrowser(); | 32 Browser* GetDesktopBrowser(); |
| 35 void SyncStarterCallback(OneClickSigninSyncStarter::SyncSetupResult result); | 33 void SyncStarterCallback(OneClickSigninSyncStarter::SyncSetupResult result); |
| 36 // Closes the current tab and shows the account management view of the avatar | 34 // Closes the current tab and shows the account management view of the avatar |
| 37 // bubble if |show_account_management| is true. | 35 // bubble if |show_account_management| is true. |
| 38 void CloseTab(bool show_account_management); | 36 void CloseTab(bool show_account_management); |
| 39 void HandleLoginError(const std::string& error_msg); | 37 void HandleLoginError(const std::string& error_msg); |
| 40 | 38 |
| 41 private: | 39 private: |
| 42 // InlineLoginHandler overrides: | 40 // InlineLoginHandler overrides: |
| 43 void SetExtraInitParams(base::DictionaryValue& params) override; | 41 void SetExtraInitParams(base::DictionaryValue& params) override; |
| 44 void CompleteLogin(const base::ListValue* args) override; | 42 void CompleteLogin(const base::ListValue* args) override; |
| 45 | 43 |
| 46 // Overridden from content::WebContentsDelegate. | |
| 47 bool HandleContextMenu(const content::ContextMenuParams& params) override; | |
| 48 | |
| 49 // Overridden from content::WebContentsObserver overrides. | 44 // Overridden from content::WebContentsObserver overrides. |
| 50 void DidCommitProvisionalLoadForFrame( | 45 void DidCommitProvisionalLoadForFrame( |
| 51 content::RenderFrameHost* render_frame_host, | 46 content::RenderFrameHost* render_frame_host, |
| 52 const GURL& url, | 47 const GURL& url, |
| 53 ui::PageTransition transition_type) override; | 48 ui::PageTransition transition_type) override; |
| 54 | 49 |
| 55 // True if the user has navigated to untrusted domains during the signin | 50 // True if the user has navigated to untrusted domains during the signin |
| 56 // process. | 51 // process. |
| 57 bool confirm_untrusted_signin_; | 52 bool confirm_untrusted_signin_; |
| 58 | 53 |
| 59 base::WeakPtrFactory<InlineLoginHandlerImpl> weak_factory_; | 54 base::WeakPtrFactory<InlineLoginHandlerImpl> weak_factory_; |
| 60 | 55 |
| 61 DISALLOW_COPY_AND_ASSIGN(InlineLoginHandlerImpl); | 56 DISALLOW_COPY_AND_ASSIGN(InlineLoginHandlerImpl); |
| 62 }; | 57 }; |
| 63 | 58 |
| 64 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ | 59 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ |
| OLD | NEW |