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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 ash::ShelfModel* model) | 365 ash::ShelfModel* model) |
366 : model_(model), | 366 : model_(model), |
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 |
msw
2015/05/21 04:34:43
nit/q: Did you mean to use the system profile and
Mike Lerman
2015/05/21 15:27:31
SystemProfile is OTRProfileImpl. There is an origi
msw
2015/05/21 17:48:12
Acknowledged.
| |
376 // the right one). | 376 // the right one). |
377 Profile* active_profile = ProfileManager::GetActiveUserProfile(); | 377 Profile* active_profile = ProfileManager::GetActiveUserProfile(); |
378 profile_ = active_profile->IsGuestSession() ? active_profile : | 378 profile_ = |
msw
2015/05/21 04:34:43
nit: consider:
profile_ = ProfileManager::GetAct
Mike Lerman
2015/05/21 15:27:31
Done.
| |
379 active_profile->GetOriginalProfile(); | 379 active_profile->IsGuestSession() || active_profile->IsSystemProfile() |
380 ? active_profile | |
381 : active_profile->GetOriginalProfile(); | |
380 | 382 |
381 app_sync_ui_state_ = AppSyncUIState::Get(profile_); | 383 app_sync_ui_state_ = AppSyncUIState::Get(profile_); |
382 if (app_sync_ui_state_) | 384 if (app_sync_ui_state_) |
383 app_sync_ui_state_->AddObserver(this); | 385 app_sync_ui_state_->AddObserver(this); |
384 } | 386 } |
385 | 387 |
386 // All profile relevant settings get bound to the current profile. | 388 // All profile relevant settings get bound to the current profile. |
387 AttachProfile(profile_); | 389 AttachProfile(profile_); |
388 model_->AddObserver(this); | 390 model_->AddObserver(this); |
389 | 391 |
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2045 if (!app_list_icon_added) { | 2047 if (!app_list_icon_added) { |
2046 pinned_apps.insert(pinned_apps.begin(), kAppShelfIdPlaceholder); | 2048 pinned_apps.insert(pinned_apps.begin(), kAppShelfIdPlaceholder); |
2047 } | 2049 } |
2048 return pinned_apps; | 2050 return pinned_apps; |
2049 } | 2051 } |
2050 | 2052 |
2051 bool ChromeLauncherController::IsIncognito( | 2053 bool ChromeLauncherController::IsIncognito( |
2052 const content::WebContents* web_contents) const { | 2054 const content::WebContents* web_contents) const { |
2053 const Profile* profile = | 2055 const Profile* profile = |
2054 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 2056 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
2055 return profile->IsOffTheRecord() && !profile->IsGuestSession(); | 2057 return profile->IsOffTheRecord() && !profile->IsGuestSession() && |
2058 !profile->IsSystemProfile(); | |
msw
2015/05/21 04:34:43
nit: should this only be indented 4 spaces without
Mike Lerman
2015/05/21 15:27:31
I tried it your way, but apparently not - I did th
msw
2015/05/21 17:48:12
Acknowledged.
| |
2056 } | 2059 } |
2057 | 2060 |
2058 void ChromeLauncherController::CloseWindowedAppsFromRemovedExtension( | 2061 void ChromeLauncherController::CloseWindowedAppsFromRemovedExtension( |
2059 const std::string& app_id, | 2062 const std::string& app_id, |
2060 const Profile* profile) { | 2063 const Profile* profile) { |
2061 // This function cannot rely on the controller's enumeration functionality | 2064 // This function cannot rely on the controller's enumeration functionality |
2062 // since the extension has already be unloaded. | 2065 // since the extension has already be unloaded. |
2063 const BrowserList* ash_browser_list = | 2066 const BrowserList* ash_browser_list = |
2064 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 2067 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
2065 std::vector<Browser*> browser_to_close; | 2068 std::vector<Browser*> browser_to_close; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2139 void ChromeLauncherController::ReleaseProfile() { | 2142 void ChromeLauncherController::ReleaseProfile() { |
2140 if (app_sync_ui_state_) | 2143 if (app_sync_ui_state_) |
2141 app_sync_ui_state_->RemoveObserver(this); | 2144 app_sync_ui_state_->RemoveObserver(this); |
2142 | 2145 |
2143 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); | 2146 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); |
2144 | 2147 |
2145 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2148 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
2146 | 2149 |
2147 pref_change_registrar_.RemoveAll(); | 2150 pref_change_registrar_.RemoveAll(); |
2148 } | 2151 } |
OLD | NEW |