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

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

Issue 1860413002: Fix the potential crash on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 if (input_components && event_router) { 614 if (input_components && event_router) {
615 event_router->RegisterImeExtension(extension->id(), *input_components); 615 event_router->RegisterImeExtension(extension->id(), *input_components);
616 } 616 }
617 } 617 }
618 618
619 void InputImeAPI::OnExtensionUnloaded(content::BrowserContext* browser_context, 619 void InputImeAPI::OnExtensionUnloaded(content::BrowserContext* browser_context,
620 const Extension* extension, 620 const Extension* extension,
621 UnloadedExtensionInfo::Reason reason) { 621 UnloadedExtensionInfo::Reason reason) {
622 const std::vector<InputComponentInfo>* input_components = 622 const std::vector<InputComponentInfo>* input_components =
623 InputComponents::GetInputComponents(extension); 623 InputComponents::GetInputComponents(extension);
624 if (!input_components || input_components->empty())
625 return;
624 InputImeEventRouter* event_router = 626 InputImeEventRouter* event_router =
625 GetInputImeEventRouter(Profile::FromBrowserContext(browser_context)); 627 GetInputImeEventRouter(Profile::FromBrowserContext(browser_context));
626 if (input_components && !input_components->empty() && event_router) { 628 if (event_router) {
627 event_router->UnregisterAllImes(extension->id()); 629 event_router->UnregisterAllImes(extension->id());
628 } 630 }
629 } 631 }
630 632
631 void InputImeAPI::OnListenerAdded(const EventListenerInfo& details) { 633 void InputImeAPI::OnListenerAdded(const EventListenerInfo& details) {
632 if (!details.browser_context) 634 if (!details.browser_context)
633 return; 635 return;
634 InputMethodEngine* engine = 636 InputMethodEngine* engine =
635 GetActiveEngine(Profile::FromBrowserContext(details.browser_context), 637 GetActiveEngine(Profile::FromBrowserContext(details.browser_context),
636 details.extension_id); 638 details.extension_id);
637 // Notifies the IME extension for IME ready with onActivate/onFocus events. 639 // Notifies the IME extension for IME ready with onActivate/onFocus events.
638 if (engine) 640 if (engine)
639 engine->Enable(engine->GetActiveComponentId()); 641 engine->Enable(engine->GetActiveComponentId());
640 } 642 }
641 643
642 } // namespace extensions 644 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698