| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_widget_host.h" | 5 #include "content/browser/renderer_host/render_widget_host.h" | 
| 6 | 6 | 
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" | 
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" | 
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" | 
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" | 
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 93   // tell the process host that we're alive. | 93   // tell the process host that we're alive. | 
| 94   process_->WidgetRestored(); | 94   process_->WidgetRestored(); | 
| 95 | 95 | 
| 96   if (CommandLine::ForCurrentProcess()->HasSwitch( | 96   if (CommandLine::ForCurrentProcess()->HasSwitch( | 
| 97           switches::kForceRendererAccessibility)) { | 97           switches::kForceRendererAccessibility)) { | 
| 98     EnableRendererAccessibility(); | 98     EnableRendererAccessibility(); | 
| 99   } | 99   } | 
| 100 } | 100 } | 
| 101 | 101 | 
| 102 RenderWidgetHost::~RenderWidgetHost() { | 102 RenderWidgetHost::~RenderWidgetHost() { | 
|  | 103   set_view(NULL); | 
|  | 104 | 
| 103   // Clear our current or cached backing store if either remains. | 105   // Clear our current or cached backing store if either remains. | 
| 104   BackingStoreManager::RemoveBackingStore(this); | 106   BackingStoreManager::RemoveBackingStore(this); | 
| 105 | 107 | 
| 106   process_->Release(routing_id_); | 108   process_->Release(routing_id_); | 
| 107 } | 109 } | 
| 108 | 110 | 
|  | 111 void RenderWidgetHost::set_view(RenderWidgetHostView* view) { | 
|  | 112   view_ = view; | 
|  | 113 | 
|  | 114   if (!view_) | 
|  | 115     process_->SetCompositingSurface(routing_id_, gfx::kNullPluginWindow); | 
|  | 116 } | 
|  | 117 | 
| 109 gfx::NativeViewId RenderWidgetHost::GetNativeViewId() { | 118 gfx::NativeViewId RenderWidgetHost::GetNativeViewId() { | 
| 110   if (view_) | 119   if (view_) | 
| 111     return gfx::IdFromNativeView(view_->GetNativeView()); | 120     return gfx::IdFromNativeView(view_->GetNativeView()); | 
| 112   return 0; | 121   return 0; | 
| 113 } | 122 } | 
| 114 | 123 | 
| 115 gfx::PluginWindowHandle RenderWidgetHost::GetCompositingSurface() { | 124 gfx::PluginWindowHandle RenderWidgetHost::GetCompositingSurface() { | 
| 116   if (view_) | 125   if (view_) | 
| 117     return view_->GetCompositingSurface(); | 126     return view_->GetCompositingSurface(); | 
| 118   return gfx::kNullPluginWindow; | 127   return gfx::kNullPluginWindow; | 
| 119 } | 128 } | 
| 120 | 129 | 
| 121 bool RenderWidgetHost::PreHandleKeyboardEvent( | 130 bool RenderWidgetHost::PreHandleKeyboardEvent( | 
| 122     const NativeWebKeyboardEvent& event, | 131     const NativeWebKeyboardEvent& event, | 
| 123     bool* is_keyboard_shortcut) { | 132     bool* is_keyboard_shortcut) { | 
| 124   return false; | 133   return false; | 
| 125 } | 134 } | 
| 126 | 135 | 
| 127 void RenderWidgetHost::Init() { | 136 void RenderWidgetHost::Init() { | 
| 128   DCHECK(process_->HasConnection()); | 137   DCHECK(process_->HasConnection()); | 
| 129 | 138 | 
| 130   renderer_initialized_ = true; | 139   renderer_initialized_ = true; | 
| 131 | 140 | 
|  | 141   process_->SetCompositingSurface(routing_id_, | 
|  | 142                                   GetCompositingSurface()); | 
|  | 143 | 
| 132   // Send the ack along with the information on placement. | 144   // Send the ack along with the information on placement. | 
| 133   Send(new ViewMsg_CreatingNew_ACK( | 145   Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); | 
| 134       routing_id_, GetNativeViewId(), GetCompositingSurface())); |  | 
| 135   WasResized(); | 146   WasResized(); | 
| 136 } | 147 } | 
| 137 | 148 | 
| 138 void RenderWidgetHost::Shutdown() { | 149 void RenderWidgetHost::Shutdown() { | 
| 139   if (process_->HasConnection()) { | 150   if (process_->HasConnection()) { | 
| 140     // Tell the renderer object to close. | 151     // Tell the renderer object to close. | 
| 141     process_->ReportExpectingClose(routing_id_); | 152     process_->ReportExpectingClose(routing_id_); | 
| 142     bool rv = Send(new ViewMsg_Close(routing_id_)); | 153     bool rv = Send(new ViewMsg_Close(routing_id_)); | 
| 143     DCHECK(rv); | 154     DCHECK(rv); | 
| 144   } | 155   } | 
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 358   Send(new ViewMsg_SetFocus(routing_id_, false)); | 369   Send(new ViewMsg_SetFocus(routing_id_, false)); | 
| 359 } | 370 } | 
| 360 | 371 | 
| 361 void RenderWidgetHost::LostCapture() { | 372 void RenderWidgetHost::LostCapture() { | 
| 362   Send(new ViewMsg_MouseCaptureLost(routing_id_)); | 373   Send(new ViewMsg_MouseCaptureLost(routing_id_)); | 
| 363 } | 374 } | 
| 364 | 375 | 
| 365 void RenderWidgetHost::ViewDestroyed() { | 376 void RenderWidgetHost::ViewDestroyed() { | 
| 366   // TODO(evanm): tracking this may no longer be necessary; | 377   // TODO(evanm): tracking this may no longer be necessary; | 
| 367   // eliminate this function if so. | 378   // eliminate this function if so. | 
| 368   view_ = NULL; | 379   set_view(NULL); | 
| 369 } | 380 } | 
| 370 | 381 | 
| 371 void RenderWidgetHost::SetIsLoading(bool is_loading) { | 382 void RenderWidgetHost::SetIsLoading(bool is_loading) { | 
| 372   is_loading_ = is_loading; | 383   is_loading_ = is_loading; | 
| 373   if (!view_) | 384   if (!view_) | 
| 374     return; | 385     return; | 
| 375   view_->SetIsLoading(is_loading); | 386   view_->SetIsLoading(is_loading); | 
| 376 } | 387 } | 
| 377 | 388 | 
| 378 void RenderWidgetHost::PaintAtSize(TransportDIB::Handle dib_handle, | 389 void RenderWidgetHost::PaintAtSize(TransportDIB::Handle dib_handle, | 
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1197     view_->CreatePluginContainer(deferred_plugin_handles_[i]); | 1208     view_->CreatePluginContainer(deferred_plugin_handles_[i]); | 
| 1198 #endif | 1209 #endif | 
| 1199   } | 1210   } | 
| 1200 | 1211 | 
| 1201   deferred_plugin_handles_.clear(); | 1212   deferred_plugin_handles_.clear(); | 
| 1202 } | 1213 } | 
| 1203 | 1214 | 
| 1204 void RenderWidgetHost::StartUserGesture() { | 1215 void RenderWidgetHost::StartUserGesture() { | 
| 1205   OnUserGesture(); | 1216   OnUserGesture(); | 
| 1206 } | 1217 } | 
| OLD | NEW | 
|---|