OLD | NEW |
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/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/chromeos/input_method/input_method_engine.h" | 10 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 | 771 |
772 bool InputImeKeyEventHandledFunction::RunImpl() { | 772 bool InputImeKeyEventHandledFunction::RunImpl() { |
773 scoped_ptr<KeyEventHandled::Params> params( | 773 scoped_ptr<KeyEventHandled::Params> params( |
774 KeyEventHandled::Params::Create(*args_)); | 774 KeyEventHandled::Params::Create(*args_)); |
775 InputImeEventRouter::GetInstance()->OnKeyEventHandled( | 775 InputImeEventRouter::GetInstance()->OnKeyEventHandled( |
776 extension_id(), params->request_id, params->response); | 776 extension_id(), params->request_id, params->response); |
777 return true; | 777 return true; |
778 } | 778 } |
779 #endif | 779 #endif |
780 | 780 |
781 InputImeAPI::InputImeAPI(Profile* profile) | 781 InputImeAPI::InputImeAPI(content::BrowserContext* context) |
782 : profile_(profile) { | 782 : profile_(Profile::FromBrowserContext(context)) { |
783 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 783 registrar_.Add(this, |
784 content::Source<Profile>(profile)); | 784 chrome::NOTIFICATION_EXTENSION_LOADED, |
785 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 785 content::Source<Profile>(profile_)); |
786 content::Source<Profile>(profile)); | 786 registrar_.Add(this, |
| 787 chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 788 content::Source<Profile>(profile_)); |
787 } | 789 } |
788 | 790 |
789 InputImeAPI::~InputImeAPI() { | 791 InputImeAPI::~InputImeAPI() { |
790 } | 792 } |
791 | 793 |
792 static base::LazyInstance<ProfileKeyedAPIFactory<InputImeAPI> > | 794 static base::LazyInstance<ProfileKeyedAPIFactory<InputImeAPI> > |
793 g_factory = LAZY_INSTANCE_INITIALIZER; | 795 g_factory = LAZY_INSTANCE_INITIALIZER; |
794 | 796 |
795 // static | 797 // static |
796 ProfileKeyedAPIFactory<InputImeAPI>* InputImeAPI::GetFactoryInstance() { | 798 ProfileKeyedAPIFactory<InputImeAPI>* InputImeAPI::GetFactoryInstance() { |
(...skipping 28 matching lines...) Expand all Loading... |
825 if (input_components->size() > 0) | 827 if (input_components->size() > 0) |
826 input_ime_event_router()->UnregisterAllImes(profile_, extension->id()); | 828 input_ime_event_router()->UnregisterAllImes(profile_, extension->id()); |
827 } | 829 } |
828 } | 830 } |
829 | 831 |
830 InputImeEventRouter* InputImeAPI::input_ime_event_router() { | 832 InputImeEventRouter* InputImeAPI::input_ime_event_router() { |
831 return InputImeEventRouter::GetInstance(); | 833 return InputImeEventRouter::GetInstance(); |
832 } | 834 } |
833 | 835 |
834 } // namespace extensions | 836 } // namespace extensions |
OLD | NEW |