1ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen// Copyright (c) 2011 The Chromium Authors. All rights reserved. 2bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen// Use of this source code is governed by a BSD-style license that can be 3bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen// found in the LICENSE file. 4bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 5bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_HTML_PAGE_SCREEN_H_ 6bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen#define CHROME_BROWSER_CHROMEOS_LOGIN_HTML_PAGE_SCREEN_H_ 7bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen#pragma once 8bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 9bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen#include <string> 10bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 11ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen#include "base/memory/scoped_ptr.h" 12bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen#include "chrome/browser/chromeos/login/screen_observer.h" 13bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen#include "chrome/browser/chromeos/login/view_screen.h" 14bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen#include "chrome/browser/chromeos/login/web_page_screen.h" 15bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen#include "chrome/browser/chromeos/login/web_page_view.h" 16bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 17bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsenclass WizardScreenDelegate; 18bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 19bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsennamespace chromeos { 20bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 21bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsenclass HTMLPageDomView : public WebPageDomView { 22bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen public: 23bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen HTMLPageDomView() {} 24bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 25bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen protected: 26bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen // Overriden from DOMView: 27bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual TabContents* CreateTabContents(Profile* profile, 28bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen SiteInstance* instance); 29bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 30bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen private: 31bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen DISALLOW_COPY_AND_ASSIGN(HTMLPageDomView); 32bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen}; 33bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 34bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsenclass HTMLPageView : public WebPageView { 35bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen public: 36bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen HTMLPageView(); 37bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 38bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen protected: 39bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual WebPageDomView* dom_view() { return dom_view_; } 40bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 41bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen private: 42bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen // View that renders page. 43bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen HTMLPageDomView* dom_view_; 44bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 45bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen DISALLOW_COPY_AND_ASSIGN(HTMLPageView); 46bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen}; 47bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 48bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen// HTMLPageScreen is used to show arbitrary HTML page. It is used to show 49bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen// simple screens like recover. 50bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsenclass HTMLPageScreen : public ViewScreen<HTMLPageView>, 51bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen public WebPageScreen, 52bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen public WebPageDelegate { 53bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen public: 54bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen HTMLPageScreen(WizardScreenDelegate* delegate, const std::string& url); 55bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 56bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen // WebPageDelegate implementation: 57bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual void OnPageLoaded(); 58bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual void OnPageLoadFailed(const std::string& url); 59bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 60bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen protected: 61bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen // Overrides WebPageScreen: 62bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual void OnNetworkTimeout(); 63bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 64bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen private: 65bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen // ViewScreen implementation: 66bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual void CreateView(); 67bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual void Refresh(); 68bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual HTMLPageView* AllocateView(); 69bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 70bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual void LoadingStateChanged(TabContents* source); 71bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual void NavigationStateChanged(const TabContents* source, 72bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen unsigned changed_flags); 73bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); 74bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 75bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen // WebPageScreen implementation: 76bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen virtual void CloseScreen(ScreenObserver::ExitCodes code); 77bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 78bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen // URL to navigate. 79bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen std::string url_; 80bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 81bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen DISALLOW_COPY_AND_ASSIGN(HTMLPageScreen); 82bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen}; 83bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 84bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen} // namespace chromeos 85bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen 86bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293Kristian Monsen#endif // CHROME_BROWSER_CHROMEOS_LOGIN_HTML_PAGE_SCREEN_H_ 87