diff options
author | yusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-27 03:40:23 +0000 |
---|---|---|
committer | yusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-27 03:40:23 +0000 |
commit | e88f626c222ff159392515901a6958e0e73812a8 (patch) | |
tree | 1538e123f0482c2fdc625d0e0cc5e2613839f69c | |
parent | 3e17c69c533d265be75410b657e8dfbb814563ec (diff) | |
download | chromium_src-e88f626c222ff159392515901a6958e0e73812a8.zip chromium_src-e88f626c222ff159392515901a6958e0e73812a8.tar.gz chromium_src-e88f626c222ff159392515901a6958e0e73812a8.tar.bz2 |
Monitor chrome::NOTIFICATION_SESSION_STARTED instead of NOTIFICATION_PROFILE_CREATED.
It seems that observing NOTIFICATION_PROFILE_CREATED is currently not working fine because:
- When a user logs in, the chrome::NOTIFICATION_PROFILE_CREATED notification is sent to the browser twice, one is with StatusAreaViewChromeos::IsLoginMode(), the other is with IsBrowserMode().
- When a new user is added, the chrome::NOTIFICATION_PROFILE_CREATED notification is sent to the browser twice both with StatusAreaViewChromeos::IsLoginMode().
This CL changes the notification type to watch to NOTIFICATION_SESSION_STARTED because when the notification is sent, it is guaranteed that IsBrowserMode() always returns true.
BUG=chromium-os:26542
TEST=see the bug
Review URL: http://codereview.chromium.org/9355055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123708 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/status/input_method_menu.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/chrome/browser/chromeos/status/input_method_menu.cc b/chrome/browser/chromeos/status/input_method_menu.cc index b938b14..2cfd1fa 100644 --- a/chrome/browser/chromeos/status/input_method_menu.cc +++ b/chrome/browser/chromeos/status/input_method_menu.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -163,12 +163,15 @@ InputMethodMenu::InputMethodMenu(PrefService* pref_service, chrome::NOTIFICATION_LOGIN_USER_CHANGED, content::NotificationService::AllSources()); #if defined(USE_AURA) - // On Aura status area is not recreated on sign in. + // On Aura status area is not recreated on sign in. Instead, 2 notifications + // are sent to Chrome on sign in: NOTIFICATION_LOGIN_USER_CHANGED with + // StatusAreaViewChromeos::IsLoginMode() and NOTIFICATION_SESSION_STARTED + // with StatusAreaViewChromeos::IsBrowserMode(). // In case of Chrome crash, Chrome will be reloaded but IsLoginMode() will - // return false at this point so NOTIFICATION_PROFILE_CREATED will be + // return false at this point so NOTIFICATION_SESSION_STARTED will be // ignored and all initialization will happen in ctor. registrar_.Add(this, - chrome::NOTIFICATION_PROFILE_CREATED, + chrome::NOTIFICATION_SESSION_STARTED, content::NotificationService::AllSources()); #endif } @@ -413,6 +416,7 @@ void InputMethodMenu::InputMethodChanged( UpdateUIFromInputMethod(current_input_method, num_active_input_methods); } +// TODO(yusukes): Move code for handling preferences to chromeos/input_method/. void InputMethodMenu::PreferenceUpdateNeeded( InputMethodManager* manager, const input_method::InputMethodDescriptor& previous_input_method, @@ -706,11 +710,12 @@ void InputMethodMenu::Observe(int type, RemoveObservers(); } #if defined(USE_AURA) - if (type == chrome::NOTIFICATION_PROFILE_CREATED) { - // On Aura status area is not recreated on login for normal user sign in. - // NOTIFICATION_LOGIN_USER_CHANGED has been notified early in login process. + if (type == chrome::NOTIFICATION_SESSION_STARTED) { InitializePrefMembers(); AddObservers(); + InputMethodManager* manager = InputMethodManager::GetInstance(); + UpdateUIFromInputMethod(manager->current_input_method(), + manager->GetNumActiveInputMethods()); } #endif } |