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

Side by Side Diff: chrome/browser/extensions/api/input_ime/input_ime_event_router_base.cc

Issue 1554983002: Build chrome.input.ime.* API in GN mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/api/input_ime/input_ime_event_router_base.h"
6
7 #include "base/strings/string_number_conversions.h"
8
9 namespace extensions {
10
11 InputImeEventRouterBase::InputImeEventRouterBase(Profile* profile)
12 : profile_(profile), next_request_id_(1) {}
13
14 InputImeEventRouterBase::~InputImeEventRouterBase() {}
15
16 void InputImeEventRouterBase::OnKeyEventHandled(const std::string& extension_id,
17 const std::string& request_id,
18 bool handled) {
19 RequestMap::iterator request = request_map_.find(request_id);
20 if (request == request_map_.end()) {
21 LOG(ERROR) << "Request ID not found: " << request_id;
22 return;
23 }
24
25 std::string component_id = request->second.first;
Devlin 2016/01/07 23:08:29 why make the copy? In fact, is this even needed a
Azure Wei 2016/01/08 06:40:55 Yeah, component_id was not used here. Deleted.
26 (request->second.second).Run(handled);
Devlin 2016/01/07 23:08:29 parens not needed.
Azure Wei 2016/01/08 06:40:55 Done.
27 request_map_.erase(request);
28 }
29
30 std::string InputImeEventRouterBase::AddRequest(
31 const std::string& component_id,
32 ui::IMEEngineHandlerInterface::KeyEventDoneCallback& key_data) {
33 std::string request_id = base::IntToString(next_request_id_);
34 ++next_request_id_;
35
36 request_map_[request_id] = std::make_pair(component_id, key_data);
37
38 return request_id;
39 }
40
41 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698