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