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

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

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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 (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/profiles/profile_helper.h" 10 #include "chrome/browser/chromeos/profiles/profile_helper.h"
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 scoped_ptr<KeyEventHandled::Params> params( 771 scoped_ptr<KeyEventHandled::Params> params(
772 KeyEventHandled::Params::Create(*args_)); 772 KeyEventHandled::Params::Create(*args_));
773 InputImeEventRouter::GetInstance()->OnKeyEventHandled( 773 InputImeEventRouter::GetInstance()->OnKeyEventHandled(
774 extension_id(), params->request_id, params->response); 774 extension_id(), params->request_id, params->response);
775 return true; 775 return true;
776 } 776 }
777 777
778 InputImeAPI::InputImeAPI(content::BrowserContext* context) 778 InputImeAPI::InputImeAPI(content::BrowserContext* context)
779 : profile_(Profile::FromBrowserContext(context)) { 779 : profile_(Profile::FromBrowserContext(context)) {
780 registrar_.Add(this, 780 registrar_.Add(this,
781 chrome::NOTIFICATION_EXTENSION_LOADED, 781 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
782 content::Source<Profile>(profile_)); 782 content::Source<Profile>(profile_));
783 registrar_.Add(this, 783 registrar_.Add(this,
784 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 784 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
785 content::Source<Profile>(profile_)); 785 content::Source<Profile>(profile_));
786 786
787 EventRouter* event_router = EventRouter::Get(profile_); 787 EventRouter* event_router = EventRouter::Get(profile_);
788 event_router->RegisterObserver(this, input_ime::OnActivate::kEventName); 788 event_router->RegisterObserver(this, input_ime::OnActivate::kEventName);
789 event_router->RegisterObserver(this, input_ime::OnFocus::kEventName); 789 event_router->RegisterObserver(this, input_ime::OnFocus::kEventName);
790 } 790 }
791 791
792 InputImeAPI::~InputImeAPI() { 792 InputImeAPI::~InputImeAPI() {
793 EventRouter::Get(profile_)->UnregisterObserver(this); 793 EventRouter::Get(profile_)->UnregisterObserver(this);
794 } 794 }
795 795
796 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputImeAPI> > 796 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputImeAPI> >
797 g_factory = LAZY_INSTANCE_INITIALIZER; 797 g_factory = LAZY_INSTANCE_INITIALIZER;
798 798
799 // static 799 // static
800 BrowserContextKeyedAPIFactory<InputImeAPI>* InputImeAPI::GetFactoryInstance() { 800 BrowserContextKeyedAPIFactory<InputImeAPI>* InputImeAPI::GetFactoryInstance() {
801 return g_factory.Pointer(); 801 return g_factory.Pointer();
802 } 802 }
803 803
804 void InputImeAPI::Observe(int type, 804 void InputImeAPI::Observe(int type,
805 const content::NotificationSource& source, 805 const content::NotificationSource& source,
806 const content::NotificationDetails& details) { 806 const content::NotificationDetails& details) {
807 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { 807 if (type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED) {
808 const Extension* extension = 808 const Extension* extension =
809 content::Details<const Extension>(details).ptr(); 809 content::Details<const Extension>(details).ptr();
810 const std::vector<InputComponentInfo>* input_components = 810 const std::vector<InputComponentInfo>* input_components =
811 extensions::InputComponents::GetInputComponents(extension); 811 extensions::InputComponents::GetInputComponents(extension);
812 if (!input_components) 812 if (!input_components)
813 return; 813 return;
814 for (std::vector<extensions::InputComponentInfo>::const_iterator component = 814 for (std::vector<extensions::InputComponentInfo>::const_iterator component =
815 input_components->begin(); component != input_components->end(); 815 input_components->begin(); component != input_components->end();
816 ++component) { 816 ++component) {
817 if (component->type == extensions::INPUT_COMPONENT_TYPE_IME) { 817 if (component->type == extensions::INPUT_COMPONENT_TYPE_IME) {
(...skipping 24 matching lines...) Expand all
842 input_ime_event_router()->GetActiveEngine(details.extension_id); 842 input_ime_event_router()->GetActiveEngine(details.extension_id);
843 if (engine) 843 if (engine)
844 engine->NotifyImeReady(); 844 engine->NotifyImeReady();
845 } 845 }
846 846
847 InputImeEventRouter* InputImeAPI::input_ime_event_router() { 847 InputImeEventRouter* InputImeAPI::input_ime_event_router() {
848 return InputImeEventRouter::GetInstance(); 848 return InputImeEventRouter::GetInstance();
849 } 849 }
850 850
851 } // namespace extensions 851 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698