Commit 2f0b419d authored by Shu Chen's avatar Shu Chen Committed by Commit Bot

Fix the regression caused by http://crrev.com/c/1288350.

Bug: 900124,856135
Change-Id: Ie11ad406bd1ea383dc2a83cc8661076309154865
Reviewed-on: https://chromium-review.googlesource.com/c/1317010Reviewed-by: default avatarLan Wei <azurewei@chromium.org>
Commit-Queue: Shu Chen <shuchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605282}
parent 1a0b6349
...@@ -275,9 +275,18 @@ InputImeEventRouterFactory::~InputImeEventRouterFactory() { ...@@ -275,9 +275,18 @@ InputImeEventRouterFactory::~InputImeEventRouterFactory() {
InputImeEventRouter* InputImeEventRouterFactory::GetRouter(Profile* profile) { InputImeEventRouter* InputImeEventRouterFactory::GetRouter(Profile* profile) {
if (!profile) if (!profile)
return nullptr; return nullptr;
// The |router_map_| is keyed by the original profile.
// Refers to the comments in |RemoveProfile| method for the reason.
profile = profile->GetOriginalProfile();
InputImeEventRouter* router = router_map_[profile]; InputImeEventRouter* router = router_map_[profile];
if (!router) { if (!router) {
router = new InputImeEventRouter(profile); // The router must attach to the profile from which the extension can
// receive events. If |profile| has an off-the-record profile, attach the
// off-the-record profile. e.g. In guest mode, the extension is running with
// the incognito profile instead of its original profile.
router = new InputImeEventRouter(profile->HasOffTheRecordProfile()
? profile->GetOffTheRecordProfile()
: profile);
router_map_[profile] = router; router_map_[profile] = router;
} }
return router; return router;
...@@ -450,7 +459,7 @@ InputImeEventRouter* GetInputImeEventRouter(Profile* profile) { ...@@ -450,7 +459,7 @@ InputImeEventRouter* GetInputImeEventRouter(Profile* profile) {
if (!profile) if (!profile)
return nullptr; return nullptr;
return extensions::InputImeEventRouterFactory::GetInstance()->GetRouter( return extensions::InputImeEventRouterFactory::GetInstance()->GetRouter(
profile->GetOriginalProfile()); profile);
} }
} // namespace extensions } // namespace extensions
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment