| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 !delegate_->ShouldCreateWebContents( | 1836 !delegate_->ShouldCreateWebContents( |
| 1837 this, route_id, main_frame_route_id, main_frame_widget_route_id, | 1837 this, route_id, main_frame_route_id, main_frame_widget_route_id, |
| 1838 params.window_container_type, params.frame_name, params.target_url, | 1838 params.window_container_type, params.frame_name, params.target_url, |
| 1839 partition_id, session_storage_namespace)) { | 1839 partition_id, session_storage_namespace)) { |
| 1840 if (route_id != MSG_ROUTING_NONE && | 1840 if (route_id != MSG_ROUTING_NONE && |
| 1841 !RenderViewHost::FromID(render_process_id, route_id)) { | 1841 !RenderViewHost::FromID(render_process_id, route_id)) { |
| 1842 // If the embedder didn't create a WebContents for this route, we need to | 1842 // If the embedder didn't create a WebContents for this route, we need to |
| 1843 // delete the RenderView that had already been created. | 1843 // delete the RenderView that had already been created. |
| 1844 Send(new ViewMsg_Close(route_id)); | 1844 Send(new ViewMsg_Close(route_id)); |
| 1845 } | 1845 } |
| 1846 GetRenderViewHost()->GetProcess()->ResumeRequestsForView(route_id); | |
| 1847 return; | 1846 return; |
| 1848 } | 1847 } |
| 1849 | 1848 |
| 1850 // Create the new web contents. This will automatically create the new | 1849 // Create the new web contents. This will automatically create the new |
| 1851 // WebContentsView. In the future, we may want to create the view separately. | 1850 // WebContentsView. In the future, we may want to create the view separately. |
| 1852 CreateParams create_params(GetBrowserContext(), site_instance.get()); | 1851 CreateParams create_params(GetBrowserContext(), site_instance.get()); |
| 1853 create_params.routing_id = route_id; | 1852 create_params.routing_id = route_id; |
| 1854 create_params.main_frame_routing_id = main_frame_route_id; | 1853 create_params.main_frame_routing_id = main_frame_route_id; |
| 1855 create_params.main_frame_widget_routing_id = main_frame_widget_route_id; | 1854 create_params.main_frame_widget_routing_id = main_frame_widget_route_id; |
| 1856 create_params.main_frame_name = params.frame_name; | 1855 create_params.main_frame_name = params.frame_name; |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2890 GetRenderViewHost()->GetWidget()->RejectMouseLockOrUnlockIfNecessary(); | 2889 GetRenderViewHost()->GetWidget()->RejectMouseLockOrUnlockIfNecessary(); |
| 2891 ExitFullscreenMode(); | 2890 ExitFullscreenMode(); |
| 2892 } | 2891 } |
| 2893 | 2892 |
| 2894 void WebContentsImpl::ResumeLoadingCreatedWebContents() { | 2893 void WebContentsImpl::ResumeLoadingCreatedWebContents() { |
| 2895 if (delayed_open_url_params_.get()) { | 2894 if (delayed_open_url_params_.get()) { |
| 2896 OpenURL(*delayed_open_url_params_.get()); | 2895 OpenURL(*delayed_open_url_params_.get()); |
| 2897 delayed_open_url_params_.reset(nullptr); | 2896 delayed_open_url_params_.reset(nullptr); |
| 2898 return; | 2897 return; |
| 2899 } | 2898 } |
| 2900 | |
| 2901 // Resume blocked requests for both the RenderViewHost and RenderFrameHost. | |
| 2902 // TODO(brettw): It seems bogus to reach into here and initialize the host. | |
| 2903 if (is_resume_pending_) { | |
| 2904 is_resume_pending_ = false; | |
| 2905 GetRenderViewHost()->GetWidget()->Init(); | |
| 2906 GetMainFrame()->Init(); | |
| 2907 } | |
| 2908 } | 2899 } |
| 2909 | 2900 |
| 2910 bool WebContentsImpl::FocusLocationBarByDefault() { | 2901 bool WebContentsImpl::FocusLocationBarByDefault() { |
| 2911 NavigationEntry* entry = controller_.GetVisibleEntry(); | 2902 NavigationEntry* entry = controller_.GetVisibleEntry(); |
| 2912 if (entry && entry->GetURL() == GURL(url::kAboutBlankURL)) | 2903 if (entry && entry->GetURL() == GURL(url::kAboutBlankURL)) |
| 2913 return true; | 2904 return true; |
| 2914 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); | 2905 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); |
| 2915 } | 2906 } |
| 2916 | 2907 |
| 2917 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { | 2908 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { |
| (...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4746 const WebContentsObserver::MediaPlayerId& id) { | 4737 const WebContentsObserver::MediaPlayerId& id) { |
| 4747 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); | 4738 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); |
| 4748 } | 4739 } |
| 4749 | 4740 |
| 4750 void WebContentsImpl::MediaStoppedPlaying( | 4741 void WebContentsImpl::MediaStoppedPlaying( |
| 4751 const WebContentsObserver::MediaPlayerId& id) { | 4742 const WebContentsObserver::MediaPlayerId& id) { |
| 4752 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); | 4743 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); |
| 4753 } | 4744 } |
| 4754 | 4745 |
| 4755 } // namespace content | 4746 } // namespace content |
| OLD | NEW |