| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 process_(process), | 46 process_(process), |
| 47 routing_id_(routing_id), | 47 routing_id_(routing_id), |
| 48 is_loading_(false), | 48 is_loading_(false), |
| 49 is_hidden_(false), | 49 is_hidden_(false), |
| 50 repaint_ack_pending_(false), | 50 repaint_ack_pending_(false), |
| 51 resize_ack_pending_(false), | 51 resize_ack_pending_(false), |
| 52 suppress_view_updating_(false), | 52 suppress_view_updating_(false), |
| 53 mouse_move_pending_(false), | 53 mouse_move_pending_(false), |
| 54 needs_repainting_on_restore_(false), | 54 needs_repainting_on_restore_(false), |
| 55 is_unresponsive_(false), | 55 is_unresponsive_(false), |
| 56 view_being_painted_(false) { | 56 view_being_painted_(false), |
| 57 text_direction_updated_(false), |
| 58 text_direction_(WEB_TEXT_DIRECTION_LTR) { |
| 57 if (routing_id_ == MSG_ROUTING_NONE) | 59 if (routing_id_ == MSG_ROUTING_NONE) |
| 58 routing_id_ = process_->GetNextRoutingID(); | 60 routing_id_ = process_->GetNextRoutingID(); |
| 59 | 61 |
| 60 process_->Attach(this, routing_id_); | 62 process_->Attach(this, routing_id_); |
| 61 // Because the widget initializes as is_hidden_ == false, | 63 // Because the widget initializes as is_hidden_ == false, |
| 62 // tell the process host that we're alive. | 64 // tell the process host that we're alive. |
| 63 process_->WidgetRestored(); | 65 process_->WidgetRestored(); |
| 64 } | 66 } |
| 65 | 67 |
| 66 RenderWidgetHost::~RenderWidgetHost() { | 68 RenderWidgetHost::~RenderWidgetHost() { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 view_ = NULL; // The View should be deleted by RenderViewGone. | 351 view_ = NULL; // The View should be deleted by RenderViewGone. |
| 350 } | 352 } |
| 351 | 353 |
| 352 BackingStoreManager::RemoveBackingStore(this); | 354 BackingStoreManager::RemoveBackingStore(this); |
| 353 } | 355 } |
| 354 | 356 |
| 355 gfx::Rect RenderWidgetHost::GetRootWindowResizerRect() const { | 357 gfx::Rect RenderWidgetHost::GetRootWindowResizerRect() const { |
| 356 return gfx::Rect(); | 358 return gfx::Rect(); |
| 357 } | 359 } |
| 358 | 360 |
| 361 void RenderWidgetHost::UpdateTextDirection(WebTextDirection direction) { |
| 362 text_direction_updated_ = true; |
| 363 text_direction_ = direction; |
| 364 } |
| 365 |
| 366 void RenderWidgetHost::NotifyTextDirection() { |
| 367 if (text_direction_updated_) { |
| 368 text_direction_updated_ = false; |
| 369 Send(new ViewMsg_SetTextDirection(routing_id(), |
| 370 text_direction_)); |
| 371 } |
| 372 } |
| 373 |
| 359 void RenderWidgetHost::Destroy() { | 374 void RenderWidgetHost::Destroy() { |
| 360 NotificationService::current()->Notify( | 375 NotificationService::current()->Notify( |
| 361 NotificationType::RENDER_WIDGET_HOST_DESTROYED, | 376 NotificationType::RENDER_WIDGET_HOST_DESTROYED, |
| 362 Source<RenderWidgetHost>(this), | 377 Source<RenderWidgetHost>(this), |
| 363 NotificationService::NoDetails()); | 378 NotificationService::NoDetails()); |
| 364 | 379 |
| 365 // Tell the view to die. | 380 // Tell the view to die. |
| 366 // Note that in the process of the view shutting down, it can call a ton | 381 // Note that in the process of the view shutting down, it can call a ton |
| 367 // of other messages on us. So if you do any other deinitialization here, | 382 // of other messages on us. So if you do any other deinitialization here, |
| 368 // do it after this call to view_->Destroy(). | 383 // do it after this call to view_->Destroy(). |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 | 678 |
| 664 // TODO(darin): do we need to do something else if our backing store is not | 679 // TODO(darin): do we need to do something else if our backing store is not |
| 665 // the same size as the advertised view? maybe we just assume there is a | 680 // the same size as the advertised view? maybe we just assume there is a |
| 666 // full paint on its way? | 681 // full paint on its way? |
| 667 BackingStore* backing_store = BackingStoreManager::Lookup(this); | 682 BackingStore* backing_store = BackingStoreManager::Lookup(this); |
| 668 if (!backing_store || (backing_store->size() != view_size)) | 683 if (!backing_store || (backing_store->size() != view_size)) |
| 669 return; | 684 return; |
| 670 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, | 685 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, |
| 671 dx, dy, clip_rect, view_size); | 686 dx, dy, clip_rect, view_size); |
| 672 } | 687 } |
| OLD | NEW |