GetDefaultProfile fixit for Chrome OS network & power settings.

BUG=322682

Review URL: https://codereview.chromium.org/99133022

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241121 0039d316-1c4b-4281-b951-d872f2087c98
parent 68e5cc78
...@@ -26,7 +26,7 @@ namespace chromeos { ...@@ -26,7 +26,7 @@ namespace chromeos {
// static // static
void ChooseMobileNetworkDialog::ShowDialog(gfx::NativeWindow owning_window) { void ChooseMobileNetworkDialog::ShowDialog(gfx::NativeWindow owning_window) {
chrome::ShowWebDialog(owning_window, chrome::ShowWebDialog(owning_window,
ProfileManager::GetDefaultProfileOrOffTheRecord(), ProfileManager::GetActiveUserProfile(),
new ChooseMobileNetworkDialog); new ChooseMobileNetworkDialog);
} }
......
...@@ -226,8 +226,9 @@ bool PeripheralBatteryObserver::PostNotification(const std::string& address, ...@@ -226,8 +226,9 @@ bool PeripheralBatteryObserver::PostNotification(const std::string& address,
UTF8ToUTF16(address), UTF8ToUTF16(address),
new PeripheralBatteryNotificationDelegate(address)); new PeripheralBatteryNotificationDelegate(address));
notification_manager->Add(notification, notification_manager->Add(
ProfileManager::GetDefaultProfileOrOffTheRecord()); notification,
ProfileManager::GetPrimaryUserProfileOrOffTheRecord());
return true; return true;
} }
......
...@@ -84,7 +84,7 @@ void PowerPrefs::Observe(int type, ...@@ -84,7 +84,7 @@ void PowerPrefs::Observe(int type,
} }
case chrome::NOTIFICATION_SESSION_STARTED: case chrome::NOTIFICATION_SESSION_STARTED:
// Update |profile_| when entering a session. // Update |profile_| when entering a session.
SetProfile(ProfileManager::GetDefaultProfile()); SetProfile(ProfileManager::GetPrimaryUserProfile());
break; break;
case chrome::NOTIFICATION_PROFILE_DESTROYED: { case chrome::NOTIFICATION_PROFILE_DESTROYED: {
// Update |profile_| when exiting a session or shutting down. // Update |profile_| when exiting a session or shutting down.
...@@ -229,6 +229,11 @@ void PowerPrefs::RegisterProfilePrefs( ...@@ -229,6 +229,11 @@ void PowerPrefs::RegisterProfilePrefs(
} }
void PowerPrefs::SetProfile(Profile* profile) { void PowerPrefs::SetProfile(Profile* profile) {
// No need to reapply policy if profile hasn't changed, e.g. when adding a
// secondary user to an existing session.
if (profile == profile_)
return;
profile_ = profile; profile_ = profile;
pref_change_registrar_.reset(); pref_change_registrar_.reset();
......
...@@ -45,7 +45,7 @@ namespace chromeos { ...@@ -45,7 +45,7 @@ namespace chromeos {
void SimDialogDelegate::ShowDialog(gfx::NativeWindow owning_window, void SimDialogDelegate::ShowDialog(gfx::NativeWindow owning_window,
SimDialogMode mode) { SimDialogMode mode) {
chrome::ShowWebDialog(owning_window, chrome::ShowWebDialog(owning_window,
ProfileManager::GetDefaultProfileOrOffTheRecord(), ProfileManager::GetActiveUserProfile(),
new SimDialogDelegate(mode)); new SimDialogDelegate(mode));
} }
......
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