OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FRAME_HOST_INTERSTITIAL_PAGE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_INTERSTITIAL_PAGE_IMPL_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_INTERSTITIAL_PAGE_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_INTERSTITIAL_PAGE_IMPL_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 NO_ACTION, // No action has been taken yet. | 48 NO_ACTION, // No action has been taken yet. |
49 PROCEED_ACTION, // "Proceed" was selected. | 49 PROCEED_ACTION, // "Proceed" was selected. |
50 DONT_PROCEED_ACTION // "Don't proceed" was selected. | 50 DONT_PROCEED_ACTION // "Don't proceed" was selected. |
51 }; | 51 }; |
52 | 52 |
53 InterstitialPageImpl(WebContents* web_contents, | 53 InterstitialPageImpl(WebContents* web_contents, |
54 RenderWidgetHostDelegate* render_widget_host_delegate, | 54 RenderWidgetHostDelegate* render_widget_host_delegate, |
55 bool new_navigation, | 55 bool new_navigation, |
56 const GURL& url, | 56 const GURL& url, |
57 InterstitialPageDelegate* delegate); | 57 InterstitialPageDelegate* delegate); |
58 virtual ~InterstitialPageImpl(); | 58 ~InterstitialPageImpl() override; |
59 | 59 |
60 // InterstitialPage implementation: | 60 // InterstitialPage implementation: |
61 virtual void Show() override; | 61 void Show() override; |
62 virtual void Hide() override; | 62 void Hide() override; |
63 virtual void DontProceed() override; | 63 void DontProceed() override; |
64 virtual void Proceed() override; | 64 void Proceed() override; |
65 virtual RenderViewHost* GetRenderViewHostForTesting() const override; | 65 RenderViewHost* GetRenderViewHostForTesting() const override; |
66 virtual InterstitialPageDelegate* GetDelegateForTesting() override; | 66 InterstitialPageDelegate* GetDelegateForTesting() override; |
67 virtual void DontCreateViewForTesting() override; | 67 void DontCreateViewForTesting() override; |
68 virtual void SetSize(const gfx::Size& size) override; | 68 void SetSize(const gfx::Size& size) override; |
69 virtual void Focus() override; | 69 void Focus() override; |
70 | 70 |
71 // Allows the user to navigate away by disabling the interstitial, canceling | 71 // Allows the user to navigate away by disabling the interstitial, canceling |
72 // the pending request, and unblocking the hidden renderer. The interstitial | 72 // the pending request, and unblocking the hidden renderer. The interstitial |
73 // will stay visible until the navigation completes. | 73 // will stay visible until the navigation completes. |
74 void CancelForNavigation(); | 74 void CancelForNavigation(); |
75 | 75 |
76 // Focus the first (last if reverse is true) element in the interstitial page. | 76 // Focus the first (last if reverse is true) element in the interstitial page. |
77 // Called when tab traversing. | 77 // Called when tab traversing. |
78 void FocusThroughTabTraversal(bool reverse); | 78 void FocusThroughTabTraversal(bool reverse); |
79 | 79 |
(...skipping 12 matching lines...) Expand all Loading... |
92 #endif | 92 #endif |
93 | 93 |
94 // TODO(nasko): This should move to InterstitialPageNavigatorImpl, but in | 94 // TODO(nasko): This should move to InterstitialPageNavigatorImpl, but in |
95 // the meantime make it public, so it can be called directly. | 95 // the meantime make it public, so it can be called directly. |
96 void DidNavigate( | 96 void DidNavigate( |
97 RenderViewHost* render_view_host, | 97 RenderViewHost* render_view_host, |
98 const FrameHostMsg_DidCommitProvisionalLoad_Params& params); | 98 const FrameHostMsg_DidCommitProvisionalLoad_Params& params); |
99 | 99 |
100 protected: | 100 protected: |
101 // NotificationObserver method: | 101 // NotificationObserver method: |
102 virtual void Observe(int type, | 102 void Observe(int type, |
103 const NotificationSource& source, | 103 const NotificationSource& source, |
104 const NotificationDetails& details) override; | 104 const NotificationDetails& details) override; |
105 | 105 |
106 // WebContentsObserver implementation: | 106 // WebContentsObserver implementation: |
107 virtual bool OnMessageReceived(const IPC::Message& message, | 107 bool OnMessageReceived(const IPC::Message& message, |
108 RenderFrameHost* render_frame_host) override; | 108 RenderFrameHost* render_frame_host) override; |
109 virtual bool OnMessageReceived(const IPC::Message& message) override; | 109 bool OnMessageReceived(const IPC::Message& message) override; |
110 virtual void WebContentsDestroyed() override; | 110 void WebContentsDestroyed() override; |
111 virtual void NavigationEntryCommitted( | 111 void NavigationEntryCommitted( |
112 const LoadCommittedDetails& load_details) override; | 112 const LoadCommittedDetails& load_details) override; |
113 | 113 |
114 // RenderFrameHostDelegate implementation: | 114 // RenderFrameHostDelegate implementation: |
115 virtual bool OnMessageReceived(RenderFrameHost* render_frame_host, | 115 bool OnMessageReceived(RenderFrameHost* render_frame_host, |
116 const IPC::Message& message) override; | 116 const IPC::Message& message) override; |
117 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) override; | 117 void RenderFrameCreated(RenderFrameHost* render_frame_host) override; |
118 virtual void UpdateTitle(RenderFrameHost* render_frame_host, | 118 void UpdateTitle(RenderFrameHost* render_frame_host, |
119 int32 page_id, | 119 int32 page_id, |
120 const base::string16& title, | 120 const base::string16& title, |
121 base::i18n::TextDirection title_direction) override; | 121 base::i18n::TextDirection title_direction) override; |
122 virtual AccessibilityMode GetAccessibilityMode() const override; | 122 AccessibilityMode GetAccessibilityMode() const override; |
123 | 123 |
124 // RenderViewHostDelegate implementation: | 124 // RenderViewHostDelegate implementation: |
125 virtual RenderViewHostDelegateView* GetDelegateView() override; | 125 RenderViewHostDelegateView* GetDelegateView() override; |
126 virtual bool OnMessageReceived(RenderViewHost* render_view_host, | 126 bool OnMessageReceived(RenderViewHost* render_view_host, |
127 const IPC::Message& message) override; | 127 const IPC::Message& message) override; |
128 virtual const GURL& GetMainFrameLastCommittedURL() const override; | 128 const GURL& GetMainFrameLastCommittedURL() const override; |
129 virtual void RenderViewTerminated(RenderViewHost* render_view_host, | 129 void RenderViewTerminated(RenderViewHost* render_view_host, |
130 base::TerminationStatus status, | 130 base::TerminationStatus status, |
131 int error_code) override; | 131 int error_code) override; |
132 virtual RendererPreferences GetRendererPrefs( | 132 RendererPreferences GetRendererPrefs( |
133 BrowserContext* browser_context) const override; | 133 BrowserContext* browser_context) const override; |
134 virtual WebPreferences ComputeWebkitPrefs() override; | 134 WebPreferences ComputeWebkitPrefs() override; |
135 virtual gfx::Rect GetRootWindowResizerRect() const override; | 135 gfx::Rect GetRootWindowResizerRect() const override; |
136 virtual void CreateNewWindow( | 136 void CreateNewWindow( |
137 int render_process_id, | 137 int render_process_id, |
138 int route_id, | 138 int route_id, |
139 int main_frame_route_id, | 139 int main_frame_route_id, |
140 const ViewHostMsg_CreateWindow_Params& params, | 140 const ViewHostMsg_CreateWindow_Params& params, |
141 SessionStorageNamespace* session_storage_namespace) override; | 141 SessionStorageNamespace* session_storage_namespace) override; |
142 virtual void CreateNewWidget(int render_process_id, | 142 void CreateNewWidget(int render_process_id, |
143 int route_id, | 143 int route_id, |
144 blink::WebPopupType popup_type) override; | 144 blink::WebPopupType popup_type) override; |
145 virtual void CreateNewFullscreenWidget(int render_process_id, | 145 void CreateNewFullscreenWidget(int render_process_id, int route_id) override; |
146 int route_id) override; | 146 void ShowCreatedWindow(int route_id, |
147 virtual void ShowCreatedWindow(int route_id, | 147 WindowOpenDisposition disposition, |
148 WindowOpenDisposition disposition, | 148 const gfx::Rect& initial_pos, |
149 const gfx::Rect& initial_pos, | 149 bool user_gesture) override; |
150 bool user_gesture) override; | 150 void ShowCreatedWidget(int route_id, const gfx::Rect& initial_pos) override; |
151 virtual void ShowCreatedWidget(int route_id, | 151 void ShowCreatedFullscreenWidget(int route_id) override; |
152 const gfx::Rect& initial_pos) override; | |
153 virtual void ShowCreatedFullscreenWidget(int route_id) override; | |
154 | 152 |
155 virtual SessionStorageNamespace* GetSessionStorageNamespace( | 153 SessionStorageNamespace* GetSessionStorageNamespace( |
156 SiteInstance* instance) override; | 154 SiteInstance* instance) override; |
157 | 155 |
158 virtual FrameTree* GetFrameTree() override; | 156 FrameTree* GetFrameTree() override; |
159 | 157 |
160 // RenderWidgetHostDelegate implementation: | 158 // RenderWidgetHostDelegate implementation: |
161 virtual void RenderWidgetDeleted( | 159 void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) override; |
162 RenderWidgetHostImpl* render_widget_host) override; | 160 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
163 virtual bool PreHandleKeyboardEvent( | 161 bool* is_keyboard_shortcut) override; |
164 const NativeWebKeyboardEvent& event, | 162 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) override; |
165 bool* is_keyboard_shortcut) override; | |
166 virtual void HandleKeyboardEvent( | |
167 const NativeWebKeyboardEvent& event) override; | |
168 #if defined(OS_WIN) | 163 #if defined(OS_WIN) |
169 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() override; | 164 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() override; |
170 #endif | 165 #endif |
171 | 166 |
172 bool enabled() const { return enabled_; } | 167 bool enabled() const { return enabled_; } |
173 WebContents* web_contents() const; | 168 WebContents* web_contents() const; |
174 const GURL& url() const { return url_; } | 169 const GURL& url() const { return url_; } |
175 | 170 |
176 // Creates the RenderViewHost containing the interstitial content. | 171 // Creates the RenderViewHost containing the interstitial content. |
177 // Overriden in unit tests. | 172 // Overriden in unit tests. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 scoped_refptr<SessionStorageNamespace> session_storage_namespace_; | 280 scoped_refptr<SessionStorageNamespace> session_storage_namespace_; |
286 | 281 |
287 base::WeakPtrFactory<InterstitialPageImpl> weak_ptr_factory_; | 282 base::WeakPtrFactory<InterstitialPageImpl> weak_ptr_factory_; |
288 | 283 |
289 DISALLOW_COPY_AND_ASSIGN(InterstitialPageImpl); | 284 DISALLOW_COPY_AND_ASSIGN(InterstitialPageImpl); |
290 }; | 285 }; |
291 | 286 |
292 } // namespace content | 287 } // namespace content |
293 | 288 |
294 #endif // CONTENT_BROWSER_FRAME_HOST_INTERSTITIAL_PAGE_IMPL_H_ | 289 #endif // CONTENT_BROWSER_FRAME_HOST_INTERSTITIAL_PAGE_IMPL_H_ |
OLD | NEW |