| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_view_views.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 return; | 382 return; |
| 383 } | 383 } |
| 384 | 384 |
| 385 gfx::Rect keyboard_rect = *Details<gfx::Rect>(details).ptr(); | 385 gfx::Rect keyboard_rect = *Details<gfx::Rect>(details).ptr(); |
| 386 | 386 |
| 387 if (keyboard_rect != keyboard_rect_) { | 387 if (keyboard_rect != keyboard_rect_) { |
| 388 keyboard_rect_ = keyboard_rect; | 388 keyboard_rect_ = keyboard_rect; |
| 389 gfx::Rect screen_bounds = GetScreenBounds(); | 389 gfx::Rect screen_bounds = GetScreenBounds(); |
| 390 gfx::Rect intersecting_rect = screen_bounds.Intersect(keyboard_rect); | 390 gfx::Rect intersecting_rect = screen_bounds.Intersect(keyboard_rect); |
| 391 gfx::Rect available_rect = screen_bounds.Subtract(intersecting_rect); | 391 gfx::Rect available_rect = screen_bounds.Subtract(intersecting_rect); |
| 392 host_->Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect( | 392 host_->ScrollFocusedEditableNodeIntoRect(available_rect); |
| 393 host_->routing_id(), available_rect)); | |
| 394 } | 393 } |
| 395 #endif | 394 #endif |
| 396 } | 395 } |
| 397 | 396 |
| 398 void RenderWidgetHostViewViews::ShowingContextMenu(bool showing) { | 397 void RenderWidgetHostViewViews::ShowingContextMenu(bool showing) { |
| 399 is_showing_context_menu_ = showing; | 398 is_showing_context_menu_ = showing; |
| 400 } | 399 } |
| 401 | 400 |
| 402 BackingStore* RenderWidgetHostViewViews::AllocBackingStore( | 401 BackingStore* RenderWidgetHostViewViews::AllocBackingStore( |
| 403 const gfx::Size& size) { | 402 const gfx::Size& size) { |
| 404 return new BackingStoreSkia(host_, size); | 403 return new BackingStoreSkia(host_, size); |
| 405 } | 404 } |
| 406 | 405 |
| 407 void RenderWidgetHostViewViews::SetBackground(const SkBitmap& background) { | 406 void RenderWidgetHostViewViews::SetBackground(const SkBitmap& background) { |
| 408 RenderWidgetHostView::SetBackground(background); | 407 RenderWidgetHostView::SetBackground(background); |
| 409 if (host_) | 408 if (host_) |
| 410 host_->Send(new ViewMsg_SetBackground(host_->routing_id(), background)); | 409 host_->SetBackground(background); |
| 411 } | 410 } |
| 412 | 411 |
| 413 void RenderWidgetHostViewViews::SetVisuallyDeemphasized( | 412 void RenderWidgetHostViewViews::SetVisuallyDeemphasized( |
| 414 const SkColor* color, bool animate) { | 413 const SkColor* color, bool animate) { |
| 415 // TODO(anicolao) | 414 // TODO(anicolao) |
| 416 } | 415 } |
| 417 | 416 |
| 418 void RenderWidgetHostViewViews::UnhandledWheelEvent( | 417 void RenderWidgetHostViewViews::UnhandledWheelEvent( |
| 419 const WebKit::WebMouseWheelEvent& event) { | 418 const WebKit::WebMouseWheelEvent& event) { |
| 420 } | 419 } |
| 421 | 420 |
| 422 void RenderWidgetHostViewViews::SetHasHorizontalScrollbar( | 421 void RenderWidgetHostViewViews::SetHasHorizontalScrollbar( |
| 423 bool has_horizontal_scrollbar) { | 422 bool has_horizontal_scrollbar) { |
| 424 } | 423 } |
| 425 | 424 |
| 426 void RenderWidgetHostViewViews::SetScrollOffsetPinning( | 425 void RenderWidgetHostViewViews::SetScrollOffsetPinning( |
| 427 bool is_pinned_to_left, bool is_pinned_to_right) { | 426 bool is_pinned_to_left, bool is_pinned_to_right) { |
| 428 } | 427 } |
| 429 | 428 |
| 430 void RenderWidgetHostViewViews::SelectRect(const gfx::Point& start, | 429 void RenderWidgetHostViewViews::SelectRect(const gfx::Point& start, |
| 431 const gfx::Point& end) { | 430 const gfx::Point& end) { |
| 432 if (host_) | 431 if (host_) |
| 433 host_->Send(new ViewMsg_SelectRange(host_->routing_id(), start, end)); | 432 host_->SelectRange(start, end); |
| 434 } | 433 } |
| 435 | 434 |
| 436 bool RenderWidgetHostViewViews::IsCommandIdChecked(int command_id) const { | 435 bool RenderWidgetHostViewViews::IsCommandIdChecked(int command_id) const { |
| 437 NOTREACHED(); | 436 NOTREACHED(); |
| 438 return true; | 437 return true; |
| 439 } | 438 } |
| 440 | 439 |
| 441 bool RenderWidgetHostViewViews::IsCommandIdEnabled(int command_id) const { | 440 bool RenderWidgetHostViewViews::IsCommandIdEnabled(int command_id) const { |
| 442 bool editable = GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; | 441 bool editable = GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; |
| 443 bool has_selection = selection_start_ != selection_end_; | 442 bool has_selection = selection_start_ != selection_end_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 465 bool RenderWidgetHostViewViews::GetAcceleratorForCommandId( | 464 bool RenderWidgetHostViewViews::GetAcceleratorForCommandId( |
| 466 int command_id, | 465 int command_id, |
| 467 ui::Accelerator* accelerator) { | 466 ui::Accelerator* accelerator) { |
| 468 NOTREACHED(); | 467 NOTREACHED(); |
| 469 return true; | 468 return true; |
| 470 } | 469 } |
| 471 | 470 |
| 472 void RenderWidgetHostViewViews::ExecuteCommand(int command_id) { | 471 void RenderWidgetHostViewViews::ExecuteCommand(int command_id) { |
| 473 switch (command_id) { | 472 switch (command_id) { |
| 474 case IDS_APP_CUT: | 473 case IDS_APP_CUT: |
| 475 host_->Send(new ViewMsg_Cut(host_->routing_id())); | 474 host_->Cut(); |
| 476 break; | 475 break; |
| 477 case IDS_APP_COPY: | 476 case IDS_APP_COPY: |
| 478 host_->Send(new ViewMsg_Copy(host_->routing_id())); | 477 host_->Copy(); |
| 479 break; | 478 break; |
| 480 case IDS_APP_PASTE: | 479 case IDS_APP_PASTE: |
| 481 host_->Send(new ViewMsg_Paste(host_->routing_id())); | 480 host_->Paste(); |
| 482 break; | 481 break; |
| 483 case IDS_APP_DELETE: | 482 case IDS_APP_DELETE: |
| 484 host_->Send(new ViewMsg_Delete(host_->routing_id())); | 483 host_->Delete(); |
| 485 break; | 484 break; |
| 486 case IDS_APP_SELECT_ALL: | 485 case IDS_APP_SELECT_ALL: |
| 487 host_->Send(new ViewMsg_SelectAll(host_->routing_id())); | 486 host_->SelectAll(); |
| 488 break; | 487 break; |
| 489 default: | 488 default: |
| 490 NOTREACHED(); | 489 NOTREACHED(); |
| 491 } | 490 } |
| 492 } | 491 } |
| 493 | 492 |
| 494 std::string RenderWidgetHostViewViews::GetClassName() const { | 493 std::string RenderWidgetHostViewViews::GetClassName() const { |
| 495 return kViewClassName; | 494 return kViewClassName; |
| 496 } | 495 } |
| 497 | 496 |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 } | 1003 } |
| 1005 #endif | 1004 #endif |
| 1006 | 1005 |
| 1007 #if defined(USE_AURA) | 1006 #if defined(USE_AURA) |
| 1008 // static | 1007 // static |
| 1009 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | 1008 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( |
| 1010 RenderWidgetHost* widget) { | 1009 RenderWidgetHost* widget) { |
| 1011 return new RenderWidgetHostViewViews(widget); | 1010 return new RenderWidgetHostViewViews(widget); |
| 1012 } | 1011 } |
| 1013 #endif | 1012 #endif |
| OLD | NEW |