| 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_view_gtk.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" |
| 6 | 6 |
| 7 // If this gets included after the gtk headers, then a bunch of compiler | 7 // If this gets included after the gtk headers, then a bunch of compiler |
| 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts | 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts |
| 9 // badly with URLRequestStatus::Status. | 9 // badly with URLRequestStatus::Status. |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 // shrink down to the size of its child contents. | 369 // shrink down to the size of its child contents. |
| 370 gtk_window_set_resizable(GTK_WINDOW(popup), FALSE); | 370 gtk_window_set_resizable(GTK_WINDOW(popup), FALSE); |
| 371 gtk_window_move(GTK_WINDOW(popup), pos.x(), pos.y()); | 371 gtk_window_move(GTK_WINDOW(popup), pos.x(), pos.y()); |
| 372 gtk_widget_show_all(popup); | 372 gtk_widget_show_all(popup); |
| 373 } | 373 } |
| 374 | 374 |
| 375 void RenderWidgetHostViewGtk::DidBecomeSelected() { | 375 void RenderWidgetHostViewGtk::DidBecomeSelected() { |
| 376 if (!is_hidden_) | 376 if (!is_hidden_) |
| 377 return; | 377 return; |
| 378 | 378 |
| 379 if (tab_switch_paint_time_.is_null()) |
| 380 tab_switch_paint_time_ = base::TimeTicks::Now(); |
| 379 is_hidden_ = false; | 381 is_hidden_ = false; |
| 380 host_->WasRestored(); | 382 host_->WasRestored(); |
| 381 } | 383 } |
| 382 | 384 |
| 383 void RenderWidgetHostViewGtk::WasHidden() { | 385 void RenderWidgetHostViewGtk::WasHidden() { |
| 384 if (is_hidden_) | 386 if (is_hidden_) |
| 385 return; | 387 return; |
| 386 | 388 |
| 387 // If we receive any more paint messages while we are hidden, we want to | 389 // If we receive any more paint messages while we are hidden, we want to |
| 388 // ignore them so we don't re-allocate the backing store. We will paint | 390 // ignore them so we don't re-allocate the backing store. We will paint |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 } | 590 } |
| 589 if (!whiteout_start_time_.is_null()) { | 591 if (!whiteout_start_time_.is_null()) { |
| 590 base::TimeDelta whiteout_duration = base::TimeTicks::Now() - | 592 base::TimeDelta whiteout_duration = base::TimeTicks::Now() - |
| 591 whiteout_start_time_; | 593 whiteout_start_time_; |
| 592 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration); | 594 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration); |
| 593 | 595 |
| 594 // Reset the start time to 0 so that we start recording again the next | 596 // Reset the start time to 0 so that we start recording again the next |
| 595 // time the backing store is NULL... | 597 // time the backing store is NULL... |
| 596 whiteout_start_time_ = base::TimeTicks(); | 598 whiteout_start_time_ = base::TimeTicks(); |
| 597 } | 599 } |
| 600 if (!tab_switch_paint_time_.is_null()) { |
| 601 base::TimeDelta tab_switch_paint_duration = base::TimeTicks::Now() - |
| 602 tab_switch_paint_time_; |
| 603 UMA_HISTOGRAM_TIMES("MPArch.RWH_TabSwitchPaintDuration", |
| 604 tab_switch_paint_duration); |
| 605 // Reset tab_switch_paint_time_ to 0 so future tab selections are |
| 606 // recorded. |
| 607 tab_switch_paint_time_ = base::TimeTicks(); |
| 608 } |
| 598 } else { | 609 } else { |
| 599 if (window) | 610 if (window) |
| 600 gdk_window_clear(window); | 611 gdk_window_clear(window); |
| 601 if (whiteout_start_time_.is_null()) | 612 if (whiteout_start_time_.is_null()) |
| 602 whiteout_start_time_ = base::TimeTicks::Now(); | 613 whiteout_start_time_ = base::TimeTicks::Now(); |
| 603 } | 614 } |
| 604 } | 615 } |
| 605 | 616 |
| 606 void RenderWidgetHostViewGtk::ShowCurrentCursor() { | 617 void RenderWidgetHostViewGtk::ShowCurrentCursor() { |
| 607 // The widget may not have a window. If that's the case, abort mission. This | 618 // The widget may not have a window. If that's the case, abort mission. This |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 const NativeWebKeyboardEvent& event) { | 670 const NativeWebKeyboardEvent& event) { |
| 660 if (!host_) | 671 if (!host_) |
| 661 return; | 672 return; |
| 662 | 673 |
| 663 EditCommands edit_commands; | 674 EditCommands edit_commands; |
| 664 if (key_bindings_handler_->Match(event, &edit_commands)) { | 675 if (key_bindings_handler_->Match(event, &edit_commands)) { |
| 665 host_->ForwardEditCommandsForNextKeyEvent(edit_commands); | 676 host_->ForwardEditCommandsForNextKeyEvent(edit_commands); |
| 666 } | 677 } |
| 667 host_->ForwardKeyboardEvent(event); | 678 host_->ForwardKeyboardEvent(event); |
| 668 } | 679 } |
| OLD | NEW |