Chromium Code Reviews| Index: chrome/browser/extensions/api/input_ime/input_ime_event_router_base.h |
| diff --git a/chrome/browser/extensions/api/input_ime/input_ime_event_router_base.h b/chrome/browser/extensions/api/input_ime/input_ime_event_router_base.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..da45a4e332f8af69e1da4695139c10b00a24f27c |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/input_ime/input_ime_event_router_base.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_EVENT_ROUTER_BASE_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_EVENT_ROUTER_BASE_H_ |
| + |
| +#include <map> |
| +#include <string> |
| +#include <utility> |
| + |
| +#include "base/macros.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "extensions/browser/extension_function.h" |
| +#include "ui/base/ime/ime_engine_handler_interface.h" |
| + |
| +class Profile; |
| + |
| +namespace ui { |
| +class IMEEngineHandlerInterface; |
| +} // namespace ui |
| + |
| +namespace extensions { |
| + |
| +class InputImeEventRouterBase { |
| + public: |
| + explicit InputImeEventRouterBase(Profile* profile); |
| + virtual ~InputImeEventRouterBase(); |
| + |
| + // Called when a key event was handled. |
| + void OnKeyEventHandled(const std::string& extension_id, |
| + const std::string& request_id, |
| + bool handled); |
| + |
| + std::string AddRequest( |
| + const std::string& component_id, |
| + ui::IMEEngineHandlerInterface::KeyEventDoneCallback& key_data); |
| + |
| + private: |
| + using RequestMap = |
| + std::map<std::string, |
| + std::pair<std::string, |
| + ui::IMEEngineHandlerInterface::KeyEventDoneCallback>>; |
| + |
| + unsigned int next_request_id_; |
| + RequestMap request_map_; |
| + |
| + protected: |
|
Shu Chen
2016/01/06 08:02:22
nit: the order should be public/protected/private.
Azure Wei
2016/01/06 09:57:19
Done.
|
| + Profile* profile_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(InputImeEventRouterBase); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_EVENT_ROUTER_BASE_H_ |