summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos
diff options
context:
space:
mode:
authorskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-19 11:51:14 +0000
committerskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-19 11:51:14 +0000
commitc112484c4665767e8d814a37b7da04d4d86312bc (patch)
treef78aeab8dd10be0aade122a15dd6ba8cd4d36103 /chrome/browser/chromeos
parenteafe219fa056257cacf77b4d360814f7e62d5049 (diff)
downloadchromium_src-c112484c4665767e8d814a37b7da04d4d86312bc.zip
chromium_src-c112484c4665767e8d814a37b7da04d4d86312bc.tar.gz
chromium_src-c112484c4665767e8d814a37b7da04d4d86312bc.tar.bz2
Remove GetDefaultProfile from IME related functions.
I spoke with mlchan and we are working on this functionality for M34. This patch is making sure that we do a reasonable thing for M33, but we should revisit these decisions once the IME handling for multi profile is implemented as planned. BUG=322682, 328541 TEST=covered by existing tests Review URL: https://codereview.chromium.org/115603002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241841 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r--chrome/browser/chromeos/input_method/accessibility.cc2
-rw-r--r--chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc6
-rw-r--r--chrome/browser/chromeos/input_method/input_method_persistence.cc26
-rw-r--r--chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc5
4 files changed, 25 insertions, 14 deletions
diff --git a/chrome/browser/chromeos/input_method/accessibility.cc b/chrome/browser/chromeos/input_method/accessibility.cc
index 3129dd4..0dac232 100644
--- a/chrome/browser/chromeos/input_method/accessibility.cc
+++ b/chrome/browser/chromeos/input_method/accessibility.cc
@@ -48,7 +48,7 @@ void Accessibility::InputMethodChanged(InputMethodManager* imm,
const std::string medium_name = UTF16ToUTF8(
imm_->GetInputMethodUtil()->GetInputMethodMediumName(descriptor));
- AccessibilityAlertInfo event(ProfileManager::GetDefaultProfile(),
+ AccessibilityAlertInfo event(ProfileManager::GetActiveUserProfile(),
medium_name);
SendControlAccessibilityNotification(
ui::AccessibilityTypes::EVENT_ALERT, &event);
diff --git a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
index 3a31256..c48a9c0 100644
--- a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
+++ b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
@@ -87,7 +87,11 @@ struct WhitelistedComponentExtensionIME {
};
extensions::ComponentLoader* GetComponentLoader() {
- Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
+ // TODO(skuhne, nkostylev): At this time the only thing which makes sense here
+ // is to use the active profile. Nkostylev is working on getting IME settings
+ // to work for multi user by collecting all settings from all users. Once that
+ // is done we might have to re-visit this decision.
+ Profile* profile = ProfileManager::GetActiveUserProfile();
extensions::ExtensionSystem* extension_system =
extensions::ExtensionSystem::Get(profile);
ExtensionService* extension_service = extension_system->extension_service();
diff --git a/chrome/browser/chromeos/input_method/input_method_persistence.cc b/chrome/browser/chromeos/input_method/input_method_persistence.cc
index 822b3b8..31b4632 100644
--- a/chrome/browser/chromeos/input_method/input_method_persistence.cc
+++ b/chrome/browser/chromeos/input_method/input_method_persistence.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
#include "chrome/browser/chromeos/language_preferences.h"
+#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/pref_names.h"
@@ -30,7 +31,8 @@ void PersistSystemInputMethod(const std::string& input_method) {
// Update user LRU keyboard layout for login screen
static void SetUserLRUInputMethod(
const std::string& input_method,
- const chromeos::input_method::InputMethodManager* const manager) {
+ const chromeos::input_method::InputMethodManager* const manager,
+ Profile* profile) {
// Skip if it's not a keyboard layout. Drop input methods including
// extension ones.
if (!manager->IsLoginKeyboard(input_method))
@@ -38,14 +40,9 @@ static void SetUserLRUInputMethod(
PrefService* const local_state = g_browser_process->local_state();
- Profile* const profile = ProfileManager::GetDefaultProfile();
-
if (profile == NULL)
return;
- if (!manager->IsLoginKeyboard(input_method))
- return;
-
const std::string username = profile->GetProfileName();
if (base::SysInfo::IsRunningOnChromeOS() && !username.empty() &&
!local_state->ReadOnly()) {
@@ -83,14 +80,25 @@ static void SetUserLRUInputMethod(
void PersistUserInputMethod(const std::string& input_method,
InputMethodManager* const manager) {
+ // TODO(nkostylev): This feature is currently broken in various ways (see for
+ // example crbug.com/328541). Furthermore it is planned to combine all IME
+ // settings of all users in a session, which means that the user might not
+ // have the used IME setting installed. We therefore do not persist the IME
+ // in a multi profile session. This should be fixed in M34.
+ if (UserManager::IsInitialized() &&
+ UserManager::Get()->GetLoggedInUsers().size() > 1)
+ return;
+
PrefService* user_prefs = NULL;
- Profile* profile = ProfileManager::GetDefaultProfile();
+ // Persist the method on a per user basis. Note that the keyboard settings are
+ // stored per user desktop and a visiting window will use the same input
+ // method as the desktop it is on (and not of the owner of the window).
+ Profile* profile = ProfileManager::GetActiveUserProfile();
if (profile)
user_prefs = profile->GetPrefs();
if (!user_prefs)
return;
-
- SetUserLRUInputMethod(input_method, manager);
+ SetUserLRUInputMethod(input_method, manager, profile);
const std::string current_input_method_on_pref =
user_prefs->GetString(prefs::kLanguageCurrentInputMethod);
diff --git a/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc b/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc
index e9b9923f..c6d0fde 100644
--- a/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc
+++ b/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc
@@ -34,8 +34,7 @@ class InputMethodPersistenceTest : public testing::Test {
: mock_profile_manager_(TestingBrowserProcess::GetGlobal()) {}
virtual void SetUp() OVERRIDE {
- // Set up a profile that will be returned by
- // ProfileManager::GetDefaultProfile().
+ // Set up a valid profile for our test.
ASSERT_TRUE(mock_profile_manager_.SetUp());
TestingProfile* mock_profile =
mock_profile_manager_.CreateTestingProfile(chrome::kTestUserProfileDir);
@@ -43,7 +42,7 @@ class InputMethodPersistenceTest : public testing::Test {
cl->AppendSwitchASCII(switches::kLoginProfile, chrome::kTestUserProfileDir);
mock_profile_manager_.SetLoggedIn(true);
ProfileManager::AllowGetDefaultProfile();
- EXPECT_TRUE(ProfileManager::GetDefaultProfile() != NULL);
+ EXPECT_TRUE(ProfileManager::GetActiveUserProfile() != NULL);
mock_user_prefs_ = mock_profile->GetTestingPrefService();
}