summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-07 20:20:46 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-07 20:20:46 +0000
commite5eea6e87d1cc22e491ff2842163c67164776535 (patch)
tree2bda9c8c46b706b3d638522bab34a7b4caae981e
parent0fe6c242b32d43ec750490b5af5ee840dcbd922b (diff)
downloadchromium_src-e5eea6e87d1cc22e491ff2842163c67164776535.zip
chromium_src-e5eea6e87d1cc22e491ff2842163c67164776535.tar.gz
chromium_src-e5eea6e87d1cc22e491ff2842163c67164776535.tar.bz2
Move debug print functions for ex-libcros classes from .h to .cc.
The functions are located in header files due to a historical reason (see the original comment in ibus_ui_controller.h), which should have disappeared thanks to the code movement from libcros to Chrome. BUG=none TEST=verify it compiles. Review URL: http://codereview.chromium.org/7837020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100000 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/input_method/ibus_controller.cc45
-rw-r--r--chrome/browser/chromeos/input_method/ibus_controller.h46
-rw-r--r--chrome/browser/chromeos/input_method/ibus_ui_controller.cc18
-rw-r--r--chrome/browser/chromeos/input_method/ibus_ui_controller.h25
4 files changed, 68 insertions, 66 deletions
diff --git a/chrome/browser/chromeos/input_method/ibus_controller.cc b/chrome/browser/chromeos/input_method/ibus_controller.cc
index 3dddbc8..93b63d1 100644
--- a/chrome/browser/chromeos/input_method/ibus_controller.cc
+++ b/chrome/browser/chromeos/input_method/ibus_controller.cc
@@ -45,6 +45,15 @@ InputMethodDescriptor::InputMethodDescriptor(
InputMethodDescriptor::~InputMethodDescriptor() {
}
+std::string InputMethodDescriptor::ToString() const {
+ std::stringstream stream;
+ stream << "id=" << id()
+ << ", keyboard_layout=" << keyboard_layout()
+ << ", virtual_keyboard_layouts=" << virtual_keyboard_layouts_.size()
+ << ", language_code=" << language_code();
+ return stream.str();
+}
+
ImeProperty::ImeProperty(const std::string& in_key,
const std::string& in_label,
bool in_is_selection_item,
@@ -67,6 +76,16 @@ ImeProperty::ImeProperty()
ImeProperty::~ImeProperty() {
}
+std::string ImeProperty::ToString() const {
+ std::stringstream stream;
+ stream << "key=" << key
+ << ", label=" << label
+ << ", is_selection_item=" << is_selection_item
+ << ", is_selection_item_checked=" << is_selection_item_checked
+ << ", selection_item_id=" << selection_item_id;
+ return stream.str();
+}
+
ImeConfigValue::ImeConfigValue()
: type(kValueTypeString),
int_value(0),
@@ -76,6 +95,32 @@ ImeConfigValue::ImeConfigValue()
ImeConfigValue::~ImeConfigValue() {
}
+std::string ImeConfigValue::ToString() const {
+ std::stringstream stream;
+ stream << "type=" << type;
+ switch (type) {
+ case kValueTypeString:
+ stream << ", string_value=" << string_value;
+ break;
+ case kValueTypeInt:
+ stream << ", int_value=" << int_value;
+ break;
+ case kValueTypeBool:
+ stream << ", bool_value=" << (bool_value ? "true" : "false");
+ break;
+ case kValueTypeStringList:
+ stream << ", string_list_value=";
+ for (size_t i = 0; i < string_list_value.size(); ++i) {
+ if (i) {
+ stream << ",";
+ }
+ stream << string_list_value[i];
+ }
+ break;
+ }
+ return stream.str();
+}
+
// Returns true if |input_method_id| is whitelisted.
bool InputMethodIdIsWhitelisted(const std::string& input_method_id) {
static std::set<std::string>* g_supported_input_methods = NULL;
diff --git a/chrome/browser/chromeos/input_method/ibus_controller.h b/chrome/browser/chromeos/input_method/ibus_controller.h
index 6f0353f..b04075a 100644
--- a/chrome/browser/chromeos/input_method/ibus_controller.h
+++ b/chrome/browser/chromeos/input_method/ibus_controller.h
@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_H_
#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_H_
-#include <sstream>
#include <string>
#include <utility>
#include <vector>
@@ -33,14 +32,7 @@ class InputMethodDescriptor {
}
// Debug print function.
- std::string ToString() const {
- std::stringstream stream;
- stream << "id=" << id()
- << ", keyboard_layout=" << keyboard_layout()
- << ", virtual_keyboard_layouts=" << virtual_keyboard_layouts_.size()
- << ", language_code=" << language_code();
- return stream.str();
- }
+ std::string ToString() const;
const std::string& id() const { return id_; }
const std::string& keyboard_layout() const { return keyboard_layout_; }
@@ -86,15 +78,7 @@ struct ImeProperty {
~ImeProperty();
// Debug print function.
- std::string ToString() const {
- std::stringstream stream;
- stream << "key=" << key
- << ", label=" << label
- << ", is_selection_item=" << is_selection_item
- << ", is_selection_item_checked=" << is_selection_item_checked
- << ", selection_item_id=" << selection_item_id;
- return stream.str();
- }
+ std::string ToString() const;
std::string key; // A key which identifies the property. Non-empty string.
// (e.g. "InputMode.HalfWidthKatakana")
@@ -120,31 +104,7 @@ struct ImeConfigValue {
~ImeConfigValue();
// Debug print function.
- std::string ToString() const {
- std::stringstream stream;
- stream << "type=" << type;
- switch (type) {
- case kValueTypeString:
- stream << ", string_value=" << string_value;
- break;
- case kValueTypeInt:
- stream << ", int_value=" << int_value;
- break;
- case kValueTypeBool:
- stream << ", bool_value=" << (bool_value ? "true" : "false");
- break;
- case kValueTypeStringList:
- stream << ", string_list_value=";
- for (size_t i = 0; i < string_list_value.size(); ++i) {
- if (i) {
- stream << ",";
- }
- stream << string_list_value[i];
- }
- break;
- }
- return stream.str();
- }
+ std::string ToString() const;
enum ValueType {
kValueTypeString = 0,
diff --git a/chrome/browser/chromeos/input_method/ibus_ui_controller.cc b/chrome/browser/chromeos/input_method/ibus_ui_controller.cc
index f6d1363..779c926 100644
--- a/chrome/browser/chromeos/input_method/ibus_ui_controller.cc
+++ b/chrome/browser/chromeos/input_method/ibus_ui_controller.cc
@@ -8,6 +8,7 @@
#include <ibus.h>
#endif
+#include <sstream>
#include "base/logging.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -26,6 +27,23 @@ InputMethodLookupTable::InputMethodLookupTable()
InputMethodLookupTable::~InputMethodLookupTable() {
}
+std::string InputMethodLookupTable::ToString() const {
+ std::stringstream stream;
+ stream << "visible: " << visible << "\n";
+ stream << "cursor_absolute_index: " << cursor_absolute_index << "\n";
+ stream << "page_size: " << page_size << "\n";
+ stream << "orientation: " << orientation << "\n";
+ stream << "candidates:";
+ for (size_t i = 0; i < candidates.size(); ++i) {
+ stream << " [" << candidates[i] << "]";
+ }
+ stream << "\nlabels:";
+ for (size_t i = 0; i < labels.size(); ++i) {
+ stream << " [" << labels[i] << "]";
+ }
+ return stream.str();
+}
+
#if defined(HAVE_IBUS)
// Checks the attribute if this indicates annotation.
diff --git a/chrome/browser/chromeos/input_method/ibus_ui_controller.h b/chrome/browser/chromeos/input_method/ibus_ui_controller.h
index 45fbdcb..27e443a 100644
--- a/chrome/browser/chromeos/input_method/ibus_ui_controller.h
+++ b/chrome/browser/chromeos/input_method/ibus_ui_controller.h
@@ -10,7 +10,6 @@
#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_UI_CONTROLLER_H_
#pragma once
-#include <sstream>
#include <string>
#include <vector>
@@ -36,28 +35,8 @@ struct InputMethodLookupTable {
~InputMethodLookupTable();
- // Returns a string representation of the class. Used for debugging.
- // The function has to be defined here rather than in the .cc file. If
- // it's defined in the .cc file, the code will be part of libcros.so,
- // which cannot be accessed from clients directly. libcros.so is loaded
- // by dlopen() so all functions are unbound unless explicitly bound by
- // dlsym().
- std::string ToString() const {
- std::stringstream stream;
- stream << "visible: " << visible << "\n";
- stream << "cursor_absolute_index: " << cursor_absolute_index << "\n";
- stream << "page_size: " << page_size << "\n";
- stream << "orientation: " << orientation << "\n";
- stream << "candidates:";
- for (size_t i = 0; i < candidates.size(); ++i) {
- stream << " [" << candidates[i] << "]";
- }
- stream << "\nlabels:";
- for (size_t i = 0; i < labels.size(); ++i) {
- stream << " [" << labels[i] << "]";
- }
- return stream.str();
- }
+ // Debug print function.
+ std::string ToString() const;
// True if the lookup table is visible.
bool visible;