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

Side by Side Diff: chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h

Issue 1528483002: Add chrome.input.ime.activate and chrome.input.ime.deactivate API (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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_NONCHROMEOS_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_NONCHROMEOS_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_NONCHROMEOS_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_NONCHROMEOS_H_
7 7
8 #include "chrome/browser/extensions/api/input_ime/input_ime_event_router_base.h" 8 #include "chrome/browser/extensions/api/input_ime/input_ime_event_router_base.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "extensions/browser/extension_function.h"
10 11
11 class Profile; 12 class Profile;
12 13
14 namespace input_method {
15 class InputMethodEngine;
16 } // namespace input_method
17
13 namespace extensions { 18 namespace extensions {
14 class InputImeEventRouterBase; 19 class InputImeEventRouterBase;
15 20
16 class InputImeEventRouter : public InputImeEventRouterBase { 21 class InputImeEventRouter : public InputImeEventRouterBase {
17 public: 22 public:
18 explicit InputImeEventRouter(Profile* profile); 23 explicit InputImeEventRouter(Profile* profile);
19 ~InputImeEventRouter() override; 24 ~InputImeEventRouter() override;
20 25
26 // Registers the extension by saving the |extension_id| in the vector
Devlin 2016/01/15 22:06:02 When making class comments, try to describe the in
Azure Wei 2016/01/19 03:46:54 Done. Thank you for your suggestion.
27 // |extension_ids_|.
28 bool RegisterImeExtension(const std::string& extension_id);
29
30 // Unregisters the extension by deleting the |extesion_id| from the vector
31 // |extension_ids_|, and deletes the input method engine if the extenstion
32 // is active.
33 void UnregisterImeExtension(const std::string& extension_id);
34
35 // Gets the input method engine if the extension is active.
36 input_method::InputMethodEngine* GetActiveEngine(
37 const std::string& extension_id);
38
39 // Actives the extension with new input method engine, and deletes the
40 // previous engine if another extension was active.
41 void SetActiveEngine(const std::string& extension_id);
42
43 private:
44 // Deletes the current input method engine.
45 void DeleteInputMethodEngine();
46
47 // The active input method engine.
48 input_method::InputMethodEngine* active_engine_;
49
50 // The id of the all registered extensions.
51 std::vector<std::string> extension_ids_;
Devlin 2016/01/15 22:06:02 Out of curiosity, why do we even need this list (o
Azure Wei 2016/01/19 03:46:54 Yeah, extension_ids_ doesn't really work now. It w
52
21 DISALLOW_COPY_AND_ASSIGN(InputImeEventRouter); 53 DISALLOW_COPY_AND_ASSIGN(InputImeEventRouter);
22 }; 54 };
23 55
56 class InputImeActivateFunction : public UIThreadExtensionFunction {
57 public:
58 DECLARE_EXTENSION_FUNCTION("input.ime.activate", INPUT_IME_ACTIVATE)
59
60 protected:
61 ~InputImeActivateFunction() override {}
62
63 // UIThreadExtensionFunction:
64 ResponseAction Run() override;
65 };
66
67 class InputImeDeactivateFunction : public UIThreadExtensionFunction {
68 public:
69 DECLARE_EXTENSION_FUNCTION("input.ime.deactivate", INPUT_IME_DEACTIVATE)
70
71 protected:
72 ~InputImeDeactivateFunction() override {}
73
74 // UIThreadExtensionFunction:
75 ResponseAction Run() override;
76 };
77
24 } // namespace extensions 78 } // namespace extensions
25 79
26 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_NONCHROMEOS_H_ 80 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_NONCHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698