summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/input_method
diff options
context:
space:
mode:
authoryusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-08 09:32:03 +0000
committeryusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-08 09:32:03 +0000
commitc2fd7b445e7ef6fd888d4de9d12b4384dbbbf637 (patch)
tree835d1d73ceee92cf008a562a67d0569f70fcedfa /chrome/browser/chromeos/input_method
parent9b147aed36f3cc139fcb9ce13d9146167bb13db4 (diff)
downloadchromium_src-c2fd7b445e7ef6fd888d4de9d12b4384dbbbf637.zip
chromium_src-c2fd7b445e7ef6fd888d4de9d12b4384dbbbf637.tar.gz
chromium_src-c2fd7b445e7ef6fd888d4de9d12b4384dbbbf637.tar.bz2
Pass a correct button name to OnCandidateClicked()
- Found by GCC 4.6: chrome/browser/chromeos/input_method/input_method_engine.cc:508:7: warning: variable 'pressed_button' set but not used [-Wunused-but-set-variable] - To prevent this kind of error, added explicit types to enums in the class. BUG=None TEST=try Review URL: http://codereview.chromium.org/8498003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108995 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/input_method')
-rw-r--r--chrome/browser/chromeos/input_method/input_method_engine.cc8
-rw-r--r--chrome/browser/chromeos/input_method/input_method_engine.h42
2 files changed, 27 insertions, 23 deletions
diff --git a/chrome/browser/chromeos/input_method/input_method_engine.cc b/chrome/browser/chromeos/input_method/input_method_engine.cc
index 5bbe0fc..de50387 100644
--- a/chrome/browser/chromeos/input_method/input_method_engine.cc
+++ b/chrome/browser/chromeos/input_method/input_method_engine.cc
@@ -505,16 +505,20 @@ void InputMethodEngineImpl::OnCandidateClicked(unsigned int index,
return;
}
- int pressed_button = 0;
+ MouseButtonEvent pressed_button;
if (button & input_method::IBusEngineController::MOUSE_BUTTON_1_MASK) {
pressed_button = MOUSE_BUTTON_LEFT;
} else if (button & input_method::IBusEngineController::MOUSE_BUTTON_2_MASK) {
pressed_button = MOUSE_BUTTON_MIDDLE;
} else if (button & input_method::IBusEngineController::MOUSE_BUTTON_3_MASK) {
pressed_button = MOUSE_BUTTON_RIGHT;
+ } else {
+ LOG(ERROR) << "Unknown button: " << button;
+ pressed_button = MOUSE_BUTTON_LEFT;
}
- observer_->OnCandidateClicked(engine_id_, candidate_ids_.at(index), button);
+ observer_->OnCandidateClicked(
+ engine_id_, candidate_ids_.at(index), pressed_button);
}
class InputMethodEngineStub : public InputMethodEngine {
diff --git a/chrome/browser/chromeos/input_method/input_method_engine.h b/chrome/browser/chromeos/input_method/input_method_engine.h
index 64bb61b..2e5fcb9 100644
--- a/chrome/browser/chromeos/input_method/input_method_engine.h
+++ b/chrome/browser/chromeos/input_method/input_method_engine.h
@@ -43,13 +43,31 @@ class InputMethodEngine {
MENU_ITEM_MODIFIED_SHORTCUT_KEY = 0x0040,
};
+ enum MenuItemStyle {
+ MENU_ITEM_STYLE_NONE,
+ MENU_ITEM_STYLE_CHECK,
+ MENU_ITEM_STYLE_RADIO,
+ MENU_ITEM_STYLE_SEPARATOR,
+ };
+
+ enum MouseButtonEvent {
+ MOUSE_BUTTON_LEFT,
+ MOUSE_BUTTON_RIGHT,
+ MOUSE_BUTTON_MIDDLE,
+ };
+
+ enum SegmentStyle {
+ SEGMENT_STYLE_UNDERLINE,
+ SEGMENT_STYLE_DOUBLE_UNDERLINE,
+ };
+
struct MenuItem {
MenuItem();
virtual ~MenuItem();
std::string id;
std::string label;
- int style;
+ MenuItemStyle style;
bool visible;
bool enabled;
bool checked;
@@ -79,7 +97,7 @@ class InputMethodEngine {
struct SegmentInfo {
int start;
int end;
- int style;
+ SegmentStyle style;
};
class Observer {
@@ -109,31 +127,13 @@ class InputMethodEngine {
// Called when the user clicks on an item in the candidate list.
virtual void OnCandidateClicked(const std::string& engine_id,
int candidate_id,
- int button) = 0;
+ MouseButtonEvent button) = 0;
// Called when a menu item for this IME is interacted with.
virtual void OnMenuItemActivated(const std::string& engine_id,
const std::string& menu_id) = 0;
};
- enum {
- MENU_ITEM_STYLE_NONE,
- MENU_ITEM_STYLE_CHECK,
- MENU_ITEM_STYLE_RADIO,
- MENU_ITEM_STYLE_SEPARATOR,
- };
-
- enum {
- MOUSE_BUTTON_LEFT,
- MOUSE_BUTTON_RIGHT,
- MOUSE_BUTTON_MIDDLE,
- };
-
- enum {
- SEGMENT_STYLE_UNDERLINE,
- SEGMENT_STYLE_DOUBLE_UNDERLINE,
- };
-
virtual ~InputMethodEngine() {}
// Set the current composition and associated properties.