| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/base/ime/chromeos/ime_bridge.h" | 5 #include "ui/base/ime/chromeos/ime_bridge.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 | 10 |
| 11 namespace chromeos { | 11 namespace chromeos { |
| 12 | 12 |
| 13 static IMEBridge* g_ime_bridge = NULL; | 13 static IMEBridge* g_ime_bridge = NULL; |
| 14 | 14 |
| 15 // An implementation of IMEBridge. | 15 // An implementation of IMEBridge. |
| 16 class IMEBridgeImpl : public IMEBridge { | 16 class IMEBridgeImpl : public IMEBridge { |
| 17 public: | 17 public: |
| 18 IMEBridgeImpl() | 18 IMEBridgeImpl() |
| 19 : input_context_handler_(NULL), | 19 : input_context_handler_(NULL), |
| 20 engine_handler_(NULL), | 20 engine_handler_(NULL), |
| 21 candidate_window_handler_(NULL), | 21 candidate_window_handler_(NULL), |
| 22 current_text_input_(ui::TEXT_INPUT_TYPE_NONE) { | 22 current_text_input_(ui::TEXT_INPUT_TYPE_NONE) { |
| 23 } | 23 } |
| 24 | 24 |
| 25 virtual ~IMEBridgeImpl() { | 25 virtual ~IMEBridgeImpl() { |
| 26 } | 26 } |
| 27 | 27 |
| 28 // IMEBridge override. | 28 // IMEBridge override. |
| 29 virtual IMEInputContextHandlerInterface* | 29 virtual IMEInputContextHandlerInterface* |
| 30 GetInputContextHandler() const OVERRIDE { | 30 GetInputContextHandler() const override { |
| 31 return input_context_handler_; | 31 return input_context_handler_; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // IMEBridge override. | 34 // IMEBridge override. |
| 35 virtual void SetInputContextHandler( | 35 virtual void SetInputContextHandler( |
| 36 IMEInputContextHandlerInterface* handler) OVERRIDE { | 36 IMEInputContextHandlerInterface* handler) override { |
| 37 input_context_handler_ = handler; | 37 input_context_handler_ = handler; |
| 38 } | 38 } |
| 39 | 39 |
| 40 // IMEBridge override. | 40 // IMEBridge override. |
| 41 virtual void SetCurrentEngineHandler( | 41 virtual void SetCurrentEngineHandler( |
| 42 IMEEngineHandlerInterface* handler) OVERRIDE { | 42 IMEEngineHandlerInterface* handler) override { |
| 43 engine_handler_ = handler; | 43 engine_handler_ = handler; |
| 44 } | 44 } |
| 45 | 45 |
| 46 // IMEBridge override. | 46 // IMEBridge override. |
| 47 virtual IMEEngineHandlerInterface* GetCurrentEngineHandler() const OVERRIDE { | 47 virtual IMEEngineHandlerInterface* GetCurrentEngineHandler() const override { |
| 48 return engine_handler_; | 48 return engine_handler_; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // IMEBridge override. | 51 // IMEBridge override. |
| 52 virtual IMECandidateWindowHandlerInterface* GetCandidateWindowHandler() const | 52 virtual IMECandidateWindowHandlerInterface* GetCandidateWindowHandler() const |
| 53 OVERRIDE { | 53 override { |
| 54 return candidate_window_handler_; | 54 return candidate_window_handler_; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // IMEBridge override. | 57 // IMEBridge override. |
| 58 virtual void SetCandidateWindowHandler( | 58 virtual void SetCandidateWindowHandler( |
| 59 IMECandidateWindowHandlerInterface* handler) OVERRIDE { | 59 IMECandidateWindowHandlerInterface* handler) override { |
| 60 candidate_window_handler_ = handler; | 60 candidate_window_handler_ = handler; |
| 61 } | 61 } |
| 62 | 62 |
| 63 // IMEBridge override. | 63 // IMEBridge override. |
| 64 virtual void SetCurrentTextInputType(ui::TextInputType input_type) OVERRIDE { | 64 virtual void SetCurrentTextInputType(ui::TextInputType input_type) override { |
| 65 current_text_input_ = input_type; | 65 current_text_input_ = input_type; |
| 66 } | 66 } |
| 67 | 67 |
| 68 // IMEBridge override. | 68 // IMEBridge override. |
| 69 virtual ui::TextInputType GetCurrentTextInputType() const OVERRIDE { | 69 virtual ui::TextInputType GetCurrentTextInputType() const override { |
| 70 return current_text_input_; | 70 return current_text_input_; |
| 71 } | 71 } |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 IMEInputContextHandlerInterface* input_context_handler_; | 74 IMEInputContextHandlerInterface* input_context_handler_; |
| 75 IMEEngineHandlerInterface* engine_handler_; | 75 IMEEngineHandlerInterface* engine_handler_; |
| 76 IMECandidateWindowHandlerInterface* candidate_window_handler_; | 76 IMECandidateWindowHandlerInterface* candidate_window_handler_; |
| 77 ui::TextInputType current_text_input_; | 77 ui::TextInputType current_text_input_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(IMEBridgeImpl); | 79 DISALLOW_COPY_AND_ASSIGN(IMEBridgeImpl); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 98 delete g_ime_bridge; | 98 delete g_ime_bridge; |
| 99 g_ime_bridge = NULL; | 99 g_ime_bridge = NULL; |
| 100 } | 100 } |
| 101 | 101 |
| 102 // static. | 102 // static. |
| 103 IMEBridge* IMEBridge::Get() { | 103 IMEBridge* IMEBridge::Get() { |
| 104 return g_ime_bridge; | 104 return g_ime_bridge; |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace chromeos | 107 } // namespace chromeos |
| OLD | NEW |