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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 item_delegate_manager_(NULL), | 367 item_delegate_manager_(NULL), |
368 profile_(profile), | 368 profile_(profile), |
369 app_sync_ui_state_(NULL), | 369 app_sync_ui_state_(NULL), |
370 ignore_persist_pinned_state_change_(false) { | 370 ignore_persist_pinned_state_change_(false) { |
371 if (!profile_) { | 371 if (!profile_) { |
372 // If no profile was passed, we take the currently active profile and use it | 372 // If no profile was passed, we take the currently active profile and use it |
373 // as the owner of the current desktop. | 373 // as the owner of the current desktop. |
374 // Use the original profile as on chromeos we may get a temporary off the | 374 // Use the original profile as on chromeos we may get a temporary off the |
375 // record profile, unless in guest session (where off the record profile is | 375 // record profile, unless in guest session (where off the record profile is |
376 // the right one). | 376 // the right one). |
377 Profile* active_profile = ProfileManager::GetActiveUserProfile(); | 377 profile_ = ProfileManager::GetActiveUserProfile(); |
378 profile_ = active_profile->IsGuestSession() ? active_profile : | 378 if (!profile_->IsGuestSession() && !profile_->IsSystemProfile()) |
379 active_profile->GetOriginalProfile(); | 379 profile_ = profile_->GetOriginalProfile(); |
380 | 380 |
381 app_sync_ui_state_ = AppSyncUIState::Get(profile_); | 381 app_sync_ui_state_ = AppSyncUIState::Get(profile_); |
382 if (app_sync_ui_state_) | 382 if (app_sync_ui_state_) |
383 app_sync_ui_state_->AddObserver(this); | 383 app_sync_ui_state_->AddObserver(this); |
384 } | 384 } |
385 | 385 |
386 // All profile relevant settings get bound to the current profile. | 386 // All profile relevant settings get bound to the current profile. |
387 AttachProfile(profile_); | 387 AttachProfile(profile_); |
388 model_->AddObserver(this); | 388 model_->AddObserver(this); |
389 | 389 |
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 if (!app_list_icon_added) { | 2045 if (!app_list_icon_added) { |
2046 pinned_apps.insert(pinned_apps.begin(), kAppShelfIdPlaceholder); | 2046 pinned_apps.insert(pinned_apps.begin(), kAppShelfIdPlaceholder); |
2047 } | 2047 } |
2048 return pinned_apps; | 2048 return pinned_apps; |
2049 } | 2049 } |
2050 | 2050 |
2051 bool ChromeLauncherController::IsIncognito( | 2051 bool ChromeLauncherController::IsIncognito( |
2052 const content::WebContents* web_contents) const { | 2052 const content::WebContents* web_contents) const { |
2053 const Profile* profile = | 2053 const Profile* profile = |
2054 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 2054 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
2055 return profile->IsOffTheRecord() && !profile->IsGuestSession(); | 2055 return profile->IsOffTheRecord() && !profile->IsGuestSession() && |
| 2056 !profile->IsSystemProfile(); |
2056 } | 2057 } |
2057 | 2058 |
2058 void ChromeLauncherController::CloseWindowedAppsFromRemovedExtension( | 2059 void ChromeLauncherController::CloseWindowedAppsFromRemovedExtension( |
2059 const std::string& app_id, | 2060 const std::string& app_id, |
2060 const Profile* profile) { | 2061 const Profile* profile) { |
2061 // This function cannot rely on the controller's enumeration functionality | 2062 // This function cannot rely on the controller's enumeration functionality |
2062 // since the extension has already be unloaded. | 2063 // since the extension has already be unloaded. |
2063 const BrowserList* ash_browser_list = | 2064 const BrowserList* ash_browser_list = |
2064 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 2065 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
2065 std::vector<Browser*> browser_to_close; | 2066 std::vector<Browser*> browser_to_close; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 void ChromeLauncherController::ReleaseProfile() { | 2140 void ChromeLauncherController::ReleaseProfile() { |
2140 if (app_sync_ui_state_) | 2141 if (app_sync_ui_state_) |
2141 app_sync_ui_state_->RemoveObserver(this); | 2142 app_sync_ui_state_->RemoveObserver(this); |
2142 | 2143 |
2143 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); | 2144 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); |
2144 | 2145 |
2145 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2146 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
2146 | 2147 |
2147 pref_change_registrar_.RemoveAll(); | 2148 pref_change_registrar_.RemoveAll(); |
2148 } | 2149 } |
OLD | NEW |