• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "chromeos/ime/candidate_window.h"
6 
7 #include <string>
8 #include "base/logging.h"
9 #include "base/values.h"
10 
11 namespace chromeos {
12 namespace input_method {
13 
14 namespace {
15 // The default entry number of a page in CandidateWindow.
16 const int kDefaultPageSize = 9;
17 }  // namespace
18 
CandidateWindow()19 CandidateWindow::CandidateWindow()
20     : property_(new CandidateWindowProperty) {
21 }
22 
~CandidateWindow()23 CandidateWindow::~CandidateWindow() {
24 }
25 
IsEqual(const CandidateWindow & cw) const26 bool CandidateWindow::IsEqual(const CandidateWindow& cw) const {
27   if (page_size() != cw.page_size() ||
28       cursor_position() != cw.cursor_position() ||
29       is_cursor_visible() != cw.is_cursor_visible() ||
30       orientation() != cw.orientation() ||
31       show_window_at_composition() != cw.show_window_at_composition() ||
32       candidates_.size() != cw.candidates_.size())
33     return false;
34 
35   for (size_t i = 0; i < candidates_.size(); ++i) {
36     const Entry& left = candidates_[i];
37     const Entry& right = cw.candidates_[i];
38     if (left.value != right.value ||
39         left.label != right.label ||
40         left.annotation != right.annotation ||
41         left.description_title != right.description_title ||
42         left.description_body != right.description_body)
43       return false;
44   }
45   return true;
46 }
47 
CopyFrom(const CandidateWindow & cw)48 void CandidateWindow::CopyFrom(const CandidateWindow& cw) {
49   SetProperty(cw.GetProperty());
50   candidates_.clear();
51   candidates_ = cw.candidates_;
52 }
53 
54 
55 // When the default values are changed, please modify
56 // InputMethodEngineInterface::CandidateWindowProperty too.
CandidateWindowProperty()57 CandidateWindow::CandidateWindowProperty::CandidateWindowProperty()
58     : page_size(kDefaultPageSize),
59       cursor_position(0),
60       is_cursor_visible(true),
61       is_vertical(false),
62       show_window_at_composition(false) {
63 }
64 
~CandidateWindowProperty()65 CandidateWindow::CandidateWindowProperty::~CandidateWindowProperty() {
66 }
67 
Entry()68 CandidateWindow::Entry::Entry() {
69 }
70 
~Entry()71 CandidateWindow::Entry::~Entry() {
72 }
73 
74 }  // namespace input_method
75 }  // namespace chromeos
76