| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "content/browser/media/audio_stream_monitor.h" | 41 #include "content/browser/media/audio_stream_monitor.h" |
| 42 #include "content/browser/media/midi_dispatcher_host.h" | 42 #include "content/browser/media/midi_dispatcher_host.h" |
| 43 #include "content/browser/message_port_message_filter.h" | 43 #include "content/browser/message_port_message_filter.h" |
| 44 #include "content/browser/message_port_service.h" | 44 #include "content/browser/message_port_service.h" |
| 45 #include "content/browser/power_save_blocker_impl.h" | 45 #include "content/browser/power_save_blocker_impl.h" |
| 46 #include "content/browser/renderer_host/render_process_host_impl.h" | 46 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 47 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 47 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
| 48 #include "content/browser/renderer_host/render_view_host_impl.h" | 48 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 49 #include "content/browser/renderer_host/render_widget_host_impl.h" | 49 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 50 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 50 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 51 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_
impl.h" | |
| 52 #include "content/browser/site_instance_impl.h" | 51 #include "content/browser/site_instance_impl.h" |
| 53 #include "content/browser/web_contents/web_contents_view_guest.h" | 52 #include "content/browser/web_contents/web_contents_view_guest.h" |
| 54 #include "content/browser/webui/generic_handler.h" | 53 #include "content/browser/webui/generic_handler.h" |
| 55 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 54 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 56 #include "content/browser/webui/web_ui_impl.h" | 55 #include "content/browser/webui/web_ui_impl.h" |
| 57 #include "content/common/browser_plugin/browser_plugin_constants.h" | 56 #include "content/common/browser_plugin/browser_plugin_constants.h" |
| 58 #include "content/common/browser_plugin/browser_plugin_messages.h" | 57 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 59 #include "content/common/frame_messages.h" | 58 #include "content/common/frame_messages.h" |
| 60 #include "content/common/image_messages.h" | 59 #include "content/common/image_messages.h" |
| 61 #include "content/common/input_messages.h" | 60 #include "content/common/input_messages.h" |
| 62 #include "content/common/ssl_status_serialization.h" | 61 #include "content/common/ssl_status_serialization.h" |
| 63 #include "content/common/view_messages.h" | 62 #include "content/common/view_messages.h" |
| 64 #include "content/public/browser/ax_event_notification_details.h" | 63 #include "content/public/browser/ax_event_notification_details.h" |
| 65 #include "content/public/browser/browser_context.h" | 64 #include "content/public/browser/browser_context.h" |
| 66 #include "content/public/browser/browser_plugin_guest_manager.h" | 65 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 67 #include "content/public/browser/content_browser_client.h" | 66 #include "content/public/browser/content_browser_client.h" |
| 68 #include "content/public/browser/devtools_agent_host.h" | 67 #include "content/public/browser/devtools_agent_host.h" |
| 69 #include "content/public/browser/download_manager.h" | 68 #include "content/public/browser/download_manager.h" |
| 70 #include "content/public/browser/download_url_parameters.h" | 69 #include "content/public/browser/download_url_parameters.h" |
| 71 #include "content/public/browser/invalidate_type.h" | 70 #include "content/public/browser/invalidate_type.h" |
| 72 #include "content/public/browser/javascript_dialog_manager.h" | 71 #include "content/public/browser/javascript_dialog_manager.h" |
| 73 #include "content/public/browser/load_from_memory_cache_details.h" | 72 #include "content/public/browser/load_from_memory_cache_details.h" |
| 74 #include "content/public/browser/load_notification_details.h" | 73 #include "content/public/browser/load_notification_details.h" |
| 75 #include "content/public/browser/navigation_details.h" | 74 #include "content/public/browser/navigation_details.h" |
| 76 #include "content/public/browser/notification_details.h" | 75 #include "content/public/browser/notification_details.h" |
| 77 #include "content/public/browser/notification_service.h" | 76 #include "content/public/browser/notification_service.h" |
| 78 #include "content/public/browser/render_widget_host_iterator.h" | 77 #include "content/public/browser/render_widget_host_iterator.h" |
| 79 #include "content/public/browser/resource_request_details.h" | 78 #include "content/public/browser/resource_request_details.h" |
| 80 #include "content/public/browser/screen_orientation_dispatcher_host.h" | 79 #include "content/public/browser/screen_orientation_provider.h" |
| 81 #include "content/public/browser/storage_partition.h" | 80 #include "content/public/browser/storage_partition.h" |
| 82 #include "content/public/browser/user_metrics.h" | 81 #include "content/public/browser/user_metrics.h" |
| 83 #include "content/public/browser/web_contents_delegate.h" | 82 #include "content/public/browser/web_contents_delegate.h" |
| 84 #include "content/public/browser/web_contents_observer.h" | 83 #include "content/public/browser/web_contents_observer.h" |
| 85 #include "content/public/common/bindings_policy.h" | 84 #include "content/public/common/bindings_policy.h" |
| 86 #include "content/public/common/content_constants.h" | 85 #include "content/public/common/content_constants.h" |
| 87 #include "content/public/common/content_switches.h" | 86 #include "content/public/common/content_switches.h" |
| 88 #include "content/public/common/page_zoom.h" | 87 #include "content/public/common/page_zoom.h" |
| 89 #include "content/public/common/result_codes.h" | 88 #include "content/public/common/result_codes.h" |
| 90 #include "content/public/common/url_constants.h" | 89 #include "content/public/common/url_constants.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 render_frame_id(render_frame_id), | 325 render_frame_id(render_frame_id), |
| 327 chooser(chooser), | 326 chooser(chooser), |
| 328 identifier(identifier) { | 327 identifier(identifier) { |
| 329 } | 328 } |
| 330 | 329 |
| 331 WebContentsImpl::ColorChooserInfo::~ColorChooserInfo() { | 330 WebContentsImpl::ColorChooserInfo::~ColorChooserInfo() { |
| 332 } | 331 } |
| 333 | 332 |
| 334 // WebContentsImpl ------------------------------------------------------------- | 333 // WebContentsImpl ------------------------------------------------------------- |
| 335 | 334 |
| 336 WebContentsImpl::WebContentsImpl( | 335 WebContentsImpl::WebContentsImpl(BrowserContext* browser_context, |
| 337 BrowserContext* browser_context, | 336 WebContentsImpl* opener) |
| 338 WebContentsImpl* opener) | |
| 339 : delegate_(NULL), | 337 : delegate_(NULL), |
| 340 controller_(this, browser_context), | 338 controller_(this, browser_context), |
| 341 render_view_host_delegate_view_(NULL), | 339 render_view_host_delegate_view_(NULL), |
| 342 opener_(opener), | 340 opener_(opener), |
| 343 created_with_opener_(!!opener), | 341 created_with_opener_(!!opener), |
| 344 #if defined(OS_WIN) | 342 #if defined(OS_WIN) |
| 345 accessible_parent_(NULL), | 343 accessible_parent_(NULL), |
| 346 #endif | 344 #endif |
| 347 frame_tree_(new NavigatorImpl(&controller_, this), | 345 frame_tree_(new NavigatorImpl(&controller_, this), |
| 348 this, this, this, this), | 346 this, |
| 347 this, |
| 348 this, |
| 349 this), |
| 349 is_loading_(false), | 350 is_loading_(false), |
| 350 is_load_to_different_document_(false), | 351 is_load_to_different_document_(false), |
| 351 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 352 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 352 crashed_error_code_(0), | 353 crashed_error_code_(0), |
| 353 waiting_for_response_(false), | 354 waiting_for_response_(false), |
| 354 load_state_(net::LOAD_STATE_IDLE, base::string16()), | 355 load_state_(net::LOAD_STATE_IDLE, base::string16()), |
| 355 loading_total_progress_(0.0), | 356 loading_total_progress_(0.0), |
| 356 loading_weak_factory_(this), | 357 loading_weak_factory_(this), |
| 357 loading_frames_in_progress_(0), | 358 loading_frames_in_progress_(0), |
| 358 upload_size_(0), | 359 upload_size_(0), |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 if (opener_) | 1197 if (opener_) |
| 1197 AddDestructionObserver(opener_); | 1198 AddDestructionObserver(opener_); |
| 1198 | 1199 |
| 1199 registrar_.Add(this, | 1200 registrar_.Add(this, |
| 1200 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 1201 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
| 1201 NotificationService::AllBrowserContextsAndSources()); | 1202 NotificationService::AllBrowserContextsAndSources()); |
| 1202 | 1203 |
| 1203 geolocation_dispatcher_host_.reset(new GeolocationDispatcherHost(this)); | 1204 geolocation_dispatcher_host_.reset(new GeolocationDispatcherHost(this)); |
| 1204 midi_dispatcher_host_.reset(new MidiDispatcherHost(this)); | 1205 midi_dispatcher_host_.reset(new MidiDispatcherHost(this)); |
| 1205 | 1206 |
| 1206 screen_orientation_dispatcher_host_.reset( | |
| 1207 new ScreenOrientationDispatcherHostImpl(this)); | |
| 1208 | |
| 1209 #if defined(OS_ANDROID) | 1207 #if defined(OS_ANDROID) |
| 1210 date_time_chooser_.reset(new DateTimeChooserAndroid()); | 1208 date_time_chooser_.reset(new DateTimeChooserAndroid()); |
| 1211 #endif | 1209 #endif |
| 1212 } | 1210 } |
| 1213 | 1211 |
| 1214 void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) { | 1212 void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) { |
| 1215 RemoveDestructionObserver(web_contents); | 1213 RemoveDestructionObserver(web_contents); |
| 1216 | 1214 |
| 1217 // Clear the opener if it has been closed. | 1215 // Clear the opener if it has been closed. |
| 1218 if (web_contents == opener_) { | 1216 if (web_contents == opener_) { |
| (...skipping 2247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3466 return false; | 3464 return false; |
| 3467 return delegate_->IsNeverVisible(this); | 3465 return delegate_->IsNeverVisible(this); |
| 3468 } | 3466 } |
| 3469 | 3467 |
| 3470 #if defined(OS_WIN) | 3468 #if defined(OS_WIN) |
| 3471 gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() { | 3469 gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() { |
| 3472 return accessible_parent_; | 3470 return accessible_parent_; |
| 3473 } | 3471 } |
| 3474 #endif | 3472 #endif |
| 3475 | 3473 |
| 3474 ScreenOrientationProvider* WebContentsImpl::GetScreenOrientationProvider() { |
| 3475 if (!screen_orientation_provider_) |
| 3476 screen_orientation_provider_.reset(ScreenOrientationProvider::Create(this)); |
| 3477 return screen_orientation_provider_.get(); |
| 3478 } |
| 3479 |
| 3476 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { | 3480 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { |
| 3477 return render_view_host_delegate_view_; | 3481 return render_view_host_delegate_view_; |
| 3478 } | 3482 } |
| 3479 | 3483 |
| 3480 RendererPreferences WebContentsImpl::GetRendererPrefs( | 3484 RendererPreferences WebContentsImpl::GetRendererPrefs( |
| 3481 BrowserContext* browser_context) const { | 3485 BrowserContext* browser_context) const { |
| 3482 return renderer_preferences_; | 3486 return renderer_preferences_; |
| 3483 } | 3487 } |
| 3484 | 3488 |
| 3485 gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const { | 3489 gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const { |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4345 node->render_manager()->ResumeResponseDeferredAtStart(); | 4349 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4346 } | 4350 } |
| 4347 | 4351 |
| 4348 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4352 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4349 force_disable_overscroll_content_ = force_disable; | 4353 force_disable_overscroll_content_ = force_disable; |
| 4350 if (view_) | 4354 if (view_) |
| 4351 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4355 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4352 } | 4356 } |
| 4353 | 4357 |
| 4354 } // namespace content | 4358 } // namespace content |
| OLD | NEW |