| 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/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 24 #include "base/values.h" | 24 #include "base/values.h" |
| 25 #include "content/browser/child_process_security_policy_impl.h" | 25 #include "content/browser/child_process_security_policy_impl.h" |
| 26 #include "content/browser/cross_site_request_manager.h" | 26 #include "content/browser/cross_site_request_manager.h" |
| 27 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 27 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 28 #include "content/browser/gpu/gpu_surface_tracker.h" | 28 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 29 #include "content/browser/host_zoom_map_impl.h" | 29 #include "content/browser/host_zoom_map_impl.h" |
| 30 #include "content/browser/renderer_host/dip_util.h" | 30 #include "content/browser/renderer_host/dip_util.h" |
| 31 #include "content/browser/renderer_host/frame_tree.h" |
| 31 #include "content/browser/renderer_host/render_process_host_impl.h" | 32 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 32 #include "content/browser/renderer_host/render_view_host_delegate.h" | 33 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 33 #include "content/common/accessibility_messages.h" | 34 #include "content/common/accessibility_messages.h" |
| 34 #include "content/common/browser_plugin/browser_plugin_messages.h" | 35 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 35 #include "content/common/desktop_notification_messages.h" | 36 #include "content/common/desktop_notification_messages.h" |
| 36 #include "content/common/drag_messages.h" | 37 #include "content/common/drag_messages.h" |
| 37 #include "content/common/input_messages.h" | 38 #include "content/common/input_messages.h" |
| 38 #include "content/common/inter_process_time_ticks_converter.h" | 39 #include "content/common/inter_process_time_ticks_converter.h" |
| 39 #include "content/common/speech_recognition_messages.h" | 40 #include "content/common/speech_recognition_messages.h" |
| 40 #include "content/common/swapped_out_messages.h" | 41 #include "content/common/swapped_out_messages.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 are_javascript_messages_suppressed_(false), | 178 are_javascript_messages_suppressed_(false), |
| 178 sudden_termination_allowed_(false), | 179 sudden_termination_allowed_(false), |
| 179 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) { | 180 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) { |
| 180 DCHECK(instance_.get()); | 181 DCHECK(instance_.get()); |
| 181 CHECK(delegate_); // http://crbug.com/82827 | 182 CHECK(delegate_); // http://crbug.com/82827 |
| 182 | 183 |
| 183 if (main_frame_routing_id == MSG_ROUTING_NONE) | 184 if (main_frame_routing_id == MSG_ROUTING_NONE) |
| 184 main_frame_routing_id = GetProcess()->GetNextRoutingID(); | 185 main_frame_routing_id = GetProcess()->GetNextRoutingID(); |
| 185 | 186 |
| 186 main_render_frame_host_.reset( | 187 main_render_frame_host_.reset( |
| 187 new RenderFrameHostImpl(this, main_frame_routing_id, is_swapped_out_)); | 188 new RenderFrameHostImpl(GetProcess(), delegate_->GetFrameTree(), |
| 189 main_frame_routing_id, is_swapped_out_)); |
| 188 | 190 |
| 189 GetProcess()->EnableSendQueue(); | 191 GetProcess()->EnableSendQueue(); |
| 190 | 192 |
| 191 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 193 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
| 192 g_created_callbacks.Get().at(i).Run(this); | 194 g_created_callbacks.Get().at(i).Run(this); |
| 193 | 195 |
| 194 if (!swapped_out) | 196 if (!swapped_out) |
| 195 instance_->increment_active_view_count(); | 197 instance_->increment_active_view_count(); |
| 196 | 198 |
| 197 #if defined(OS_ANDROID) | 199 #if defined(OS_ANDROID) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // page ID it might be asked to render. | 250 // page ID it might be asked to render. |
| 249 int32 next_page_id = 1; | 251 int32 next_page_id = 1; |
| 250 if (max_page_id > -1) | 252 if (max_page_id > -1) |
| 251 next_page_id = max_page_id + 1; | 253 next_page_id = max_page_id + 1; |
| 252 | 254 |
| 253 ViewMsg_New_Params params; | 255 ViewMsg_New_Params params; |
| 254 params.renderer_preferences = | 256 params.renderer_preferences = |
| 255 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); | 257 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); |
| 256 params.web_preferences = delegate_->GetWebkitPrefs(); | 258 params.web_preferences = delegate_->GetWebkitPrefs(); |
| 257 params.view_id = GetRoutingID(); | 259 params.view_id = GetRoutingID(); |
| 258 params.main_frame_routing_id = main_render_frame_host_->routing_id(); | 260 params.main_frame_routing_id = main_render_frame_host()->routing_id(); |
| 259 params.surface_id = surface_id(); | 261 params.surface_id = surface_id(); |
| 260 params.session_storage_namespace_id = | 262 params.session_storage_namespace_id = |
| 261 delegate_->GetSessionStorageNamespace(instance_)->id(); | 263 delegate_->GetSessionStorageNamespace(instance_)->id(); |
| 262 params.frame_name = frame_name; | 264 params.frame_name = frame_name; |
| 263 // Ensure the RenderView sets its opener correctly. | 265 // Ensure the RenderView sets its opener correctly. |
| 264 params.opener_route_id = opener_route_id; | 266 params.opener_route_id = opener_route_id; |
| 265 params.swapped_out = is_swapped_out_; | 267 params.swapped_out = is_swapped_out_; |
| 266 params.hidden = is_hidden(); | 268 params.hidden = is_hidden(); |
| 267 params.next_page_id = next_page_id; | 269 params.next_page_id = next_page_id; |
| 268 GetWebScreenInfo(¶ms.screen_info); | 270 GetWebScreenInfo(¶ms.screen_info); |
| (...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2024 params.item_height, | 2026 params.item_height, |
| 2025 params.item_font_size, | 2027 params.item_font_size, |
| 2026 params.selected_item, | 2028 params.selected_item, |
| 2027 params.popup_items, | 2029 params.popup_items, |
| 2028 params.right_aligned, | 2030 params.right_aligned, |
| 2029 params.allow_multiple_selection); | 2031 params.allow_multiple_selection); |
| 2030 } | 2032 } |
| 2031 } | 2033 } |
| 2032 #endif | 2034 #endif |
| 2033 | 2035 |
| 2034 RenderFrameHostImpl* RenderViewHostImpl::main_render_frame_host() const { | |
| 2035 DCHECK_EQ(GetProcess(), main_render_frame_host_->GetProcess()); | |
| 2036 return main_render_frame_host_.get(); | |
| 2037 } | |
| 2038 | |
| 2039 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) { | 2036 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) { |
| 2040 // We update the number of RenderViews in a SiteInstance when the | 2037 // We update the number of RenderViews in a SiteInstance when the |
| 2041 // swapped out status of this RenderView gets flipped. | 2038 // swapped out status of this RenderView gets flipped. |
| 2042 if (is_swapped_out_ && !is_swapped_out) | 2039 if (is_swapped_out_ && !is_swapped_out) |
| 2043 instance_->increment_active_view_count(); | 2040 instance_->increment_active_view_count(); |
| 2044 else if (!is_swapped_out_ && is_swapped_out) | 2041 else if (!is_swapped_out_ && is_swapped_out) |
| 2045 instance_->decrement_active_view_count(); | 2042 instance_->decrement_active_view_count(); |
| 2046 | 2043 |
| 2047 is_swapped_out_ = is_swapped_out; | 2044 is_swapped_out_ = is_swapped_out; |
| 2048 | 2045 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2061 | 2058 |
| 2062 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); | 2059 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); |
| 2063 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); | 2060 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); |
| 2064 file != file_paths.end(); ++file) { | 2061 file != file_paths.end(); ++file) { |
| 2065 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) | 2062 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) |
| 2066 return false; | 2063 return false; |
| 2067 } | 2064 } |
| 2068 return true; | 2065 return true; |
| 2069 } | 2066 } |
| 2070 | 2067 |
| 2068 void RenderViewHostImpl::AttachToFrameTree() { |
| 2069 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 2070 |
| 2071 frame_tree->SwapMainFrame(main_render_frame_host_.get()); |
| 2072 if (main_frame_id() != FrameTreeNode::kInvalidFrameId) { |
| 2073 frame_tree->OnFirstNavigationAfterSwap(main_frame_id()); |
| 2074 } |
| 2075 } |
| 2076 |
| 2071 } // namespace content | 2077 } // namespace content |
| OLD | NEW |