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

Side by Side Diff: chromeos/ime/ibus_bridge.cc

Issue 68603002: Delete IBusEngineFactoryService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 7 years, 1 month 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
« no previous file with comments | « chromeos/ime/ibus_bridge.h ('k') | 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/ime/ibus_bridge.h" 5 #include "chromeos/ime/ibus_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 namespace {
14 void NoOpCreateEngineReply(const dbus::ObjectPath& unused_path) {}
15 } // namespace
16
17 static IBusBridge* g_ibus_bridge = NULL; 13 static IBusBridge* g_ibus_bridge = NULL;
18 14
19 // An implementation of IBusBridge. 15 // An implementation of IBusBridge.
20 class IBusBridgeImpl : public IBusBridge { 16 class IBusBridgeImpl : public IBusBridge {
21 public: 17 public:
22 IBusBridgeImpl() 18 IBusBridgeImpl()
23 : input_context_handler_(NULL), 19 : input_context_handler_(NULL),
24 engine_handler_(NULL), 20 engine_handler_(NULL),
25 candidate_window_handler_(NULL), 21 candidate_window_handler_(NULL),
26 panel_handler_(NULL) { 22 panel_handler_(NULL) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 66 }
71 67
72 // IBusBridge override. 68 // IBusBridge override.
73 virtual void SetPropertyHandler( 69 virtual void SetPropertyHandler(
74 IBusPanelPropertyHandlerInterface* handler) OVERRIDE { 70 IBusPanelPropertyHandlerInterface* handler) OVERRIDE {
75 panel_handler_ = handler; 71 panel_handler_ = handler;
76 } 72 }
77 73
78 virtual void SetCreateEngineHandler( 74 virtual void SetCreateEngineHandler(
79 const std::string& engine_id, 75 const std::string& engine_id,
80 const IBusEngineFactoryService::CreateEngineHandler& handler) OVERRIDE { 76 const CreateEngineHandler& handler) OVERRIDE {
81 create_engine_handler_map_[engine_id] = handler; 77 create_engine_handler_map_[engine_id] = handler;
82 } 78 }
83 79
84 // IBusBridge override. 80 // IBusBridge override.
85 virtual void UnsetCreateEngineHandler(const std::string& engine_id) OVERRIDE { 81 virtual void UnsetCreateEngineHandler(const std::string& engine_id) OVERRIDE {
86 create_engine_handler_map_.erase(engine_id); 82 create_engine_handler_map_.erase(engine_id);
87 } 83 }
88 84
89 // IBusBridge override. 85 // IBusBridge override.
90 virtual void CreateEngine(const std::string& engine_id) OVERRIDE { 86 virtual void CreateEngine(const std::string& engine_id) OVERRIDE {
91 // TODO(nona): Change following condition to DCHECK once all legacy IME is 87 // TODO(nona): Change following condition to DCHECK once all legacy IME is
92 // migrated to extension IME. 88 // migrated to extension IME.
93 if (create_engine_handler_map_[engine_id].is_null()) 89 if (create_engine_handler_map_[engine_id].is_null())
94 return; 90 return;
95 create_engine_handler_map_[engine_id].Run( 91 create_engine_handler_map_[engine_id].Run();
96 base::Bind(&NoOpCreateEngineReply));
97 } 92 }
98 93
99 private: 94 private:
100 IBusInputContextHandlerInterface* input_context_handler_; 95 IBusInputContextHandlerInterface* input_context_handler_;
101 IBusEngineHandlerInterface* engine_handler_; 96 IBusEngineHandlerInterface* engine_handler_;
102 IBusPanelCandidateWindowHandlerInterface* candidate_window_handler_; 97 IBusPanelCandidateWindowHandlerInterface* candidate_window_handler_;
103 IBusPanelPropertyHandlerInterface* panel_handler_; 98 IBusPanelPropertyHandlerInterface* panel_handler_;
104 std::map<std::string, IBusEngineFactoryService::CreateEngineHandler> 99 std::map<std::string, CreateEngineHandler> create_engine_handler_map_;
105 create_engine_handler_map_;
106 100
107 DISALLOW_COPY_AND_ASSIGN(IBusBridgeImpl); 101 DISALLOW_COPY_AND_ASSIGN(IBusBridgeImpl);
108 }; 102 };
109 103
110 /////////////////////////////////////////////////////////////////////////////// 104 ///////////////////////////////////////////////////////////////////////////////
111 // IBusBridge 105 // IBusBridge
112 IBusBridge::IBusBridge() { 106 IBusBridge::IBusBridge() {
113 } 107 }
114 108
115 IBusBridge::~IBusBridge() { 109 IBusBridge::~IBusBridge() {
(...skipping 10 matching lines...) Expand all
126 delete g_ibus_bridge; 120 delete g_ibus_bridge;
127 g_ibus_bridge = NULL; 121 g_ibus_bridge = NULL;
128 } 122 }
129 123
130 // static. 124 // static.
131 IBusBridge* IBusBridge::Get() { 125 IBusBridge* IBusBridge::Get() {
132 return g_ibus_bridge; 126 return g_ibus_bridge;
133 } 127 }
134 128
135 } // namespace chromeos 129 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/ime/ibus_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698