| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_CHROMEOS_LOGIN_WEB_PAGE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WEB_PAGE_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEB_PAGE_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEB_PAGE_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/timer.h" | 12 #include "base/timer.h" |
| 13 #include "chrome/browser/ui/views/dom_view.h" | 13 #include "ui/views/controls/webview/webview.h" |
| 14 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
| 15 | 15 |
| 16 class Profile; | 16 class Profile; |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 class BrowserContext; |
| 19 class SiteInstance; | 20 class SiteInstance; |
| 20 class WebContentsDelegate; | 21 class WebContentsDelegate; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace views { | 24 namespace views { |
| 24 class Label; | 25 class Label; |
| 25 class Throbber; | 26 class Throbber; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace chromeos { | 29 namespace chromeos { |
| 29 | 30 |
| 30 // WebPageDomView is the view that is rendering the page. | 31 // WebPageDomView is the view that is rendering the page. |
| 31 class WebPageDomView : public DOMView { | 32 class WebPageDomView : public views::WebView { |
| 32 public: | 33 public: |
| 33 WebPageDomView() {} | 34 explicit WebPageDomView(content::BrowserContext* browser_context); |
| 34 | 35 |
| 35 // Set delegate that will be notified about tab contents changes. | 36 // Set delegate that will be notified about tab contents changes. |
| 36 void SetWebContentsDelegate(content::WebContentsDelegate* delegate); | 37 void SetWebContentsDelegate(content::WebContentsDelegate* delegate); |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 DISALLOW_COPY_AND_ASSIGN(WebPageDomView); | 40 DISALLOW_COPY_AND_ASSIGN(WebPageDomView); |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 // WebPageView represents the view that holds WebPageDomView with | 43 // WebPageView represents the view that holds WebPageDomView with |
| 43 // page rendered in it. While page is loaded spinner overlay is shown. | 44 // page rendered in it. While page is loaded spinner overlay is shown. |
| 44 class WebPageView : public views::View { | 45 class WebPageView : public views::View { |
| 45 public: | 46 public: |
| 46 WebPageView(); | 47 WebPageView(); |
| 47 virtual ~WebPageView(); | 48 virtual ~WebPageView(); |
| 48 | 49 |
| 49 // Initialize view layout. | 50 // Initialize view layout. |
| 50 void Init(); | 51 void Init(); |
| 51 | 52 |
| 52 // Initialize the DOM view, creating the contents. This should be | 53 // Initialize the WebView, creating the contents. This should be |
| 53 // called once the view has been added to a container. | 54 // called once the view has been added to a container. |
| 54 void InitDOM(Profile* profile, content::SiteInstance* site_instance); | 55 void InitWebView(content::SiteInstance* site_instance); |
| 55 | 56 |
| 56 // Loads the given URL into the page. | 57 // Loads the given URL into the page. |
| 57 // You must have previously called Init() and SetWebContentsDelegate. | 58 // You must have previously called Init() and SetWebContentsDelegate. |
| 58 void LoadURL(const GURL& url); | 59 void LoadURL(const GURL& url); |
| 59 | 60 |
| 60 // Sets delegate for tab contents changes. | 61 // Sets delegate for tab contents changes. |
| 61 void SetWebContentsDelegate(content::WebContentsDelegate* delegate); | 62 void SetWebContentsDelegate(content::WebContentsDelegate* delegate); |
| 62 | 63 |
| 63 // Stops throbber and shows page content (starts renderer_timer_ for that). | 64 // Stops throbber and shows page content (starts renderer_timer_ for that). |
| 64 void ShowPageContent(); | 65 void ShowPageContent(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 87 | 88 |
| 88 // Timer used before toggling loaded page visibility. | 89 // Timer used before toggling loaded page visibility. |
| 89 base::OneShotTimer<WebPageView> stop_timer_; | 90 base::OneShotTimer<WebPageView> stop_timer_; |
| 90 | 91 |
| 91 DISALLOW_COPY_AND_ASSIGN(WebPageView); | 92 DISALLOW_COPY_AND_ASSIGN(WebPageView); |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 } // namespace chromeos | 95 } // namespace chromeos |
| 95 | 96 |
| 96 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEB_PAGE_VIEW_H_ | 97 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEB_PAGE_VIEW_H_ |
| OLD | NEW |