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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 // same application took a grab, which explains why we didn't see the issue | 752 // same application took a grab, which explains why we didn't see the issue |
753 // before r72934). So, for now, we give up the mouse-up selection and use | 753 // before r72934). So, for now, we give up the mouse-up selection and use |
754 // mouse-down selection, which doen't require grabbing. | 754 // mouse-down selection, which doen't require grabbing. |
755 // | 755 // |
756 // Moreover, there seems to be another issue when grabbing windows is hidden | 756 // Moreover, there seems to be another issue when grabbing windows is hidden |
757 // http://crosbug.com/11422. | 757 // http://crosbug.com/11422. |
758 // TODO(yusukes): investigate if we could fix Views so it always releases grab | 758 // TODO(yusukes): investigate if we could fix Views so it always releases grab |
759 // when a popup window gets hidden. http://crosbug.com/11422 | 759 // when a popup window gets hidden. http://crosbug.com/11422 |
760 | 760 |
761 gfx::Point location_in_candidate_window = event.location(); | 761 gfx::Point location_in_candidate_window = event.location(); |
762 views::View::ConvertPointToView(this, parent_candidate_window_, | 762 views::View::ConvertPointToTarget(this, parent_candidate_window_, |
763 &location_in_candidate_window); | 763 &location_in_candidate_window); |
764 parent_candidate_window_->OnCandidatePressed(location_in_candidate_window); | 764 parent_candidate_window_->OnCandidatePressed(location_in_candidate_window); |
765 parent_candidate_window_->CommitCandidate(); | 765 parent_candidate_window_->CommitCandidate(); |
766 return false; | 766 return false; |
767 } | 767 } |
768 | 768 |
769 void CandidateView::UpdateLabelBackgroundColors() { | 769 void CandidateView::UpdateLabelBackgroundColors() { |
770 SkColor color = background() ? | 770 SkColor color = background() ? |
771 background()->get_color() : kDefaultBackgroundColor; | 771 background()->get_color() : kDefaultBackgroundColor; |
772 if (orientation_ != InputMethodLookupTable::kVertical) | 772 if (orientation_ != InputMethodLookupTable::kVertical) |
773 shortcut_label_->SetBackgroundColor(color); | 773 shortcut_label_->SetBackgroundColor(color); |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 candidate_views_[index_in_page]->Select(); | 1176 candidate_views_[index_in_page]->Select(); |
1177 | 1177 |
1178 // Update the cursor indexes in the model. | 1178 // Update the cursor indexes in the model. |
1179 lookup_table_.cursor_absolute_index = cursor_absolute_index; | 1179 lookup_table_.cursor_absolute_index = cursor_absolute_index; |
1180 } | 1180 } |
1181 | 1181 |
1182 void CandidateWindowView::OnCandidatePressed( | 1182 void CandidateWindowView::OnCandidatePressed( |
1183 const gfx::Point& location) { | 1183 const gfx::Point& location) { |
1184 for (size_t i = 0; i < candidate_views_.size(); ++i) { | 1184 for (size_t i = 0; i < candidate_views_.size(); ++i) { |
1185 gfx::Point converted_location = location; | 1185 gfx::Point converted_location = location; |
1186 views::View::ConvertPointToView(this, candidate_views_[i], | 1186 views::View::ConvertPointToTarget(this, candidate_views_[i], |
1187 &converted_location); | 1187 &converted_location); |
1188 if (candidate_views_[i]->HitTestPoint(converted_location)) { | 1188 if (candidate_views_[i]->HitTestPoint(converted_location)) { |
1189 SelectCandidateAt(i); | 1189 SelectCandidateAt(i); |
1190 break; | 1190 break; |
1191 } | 1191 } |
1192 } | 1192 } |
1193 } | 1193 } |
1194 | 1194 |
1195 void CandidateWindowView::CommitCandidate() { | 1195 void CandidateWindowView::CommitCandidate() { |
1196 // For now, we don't distinguish left and right clicks. | 1196 // For now, we don't distinguish left and right clicks. |
1197 const int button = 1; // Left button. | 1197 const int button = 1; // Left button. |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 } | 1770 } |
1771 | 1771 |
1772 // static | 1772 // static |
1773 CandidateWindowController* | 1773 CandidateWindowController* |
1774 CandidateWindowController::CreateCandidateWindowController() { | 1774 CandidateWindowController::CreateCandidateWindowController() { |
1775 return new CandidateWindowControllerImpl; | 1775 return new CandidateWindowControllerImpl; |
1776 } | 1776 } |
1777 | 1777 |
1778 } // namespace input_method | 1778 } // namespace input_method |
1779 } // namespace chromeos | 1779 } // namespace chromeos |
OLD | NEW |