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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 // WebContentsImpl ------------------------------------------------------------- | 364 // WebContentsImpl ------------------------------------------------------------- |
365 | 365 |
366 WebContentsImpl::WebContentsImpl( | 366 WebContentsImpl::WebContentsImpl( |
367 BrowserContext* browser_context, | 367 BrowserContext* browser_context, |
368 WebContentsImpl* opener) | 368 WebContentsImpl* opener) |
369 : delegate_(NULL), | 369 : delegate_(NULL), |
370 controller_(this, browser_context), | 370 controller_(this, browser_context), |
371 render_view_host_delegate_view_(NULL), | 371 render_view_host_delegate_view_(NULL), |
372 opener_(opener), | 372 opener_(opener), |
373 #if defined(OS_WIN) && defined(USE_AURA) | 373 #if defined(OS_WIN) |
374 accessible_parent_(NULL), | 374 accessible_parent_(NULL), |
375 #endif | 375 #endif |
376 frame_tree_(new NavigatorImpl(&controller_, this), | 376 frame_tree_(new NavigatorImpl(&controller_, this), |
377 this, this, this, this), | 377 this, this, this, this), |
378 is_loading_(false), | 378 is_loading_(false), |
379 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 379 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
380 crashed_error_code_(0), | 380 crashed_error_code_(0), |
381 waiting_for_response_(false), | 381 waiting_for_response_(false), |
382 load_state_(net::LOAD_STATE_IDLE, base::string16()), | 382 load_state_(net::LOAD_STATE_IDLE, base::string16()), |
383 upload_size_(0), | 383 upload_size_(0), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 color_chooser_->End(); | 423 color_chooser_->End(); |
424 | 424 |
425 NotifyDisconnected(); | 425 NotifyDisconnected(); |
426 | 426 |
427 // Notify any observer that have a reference on this WebContents. | 427 // Notify any observer that have a reference on this WebContents. |
428 NotificationService::current()->Notify( | 428 NotificationService::current()->Notify( |
429 NOTIFICATION_WEB_CONTENTS_DESTROYED, | 429 NOTIFICATION_WEB_CONTENTS_DESTROYED, |
430 Source<WebContents>(this), | 430 Source<WebContents>(this), |
431 NotificationService::NoDetails()); | 431 NotificationService::NoDetails()); |
432 | 432 |
433 // TODO(brettw) this should be moved to the view. | |
434 #if defined(OS_WIN) && !defined(USE_AURA) | |
435 // If we still have a window handle, destroy it. GetNativeView can return | |
436 // NULL if this contents was part of a window that closed. | |
437 if (view_->GetNativeView()) { | |
438 RenderViewHost* host = GetRenderViewHost(); | |
439 if (host && host->GetView()) | |
440 RenderWidgetHostViewPort::FromRWHV(host->GetView())->WillWmDestroy(); | |
441 } | |
442 #endif | |
443 | |
444 RenderViewHost* pending_rvh = GetRenderManager()->pending_render_view_host(); | 433 RenderViewHost* pending_rvh = GetRenderManager()->pending_render_view_host(); |
445 if (pending_rvh) { | 434 if (pending_rvh) { |
446 FOR_EACH_OBSERVER(WebContentsObserver, | 435 FOR_EACH_OBSERVER(WebContentsObserver, |
447 observers_, | 436 observers_, |
448 RenderViewDeleted(pending_rvh)); | 437 RenderViewDeleted(pending_rvh)); |
449 } | 438 } |
450 | 439 |
451 FOR_EACH_OBSERVER(WebContentsObserver, | 440 FOR_EACH_OBSERVER(WebContentsObserver, |
452 observers_, | 441 observers_, |
453 RenderViewDeleted(GetRenderManager()->current_host())); | 442 RenderViewDeleted(GetRenderManager()->current_host())); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 controller_.ReloadIgnoringCache(true); | 758 controller_.ReloadIgnoringCache(true); |
770 | 759 |
771 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 760 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
772 UserAgentOverrideSet(override)); | 761 UserAgentOverrideSet(override)); |
773 } | 762 } |
774 | 763 |
775 const std::string& WebContentsImpl::GetUserAgentOverride() const { | 764 const std::string& WebContentsImpl::GetUserAgentOverride() const { |
776 return renderer_preferences_.user_agent_override; | 765 return renderer_preferences_.user_agent_override; |
777 } | 766 } |
778 | 767 |
779 #if defined(OS_WIN) && defined(USE_AURA) | 768 #if defined(OS_WIN) |
780 void WebContentsImpl::SetParentNativeViewAccessible( | 769 void WebContentsImpl::SetParentNativeViewAccessible( |
781 gfx::NativeViewAccessible accessible_parent) { | 770 gfx::NativeViewAccessible accessible_parent) { |
782 accessible_parent_ = accessible_parent; | 771 accessible_parent_ = accessible_parent; |
783 if (GetRenderViewHost()) | 772 if (GetRenderViewHost()) |
784 GetRenderViewHostImpl()->SetParentNativeViewAccessible(accessible_parent); | 773 GetRenderViewHostImpl()->SetParentNativeViewAccessible(accessible_parent); |
785 } | 774 } |
786 #endif | 775 #endif |
787 | 776 |
788 const base::string16& WebContentsImpl::GetTitle() const { | 777 const base::string16& WebContentsImpl::GetTitle() const { |
789 // Transient entries take precedence. They are used for interstitial pages | 778 // Transient entries take precedence. They are used for interstitial pages |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 event.wheelTicksY && | 1230 event.wheelTicksY && |
1242 (event.modifiers & blink::WebInputEvent::ControlKey)) { | 1231 (event.modifiers & blink::WebInputEvent::ControlKey)) { |
1243 delegate_->ContentsZoomChange(event.wheelTicksY > 0); | 1232 delegate_->ContentsZoomChange(event.wheelTicksY > 0); |
1244 return true; | 1233 return true; |
1245 } | 1234 } |
1246 #endif | 1235 #endif |
1247 | 1236 |
1248 return false; | 1237 return false; |
1249 } | 1238 } |
1250 | 1239 |
1251 #if defined(OS_WIN) && defined(USE_AURA) | 1240 #if defined(OS_WIN) |
1252 gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() { | 1241 gfx::NativeViewAccessible WebContentsImpl::GetParentNativeViewAccessible() { |
1253 return accessible_parent_; | 1242 return accessible_parent_; |
1254 } | 1243 } |
1255 #endif | 1244 #endif |
1256 | 1245 |
1257 void WebContentsImpl::HandleMouseDown() { | 1246 void WebContentsImpl::HandleMouseDown() { |
1258 if (delegate_) | 1247 if (delegate_) |
1259 delegate_->HandleMouseDown(); | 1248 delegate_->HandleMouseDown(); |
1260 } | 1249 } |
1261 | 1250 |
(...skipping 2589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3851 } | 3840 } |
3852 | 3841 |
3853 void WebContentsImpl::OnFrameRemoved( | 3842 void WebContentsImpl::OnFrameRemoved( |
3854 RenderViewHostImpl* render_view_host, | 3843 RenderViewHostImpl* render_view_host, |
3855 int64 frame_id) { | 3844 int64 frame_id) { |
3856 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3845 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3857 FrameDetached(render_view_host, frame_id)); | 3846 FrameDetached(render_view_host, frame_id)); |
3858 } | 3847 } |
3859 | 3848 |
3860 } // namespace content | 3849 } // namespace content |
OLD | NEW |