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

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

Issue 14694010: Consolidate manifest handler registration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
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 "chrome/browser/extensions/api/input_ime/input_ime_api.h" 5 #include "chrome/browser/extensions/api/input_ime/input_ime_api.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/chromeos/input_method/input_method_engine.h" 12 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
13 #include "chrome/browser/extensions/event_router.h" 13 #include "chrome/browser/extensions/event_router.h"
14 #include "chrome/browser/extensions/extension_function_registry.h" 14 #include "chrome/browser/extensions/extension_function_registry.h"
15 #include "chrome/browser/extensions/extension_input_module_constants.h" 15 #include "chrome/browser/extensions/extension_input_module_constants.h"
16 #include "chrome/browser/extensions/extension_system.h" 16 #include "chrome/browser/extensions/extension_system.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/extensions/api/input_ime/input_components_handler.h"
18 19
19 namespace keys = extension_input_module_constants; 20 namespace keys = extension_input_module_constants;
20 21
21 namespace { 22 namespace {
22 23
23 const char kStyleNone[] = "none"; 24 const char kStyleNone[] = "none";
24 const char kStyleCheck[] = "check"; 25 const char kStyleCheck[] = "check";
25 const char kStyleRadio[] = "radio"; 26 const char kStyleRadio[] = "radio";
26 const char kStyleSeparator[] = "separator"; 27 const char kStyleSeparator[] = "separator";
27 const char kWindowPositionComposition[] = "composition"; 28 const char kWindowPositionComposition[] = "composition";
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 895
895 InputImeEventRouter::GetInstance()->OnKeyEventHandled( 896 InputImeEventRouter::GetInstance()->OnKeyEventHandled(
896 extension_id(), request_id_str, handled); 897 extension_id(), request_id_str, handled);
897 898
898 return true; 899 return true;
899 } 900 }
900 #endif 901 #endif
901 902
902 InputImeAPI::InputImeAPI(Profile* profile) 903 InputImeAPI::InputImeAPI(Profile* profile)
903 : profile_(profile) { 904 : profile_(profile) {
904 (new InputComponentsHandler)->Register();
905
906 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 905 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
907 content::Source<Profile>(profile)); 906 content::Source<Profile>(profile));
908 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 907 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
909 content::Source<Profile>(profile)); 908 content::Source<Profile>(profile));
910 909
911 ExtensionFunctionRegistry* registry = 910 ExtensionFunctionRegistry* registry =
912 ExtensionFunctionRegistry::GetInstance(); 911 ExtensionFunctionRegistry::GetInstance();
913 registry->RegisterFunction<SetCompositionFunction>(); 912 registry->RegisterFunction<SetCompositionFunction>();
914 registry->RegisterFunction<ClearCompositionFunction>(); 913 registry->RegisterFunction<ClearCompositionFunction>();
915 registry->RegisterFunction<CommitTextFunction>(); 914 registry->RegisterFunction<CommitTextFunction>();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 input_ime_event_router()->UnregisterAllImes(profile_, extension->id()); 961 input_ime_event_router()->UnregisterAllImes(profile_, extension->id());
963 } 962 }
964 } 963 }
965 } 964 }
966 965
967 InputImeEventRouter* InputImeAPI::input_ime_event_router() { 966 InputImeEventRouter* InputImeAPI::input_ime_event_router() {
968 return InputImeEventRouter::GetInstance(); 967 return InputImeEventRouter::GetInstance();
969 } 968 }
970 969
971 } // namespace extensions 970 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698