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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1141 !resize_lock_.get()) | 1143 !resize_lock_.get()) |
1142 return false; | 1144 return false; |
1143 | 1145 |
1144 return size_in_dip != resize_lock_->expected_size(); | 1146 return size_in_dip != resize_lock_->expected_size(); |
1145 } | 1147 } |
1146 | 1148 |
1147 void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { | 1149 void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { |
1148 if (HasDisplayPropertyChanged(window_)) | 1150 if (HasDisplayPropertyChanged(window_)) |
1149 host_->InvalidateScreenInfo(); | 1151 host_->InvalidateScreenInfo(); |
1150 | 1152 |
1151 window_->SetBounds(rect); | 1153 // Don't recursively call SetBounds if this bounds update is the result of |
1154 // a Window::SetBoundsInternal call. | |
1155 if (!in_bounds_changed_) | |
1156 window_->SetBounds(rect); | |
flackr
2013/12/03 21:54:06
In my first CL an activation change in some of the
| |
1152 host_->WasResized(); | 1157 host_->WasResized(); |
1153 MaybeCreateResizeLock(); | 1158 MaybeCreateResizeLock(); |
1154 if (touch_editing_client_) { | 1159 if (touch_editing_client_) { |
1155 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, | 1160 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
1156 selection_focus_rect_); | 1161 selection_focus_rect_); |
1157 } | 1162 } |
1158 #if defined(OS_WIN) | 1163 #if defined(OS_WIN) |
1159 // Create the dummy plugin parent window which will be passed as the | 1164 // Create the dummy plugin parent window which will be passed as the |
1160 // container window to windowless plugins. | 1165 // container window to windowless plugins. |
1161 // Plugins like Flash assume the container window which is returned via the | 1166 // Plugins like Flash assume the container window which is returned via the |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2424 gfx::Size RenderWidgetHostViewAura::GetMinimumSize() const { | 2429 gfx::Size RenderWidgetHostViewAura::GetMinimumSize() const { |
2425 return gfx::Size(); | 2430 return gfx::Size(); |
2426 } | 2431 } |
2427 | 2432 |
2428 gfx::Size RenderWidgetHostViewAura::GetMaximumSize() const { | 2433 gfx::Size RenderWidgetHostViewAura::GetMaximumSize() const { |
2429 return gfx::Size(); | 2434 return gfx::Size(); |
2430 } | 2435 } |
2431 | 2436 |
2432 void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, | 2437 void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, |
2433 const gfx::Rect& new_bounds) { | 2438 const gfx::Rect& new_bounds) { |
2439 base::AutoReset<bool> in_bounds_changed(&in_bounds_changed_, true); | |
2434 // We care about this only in fullscreen mode, where there is no | 2440 // We care about this only in fullscreen mode, where there is no |
2435 // WebContentsViewAura. We are sized via SetSize() or SetBounds() by | 2441 // WebContentsViewAura. We are sized via SetSize() or SetBounds() by |
2436 // WebContentsViewAura in other cases. | 2442 // WebContentsViewAura in other cases. |
2437 if (is_fullscreen_) | 2443 if (is_fullscreen_) |
2438 SetSize(new_bounds.size()); | 2444 SetSize(new_bounds.size()); |
2439 } | 2445 } |
2440 | 2446 |
2441 gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { | 2447 gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { |
2442 if (mouse_locked_) | 2448 if (mouse_locked_) |
2443 return ui::kCursorNone; | 2449 return ui::kCursorNone; |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3399 RenderWidgetHost* widget) { | 3405 RenderWidgetHost* widget) { |
3400 return new RenderWidgetHostViewAura(widget); | 3406 return new RenderWidgetHostViewAura(widget); |
3401 } | 3407 } |
3402 | 3408 |
3403 // static | 3409 // static |
3404 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3410 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3405 GetScreenInfoForWindow(results, NULL); | 3411 GetScreenInfoForWindow(results, NULL); |
3406 } | 3412 } |
3407 | 3413 |
3408 } // namespace content | 3414 } // namespace content |
OLD | NEW |