| 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 #include "ui/views/controls/webview/webview.h" | 5 #include "ui/views/controls/webview/webview.h" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_accessibility_state.h" | 7 #include "content/public/browser/browser_accessibility_state.h" |
| 8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
| 9 #include "content/public/browser/navigation_controller.h" | 9 #include "content/public/browser/navigation_controller.h" |
| 10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 return embed_fullscreen_widget_mode_enabled_; | 245 return embed_fullscreen_widget_mode_enabled_; |
| 246 } | 246 } |
| 247 | 247 |
| 248 //////////////////////////////////////////////////////////////////////////////// | 248 //////////////////////////////////////////////////////////////////////////////// |
| 249 // WebView, content::WebContentsObserver implementation: | 249 // WebView, content::WebContentsObserver implementation: |
| 250 | 250 |
| 251 void WebView::RenderViewDeleted(content::RenderViewHost* render_view_host) { | 251 void WebView::RenderViewDeleted(content::RenderViewHost* render_view_host) { |
| 252 NotifyMaybeTextInputClientChanged(); | 252 NotifyMaybeTextInputClientChanged(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void WebView::RenderProcessGone(base::TerminationStatus status) { |
| 256 NotifyMaybeTextInputClientChanged(); |
| 257 } |
| 258 |
| 255 void WebView::RenderViewHostChanged(content::RenderViewHost* old_host, | 259 void WebView::RenderViewHostChanged(content::RenderViewHost* old_host, |
| 256 content::RenderViewHost* new_host) { | 260 content::RenderViewHost* new_host) { |
| 257 FocusManager* const focus_manager = GetFocusManager(); | 261 FocusManager* const focus_manager = GetFocusManager(); |
| 258 if (focus_manager && focus_manager->GetFocusedView() == this) | 262 if (focus_manager && focus_manager->GetFocusedView() == this) |
| 259 OnFocus(); | 263 OnFocus(); |
| 260 NotifyMaybeTextInputClientChanged(); | 264 NotifyMaybeTextInputClientChanged(); |
| 261 } | 265 } |
| 262 | 266 |
| 263 void WebView::DidShowFullscreenWidget(int routing_id) { | 267 void WebView::DidShowFullscreenWidget(int routing_id) { |
| 264 if (embed_fullscreen_widget_mode_enabled_) | 268 if (embed_fullscreen_widget_mode_enabled_) |
| 265 ReattachForFullscreenChange(true); | 269 ReattachForFullscreenChange(true); |
| 266 } | 270 } |
| 267 | 271 |
| 268 void WebView::DidDestroyFullscreenWidget(int routing_id) { | 272 void WebView::DidDestroyFullscreenWidget(int routing_id) { |
| 269 if (embed_fullscreen_widget_mode_enabled_) | 273 if (embed_fullscreen_widget_mode_enabled_) |
| 270 ReattachForFullscreenChange(false); | 274 ReattachForFullscreenChange(false); |
| 271 } | 275 } |
| 272 | 276 |
| 273 void WebView::DidToggleFullscreenModeForTab(bool entered_fullscreen) { | 277 void WebView::DidToggleFullscreenModeForTab(bool entered_fullscreen) { |
| 274 if (embed_fullscreen_widget_mode_enabled_) | 278 if (embed_fullscreen_widget_mode_enabled_) |
| 275 ReattachForFullscreenChange(entered_fullscreen); | 279 ReattachForFullscreenChange(entered_fullscreen); |
| 276 } | 280 } |
| 277 | 281 |
| 282 void WebView::DidAttachInterstitialPage() { |
| 283 NotifyMaybeTextInputClientChanged(); |
| 284 } |
| 285 |
| 286 void WebView::DidDetachInterstitialPage() { |
| 287 NotifyMaybeTextInputClientChanged(); |
| 288 } |
| 289 |
| 278 //////////////////////////////////////////////////////////////////////////////// | 290 //////////////////////////////////////////////////////////////////////////////// |
| 279 // WebView, private: | 291 // WebView, private: |
| 280 | 292 |
| 281 void WebView::AttachWebContents() { | 293 void WebView::AttachWebContents() { |
| 282 // Prevents attachment if the WebView isn't already in a Widget, or it's | 294 // Prevents attachment if the WebView isn't already in a Widget, or it's |
| 283 // already attached. | 295 // already attached. |
| 284 if (!GetWidget() || !web_contents()) | 296 if (!GetWidget() || !web_contents()) |
| 285 return; | 297 return; |
| 286 | 298 |
| 287 const gfx::NativeView view_to_attach = is_embedding_fullscreen_widget_ ? | 299 const gfx::NativeView view_to_attach = is_embedding_fullscreen_widget_ ? |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 if (!contents) { | 366 if (!contents) { |
| 355 content::WebContents::CreateParams create_params( | 367 content::WebContents::CreateParams create_params( |
| 356 browser_context, NULL); | 368 browser_context, NULL); |
| 357 return content::WebContents::Create(create_params); | 369 return content::WebContents::Create(create_params); |
| 358 } | 370 } |
| 359 | 371 |
| 360 return contents; | 372 return contents; |
| 361 } | 373 } |
| 362 | 374 |
| 363 } // namespace views | 375 } // namespace views |
| OLD | NEW |