| 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" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 is_loading_(false), | 53 is_loading_(false), |
| 54 is_hidden_(false), | 54 is_hidden_(false), |
| 55 repaint_ack_pending_(false), | 55 repaint_ack_pending_(false), |
| 56 resize_ack_pending_(false), | 56 resize_ack_pending_(false), |
| 57 suppress_view_updating_(false), | 57 suppress_view_updating_(false), |
| 58 mouse_move_pending_(false), | 58 mouse_move_pending_(false), |
| 59 needs_repainting_on_restore_(false), | 59 needs_repainting_on_restore_(false), |
| 60 is_unresponsive_(false), | 60 is_unresponsive_(false), |
| 61 view_being_painted_(false), | 61 view_being_painted_(false), |
| 62 text_direction_updated_(false), | 62 text_direction_updated_(false), |
| 63 text_direction_(WEB_TEXT_DIRECTION_LTR) { | 63 text_direction_(WEB_TEXT_DIRECTION_LTR), |
| 64 text_direction_canceled_(false) { |
| 64 if (routing_id_ == MSG_ROUTING_NONE) | 65 if (routing_id_ == MSG_ROUTING_NONE) |
| 65 routing_id_ = process_->GetNextRoutingID(); | 66 routing_id_ = process_->GetNextRoutingID(); |
| 66 | 67 |
| 67 process_->Attach(this, routing_id_); | 68 process_->Attach(this, routing_id_); |
| 68 // Because the widget initializes as is_hidden_ == false, | 69 // Because the widget initializes as is_hidden_ == false, |
| 69 // tell the process host that we're alive. | 70 // tell the process host that we're alive. |
| 70 process_->WidgetRestored(); | 71 process_->WidgetRestored(); |
| 71 } | 72 } |
| 72 | 73 |
| 73 RenderWidgetHost::~RenderWidgetHost() { | 74 RenderWidgetHost::~RenderWidgetHost() { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 358 } |
| 358 | 359 |
| 359 BackingStoreManager::RemoveBackingStore(this); | 360 BackingStoreManager::RemoveBackingStore(this); |
| 360 } | 361 } |
| 361 | 362 |
| 362 void RenderWidgetHost::UpdateTextDirection(WebTextDirection direction) { | 363 void RenderWidgetHost::UpdateTextDirection(WebTextDirection direction) { |
| 363 text_direction_updated_ = true; | 364 text_direction_updated_ = true; |
| 364 text_direction_ = direction; | 365 text_direction_ = direction; |
| 365 } | 366 } |
| 366 | 367 |
| 368 void RenderWidgetHost::CancelUpdateTextDirection() { |
| 369 if (text_direction_updated_) |
| 370 text_direction_canceled_ = true; |
| 371 } |
| 372 |
| 367 void RenderWidgetHost::NotifyTextDirection() { | 373 void RenderWidgetHost::NotifyTextDirection() { |
| 368 if (text_direction_updated_) { | 374 if (text_direction_updated_) { |
| 375 if (!text_direction_canceled_) |
| 376 Send(new ViewMsg_SetTextDirection(routing_id(), |
| 377 static_cast<int>(text_direction_))); |
| 369 text_direction_updated_ = false; | 378 text_direction_updated_ = false; |
| 370 Send(new ViewMsg_SetTextDirection(routing_id(), | 379 text_direction_canceled_ = false; |
| 371 static_cast<int>(text_direction_))); | |
| 372 } | 380 } |
| 373 } | 381 } |
| 374 | 382 |
| 375 gfx::Rect RenderWidgetHost::GetRootWindowResizerRect() const { | 383 gfx::Rect RenderWidgetHost::GetRootWindowResizerRect() const { |
| 376 return gfx::Rect(); | 384 return gfx::Rect(); |
| 377 } | 385 } |
| 378 | 386 |
| 379 void RenderWidgetHost::Destroy() { | 387 void RenderWidgetHost::Destroy() { |
| 380 NotificationService::current()->Notify( | 388 NotificationService::current()->Notify( |
| 381 NotificationType::RENDER_WIDGET_HOST_DESTROYED, | 389 NotificationType::RENDER_WIDGET_HOST_DESTROYED, |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 691 |
| 684 // TODO(darin): do we need to do something else if our backing store is not | 692 // TODO(darin): do we need to do something else if our backing store is not |
| 685 // the same size as the advertised view? maybe we just assume there is a | 693 // the same size as the advertised view? maybe we just assume there is a |
| 686 // full paint on its way? | 694 // full paint on its way? |
| 687 BackingStore* backing_store = BackingStoreManager::Lookup(this); | 695 BackingStore* backing_store = BackingStoreManager::Lookup(this); |
| 688 if (!backing_store || (backing_store->size() != view_size)) | 696 if (!backing_store || (backing_store->size() != view_size)) |
| 689 return; | 697 return; |
| 690 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, | 698 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, |
| 691 dx, dy, clip_rect, view_size); | 699 dx, dy, clip_rect, view_size); |
| 692 } | 700 } |
| OLD | NEW |