Chromium Code Reviews| 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 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 #include "ui/views/controls/textfield/textfield.h" | 28 #include "ui/views/controls/textfield/textfield.h" |
| 29 #include "ui/views/layout/box_layout.h" | 29 #include "ui/views/layout/box_layout.h" |
| 30 #include "ui/views/layout/fill_layout.h" | 30 #include "ui/views/layout/fill_layout.h" |
| 31 #include "ui/views/layout/grid_layout.h" | 31 #include "ui/views/layout/grid_layout.h" |
| 32 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
| 33 #include "ui/views/window/non_client_view.h" | 33 #include "ui/views/window/non_client_view.h" |
| 34 | 34 |
| 35 #if defined(USE_ASH) | 35 #if defined(USE_ASH) |
| 36 #include "ash/shell.h" | 36 #include "ash/shell.h" |
| 37 #include "ash/shell_window_ids.h" | 37 #include "ash/shell_window_ids.h" |
| 38 #include "ash/wm/coordinate_conversion.h" | |
| 38 #include "ash/wm/window_animations.h" | 39 #include "ash/wm/window_animations.h" |
| 39 #endif // USE_ASH | 40 #endif // USE_ASH |
| 40 | 41 |
| 41 namespace chromeos { | 42 namespace chromeos { |
| 42 namespace input_method { | 43 namespace input_method { |
| 43 | 44 |
| 44 namespace { | 45 namespace { |
| 45 | 46 |
| 46 // Colors used in the candidate window UI. | 47 // Colors used in the candidate window UI. |
| 47 const SkColor kFrameColor = SkColorSetRGB(0x96, 0x96, 0x96); | 48 const SkColor kFrameColor = SkColorSetRGB(0x96, 0x96, 0x96); |
| (...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1662 const int kKeepPositionThreshold = 2; // px | 1663 const int kKeepPositionThreshold = 2; // px |
| 1663 const gfx::Rect& last_location = | 1664 const gfx::Rect& last_location = |
| 1664 candidate_window_->cursor_location(); | 1665 candidate_window_->cursor_location(); |
| 1665 const int delta_y = abs(last_location.y() - cursor_location.y()); | 1666 const int delta_y = abs(last_location.y() - cursor_location.y()); |
| 1666 if ((last_location.x() == cursor_location.x()) && | 1667 if ((last_location.x() == cursor_location.x()) && |
| 1667 (delta_y <= kKeepPositionThreshold)) { | 1668 (delta_y <= kKeepPositionThreshold)) { |
| 1668 DVLOG(1) << "Ignored set_cursor_location signal to prevent window shake"; | 1669 DVLOG(1) << "Ignored set_cursor_location signal to prevent window shake"; |
| 1669 return; | 1670 return; |
| 1670 } | 1671 } |
| 1671 | 1672 |
| 1673 #if defined(USE_ASH) | |
| 1674 aura::RootWindow* root_window = | |
| 1675 ash::wm::GetRootWindowAt(cursor_location.origin()); | |
| 1676 if (root_window) { | |
| 1677 gfx::NativeView current_container = ash::Shell::GetContainer( | |
| 1678 root_window, | |
| 1679 ash::internal::kShellWindowId_InputMethodContainer); | |
| 1680 views::Widget::ReparentNativeView(frame_->GetNativeView(), | |
|
mazda
2012/09/12 16:49:45
Is it necessary to do this here?
I think ScreenPos
Seigo Nonaka
2012/09/12 17:24:50
Seems transient window like CandidateWindow does n
| |
| 1681 current_container); | |
| 1682 } | |
| 1683 #endif | |
| 1684 | |
| 1672 // Remember the cursor location. | 1685 // Remember the cursor location. |
| 1673 candidate_window_->set_cursor_location(cursor_location); | 1686 candidate_window_->set_cursor_location(cursor_location); |
| 1674 candidate_window_->set_composition_head_location(composition_head); | 1687 candidate_window_->set_composition_head_location(composition_head); |
| 1675 // Move the window per the cursor location. | 1688 // Move the window per the cursor location. |
| 1676 candidate_window_->ResizeAndMoveParentFrame(); | 1689 candidate_window_->ResizeAndMoveParentFrame(); |
| 1677 infolist_window_->ResizeAndMoveParentFrame(); | 1690 infolist_window_->ResizeAndMoveParentFrame(); |
| 1678 } | 1691 } |
| 1679 | 1692 |
| 1680 void CandidateWindowControllerImpl::OnUpdateAuxiliaryText( | 1693 void CandidateWindowControllerImpl::OnUpdateAuxiliaryText( |
| 1681 const std::string& utf8_text, | 1694 const std::string& utf8_text, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1769 } | 1782 } |
| 1770 | 1783 |
| 1771 // static | 1784 // static |
| 1772 CandidateWindowController* | 1785 CandidateWindowController* |
| 1773 CandidateWindowController::CreateCandidateWindowController() { | 1786 CandidateWindowController::CreateCandidateWindowController() { |
| 1774 return new CandidateWindowControllerImpl; | 1787 return new CandidateWindowControllerImpl; |
| 1775 } | 1788 } |
| 1776 | 1789 |
| 1777 } // namespace input_method | 1790 } // namespace input_method |
| 1778 } // namespace chromeos | 1791 } // namespace chromeos |
| OLD | NEW |