OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 ash::ShelfModel* model) | 325 ash::ShelfModel* model) |
326 : model_(model), | 326 : model_(model), |
327 item_delegate_manager_(NULL), | 327 item_delegate_manager_(NULL), |
328 profile_(profile), | 328 profile_(profile), |
329 app_sync_ui_state_(NULL), | 329 app_sync_ui_state_(NULL), |
330 ignore_persist_pinned_state_change_(false) { | 330 ignore_persist_pinned_state_change_(false) { |
331 if (!profile_) { | 331 if (!profile_) { |
332 // If no profile was passed, we take the currently active profile and use it | 332 // If no profile was passed, we take the currently active profile and use it |
333 // as the owner of the current desktop. | 333 // as the owner of the current desktop. |
334 // Use the original profile as on chromeos we may get a temporary off the | 334 // Use the original profile as on chromeos we may get a temporary off the |
335 // record profile. | 335 // record profile, unless in guest session (where off the record profile is |
336 profile_ = ProfileManager::GetActiveUserProfile()->GetOriginalProfile(); | 336 // the right one). |
| 337 Profile* active_profile = ProfileManager::GetActiveUserProfile(); |
| 338 profile_ = active_profile->IsGuestSession() ? active_profile : |
| 339 active_profile->GetOriginalProfile(); |
337 | 340 |
338 app_sync_ui_state_ = AppSyncUIState::Get(profile_); | 341 app_sync_ui_state_ = AppSyncUIState::Get(profile_); |
339 if (app_sync_ui_state_) | 342 if (app_sync_ui_state_) |
340 app_sync_ui_state_->AddObserver(this); | 343 app_sync_ui_state_->AddObserver(this); |
341 } | 344 } |
342 | 345 |
343 // All profile relevant settings get bound to the current profile. | 346 // All profile relevant settings get bound to the current profile. |
344 AttachProfile(profile_); | 347 AttachProfile(profile_); |
345 model_->AddObserver(this); | 348 model_->AddObserver(this); |
346 | 349 |
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 } | 2025 } |
2023 | 2026 |
2024 void ChromeLauncherController::ReleaseProfile() { | 2027 void ChromeLauncherController::ReleaseProfile() { |
2025 if (app_sync_ui_state_) | 2028 if (app_sync_ui_state_) |
2026 app_sync_ui_state_->RemoveObserver(this); | 2029 app_sync_ui_state_->RemoveObserver(this); |
2027 | 2030 |
2028 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2031 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
2029 | 2032 |
2030 pref_change_registrar_.RemoveAll(); | 2033 pref_change_registrar_.RemoveAll(); |
2031 } | 2034 } |
OLD | NEW |