Chromium Code Reviews| 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.h" | 5 #include "content/browser/renderer_host/render_view_host.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> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
| 15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/time.h" | 18 #include "base/time.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "content/browser/child_process_security_policy_impl.h" | 21 #include "content/browser/child_process_security_policy_impl.h" |
| 22 #include "content/browser/cross_site_request_manager.h" | 22 #include "content/browser/cross_site_request_manager.h" |
| 23 #include "content/browser/gpu/gpu_surface_tracker.h" | 23 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 24 #include "content/browser/host_zoom_map_impl.h" | 24 #include "content/browser/host_zoom_map_impl.h" |
| 25 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 25 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
| 26 #include "content/browser/power_save_blocker.h" | 26 #include "content/browser/power_save_blocker.h" |
| 27 #include "content/browser/renderer_host/pepper_message_filter.h" | |
| 27 #include "content/browser/renderer_host/render_process_host_impl.h" | 28 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 28 #include "content/browser/renderer_host/render_widget_host.h" | 29 #include "content/browser/renderer_host/render_widget_host.h" |
| 29 #include "content/browser/renderer_host/render_widget_host_view.h" | 30 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 30 #include "content/common/desktop_notification_messages.h" | 31 #include "content/common/desktop_notification_messages.h" |
| 31 #include "content/common/drag_messages.h" | 32 #include "content/common/drag_messages.h" |
| 32 #include "content/common/speech_input_messages.h" | 33 #include "content/common/speech_input_messages.h" |
| 33 #include "content/common/swapped_out_messages.h" | 34 #include "content/common/swapped_out_messages.h" |
| 34 #include "content/common/view_messages.h" | 35 #include "content/common/view_messages.h" |
| 35 #include "content/public/browser/browser_context.h" | 36 #include "content/public/browser/browser_context.h" |
| 36 #include "content/public/browser/browser_message_filter.h" | 37 #include "content/public/browser/browser_message_filter.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 CHECK(delegate_); // http://crbug.com/82827 | 141 CHECK(delegate_); // http://crbug.com/82827 |
| 141 | 142 |
| 142 process()->EnableSendQueue(); | 143 process()->EnableSendQueue(); |
| 143 | 144 |
| 144 content::GetContentClient()->browser()->RenderViewHostCreated(this); | 145 content::GetContentClient()->browser()->RenderViewHostCreated(this); |
| 145 | 146 |
| 146 content::NotificationService::current()->Notify( | 147 content::NotificationService::current()->Notify( |
| 147 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, | 148 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, |
| 148 content::Source<RenderViewHost>(this), | 149 content::Source<RenderViewHost>(this), |
| 149 content::NotificationService::NoDetails()); | 150 content::NotificationService::NoDetails()); |
| 151 | |
| 152 PepperMessageFilter::SetRenderSite(process()->GetID(), this->routing_id(), | |
|
jam
2012/02/10 18:23:54
it's a bit odd that RenderViewHost (UI thread) is
| |
| 153 instance_->GetSite()); | |
| 150 } | 154 } |
| 151 | 155 |
| 152 RenderViewHost::~RenderViewHost() { | 156 RenderViewHost::~RenderViewHost() { |
| 153 FOR_EACH_OBSERVER( | 157 FOR_EACH_OBSERVER( |
| 154 content::RenderViewHostObserver, observers_, RenderViewHostDestruction()); | 158 content::RenderViewHostObserver, observers_, RenderViewHostDestruction()); |
| 155 | 159 |
| 156 content::NotificationService::current()->Notify( | 160 content::NotificationService::current()->Notify( |
| 157 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, | 161 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, |
| 158 content::Source<RenderViewHost>(this), | 162 content::Source<RenderViewHost>(this), |
| 159 content::NotificationService::NoDetails()); | 163 content::NotificationService::NoDetails()); |
| 160 | 164 |
| 161 ClearPowerSaveBlockers(); | 165 ClearPowerSaveBlockers(); |
| 162 | 166 |
| 163 delegate()->RenderViewDeleted(this); | 167 delegate()->RenderViewDeleted(this); |
| 164 | 168 |
| 165 // Be sure to clean up any leftover state from cross-site requests. | 169 // Be sure to clean up any leftover state from cross-site requests. |
| 166 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( | 170 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( |
| 167 process()->GetID(), routing_id(), false); | 171 process()->GetID(), routing_id(), false); |
| 172 | |
| 173 PepperMessageFilter::SetRenderSite(process()->GetID(), routing_id(), GURL()); | |
| 168 } | 174 } |
| 169 | 175 |
| 170 bool RenderViewHost::CreateRenderView(const string16& frame_name, | 176 bool RenderViewHost::CreateRenderView(const string16& frame_name, |
| 171 int32 max_page_id) { | 177 int32 max_page_id) { |
| 172 DCHECK(!IsRenderViewLive()) << "Creating view twice"; | 178 DCHECK(!IsRenderViewLive()) << "Creating view twice"; |
| 173 | 179 |
| 174 // The process may (if we're sharing a process with another host that already | 180 // The process may (if we're sharing a process with another host that already |
| 175 // initialized it) or may not (we have our own process or the old process | 181 // initialized it) or may not (we have our own process or the old process |
| 176 // crashed) have been initialized. Calling Init multiple times will be | 182 // crashed) have been initialized. Calling Init multiple times will be |
| 177 // ignored, so this is safe. | 183 // ignored, so this is safe. |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 948 FilterURL(policy, renderer_id, &validated_params.referrer.url); | 954 FilterURL(policy, renderer_id, &validated_params.referrer.url); |
| 949 for (std::vector<GURL>::iterator it(validated_params.redirects.begin()); | 955 for (std::vector<GURL>::iterator it(validated_params.redirects.begin()); |
| 950 it != validated_params.redirects.end(); ++it) { | 956 it != validated_params.redirects.end(); ++it) { |
| 951 FilterURL(policy, renderer_id, &(*it)); | 957 FilterURL(policy, renderer_id, &(*it)); |
| 952 } | 958 } |
| 953 FilterURL(policy, renderer_id, &validated_params.searchable_form_url); | 959 FilterURL(policy, renderer_id, &validated_params.searchable_form_url); |
| 954 FilterURL(policy, renderer_id, &validated_params.password_form.origin); | 960 FilterURL(policy, renderer_id, &validated_params.password_form.origin); |
| 955 FilterURL(policy, renderer_id, &validated_params.password_form.action); | 961 FilterURL(policy, renderer_id, &validated_params.password_form.action); |
| 956 | 962 |
| 957 delegate_->DidNavigate(this, validated_params); | 963 delegate_->DidNavigate(this, validated_params); |
| 964 | |
| 965 PepperMessageFilter::SetRenderSite(renderer_id, routing_id(), | |
| 966 instance_->GetSite()); | |
| 958 } | 967 } |
| 959 | 968 |
| 960 void RenderViewHost::OnMsgUpdateState(int32 page_id, | 969 void RenderViewHost::OnMsgUpdateState(int32 page_id, |
| 961 const std::string& state) { | 970 const std::string& state) { |
| 962 delegate_->UpdateState(this, page_id, state); | 971 delegate_->UpdateState(this, page_id, state); |
| 963 } | 972 } |
| 964 | 973 |
| 965 void RenderViewHost::OnMsgUpdateTitle( | 974 void RenderViewHost::OnMsgUpdateTitle( |
| 966 int32 page_id, | 975 int32 page_id, |
| 967 const string16& title, | 976 const string16& title, |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1575 // Whenever we change swap out state, we should not be waiting for | 1584 // Whenever we change swap out state, we should not be waiting for |
| 1576 // beforeunload or unload acks. We clear them here to be safe, since they | 1585 // beforeunload or unload acks. We clear them here to be safe, since they |
| 1577 // can cause navigations to be ignored in OnMsgNavigate. | 1586 // can cause navigations to be ignored in OnMsgNavigate. |
| 1578 is_waiting_for_beforeunload_ack_ = false; | 1587 is_waiting_for_beforeunload_ack_ = false; |
| 1579 is_waiting_for_unload_ack_ = false; | 1588 is_waiting_for_unload_ack_ = false; |
| 1580 } | 1589 } |
| 1581 | 1590 |
| 1582 void RenderViewHost::ClearPowerSaveBlockers() { | 1591 void RenderViewHost::ClearPowerSaveBlockers() { |
| 1583 STLDeleteValues(&power_save_blockers_); | 1592 STLDeleteValues(&power_save_blockers_); |
| 1584 } | 1593 } |
| OLD | NEW |