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

Unified Diff: chrome/browser/extensions/api/input_ime/input_ime_api.cc

Issue 428783008: GetActiveUserProfile() should not be called before profile is initialized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment on GetProfile added. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/input_ime/input_ime_api.h ('k') | chromeos/ime/input_method_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/input_ime/input_ime_api.cc
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
index b1d15c6cec63e6c77ccdf3b66a7cb0bf0111abae..ff86a328a173e8ab51fe1e321f8450f85242c45f 100644
--- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc
+++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
@@ -349,12 +349,12 @@ InputImeEventRouter::GetInstance() {
}
bool InputImeEventRouter::RegisterIme(
+ Profile* profile,
const std::string& extension_id,
const extensions::InputComponentInfo& component) {
#if defined(USE_X11)
VLOG(1) << "RegisterIme: " << extension_id << " id: " << component.id;
- Profile* profile = ProfileManager::GetActiveUserProfile();
// Avoid potential mem leaks due to duplicated component IDs.
if (!profile_engine_map_[profile][extension_id][component.id]) {
std::vector<std::string> layouts;
@@ -371,7 +371,8 @@ bool InputImeEventRouter::RegisterIme(
scoped_ptr<chromeos::InputMethodEngineInterface::Observer> observer(
new chromeos::ImeObserver(profile, extension_id));
chromeos::InputMethodEngine* engine = new chromeos::InputMethodEngine();
- engine->Initialize(observer.Pass(),
+ engine->Initialize(profile,
+ observer.Pass(),
component.name.c_str(),
extension_id.c_str(),
component.id.c_str(),
@@ -854,14 +855,17 @@ void InputImeAPI::OnExtensionLoaded(content::BrowserContext* browser_context,
component != input_components->end();
++component) {
if (component->type == extensions::INPUT_COMPONENT_TYPE_IME) {
- // Don't pass profile_ to register ime, instead always use
- // GetActiveUserProfile. It is because:
- // The original profile for login screen is called signin profile.
- // And the active profile is the incognito profile based on signin
- // profile. So if |profile_| is signin profile, we need to make sure
+ // If |browser_context| looks like signin profile, use the real signin
+ // profile. This is because IME extensions for signin profile are run
+ // in Off-The-Record profile, based on given static defaults.
+ // So if |profile_| is signin profile, we need to make sure
// the router/observer runs under its incognito profile, because the
// component extensions were installed under its incognito profile.
- input_ime_event_router()->RegisterIme(extension->id(), *component);
+ Profile* profile = Profile::FromBrowserContext(browser_context);
+ if (chromeos::ProfileHelper::IsSigninProfile(profile))
+ profile = chromeos::ProfileHelper::GetSigninProfile();
+ input_ime_event_router()->RegisterIme(
+ profile, extension->id(), *component);
}
}
}
« no previous file with comments | « chrome/browser/extensions/api/input_ime/input_ime_api.h ('k') | chromeos/ime/input_method_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698