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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 // WebContentsImpl ------------------------------------------------------------- | 302 // WebContentsImpl ------------------------------------------------------------- |
303 | 303 |
304 WebContentsImpl::WebContentsImpl( | 304 WebContentsImpl::WebContentsImpl( |
305 BrowserContext* browser_context, | 305 BrowserContext* browser_context, |
306 WebContentsImpl* opener) | 306 WebContentsImpl* opener) |
307 : delegate_(NULL), | 307 : delegate_(NULL), |
308 controller_(this, browser_context), | 308 controller_(this, browser_context), |
309 render_view_host_delegate_view_(NULL), | 309 render_view_host_delegate_view_(NULL), |
310 opener_(opener), | 310 opener_(opener), |
| 311 created_with_opener_(opener != NULL), |
311 #if defined(OS_WIN) | 312 #if defined(OS_WIN) |
312 accessible_parent_(NULL), | 313 accessible_parent_(NULL), |
313 #endif | 314 #endif |
314 frame_tree_(new NavigatorImpl(&controller_, this), | 315 frame_tree_(new NavigatorImpl(&controller_, this), |
315 this, this, this, this), | 316 this, this, this, this), |
316 is_loading_(false), | 317 is_loading_(false), |
317 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 318 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
318 crashed_error_code_(0), | 319 crashed_error_code_(0), |
319 waiting_for_response_(false), | 320 waiting_for_response_(false), |
320 load_state_(net::LOAD_STATE_IDLE, base::string16()), | 321 load_state_(net::LOAD_STATE_IDLE, base::string16()), |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 | 2043 |
2043 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 2044 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
2044 return GetRenderViewHost() ? | 2045 return GetRenderViewHost() ? |
2045 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; | 2046 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; |
2046 } | 2047 } |
2047 | 2048 |
2048 bool WebContentsImpl::HasOpener() const { | 2049 bool WebContentsImpl::HasOpener() const { |
2049 return opener_ != NULL; | 2050 return opener_ != NULL; |
2050 } | 2051 } |
2051 | 2052 |
| 2053 bool WebContentsImpl::CreatedWithOpener() const { |
| 2054 return created_with_opener_; |
| 2055 } |
| 2056 |
2052 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) { | 2057 void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) { |
2053 Send(new ViewMsg_DidChooseColorResponse( | 2058 Send(new ViewMsg_DidChooseColorResponse( |
2054 GetRoutingID(), color_chooser_identifier_, color)); | 2059 GetRoutingID(), color_chooser_identifier_, color)); |
2055 } | 2060 } |
2056 | 2061 |
2057 void WebContentsImpl::DidEndColorChooser() { | 2062 void WebContentsImpl::DidEndColorChooser() { |
2058 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), | 2063 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), |
2059 color_chooser_identifier_)); | 2064 color_chooser_identifier_)); |
2060 color_chooser_.reset(); | 2065 color_chooser_.reset(); |
2061 color_chooser_identifier_ = 0; | 2066 color_chooser_identifier_ = 0; |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3537 rwh_view->SetSize(GetSizeForNewRenderView()); | 3542 rwh_view->SetSize(GetSizeForNewRenderView()); |
3538 | 3543 |
3539 // Make sure we use the correct starting page_id in the new RenderView. | 3544 // Make sure we use the correct starting page_id in the new RenderView. |
3540 UpdateMaxPageIDIfNecessary(render_view_host); | 3545 UpdateMaxPageIDIfNecessary(render_view_host); |
3541 int32 max_page_id = | 3546 int32 max_page_id = |
3542 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); | 3547 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); |
3543 | 3548 |
3544 if (!static_cast<RenderViewHostImpl*>( | 3549 if (!static_cast<RenderViewHostImpl*>( |
3545 render_view_host)->CreateRenderView(base::string16(), | 3550 render_view_host)->CreateRenderView(base::string16(), |
3546 opener_route_id, | 3551 opener_route_id, |
3547 max_page_id)) { | 3552 max_page_id, |
| 3553 created_with_opener_)) { |
3548 return false; | 3554 return false; |
3549 } | 3555 } |
3550 | 3556 |
3551 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 3557 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
3552 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on | 3558 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on |
3553 // linux. See crbug.com/83941. | 3559 // linux. See crbug.com/83941. |
3554 if (rwh_view) { | 3560 if (rwh_view) { |
3555 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) | 3561 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) |
3556 render_widget_host->WasResized(); | 3562 render_widget_host->WasResized(); |
3557 } | 3563 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3674 | 3680 |
3675 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3681 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
3676 if (!delegate_) | 3682 if (!delegate_) |
3677 return; | 3683 return; |
3678 const gfx::Size new_size = GetPreferredSize(); | 3684 const gfx::Size new_size = GetPreferredSize(); |
3679 if (new_size != old_size) | 3685 if (new_size != old_size) |
3680 delegate_->UpdatePreferredSize(this, new_size); | 3686 delegate_->UpdatePreferredSize(this, new_size); |
3681 } | 3687 } |
3682 | 3688 |
3683 } // namespace content | 3689 } // namespace content |
OLD | NEW |