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 "chrome/browser/chromeos/input_method/candidate_window.h" | 5 #include "chrome/browser/chromeos/input_method/candidate_window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "ash/shell.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
14 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
15 #include "base/string_util.h" | 16 #include "base/string_util.h" |
16 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
17 #include "base/timer.h" | 18 #include "base/timer.h" |
18 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
19 #include "chrome/browser/chromeos/input_method/candidate_view.h" | 20 #include "chrome/browser/chromeos/input_method/candidate_view.h" |
20 #include "chrome/browser/chromeos/input_method/candidate_window_view.h" | 21 #include "chrome/browser/chromeos/input_method/candidate_window_view.h" |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 // To avoid lookup-table overlapping, uses maximum y-position of mozc specific | 1210 // To avoid lookup-table overlapping, uses maximum y-position of mozc specific |
1210 // location and cursor location, because mozc-engine does not consider about | 1211 // location and cursor location, because mozc-engine does not consider about |
1211 // multi-line composition. | 1212 // multi-line composition. |
1212 const int y = should_show_at_composition_head_? | 1213 const int y = should_show_at_composition_head_? |
1213 std::max(composition_head_location_.y(), cursor_location_.y()) : | 1214 std::max(composition_head_location_.y(), cursor_location_.y()) : |
1214 cursor_location_.y(); | 1215 cursor_location_.y(); |
1215 const int height = cursor_location_.height(); | 1216 const int height = cursor_location_.height(); |
1216 const int horizontal_offset = GetHorizontalOffset(); | 1217 const int horizontal_offset = GetHorizontalOffset(); |
1217 | 1218 |
1218 gfx::Rect old_bounds = parent_frame_->GetClientAreaBoundsInScreen(); | 1219 gfx::Rect old_bounds = parent_frame_->GetClientAreaBoundsInScreen(); |
1219 gfx::Rect screen_bounds = | 1220 gfx::Rect screen_bounds = ash::Shell::GetAshScreen()->GetDisplayMatching( |
1220 gfx::Screen::GetDisplayMatching(cursor_location_).work_area(); | 1221 cursor_location_).work_area(); |
1221 // The size. | 1222 // The size. |
1222 gfx::Rect frame_bounds = old_bounds; | 1223 gfx::Rect frame_bounds = old_bounds; |
1223 frame_bounds.set_size(GetPreferredSize()); | 1224 frame_bounds.set_size(GetPreferredSize()); |
1224 | 1225 |
1225 // The default position. | 1226 // The default position. |
1226 frame_bounds.set_x(x + horizontal_offset); | 1227 frame_bounds.set_x(x + horizontal_offset); |
1227 frame_bounds.set_y(y + height); | 1228 frame_bounds.set_y(y + height); |
1228 | 1229 |
1229 // Handle overflow at the left and the top. | 1230 // Handle overflow at the left and the top. |
1230 frame_bounds.set_x(std::max(frame_bounds.x(), screen_bounds.x())); | 1231 frame_bounds.set_x(std::max(frame_bounds.x(), screen_bounds.x())); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 infolist_row->Select(); | 1505 infolist_row->Select(); |
1505 } else { | 1506 } else { |
1506 infolist_row->Unselect(); | 1507 infolist_row->Unselect(); |
1507 } | 1508 } |
1508 } | 1509 } |
1509 } | 1510 } |
1510 | 1511 |
1511 void InfolistWindowView::ResizeAndMoveParentFrame() { | 1512 void InfolistWindowView::ResizeAndMoveParentFrame() { |
1512 int x, y; | 1513 int x, y; |
1513 gfx::Rect old_bounds = parent_frame_->GetClientAreaBoundsInScreen(); | 1514 gfx::Rect old_bounds = parent_frame_->GetClientAreaBoundsInScreen(); |
1514 gfx::Rect screen_bounds = gfx::Screen::GetDisplayNearestWindow( | 1515 gfx::Rect screen_bounds = ash::Shell::GetAshScreen()->GetDisplayNearestWindow( |
1515 parent_frame_->GetNativeView()).work_area(); | 1516 parent_frame_->GetNativeView()).work_area(); |
1516 // The size. | 1517 // The size. |
1517 gfx::Rect frame_bounds = old_bounds; | 1518 gfx::Rect frame_bounds = old_bounds; |
1518 gfx::Size size = GetPreferredSize(); | 1519 gfx::Size size = GetPreferredSize(); |
1519 frame_bounds.set_size(size); | 1520 frame_bounds.set_size(size); |
1520 | 1521 |
1521 gfx::Rect candidatewindow_bounds; | 1522 gfx::Rect candidatewindow_bounds; |
1522 if (candidate_window_frame_ != NULL) { | 1523 if (candidate_window_frame_ != NULL) { |
1523 candidatewindow_bounds = | 1524 candidatewindow_bounds = |
1524 candidate_window_frame_->GetClientAreaBoundsInScreen(); | 1525 candidate_window_frame_->GetClientAreaBoundsInScreen(); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 } | 1770 } |
1770 | 1771 |
1771 // static | 1772 // static |
1772 CandidateWindowController* | 1773 CandidateWindowController* |
1773 CandidateWindowController::CreateCandidateWindowController() { | 1774 CandidateWindowController::CreateCandidateWindowController() { |
1774 return new CandidateWindowControllerImpl; | 1775 return new CandidateWindowControllerImpl; |
1775 } | 1776 } |
1776 | 1777 |
1777 } // namespace input_method | 1778 } // namespace input_method |
1778 } // namespace chromeos | 1779 } // namespace chromeos |
OLD | NEW |