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

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

Issue 204703002: Rename NOTIFICATION_EXTENSION_UNLOADED to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maybe upload wont do something bizarre this time Created 6 years, 9 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/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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 return true; 770 return true;
771 } 771 }
772 #endif 772 #endif
773 773
774 InputImeAPI::InputImeAPI(content::BrowserContext* context) 774 InputImeAPI::InputImeAPI(content::BrowserContext* context)
775 : profile_(Profile::FromBrowserContext(context)) { 775 : profile_(Profile::FromBrowserContext(context)) {
776 registrar_.Add(this, 776 registrar_.Add(this,
777 chrome::NOTIFICATION_EXTENSION_LOADED, 777 chrome::NOTIFICATION_EXTENSION_LOADED,
778 content::Source<Profile>(profile_)); 778 content::Source<Profile>(profile_));
779 registrar_.Add(this, 779 registrar_.Add(this,
780 chrome::NOTIFICATION_EXTENSION_UNLOADED, 780 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
781 content::Source<Profile>(profile_)); 781 content::Source<Profile>(profile_));
782 782
783 EventRouter* event_router = ExtensionSystem::Get(profile_)->event_router(); 783 EventRouter* event_router = ExtensionSystem::Get(profile_)->event_router();
784 event_router->RegisterObserver(this, input_ime::OnActivate::kEventName); 784 event_router->RegisterObserver(this, input_ime::OnActivate::kEventName);
785 event_router->RegisterObserver(this, input_ime::OnFocus::kEventName); 785 event_router->RegisterObserver(this, input_ime::OnFocus::kEventName);
786 } 786 }
787 787
788 InputImeAPI::~InputImeAPI() { 788 InputImeAPI::~InputImeAPI() {
789 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 789 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
790 } 790 }
(...skipping 17 matching lines...) Expand all
808 if (!input_components) 808 if (!input_components)
809 return; 809 return;
810 for (std::vector<extensions::InputComponentInfo>::const_iterator component = 810 for (std::vector<extensions::InputComponentInfo>::const_iterator component =
811 input_components->begin(); component != input_components->end(); 811 input_components->begin(); component != input_components->end();
812 ++component) { 812 ++component) {
813 if (component->type == extensions::INPUT_COMPONENT_TYPE_IME) { 813 if (component->type == extensions::INPUT_COMPONENT_TYPE_IME) {
814 input_ime_event_router()->RegisterIme( 814 input_ime_event_router()->RegisterIme(
815 profile_, extension->id(), *component); 815 profile_, extension->id(), *component);
816 } 816 }
817 } 817 }
818 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { 818 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) {
819 const Extension* extension = 819 const Extension* extension =
820 content::Details<const UnloadedExtensionInfo>(details)->extension; 820 content::Details<const UnloadedExtensionInfo>(details)->extension;
821 const std::vector<InputComponentInfo>* input_components = 821 const std::vector<InputComponentInfo>* input_components =
822 extensions::InputComponents::GetInputComponents(extension); 822 extensions::InputComponents::GetInputComponents(extension);
823 if (!input_components) 823 if (!input_components)
824 return; 824 return;
825 if (input_components->size() > 0) 825 if (input_components->size() > 0)
826 input_ime_event_router()->UnregisterAllImes(profile_, extension->id()); 826 input_ime_event_router()->UnregisterAllImes(profile_, extension->id());
827 } 827 }
828 } 828 }
829 829
830 void InputImeAPI::OnListenerAdded(const EventListenerInfo& details) { 830 void InputImeAPI::OnListenerAdded(const EventListenerInfo& details) {
831 InputMethodEngineInterface* engine = 831 InputMethodEngineInterface* engine =
832 input_ime_event_router()->GetActiveEngine(details.extension_id); 832 input_ime_event_router()->GetActiveEngine(details.extension_id);
833 if (engine) 833 if (engine)
834 engine->NotifyImeReady(); 834 engine->NotifyImeReady();
835 } 835 }
836 836
837 InputImeEventRouter* InputImeAPI::input_ime_event_router() { 837 InputImeEventRouter* InputImeAPI::input_ime_event_router() {
838 return InputImeEventRouter::GetInstance(); 838 return InputImeEventRouter::GetInstance();
839 } 839 }
840 840
841 } // namespace extensions 841 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698