| 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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 is_being_destroyed_(false), | 311 is_being_destroyed_(false), |
| 312 notify_disconnection_(false), | 312 notify_disconnection_(false), |
| 313 dialog_creator_(NULL), | 313 dialog_creator_(NULL), |
| 314 is_showing_before_unload_dialog_(false), | 314 is_showing_before_unload_dialog_(false), |
| 315 opener_web_ui_type_(WebUI::kNoWebUI), | 315 opener_web_ui_type_(WebUI::kNoWebUI), |
| 316 closed_by_user_gesture_(false), | 316 closed_by_user_gesture_(false), |
| 317 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), | 317 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
| 318 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), | 318 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
| 319 temporary_zoom_settings_(false), | 319 temporary_zoom_settings_(false), |
| 320 content_restrictions_(0), | 320 content_restrictions_(0), |
| 321 color_chooser_(NULL) { | 321 color_chooser_(NULL), |
| 322 fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { |
| 322 } | 323 } |
| 323 | 324 |
| 324 WebContentsImpl::~WebContentsImpl() { | 325 WebContentsImpl::~WebContentsImpl() { |
| 325 is_being_destroyed_ = true; | 326 is_being_destroyed_ = true; |
| 326 | 327 |
| 327 for (std::set<RenderWidgetHostImpl*>::iterator iter = | 328 for (std::set<RenderWidgetHostImpl*>::iterator iter = |
| 328 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { | 329 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { |
| 329 (*iter)->DetachDelegate(); | 330 (*iter)->DetachDelegate(); |
| 330 } | 331 } |
| 331 created_widgets_.clear(); | 332 created_widgets_.clear(); |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 callback.Run(GetRenderViewHost(), x, y); | 829 callback.Run(GetRenderViewHost(), x, y); |
| 829 } | 830 } |
| 830 | 831 |
| 831 int WebContentsImpl::GetRoutingID() const { | 832 int WebContentsImpl::GetRoutingID() const { |
| 832 if (!GetRenderViewHost()) | 833 if (!GetRenderViewHost()) |
| 833 return MSG_ROUTING_NONE; | 834 return MSG_ROUTING_NONE; |
| 834 | 835 |
| 835 return GetRenderViewHost()->GetRoutingID(); | 836 return GetRenderViewHost()->GetRoutingID(); |
| 836 } | 837 } |
| 837 | 838 |
| 839 int WebContentsImpl::GetFullscreenWidgetRoutingID() const { |
| 840 return fullscreen_widget_routing_id_; |
| 841 } |
| 842 |
| 838 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const { | 843 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const { |
| 839 return render_manager_.GetRenderWidgetHostView(); | 844 return render_manager_.GetRenderWidgetHostView(); |
| 840 } | 845 } |
| 841 | 846 |
| 842 WebContentsView* WebContentsImpl::GetView() const { | 847 WebContentsView* WebContentsImpl::GetView() const { |
| 843 return view_.get(); | 848 return view_.get(); |
| 844 } | 849 } |
| 845 | 850 |
| 846 WebUI* WebContentsImpl::CreateWebUI(const GURL& url) { | 851 WebUI* WebContentsImpl::CreateWebUI(const GURL& url) { |
| 847 WebUIControllerFactory* factory = | 852 WebUIControllerFactory* factory = |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 RenderWidgetHostImpl* render_widget_host) { | 1244 RenderWidgetHostImpl* render_widget_host) { |
| 1240 if (is_being_destroyed_) { | 1245 if (is_being_destroyed_) { |
| 1241 // |created_widgets_| might have been destroyed. | 1246 // |created_widgets_| might have been destroyed. |
| 1242 return; | 1247 return; |
| 1243 } | 1248 } |
| 1244 | 1249 |
| 1245 std::set<RenderWidgetHostImpl*>::iterator iter = | 1250 std::set<RenderWidgetHostImpl*>::iterator iter = |
| 1246 created_widgets_.find(render_widget_host); | 1251 created_widgets_.find(render_widget_host); |
| 1247 if (iter != created_widgets_.end()) | 1252 if (iter != created_widgets_.end()) |
| 1248 created_widgets_.erase(iter); | 1253 created_widgets_.erase(iter); |
| 1254 |
| 1255 if (render_widget_host && |
| 1256 render_widget_host->GetRoutingID() == fullscreen_widget_routing_id_) { |
| 1257 FOR_EACH_OBSERVER(WebContentsObserver, |
| 1258 observers_, |
| 1259 DidDestroyFullscreenWidget( |
| 1260 fullscreen_widget_routing_id_)); |
| 1261 fullscreen_widget_routing_id_ = MSG_ROUTING_NONE; |
| 1262 } |
| 1249 } | 1263 } |
| 1250 | 1264 |
| 1251 bool WebContentsImpl::PreHandleKeyboardEvent( | 1265 bool WebContentsImpl::PreHandleKeyboardEvent( |
| 1252 const NativeWebKeyboardEvent& event, | 1266 const NativeWebKeyboardEvent& event, |
| 1253 bool* is_keyboard_shortcut) { | 1267 bool* is_keyboard_shortcut) { |
| 1254 return delegate_ && | 1268 return delegate_ && |
| 1255 delegate_->PreHandleKeyboardEvent(this, event, is_keyboard_shortcut); | 1269 delegate_->PreHandleKeyboardEvent(this, event, is_keyboard_shortcut); |
| 1256 } | 1270 } |
| 1257 | 1271 |
| 1258 void WebContentsImpl::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 1272 void WebContentsImpl::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 } | 1461 } |
| 1448 } | 1462 } |
| 1449 | 1463 |
| 1450 void WebContentsImpl::ShowCreatedWidget(int route_id, | 1464 void WebContentsImpl::ShowCreatedWidget(int route_id, |
| 1451 const gfx::Rect& initial_pos) { | 1465 const gfx::Rect& initial_pos) { |
| 1452 ShowCreatedWidget(route_id, false, initial_pos); | 1466 ShowCreatedWidget(route_id, false, initial_pos); |
| 1453 } | 1467 } |
| 1454 | 1468 |
| 1455 void WebContentsImpl::ShowCreatedFullscreenWidget(int route_id) { | 1469 void WebContentsImpl::ShowCreatedFullscreenWidget(int route_id) { |
| 1456 ShowCreatedWidget(route_id, true, gfx::Rect()); | 1470 ShowCreatedWidget(route_id, true, gfx::Rect()); |
| 1471 |
| 1472 DCHECK_EQ(MSG_ROUTING_NONE, fullscreen_widget_routing_id_); |
| 1473 fullscreen_widget_routing_id_ = route_id; |
| 1474 FOR_EACH_OBSERVER(WebContentsObserver, |
| 1475 observers_, |
| 1476 DidShowFullscreenWidget(route_id)); |
| 1457 } | 1477 } |
| 1458 | 1478 |
| 1459 void WebContentsImpl::ShowCreatedWidget(int route_id, | 1479 void WebContentsImpl::ShowCreatedWidget(int route_id, |
| 1460 bool is_fullscreen, | 1480 bool is_fullscreen, |
| 1461 const gfx::Rect& initial_pos) { | 1481 const gfx::Rect& initial_pos) { |
| 1462 if (delegate_) | 1482 if (delegate_) |
| 1463 delegate_->RenderWidgetShowing(); | 1483 delegate_->RenderWidgetShowing(); |
| 1464 | 1484 |
| 1465 RenderWidgetHostViewPort* widget_host_view = | 1485 RenderWidgetHostViewPort* widget_host_view = |
| 1466 RenderWidgetHostViewPort::FromRWHV(GetCreatedWidget(route_id)); | 1486 RenderWidgetHostViewPort::FromRWHV(GetCreatedWidget(route_id)); |
| (...skipping 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3430 | 3450 |
| 3431 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3451 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
| 3432 return browser_plugin_guest_.get(); | 3452 return browser_plugin_guest_.get(); |
| 3433 } | 3453 } |
| 3434 | 3454 |
| 3435 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3455 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
| 3436 return browser_plugin_embedder_.get(); | 3456 return browser_plugin_embedder_.get(); |
| 3437 } | 3457 } |
| 3438 | 3458 |
| 3439 } // namespace content | 3459 } // namespace content |
| OLD | NEW |