Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: chrome/browser/renderer_host/render_widget_host.cc

Issue 92043: Refactor ExtensionView to support a UI-less extension instance.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
8 #include "base/histogram.h" 7 #include "base/histogram.h"
9 #include "base/message_loop.h" 8 #include "base/message_loop.h"
10 #include "base/keyboard_codes.h" 9 #include "base/keyboard_codes.h"
11 #include "chrome/browser/renderer_host/backing_store.h" 10 #include "chrome/browser/renderer_host/backing_store.h"
12 #include "chrome/browser/renderer_host/render_process_host.h" 11 #include "chrome/browser/renderer_host/render_process_host.h"
13 #include "chrome/browser/renderer_host/render_widget_helper.h" 12 #include "chrome/browser/renderer_host/render_widget_helper.h"
14 #include "chrome/browser/renderer_host/render_widget_host_view.h" 13 #include "chrome/browser/renderer_host/render_widget_host_view.h"
15 #include "chrome/common/notification_service.h" 14 #include "chrome/common/notification_service.h"
16 #include "chrome/common/render_messages.h" 15 #include "chrome/common/render_messages.h"
17 #include "chrome/views/view.h" 16 #include "chrome/views/view.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 process_->WidgetRestored(); 71 process_->WidgetRestored();
73 } 72 }
74 73
75 RenderWidgetHost::~RenderWidgetHost() { 74 RenderWidgetHost::~RenderWidgetHost() {
76 // Clear our current or cached backing store if either remains. 75 // Clear our current or cached backing store if either remains.
77 BackingStoreManager::RemoveBackingStore(this); 76 BackingStoreManager::RemoveBackingStore(this);
78 77
79 process_->Release(routing_id_); 78 process_->Release(routing_id_);
80 } 79 }
81 80
81 gfx::NativeViewId RenderWidgetHost::GetPluginNativeViewId() {
82 if (view_)
83 return gfx::IdFromNativeView(view_->GetPluginNativeView());
84 return NULL;
85 }
86
82 void RenderWidgetHost::Init() { 87 void RenderWidgetHost::Init() {
83 DCHECK(process_->channel()); 88 DCHECK(process_->channel());
84 89
85 renderer_initialized_ = true; 90 renderer_initialized_ = true;
86 91
87 // Send the ack along with the information on placement. 92 // Send the ack along with the information on placement.
88 gfx::NativeView plugin_view = view_->GetPluginNativeView(); 93 Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetPluginNativeViewId()));
89 Send(new ViewMsg_CreatingNew_ACK(routing_id_,
90 gfx::IdFromNativeView(plugin_view)));
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // previous behavior of the code here. 455 // previous behavior of the code here.
453 Destroy(); 456 Destroy();
454 } 457 }
455 458
456 void RenderWidgetHost::OnMsgClose() { 459 void RenderWidgetHost::OnMsgClose() {
457 Shutdown(); 460 Shutdown();
458 } 461 }
459 462
460 void RenderWidgetHost::OnMsgRequestMove(const gfx::Rect& pos) { 463 void RenderWidgetHost::OnMsgRequestMove(const gfx::Rect& pos) {
461 // Note that we ignore the position. 464 // Note that we ignore the position.
462 view_->SetSize(pos.size()); 465 if (view_)
466 view_->SetSize(pos.size());
463 } 467 }
464 468
465 void RenderWidgetHost::OnMsgPaintRect( 469 void RenderWidgetHost::OnMsgPaintRect(
466 const ViewHostMsg_PaintRect_Params& params) { 470 const ViewHostMsg_PaintRect_Params& params) {
467 TimeTicks paint_start = TimeTicks::Now(); 471 TimeTicks paint_start = TimeTicks::Now();
468 472
469 // Update our knowledge of the RenderWidget's size. 473 // Update our knowledge of the RenderWidget's size.
470 current_size_ = params.view_size; 474 current_size_ = params.view_size;
471 475
472 bool is_resize_ack = 476 bool is_resize_ack =
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 724
721 // TODO(darin): do we need to do something else if our backing store is not 725 // 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 726 // the same size as the advertised view? maybe we just assume there is a
723 // full paint on its way? 727 // full paint on its way?
724 BackingStore* backing_store = BackingStoreManager::Lookup(this); 728 BackingStore* backing_store = BackingStoreManager::Lookup(this);
725 if (!backing_store || (backing_store->size() != view_size)) 729 if (!backing_store || (backing_store->size() != view_size))
726 return; 730 return;
727 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, 731 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect,
728 dx, dy, clip_rect, view_size); 732 dx, dy, clip_rect, view_size);
729 } 733 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698