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

Side by Side Diff: chromeos/dbus/ibus/ibus_lookup_table.cc

Issue 12520020: Fix crash around candidate window layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments Created 7 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chromeos/dbus/ibus/ibus_lookup_table.h" 5 #include "chromeos/dbus/ibus/ibus_lookup_table.h"
6 6
7 #include <string> 7 #include <string>
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chromeos/dbus/ibus/ibus_object.h" 10 #include "chromeos/dbus/ibus/ibus_object.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 << "4th argument should be boolean."; 111 << "4th argument should be boolean.";
112 return false; 112 return false;
113 } 113 }
114 114
115 int32 orientation = 0; 115 int32 orientation = 0;
116 if (!ibus_object_reader.PopInt32(&orientation)) { 116 if (!ibus_object_reader.PopInt32(&orientation)) {
117 LOG(ERROR) << "Invalid variant structure[IBusLookupTable]: " 117 LOG(ERROR) << "Invalid variant structure[IBusLookupTable]: "
118 << "5th argument should be int32."; 118 << "5th argument should be int32.";
119 return false; 119 return false;
120 } 120 }
121
122 // Original IBus spec has third orientation IBUS_ORIENTATION_SYSTEM but it
123 // was not supported in Chrome OS. Thus do not cast from integer to enum.
121 table->set_orientation( 124 table->set_orientation(
122 static_cast<IBusLookupTable::Orientation>(orientation)); 125 orientation == IBusLookupTable::HORIZONTAL ?
126 IBusLookupTable::HORIZONTAL : IBusLookupTable::VERTICAL);
123 127
124 dbus::MessageReader text_array_reader(NULL); 128 dbus::MessageReader text_array_reader(NULL);
125 if (!ibus_object_reader.PopArray(&text_array_reader)) { 129 if (!ibus_object_reader.PopArray(&text_array_reader)) {
126 LOG(ERROR) << "Invalid variant structure[IBusLookupTable]: " 130 LOG(ERROR) << "Invalid variant structure[IBusLookupTable]: "
127 << "6th argument should be array."; 131 << "6th argument should be array.";
128 return false; 132 return false;
129 } 133 }
130 134
131 std::vector<IBusLookupTable::Entry>* candidates = table->mutable_candidates(); 135 std::vector<IBusLookupTable::Entry>* candidates = table->mutable_candidates();
132 while (text_array_reader.HasMoreData()) { 136 while (text_array_reader.HasMoreData()) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 candidates_ = table.candidates_; 225 candidates_ = table.candidates_;
222 } 226 }
223 227
224 IBusLookupTable::Entry::Entry() { 228 IBusLookupTable::Entry::Entry() {
225 } 229 }
226 230
227 IBusLookupTable::Entry::~Entry() { 231 IBusLookupTable::Entry::~Entry() {
228 } 232 }
229 233
230 } // namespace chromeos 234 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698