| 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" |
| 11 #include "chrome/browser/renderer_host/backing_store.h" | 11 #include "chrome/browser/renderer_host/backing_store.h" |
| 12 #include "chrome/browser/renderer_host/render_process_host.h" | 12 #include "chrome/browser/renderer_host/render_process_host.h" |
| 13 #include "chrome/browser/renderer_host/render_widget_helper.h" | 13 #include "chrome/browser/renderer_host/render_widget_helper.h" |
| 14 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 14 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 15 #include "chrome/common/notification_service.h" | 15 #include "chrome/common/notification_service.h" |
| 16 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
| 17 #include "chrome/views/view.h" | 17 #include "chrome/views/view.h" |
| 18 #include "webkit/glue/webcursor.h" | 18 #include "webkit/glue/webcursor.h" |
| 19 #include "webkit/glue/webinputevent.h" | 19 #include "webkit/glue/webinputevent.h" |
| 20 #include "webkit/glue/webtextdirection.h" |
| 20 | 21 |
| 21 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 22 #include "base/gfx/gdi_util.h" | 23 #include "base/gfx/gdi_util.h" |
| 23 #include "chrome/app/chrome_dll_resource.h" | 24 #include "chrome/app/chrome_dll_resource.h" |
| 24 #include "chrome/common/win_util.h" | 25 #include "chrome/common/win_util.h" |
| 25 #endif // defined(OS_WIN) | 26 #endif // defined(OS_WIN) |
| 26 | 27 |
| 27 using base::Time; | 28 using base::Time; |
| 28 using base::TimeDelta; | 29 using base::TimeDelta; |
| 29 using base::TimeTicks; | 30 using base::TimeTicks; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 46 process_(process), | 47 process_(process), |
| 47 routing_id_(routing_id), | 48 routing_id_(routing_id), |
| 48 is_loading_(false), | 49 is_loading_(false), |
| 49 is_hidden_(false), | 50 is_hidden_(false), |
| 50 repaint_ack_pending_(false), | 51 repaint_ack_pending_(false), |
| 51 resize_ack_pending_(false), | 52 resize_ack_pending_(false), |
| 52 suppress_view_updating_(false), | 53 suppress_view_updating_(false), |
| 53 mouse_move_pending_(false), | 54 mouse_move_pending_(false), |
| 54 needs_repainting_on_restore_(false), | 55 needs_repainting_on_restore_(false), |
| 55 is_unresponsive_(false), | 56 is_unresponsive_(false), |
| 56 view_being_painted_(false) { | 57 view_being_painted_(false), |
| 58 text_direction_updated_(false), |
| 59 text_direction_(WEB_TEXT_DIRECTION_LTR) { |
| 57 if (routing_id_ == MSG_ROUTING_NONE) | 60 if (routing_id_ == MSG_ROUTING_NONE) |
| 58 routing_id_ = process_->GetNextRoutingID(); | 61 routing_id_ = process_->GetNextRoutingID(); |
| 59 | 62 |
| 60 process_->Attach(this, routing_id_); | 63 process_->Attach(this, routing_id_); |
| 61 // Because the widget initializes as is_hidden_ == false, | 64 // Because the widget initializes as is_hidden_ == false, |
| 62 // tell the process host that we're alive. | 65 // tell the process host that we're alive. |
| 63 process_->WidgetRestored(); | 66 process_->WidgetRestored(); |
| 64 } | 67 } |
| 65 | 68 |
| 66 RenderWidgetHost::~RenderWidgetHost() { | 69 RenderWidgetHost::~RenderWidgetHost() { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 is_hidden_ = false; | 348 is_hidden_ = false; |
| 346 | 349 |
| 347 if (view_) { | 350 if (view_) { |
| 348 view_->RenderViewGone(); | 351 view_->RenderViewGone(); |
| 349 view_ = NULL; // The View should be deleted by RenderViewGone. | 352 view_ = NULL; // The View should be deleted by RenderViewGone. |
| 350 } | 353 } |
| 351 | 354 |
| 352 BackingStoreManager::RemoveBackingStore(this); | 355 BackingStoreManager::RemoveBackingStore(this); |
| 353 } | 356 } |
| 354 | 357 |
| 358 void RenderWidgetHost::UpdateTextDirection(WebTextDirection direction) { |
| 359 text_direction_updated_ = true; |
| 360 text_direction_ = direction; |
| 361 } |
| 362 |
| 363 void RenderWidgetHost::NotifyTextDirection() { |
| 364 if (text_direction_updated_) { |
| 365 text_direction_updated_ = false; |
| 366 Send(new ViewMsg_SetTextDirection(routing_id(), |
| 367 static_cast<int>(text_direction_))); |
| 368 } |
| 369 } |
| 370 |
| 355 gfx::Rect RenderWidgetHost::GetRootWindowResizerRect() const { | 371 gfx::Rect RenderWidgetHost::GetRootWindowResizerRect() const { |
| 356 return gfx::Rect(); | 372 return gfx::Rect(); |
| 357 } | 373 } |
| 358 | 374 |
| 359 void RenderWidgetHost::Destroy() { | 375 void RenderWidgetHost::Destroy() { |
| 360 NotificationService::current()->Notify( | 376 NotificationService::current()->Notify( |
| 361 NotificationType::RENDER_WIDGET_HOST_DESTROYED, | 377 NotificationType::RENDER_WIDGET_HOST_DESTROYED, |
| 362 Source<RenderWidgetHost>(this), | 378 Source<RenderWidgetHost>(this), |
| 363 NotificationService::NoDetails()); | 379 NotificationService::NoDetails()); |
| 364 | 380 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 | 679 |
| 664 // TODO(darin): do we need to do something else if our backing store is not | 680 // 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 | 681 // the same size as the advertised view? maybe we just assume there is a |
| 666 // full paint on its way? | 682 // full paint on its way? |
| 667 BackingStore* backing_store = BackingStoreManager::Lookup(this); | 683 BackingStore* backing_store = BackingStoreManager::Lookup(this); |
| 668 if (!backing_store || (backing_store->size() != view_size)) | 684 if (!backing_store || (backing_store->size() != view_size)) |
| 669 return; | 685 return; |
| 670 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, | 686 backing_store->ScrollRect(process_->process().handle(), bitmap, bitmap_rect, |
| 671 dx, dy, clip_rect, view_size); | 687 dx, dy, clip_rect, view_size); |
| 672 } | 688 } |
| OLD | NEW |