15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// found in the LICENSE file. 45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ 65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ 75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include <string> 9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/memory/weak_ptr.h" 125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" 135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/browser/ui/webui/signin/inline_login_handler.h" 14f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#include "content/public/browser/web_contents_delegate.h" 155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class GaiaAuthFetcher; 175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Implementation for the inline login WebUI handler on desktop Chrome. Once 195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// CrOS migrates to the same webview approach as desktop Chrome, much of the 205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// code in this class should move to its base class |InlineLoginHandler|. 21f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)class InlineLoginHandlerImpl : public InlineLoginHandler, 226e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) public content::WebContentsDelegate, 236e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) public content::WebContentsObserver { 245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public: 255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) InlineLoginHandlerImpl(); 265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual ~InlineLoginHandlerImpl(); 275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) using InlineLoginHandler::web_ui; 29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::WeakPtr<InlineLoginHandlerImpl> GetWeakPtr() { 31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return weak_factory_.GetWeakPtr(); 32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) } 33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) Browser* GetDesktopBrowser(); 35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void SyncStarterCallback(OneClickSigninSyncStarter::SyncSetupResult result); 36f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // Closes the current tab and shows the account management view of the avatar 37f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // bubble if |show_account_management| is true. 38f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) void CloseTab(bool show_account_management); 39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void HandleLoginError(const std::string& error_msg); 40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) private: 425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // InlineLoginHandler overrides: 435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void SetExtraInitParams(base::DictionaryValue& params) OVERRIDE; 445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void CompleteLogin(const base::ListValue* args) OVERRIDE; 455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 46f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // Overridden from content::WebContentsDelegate. 47f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) virtual bool HandleContextMenu( 48f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) const content::ContextMenuParams& params) OVERRIDE; 49f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 506e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) // Overridden from content::WebContentsObserver overrides. 516e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) virtual void DidCommitProvisionalLoadForFrame( 526e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) content::RenderFrameHost* render_frame_host, 536e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) const GURL& url, 541320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci ui::PageTransition transition_type) OVERRIDE; 556e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 566e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) // True if the user has navigated to untrusted domains during the signin 576e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) // process. 586e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) bool confirm_untrusted_signin_; 595d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 601320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci base::WeakPtrFactory<InlineLoginHandlerImpl> weak_factory_; 611320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(InlineLoginHandlerImpl); 635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}; 645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_INLINE_LOGIN_HANDLER_IMPL_H_ 66