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