Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: trunk/src/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc

Issue 130833002: Revert 243777 "Moves CandidateWindow model to ui/base/ime." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_controller_impl. h" 5 #include "chrome/browser/chromeos/input_method/candidate_window_controller_impl. h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/shell_window_ids.h" 11 #include "ash/shell_window_ids.h"
12 #include "ash/wm/window_animations.h" 12 #include "ash/wm/window_animations.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "chrome/browser/chromeos/input_method/candidate_window_view.h" 16 #include "chrome/browser/chromeos/input_method/candidate_window_view.h"
17 #include "chrome/browser/chromeos/input_method/infolist_window.h" 17 #include "chrome/browser/chromeos/input_method/infolist_window.h"
18 #include "chrome/browser/chromeos/input_method/mode_indicator_controller.h" 18 #include "chrome/browser/chromeos/input_method/mode_indicator_controller.h"
19 #include "ui/gfx/screen.h" 19 #include "ui/gfx/screen.h"
20 #include "ui/views/widget/widget.h" 20 #include "ui/views/widget/widget.h"
21 21
22
22 namespace chromeos { 23 namespace chromeos {
23 namespace input_method { 24 namespace input_method {
24 25
25 namespace { 26 namespace {
26 27
27 } // namespace 28 } // namespace
28 29
29 CandidateWindowControllerImpl::CandidateWindowControllerImpl() 30 CandidateWindowControllerImpl::CandidateWindowControllerImpl()
30 : candidate_window_view_(NULL), 31 : candidate_window_view_(NULL),
31 infolist_window_(NULL) { 32 infolist_window_(NULL) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Mode indicator controller also needs the cursor bounds. 94 // Mode indicator controller also needs the cursor bounds.
94 mode_indicator_controller_->SetCursorBounds(cursor_bounds); 95 mode_indicator_controller_->SetCursorBounds(cursor_bounds);
95 } 96 }
96 97
97 void CandidateWindowControllerImpl::FocusStateChanged(bool is_focused) { 98 void CandidateWindowControllerImpl::FocusStateChanged(bool is_focused) {
98 mode_indicator_controller_->FocusStateChanged(is_focused); 99 mode_indicator_controller_->FocusStateChanged(is_focused);
99 } 100 }
100 101
101 // static 102 // static
102 void CandidateWindowControllerImpl::ConvertLookupTableToInfolistEntry( 103 void CandidateWindowControllerImpl::ConvertLookupTableToInfolistEntry(
103 const ui::CandidateWindow& candidate_window, 104 const CandidateWindow& candidate_window,
104 std::vector<InfolistEntry>* infolist_entries, 105 std::vector<InfolistEntry>* infolist_entries,
105 bool* has_highlighted) { 106 bool* has_highlighted) {
106 DCHECK(infolist_entries); 107 DCHECK(infolist_entries);
107 DCHECK(has_highlighted); 108 DCHECK(has_highlighted);
108 infolist_entries->clear(); 109 infolist_entries->clear();
109 *has_highlighted = false; 110 *has_highlighted = false;
110 111
111 const size_t cursor_index_in_page = 112 const size_t cursor_index_in_page =
112 candidate_window.cursor_position() % candidate_window.page_size(); 113 candidate_window.cursor_position() % candidate_window.page_size();
113 114
114 for (size_t i = 0; i < candidate_window.candidates().size(); ++i) { 115 for (size_t i = 0; i < candidate_window.candidates().size(); ++i) {
115 const ui::CandidateWindow::Entry& ibus_entry = 116 const CandidateWindow::Entry& ibus_entry =
116 candidate_window.candidates()[i]; 117 candidate_window.candidates()[i];
117 if (ibus_entry.description_title.empty() && 118 if (ibus_entry.description_title.empty() &&
118 ibus_entry.description_body.empty()) 119 ibus_entry.description_body.empty())
119 continue; 120 continue;
120 InfolistEntry entry(base::UTF8ToUTF16(ibus_entry.description_title), 121 InfolistEntry entry(base::UTF8ToUTF16(ibus_entry.description_title),
121 base::UTF8ToUTF16(ibus_entry.description_body)); 122 base::UTF8ToUTF16(ibus_entry.description_body));
122 if (i == cursor_index_in_page) { 123 if (i == cursor_index_in_page) {
123 entry.highlighted = true; 124 entry.highlighted = true;
124 *has_highlighted = true; 125 *has_highlighted = true;
125 } 126 }
126 infolist_entries->push_back(entry); 127 infolist_entries->push_back(entry);
127 } 128 }
128 } 129 }
129 130
130 void CandidateWindowControllerImpl::UpdateLookupTable( 131 void CandidateWindowControllerImpl::UpdateLookupTable(
131 const ui::CandidateWindow& candidate_window, 132 const CandidateWindow& candidate_window,
132 bool visible) { 133 bool visible) {
133 // If it's not visible, hide the lookup table and return. 134 // If it's not visible, hide the lookup table and return.
134 if (!visible) { 135 if (!visible) {
135 if (candidate_window_view_) 136 if (candidate_window_view_)
136 candidate_window_view_->HideLookupTable(); 137 candidate_window_view_->HideLookupTable();
137 if (infolist_window_) 138 if (infolist_window_)
138 infolist_window_->HideImmediately(); 139 infolist_window_->HideImmediately();
139 // TODO(nona): Introduce unittests for crbug.com/170036. 140 // TODO(nona): Introduce unittests for crbug.com/170036.
140 latest_infolist_entries_.clear(); 141 latest_infolist_entries_.clear();
141 return; 142 return;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 observers_.AddObserver(observer); 220 observers_.AddObserver(observer);
220 } 221 }
221 222
222 void CandidateWindowControllerImpl::RemoveObserver( 223 void CandidateWindowControllerImpl::RemoveObserver(
223 CandidateWindowController::Observer* observer) { 224 CandidateWindowController::Observer* observer) {
224 observers_.RemoveObserver(observer); 225 observers_.RemoveObserver(observer);
225 } 226 }
226 227
227 } // namespace input_method 228 } // namespace input_method
228 } // namespace chromeos 229 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698