| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/magnifier/magnification_controller.h" | 5 #include "ash/magnifier/magnification_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 // Returns the text input view's bounds in root window coordinates. | 119 // Returns the text input view's bounds in root window coordinates. |
| 120 gfx::Rect GetTextInputViewBounds() { | 120 gfx::Rect GetTextInputViewBounds() { |
| 121 DCHECK(text_input_view_); | 121 DCHECK(text_input_view_); |
| 122 gfx::Rect bounds = text_input_view_->bounds(); | 122 gfx::Rect bounds = text_input_view_->bounds(); |
| 123 gfx::Point origin = bounds.origin(); | 123 gfx::Point origin = bounds.origin(); |
| 124 // Convert origin to screen coordinates. | 124 // Convert origin to screen coordinates. |
| 125 views::View::ConvertPointToScreen(text_input_view_, &origin); | 125 views::View::ConvertPointToScreen(text_input_view_, &origin); |
| 126 // Convert origin to root_window_ coordinates. | 126 // Convert origin to root_window_ coordinates. |
| 127 wm::ConvertPointFromScreen(GetRootWindow(), &origin); | 127 ::wm::ConvertPointFromScreen(GetRootWindow(), &origin); |
| 128 return gfx::Rect(origin.x(), origin.y(), bounds.width(), bounds.height()); | 128 return gfx::Rect(origin.x(), origin.y(), bounds.width(), bounds.height()); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Returns the caret bounds in root window coordinates. | 131 // Returns the caret bounds in root window coordinates. |
| 132 gfx::Rect GetCaretBounds() { | 132 gfx::Rect GetCaretBounds() { |
| 133 gfx::Rect caret_bounds = | 133 gfx::Rect caret_bounds = |
| 134 GetInputMethod()->GetTextInputClient()->GetCaretBounds(); | 134 GetInputMethod()->GetTextInputClient()->GetCaretBounds(); |
| 135 gfx::Point origin = caret_bounds.origin(); | 135 gfx::Point origin = caret_bounds.origin(); |
| 136 wm::ConvertPointFromScreen(GetRootWindow(), &origin); | 136 ::wm::ConvertPointFromScreen(GetRootWindow(), &origin); |
| 137 return gfx::Rect( | 137 return gfx::Rect( |
| 138 origin.x(), origin.y(), caret_bounds.width(), caret_bounds.height()); | 138 origin.x(), origin.y(), caret_bounds.width(), caret_bounds.height()); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void FocusOnTextInputView() { | 141 void FocusOnTextInputView() { |
| 142 DCHECK(text_input_view_); | 142 DCHECK(text_input_view_); |
| 143 text_input_view_->FocusOnTextInput(); | 143 text_input_view_->FocusOnTextInput(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 private: | 146 private: |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 UpdateDisplay("500x500"); | 711 UpdateDisplay("500x500"); |
| 712 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 712 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 713 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 713 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
| 714 | 714 |
| 715 GetMagnificationController()->SetEnabled(false); | 715 GetMagnificationController()->SetEnabled(false); |
| 716 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 716 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 717 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 717 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
| 718 } | 718 } |
| 719 | 719 |
| 720 } // namespace ash | 720 } // namespace ash |
| OLD | NEW |