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/basictypes.h" | 8 #include "base/basictypes.h" |
8 #include "base/bind.h" | 9 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
15 #include "cc/layers/delegated_frame_provider.h" | 16 #include "cc/layers/delegated_frame_provider.h" |
16 #include "cc/output/compositor_frame.h" | 17 #include "cc/output/compositor_frame.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 DISALLOW_COPY_AND_ASSIGN(WindowObserver); | 444 DISALLOW_COPY_AND_ASSIGN(WindowObserver); |
444 }; | 445 }; |
445 | 446 |
446 //////////////////////////////////////////////////////////////////////////////// | 447 //////////////////////////////////////////////////////////////////////////////// |
447 // RenderWidgetHostViewAura, public: | 448 // RenderWidgetHostViewAura, public: |
448 | 449 |
449 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) | 450 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) |
450 : host_(RenderWidgetHostImpl::From(host)), | 451 : host_(RenderWidgetHostImpl::From(host)), |
451 window_(new aura::Window(this)), | 452 window_(new aura::Window(this)), |
452 in_shutdown_(false), | 453 in_shutdown_(false), |
| 454 in_bounds_changed_(false), |
453 is_fullscreen_(false), | 455 is_fullscreen_(false), |
454 popup_parent_host_view_(NULL), | 456 popup_parent_host_view_(NULL), |
455 popup_child_host_view_(NULL), | 457 popup_child_host_view_(NULL), |
456 is_loading_(false), | 458 is_loading_(false), |
457 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 459 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
458 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 460 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
459 can_compose_inline_(true), | 461 can_compose_inline_(true), |
460 has_composition_text_(false), | 462 has_composition_text_(false), |
461 accept_return_character_(false), | 463 accept_return_character_(false), |
462 last_output_surface_id_(0), | 464 last_output_surface_id_(0), |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 !resize_lock_.get()) | 1161 !resize_lock_.get()) |
1160 return false; | 1162 return false; |
1161 | 1163 |
1162 return size_in_dip != resize_lock_->expected_size(); | 1164 return size_in_dip != resize_lock_->expected_size(); |
1163 } | 1165 } |
1164 | 1166 |
1165 void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { | 1167 void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { |
1166 if (HasDisplayPropertyChanged(window_)) | 1168 if (HasDisplayPropertyChanged(window_)) |
1167 host_->InvalidateScreenInfo(); | 1169 host_->InvalidateScreenInfo(); |
1168 | 1170 |
1169 window_->SetBounds(rect); | 1171 // Don't recursively call SetBounds if this bounds update is the result of |
| 1172 // a Window::SetBoundsInternal call. |
| 1173 if (!in_bounds_changed_) |
| 1174 window_->SetBounds(rect); |
1170 host_->WasResized(); | 1175 host_->WasResized(); |
1171 MaybeCreateResizeLock(); | 1176 MaybeCreateResizeLock(); |
1172 if (touch_editing_client_) { | 1177 if (touch_editing_client_) { |
1173 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, | 1178 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
1174 selection_focus_rect_); | 1179 selection_focus_rect_); |
1175 } | 1180 } |
1176 #if defined(OS_WIN) | 1181 #if defined(OS_WIN) |
1177 // Create the dummy plugin parent window which will be passed as the | 1182 // Create the dummy plugin parent window which will be passed as the |
1178 // container window to windowless plugins. | 1183 // container window to windowless plugins. |
1179 // Plugins like Flash assume the container window which is returned via the | 1184 // Plugins like Flash assume the container window which is returned via the |
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2468 gfx::Size RenderWidgetHostViewAura::GetMinimumSize() const { | 2473 gfx::Size RenderWidgetHostViewAura::GetMinimumSize() const { |
2469 return gfx::Size(); | 2474 return gfx::Size(); |
2470 } | 2475 } |
2471 | 2476 |
2472 gfx::Size RenderWidgetHostViewAura::GetMaximumSize() const { | 2477 gfx::Size RenderWidgetHostViewAura::GetMaximumSize() const { |
2473 return gfx::Size(); | 2478 return gfx::Size(); |
2474 } | 2479 } |
2475 | 2480 |
2476 void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, | 2481 void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, |
2477 const gfx::Rect& new_bounds) { | 2482 const gfx::Rect& new_bounds) { |
| 2483 base::AutoReset<bool> in_bounds_changed(&in_bounds_changed_, true); |
2478 // We care about this only in fullscreen mode, where there is no | 2484 // We care about this only in fullscreen mode, where there is no |
2479 // WebContentsViewAura. We are sized via SetSize() or SetBounds() by | 2485 // WebContentsViewAura. We are sized via SetSize() or SetBounds() by |
2480 // WebContentsViewAura in other cases. | 2486 // WebContentsViewAura in other cases. |
2481 if (is_fullscreen_) | 2487 if (is_fullscreen_) |
2482 SetSize(new_bounds.size()); | 2488 SetSize(new_bounds.size()); |
2483 } | 2489 } |
2484 | 2490 |
2485 gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { | 2491 gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { |
2486 if (mouse_locked_) | 2492 if (mouse_locked_) |
2487 return ui::kCursorNone; | 2493 return ui::kCursorNone; |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3458 RenderWidgetHost* widget) { | 3464 RenderWidgetHost* widget) { |
3459 return new RenderWidgetHostViewAura(widget); | 3465 return new RenderWidgetHostViewAura(widget); |
3460 } | 3466 } |
3461 | 3467 |
3462 // static | 3468 // static |
3463 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3469 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3464 GetScreenInfoForWindow(results, NULL); | 3470 GetScreenInfoForWindow(results, NULL); |
3465 } | 3471 } |
3466 | 3472 |
3467 } // namespace content | 3473 } // namespace content |
OLD | NEW |