| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 return window_->GetBoundsInScreen(); | 771 return window_->GetBoundsInScreen(); |
| 772 } | 772 } |
| 773 | 773 |
| 774 void RenderWidgetHostViewAura::SetBackgroundOpaque(bool opaque) { | 774 void RenderWidgetHostViewAura::SetBackgroundOpaque(bool opaque) { |
| 775 RenderWidgetHostViewBase::SetBackgroundOpaque(opaque); | 775 RenderWidgetHostViewBase::SetBackgroundOpaque(opaque); |
| 776 host_->SetBackgroundOpaque(opaque); | 776 host_->SetBackgroundOpaque(opaque); |
| 777 window_->layer()->SetFillsBoundsOpaquely(opaque); | 777 window_->layer()->SetFillsBoundsOpaquely(opaque); |
| 778 } | 778 } |
| 779 | 779 |
| 780 gfx::Size RenderWidgetHostViewAura::GetVisibleViewportSize() const { | 780 gfx::Size RenderWidgetHostViewAura::GetVisibleViewportSize() const { |
| 781 gfx::Rect window_bounds = window_->bounds(); | 781 gfx::Rect requested_rect(GetRequestedRendererSize()); |
| 782 int viewport_width = std::max( | 782 requested_rect.Inset(insets_); |
| 783 0, window_bounds.width() - insets_.left() - insets_.right()); | 783 return requested_rect.size(); |
| 784 int viewport_height = std::max( | |
| 785 0, window_bounds.height() - insets_.top() - insets_.bottom()); | |
| 786 return gfx::Size(viewport_width, viewport_height); | |
| 787 } | 784 } |
| 788 | 785 |
| 789 void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) { | 786 void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) { |
| 790 if (insets != insets_) { | 787 if (insets != insets_) { |
| 791 insets_ = insets; | 788 insets_ = insets; |
| 792 host_->WasResized(); | 789 host_->WasResized(); |
| 793 } | 790 } |
| 794 } | 791 } |
| 795 | 792 |
| 796 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { | 793 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 } | 885 } |
| 889 | 886 |
| 890 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 887 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 891 ui::ScopedClipboardWriter clipboard_writer( | 888 ui::ScopedClipboardWriter clipboard_writer( |
| 892 ui::Clipboard::GetForCurrentThread(), | 889 ui::Clipboard::GetForCurrentThread(), |
| 893 ui::CLIPBOARD_TYPE_SELECTION); | 890 ui::CLIPBOARD_TYPE_SELECTION); |
| 894 clipboard_writer.WriteText(text.substr(pos, n)); | 891 clipboard_writer.WriteText(text.substr(pos, n)); |
| 895 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 892 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 896 } | 893 } |
| 897 | 894 |
| 895 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { |
| 896 return delegated_frame_host_->GetRequestedRendererSize(); |
| 897 } |
| 898 |
| 898 void RenderWidgetHostViewAura::SelectionBoundsChanged( | 899 void RenderWidgetHostViewAura::SelectionBoundsChanged( |
| 899 const ViewHostMsg_SelectionBounds_Params& params) { | 900 const ViewHostMsg_SelectionBounds_Params& params) { |
| 900 if (selection_anchor_rect_ == params.anchor_rect && | 901 if (selection_anchor_rect_ == params.anchor_rect && |
| 901 selection_focus_rect_ == params.focus_rect) | 902 selection_focus_rect_ == params.focus_rect) |
| 902 return; | 903 return; |
| 903 | 904 |
| 904 selection_anchor_rect_ = params.anchor_rect; | 905 selection_anchor_rect_ = params.anchor_rect; |
| 905 selection_focus_rect_ = params.focus_rect; | 906 selection_focus_rect_ = params.focus_rect; |
| 906 | 907 |
| 907 if (GetInputMethod()) | 908 if (GetInputMethod()) |
| (...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2379 | 2380 |
| 2380 //////////////////////////////////////////////////////////////////////////////// | 2381 //////////////////////////////////////////////////////////////////////////////// |
| 2381 // RenderWidgetHostViewBase, public: | 2382 // RenderWidgetHostViewBase, public: |
| 2382 | 2383 |
| 2383 // static | 2384 // static |
| 2384 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2385 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2385 GetScreenInfoForWindow(results, NULL); | 2386 GetScreenInfoForWindow(results, NULL); |
| 2386 } | 2387 } |
| 2387 | 2388 |
| 2388 } // namespace content | 2389 } // namespace content |
| OLD | NEW |