OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_WEB_CONTENTS_INTERSTITIAL_PAGE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_INTERSTITIAL_PAGE_IMPL_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_INTERSTITIAL_PAGE_IMPL_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_INTERSTITIAL_PAGE_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 12 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
12 #include "content/public/browser/interstitial_page.h" | 13 #include "content/public/browser/interstitial_page.h" |
13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
15 #include "content/public/browser/render_view_host_delegate.h" | 16 #include "content/public/browser/render_view_host_delegate.h" |
16 #include "content/public/common/renderer_preferences.h" | 17 #include "content/public/common/renderer_preferences.h" |
17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
18 | 19 |
19 class WebContentsImpl; | 20 class WebContentsImpl; |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 class NavigationEntry; | 23 class NavigationEntry; |
23 class RenderViewHostImpl; | 24 class RenderViewHostImpl; |
24 class WebContentsView; | 25 class WebContentsView; |
25 } | 26 } |
26 | 27 |
27 enum ResourceRequestAction { | 28 enum ResourceRequestAction { |
28 BLOCK, | 29 BLOCK, |
29 RESUME, | 30 RESUME, |
30 CANCEL | 31 CANCEL |
31 }; | 32 }; |
32 | 33 |
33 class CONTENT_EXPORT InterstitialPageImpl | 34 class CONTENT_EXPORT InterstitialPageImpl |
34 : public NON_EXPORTED_BASE(content::InterstitialPage), | 35 : public NON_EXPORTED_BASE(content::InterstitialPage), |
35 public content::NotificationObserver, | 36 public content::NotificationObserver, |
36 public content::RenderViewHostDelegate { | 37 public content::RenderViewHostDelegate, |
| 38 public content::RenderWidgetHostDelegate { |
37 public: | 39 public: |
38 // The different state of actions the user can take in an interstitial. | 40 // The different state of actions the user can take in an interstitial. |
39 enum ActionState { | 41 enum ActionState { |
40 NO_ACTION, // No action has been taken yet. | 42 NO_ACTION, // No action has been taken yet. |
41 PROCEED_ACTION, // "Proceed" was selected. | 43 PROCEED_ACTION, // "Proceed" was selected. |
42 DONT_PROCEED_ACTION // "Don't proceed" was selected. | 44 DONT_PROCEED_ACTION // "Don't proceed" was selected. |
43 }; | 45 }; |
44 | 46 |
45 InterstitialPageImpl(content::WebContents* web_contents, | 47 InterstitialPageImpl(content::WebContents* web_contents, |
46 bool new_navigation, | 48 bool new_navigation, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 virtual void DidNavigate( | 91 virtual void DidNavigate( |
90 content::RenderViewHost* render_view_host, | 92 content::RenderViewHost* render_view_host, |
91 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; | 93 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; |
92 virtual void UpdateTitle(content::RenderViewHost* render_view_host, | 94 virtual void UpdateTitle(content::RenderViewHost* render_view_host, |
93 int32 page_id, | 95 int32 page_id, |
94 const string16& title, | 96 const string16& title, |
95 base::i18n::TextDirection title_direction) OVERRIDE; | 97 base::i18n::TextDirection title_direction) OVERRIDE; |
96 virtual content::RendererPreferences GetRendererPrefs( | 98 virtual content::RendererPreferences GetRendererPrefs( |
97 content::BrowserContext* browser_context) const OVERRIDE; | 99 content::BrowserContext* browser_context) const OVERRIDE; |
98 virtual webkit_glue::WebPreferences GetWebkitPrefs() OVERRIDE; | 100 virtual webkit_glue::WebPreferences GetWebkitPrefs() OVERRIDE; |
| 101 virtual content::ViewType GetRenderViewType() const OVERRIDE; |
| 102 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; |
| 103 |
| 104 // RenderWidgetHostDelegate implementation: |
99 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 105 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
100 bool* is_keyboard_shortcut) OVERRIDE; | 106 bool* is_keyboard_shortcut) OVERRIDE; |
101 virtual void HandleKeyboardEvent( | 107 virtual void HandleKeyboardEvent( |
102 const NativeWebKeyboardEvent& event) OVERRIDE; | 108 const NativeWebKeyboardEvent& event) OVERRIDE; |
103 virtual content::ViewType GetRenderViewType() const OVERRIDE; | |
104 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; | |
105 | 109 |
106 bool enabled() const { return enabled_; } | 110 bool enabled() const { return enabled_; } |
107 content::WebContents* web_contents() const; | 111 content::WebContents* web_contents() const; |
108 const GURL& url() const { return url_; } | 112 const GURL& url() const { return url_; } |
109 | 113 |
110 // Creates the RenderViewHost containing the interstitial content. | 114 // Creates the RenderViewHost containing the interstitial content. |
111 // Overriden in unit tests. | 115 // Overriden in unit tests. |
112 virtual content::RenderViewHost* CreateRenderViewHost(); | 116 virtual content::RenderViewHost* CreateRenderViewHost(); |
113 | 117 |
114 // Creates the WebContentsView that shows the interstitial RVH. | 118 // Creates the WebContentsView that shows the interstitial RVH. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 mutable content::RendererPreferences renderer_preferences_; | 193 mutable content::RendererPreferences renderer_preferences_; |
190 | 194 |
191 bool create_view_; | 195 bool create_view_; |
192 | 196 |
193 scoped_ptr<content::InterstitialPageDelegate> delegate_; | 197 scoped_ptr<content::InterstitialPageDelegate> delegate_; |
194 | 198 |
195 DISALLOW_COPY_AND_ASSIGN(InterstitialPageImpl); | 199 DISALLOW_COPY_AND_ASSIGN(InterstitialPageImpl); |
196 }; | 200 }; |
197 | 201 |
198 #endif // CONTENT_BROWSER_WEB_CONTENTS_INTERSTITIAL_PAGE_IMPL_H_ | 202 #endif // CONTENT_BROWSER_WEB_CONTENTS_INTERSTITIAL_PAGE_IMPL_H_ |
OLD | NEW |