| 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_widget_host.h" | 5 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 6 | 6 |
| 7 #include "base/gfx/native_widget_types.h" | 7 #include "base/gfx/native_widget_types.h" |
| 8 #include "base/histogram.h" | 8 #include "base/histogram.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
| 11 #include "chrome/browser/renderer_host/backing_store.h" | 11 #include "chrome/browser/renderer_host/backing_store.h" |
| 12 #include "chrome/browser/renderer_host/renderer_security_policy.h" |
| 12 #include "chrome/browser/renderer_host/render_process_host.h" | 13 #include "chrome/browser/renderer_host/render_process_host.h" |
| 13 #include "chrome/browser/renderer_host/render_widget_helper.h" | 14 #include "chrome/browser/renderer_host/render_widget_helper.h" |
| 14 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 15 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 15 #include "chrome/common/notification_service.h" | 16 #include "chrome/common/notification_service.h" |
| 16 #include "chrome/common/render_messages.h" | 17 #include "chrome/common/render_messages.h" |
| 17 #include "chrome/views/view.h" | 18 #include "chrome/views/view.h" |
| 18 #include "webkit/glue/webcursor.h" | 19 #include "webkit/glue/webcursor.h" |
| 19 #include "webkit/glue/webtextdirection.h" | 20 #include "webkit/glue/webtextdirection.h" |
| 20 | 21 |
| 21 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 process_->Release(routing_id_); | 80 process_->Release(routing_id_); |
| 80 } | 81 } |
| 81 | 82 |
| 82 void RenderWidgetHost::Init() { | 83 void RenderWidgetHost::Init() { |
| 83 DCHECK(process_->channel()); | 84 DCHECK(process_->channel()); |
| 84 | 85 |
| 85 renderer_initialized_ = true; | 86 renderer_initialized_ = true; |
| 86 | 87 |
| 87 // Send the ack along with the information on placement. | 88 // Send the ack along with the information on placement. |
| 88 gfx::NativeView plugin_view = view_->GetPluginNativeView(); | 89 gfx::NativeView plugin_view = view_->GetPluginNativeView(); |
| 89 Send(new ViewMsg_CreatingNew_ACK(routing_id_, | 90 gfx::NativeViewId view_id = gfx::IdFromNativeView(plugin_view); |
| 90 gfx::IdFromNativeView(plugin_view))); | 91 RendererSecurityPolicy::GetInstance()->GrantNativeViewId( |
| 92 process()->pid(), view_id); |
| 93 Send(new ViewMsg_CreatingNew_ACK(routing_id_, view_id)); |
| 91 WasResized(); | 94 WasResized(); |
| 92 } | 95 } |
| 93 | 96 |
| 94 void RenderWidgetHost::Shutdown() { | 97 void RenderWidgetHost::Shutdown() { |
| 95 if (process_->channel()) { | 98 if (process_->channel()) { |
| 96 // Tell the renderer object to close. | 99 // Tell the renderer object to close. |
| 97 process_->ReportExpectingClose(routing_id_); | 100 process_->ReportExpectingClose(routing_id_); |
| 98 bool rv = Send(new ViewMsg_Close(routing_id_)); | 101 bool rv = Send(new ViewMsg_Close(routing_id_)); |
| 99 DCHECK(rv); | 102 DCHECK(rv); |
| 100 } | 103 } |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 | 723 |
| 721 // TODO(darin): do we need to do something else if our backing store is not | 724 // TODO(darin): do we need to do something else if our backing store is not |
| 722 // the same size as the advertised view? maybe we just assume there is a | 725 // the same size as the advertised view? maybe we just assume there is a |
| 723 // full paint on its way? | 726 // full paint on its way? |
| 724 BackingStore* backing_store = BackingStoreManager::Lookup(this); | 727 BackingStore* backing_store = BackingStoreManager::Lookup(this); |
| 725 if (!backing_store || (backing_store->size() != view_size)) | 728 if (!backing_store || (backing_store->size() != view_size)) |
| 726 return; | 729 return; |
| 727 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, | 730 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, |
| 728 dx, dy, clip_rect, view_size); | 731 dx, dy, clip_rect, view_size); |
| 729 } | 732 } |
| OLD | NEW |