| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/render_view_host.h" | 5 #include "chrome/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return NULL; | 97 return NULL; |
| 98 RenderWidgetHost* widget = static_cast<RenderWidgetHost*>( | 98 RenderWidgetHost* widget = static_cast<RenderWidgetHost*>( |
| 99 process->GetListenerByID(render_view_id)); | 99 process->GetListenerByID(render_view_id)); |
| 100 if (!widget || !widget->IsRenderView()) | 100 if (!widget || !widget->IsRenderView()) |
| 101 return NULL; | 101 return NULL; |
| 102 return static_cast<RenderViewHost*>(widget); | 102 return static_cast<RenderViewHost*>(widget); |
| 103 } | 103 } |
| 104 | 104 |
| 105 RenderViewHost::RenderViewHost(SiteInstance* instance, | 105 RenderViewHost::RenderViewHost(SiteInstance* instance, |
| 106 RenderViewHostDelegate* delegate, | 106 RenderViewHostDelegate* delegate, |
| 107 int routing_id) | 107 int routing_id, |
| 108 int64 session_storage_namespace_id) |
| 108 : RenderWidgetHost(instance->GetProcess(), routing_id), | 109 : RenderWidgetHost(instance->GetProcess(), routing_id), |
| 109 instance_(instance), | 110 instance_(instance), |
| 110 delegate_(delegate), | 111 delegate_(delegate), |
| 111 waiting_for_drag_context_response_(false), | 112 waiting_for_drag_context_response_(false), |
| 112 enabled_bindings_(0), | 113 enabled_bindings_(0), |
| 113 pending_request_id_(0), | 114 pending_request_id_(0), |
| 114 navigations_suspended_(false), | 115 navigations_suspended_(false), |
| 115 suspended_nav_message_(NULL), | 116 suspended_nav_message_(NULL), |
| 116 run_modal_reply_msg_(NULL), | 117 run_modal_reply_msg_(NULL), |
| 117 is_waiting_for_beforeunload_ack_(false), | 118 is_waiting_for_beforeunload_ack_(false), |
| 118 is_waiting_for_unload_ack_(false), | 119 is_waiting_for_unload_ack_(false), |
| 119 unload_ack_is_for_cross_site_transition_(false), | 120 unload_ack_is_for_cross_site_transition_(false), |
| 120 are_javascript_messages_suppressed_(false), | 121 are_javascript_messages_suppressed_(false), |
| 121 sudden_termination_allowed_(false) { | 122 sudden_termination_allowed_(false), |
| 123 session_storage_namespace_id_(session_storage_namespace_id) { |
| 122 DCHECK(instance_); | 124 DCHECK(instance_); |
| 123 DCHECK(delegate_); | 125 DCHECK(delegate_); |
| 124 | 126 |
| 125 // TODO(mpcomplete): remove this notification (and registrar) when we figure | 127 // TODO(mpcomplete): remove this notification (and registrar) when we figure |
| 126 // out why we're crashing on process()->Init(). | 128 // out why we're crashing on process()->Init(). |
| 127 // http://code.google.com/p/chromium/issues/detail?id=15607 | 129 // http://code.google.com/p/chromium/issues/detail?id=15607 |
| 128 registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, | 130 registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, |
| 129 NotificationService::AllSources()); | 131 NotificationService::AllSources()); |
| 130 } | 132 } |
| 131 | 133 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // Force local storage to be enabled for extensions. This is so that we can | 200 // Force local storage to be enabled for extensions. This is so that we can |
| 199 // enable extensions by default before databases, if necessary. | 201 // enable extensions by default before databases, if necessary. |
| 200 // TODO(aa): This should be removed when local storage and databases are | 202 // TODO(aa): This should be removed when local storage and databases are |
| 201 // enabled by default (bugs 4359 and 4360). | 203 // enabled by default (bugs 4359 and 4360). |
| 202 WebPreferences webkit_prefs = delegate_->GetWebkitPrefs(); | 204 WebPreferences webkit_prefs = delegate_->GetWebkitPrefs(); |
| 203 if (delegate_->GetURL().SchemeIs(chrome::kExtensionScheme)) { | 205 if (delegate_->GetURL().SchemeIs(chrome::kExtensionScheme)) { |
| 204 webkit_prefs.local_storage_enabled = true; | 206 webkit_prefs.local_storage_enabled = true; |
| 205 webkit_prefs.databases_enabled = true; | 207 webkit_prefs.databases_enabled = true; |
| 206 } | 208 } |
| 207 | 209 |
| 208 Send(new ViewMsg_New(GetNativeViewId(), | 210 ViewMsg_New_Params params; |
| 209 delegate_->GetRendererPrefs(process()->profile()), | 211 params.parent_window = GetNativeViewId(); |
| 210 webkit_prefs, | 212 params.renderer_preferences = |
| 211 routing_id())); | 213 delegate_->GetRendererPrefs(process()->profile()); |
| 214 params.web_preferences = webkit_prefs; |
| 215 params.view_id = routing_id(); |
| 216 params.session_storage_namespace_id = session_storage_namespace_id_; |
| 217 Send(new ViewMsg_New(params)); |
| 212 | 218 |
| 213 // Set the alternate error page, which is profile specific, in the renderer. | 219 // Set the alternate error page, which is profile specific, in the renderer. |
| 214 GURL url = delegate_->GetAlternateErrorPageURL(); | 220 GURL url = delegate_->GetAlternateErrorPageURL(); |
| 215 SetAlternateErrorPageURL(url); | 221 SetAlternateErrorPageURL(url); |
| 216 | 222 |
| 217 // If it's enabled, tell the renderer to set up the Javascript bindings for | 223 // If it's enabled, tell the renderer to set up the Javascript bindings for |
| 218 // sending messages back to the browser. | 224 // sending messages back to the browser. |
| 219 Send(new ViewMsg_AllowBindings(routing_id(), enabled_bindings_)); | 225 Send(new ViewMsg_AllowBindings(routing_id(), enabled_bindings_)); |
| 220 UpdateBrowserWindowId(delegate_->GetBrowserWindowID()); | 226 UpdateBrowserWindowId(delegate_->GetBrowserWindowID()); |
| 221 Send(new ViewMsg_NotifyRenderViewType(routing_id(), | 227 Send(new ViewMsg_NotifyRenderViewType(routing_id(), |
| (...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1782 BrowserAccessibilityManager::GetInstance()->ChangeAccessibilityFocus( | 1788 BrowserAccessibilityManager::GetInstance()->ChangeAccessibilityFocus( |
| 1783 acc_obj_id, process()->id(), routing_id()); | 1789 acc_obj_id, process()->id(), routing_id()); |
| 1784 #else | 1790 #else |
| 1785 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. | 1791 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. |
| 1786 #endif | 1792 #endif |
| 1787 } | 1793 } |
| 1788 | 1794 |
| 1789 void RenderViewHost::OnCSSInserted() { | 1795 void RenderViewHost::OnCSSInserted() { |
| 1790 delegate_->DidInsertCSS(); | 1796 delegate_->DidInsertCSS(); |
| 1791 } | 1797 } |
| OLD | NEW |