| 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 "ash/wm/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| 11 #include "ash/screen_util.h" | 11 #include "ash/screen_util.h" |
| 12 #include "ash/session/session_state_delegate.h" | 12 #include "ash/session/session_state_delegate.h" |
| 13 #include "ash/shelf/shelf_layout_manager.h" | 13 #include "ash/shelf/shelf_layout_manager.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/wm/always_on_top_controller.h" | 15 #include "ash/wm/always_on_top_controller.h" |
| 16 #include "ash/wm/window_animations.h" | 16 #include "ash/wm/window_animations.h" |
| 17 #include "ash/wm/window_positioner.h" | 17 #include "ash/wm/window_positioner.h" |
| 18 #include "ash/wm/window_properties.h" | 18 #include "ash/wm/window_properties.h" |
| 19 #include "ash/wm/window_state.h" | 19 #include "ash/wm/window_state.h" |
| 20 #include "ash/wm/window_util.h" | 20 #include "ash/wm/window_util.h" |
| 21 #include "ash/wm/wm_event.h" | 21 #include "ash/wm/wm_event.h" |
| 22 #include "ash/wm/workspace/workspace_layout_manager_delegate.h" | 22 #include "ash/wm/workspace/workspace_layout_manager_delegate.h" |
| 23 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
| 24 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 25 #include "ui/aura/window_observer.h" | 25 #include "ui/aura/window_observer.h" |
| 26 #include "ui/base/ime/input_method.h" | |
| 27 #include "ui/base/ime/text_input_client.h" | |
| 28 #include "ui/base/ui_base_types.h" | 26 #include "ui/base/ui_base_types.h" |
| 29 #include "ui/compositor/layer.h" | 27 #include "ui/compositor/layer.h" |
| 30 #include "ui/events/event.h" | 28 #include "ui/events/event.h" |
| 31 #include "ui/gfx/screen.h" | 29 #include "ui/gfx/screen.h" |
| 32 #include "ui/keyboard/keyboard_controller_observer.h" | 30 #include "ui/keyboard/keyboard_controller_observer.h" |
| 33 #include "ui/wm/core/window_util.h" | 31 #include "ui/wm/core/window_util.h" |
| 34 #include "ui/wm/public/activation_client.h" | 32 #include "ui/wm/public/activation_client.h" |
| 35 | 33 |
| 36 using aura::Window; | 34 using aura::Window; |
| 37 | 35 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 wm::SetBoundsEvent event(wm::WM_EVENT_SET_BOUNDS, requested_bounds); | 125 wm::SetBoundsEvent event(wm::WM_EVENT_SET_BOUNDS, requested_bounds); |
| 128 window_state->OnWMEvent(&event); | 126 window_state->OnWMEvent(&event); |
| 129 UpdateShelfVisibility(); | 127 UpdateShelfVisibility(); |
| 130 } | 128 } |
| 131 | 129 |
| 132 ////////////////////////////////////////////////////////////////////////////// | 130 ////////////////////////////////////////////////////////////////////////////// |
| 133 // WorkspaceLayoutManager, keyboard::KeyboardControllerObserver implementation: | 131 // WorkspaceLayoutManager, keyboard::KeyboardControllerObserver implementation: |
| 134 | 132 |
| 135 void WorkspaceLayoutManager::OnKeyboardBoundsChanging( | 133 void WorkspaceLayoutManager::OnKeyboardBoundsChanging( |
| 136 const gfx::Rect& new_bounds) { | 134 const gfx::Rect& new_bounds) { |
| 137 ui::InputMethod* input_method = root_window_->GetHost()->GetInputMethod(); | 135 aura::Window* window = wm::GetActiveWindow()->GetToplevelWindow(); |
| 138 ui::TextInputClient* text_input_client = input_method->GetTextInputClient(); | |
| 139 if (!text_input_client) | |
| 140 return; | |
| 141 aura::Window *window = | |
| 142 text_input_client->GetAttachedWindow()->GetToplevelWindow(); | |
| 143 if (!window || !window_->Contains(window)) | 136 if (!window || !window_->Contains(window)) |
| 144 return; | 137 return; |
| 145 wm::WindowState* window_state = wm::GetWindowState(window); | 138 wm::WindowState* window_state = wm::GetWindowState(window); |
| 146 if (!new_bounds.IsEmpty()) { | 139 if (!new_bounds.IsEmpty()) { |
| 147 // Store existing bounds to be restored before resizing for keyboard if it | 140 // Store existing bounds to be restored before resizing for keyboard if it |
| 148 // is not already stored. | 141 // is not already stored. |
| 149 if (!window_state->HasRestoreBounds()) | 142 if (!window_state->HasRestoreBounds()) |
| 150 window_state->SaveCurrentBoundsForRestore(); | 143 window_state->SaveCurrentBoundsForRestore(); |
| 151 | 144 |
| 152 gfx::Rect window_bounds = ScreenUtil::ConvertRectToScreen( | 145 gfx::Rect window_bounds = ScreenUtil::ConvertRectToScreen( |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 bool is_fullscreen = GetRootWindowController( | 316 bool is_fullscreen = GetRootWindowController( |
| 324 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 317 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; |
| 325 if (is_fullscreen != is_fullscreen_) { | 318 if (is_fullscreen != is_fullscreen_) { |
| 326 ash::Shell::GetInstance()->NotifyFullscreenStateChange( | 319 ash::Shell::GetInstance()->NotifyFullscreenStateChange( |
| 327 is_fullscreen, window_->GetRootWindow()); | 320 is_fullscreen, window_->GetRootWindow()); |
| 328 is_fullscreen_ = is_fullscreen; | 321 is_fullscreen_ = is_fullscreen; |
| 329 } | 322 } |
| 330 } | 323 } |
| 331 | 324 |
| 332 } // namespace ash | 325 } // namespace ash |
| OLD | NEW |