Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc

Issue 2322353002: [Merge-M53] arc: Add support of default and OEM apps. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_impl.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 void ChromeLauncherControllerUserSwitchObserver::AddUser(Profile* profile) { 184 void ChromeLauncherControllerUserSwitchObserver::AddUser(Profile* profile) {
185 if (chrome::MultiUserWindowManager::GetMultiProfileMode() == 185 if (chrome::MultiUserWindowManager::GetMultiProfileMode() ==
186 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) 186 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED)
187 chrome::MultiUserWindowManager::GetInstance()->AddUser(profile); 187 chrome::MultiUserWindowManager::GetInstance()->AddUser(profile);
188 controller_->AdditionalUserAddedToSession(profile->GetOriginalProfile()); 188 controller_->AdditionalUserAddedToSession(profile->GetOriginalProfile());
189 } 189 }
190 190
191 ChromeLauncherControllerImpl::ChromeLauncherControllerImpl( 191 ChromeLauncherControllerImpl::ChromeLauncherControllerImpl(
192 Profile* profile, 192 Profile* profile,
193 ash::ShelfModel* model) 193 ash::ShelfModel* model)
194 : model_(model), profile_(profile) { 194 : model_(model), profile_(profile), weak_ptr_factory_(this) {
195 if (!profile_) { 195 if (!profile_) {
196 // If no profile was passed, we take the currently active profile and use it 196 // If no profile was passed, we take the currently active profile and use it
197 // as the owner of the current desktop. 197 // as the owner of the current desktop.
198 // Use the original profile as on chromeos we may get a temporary off the 198 // Use the original profile as on chromeos we may get a temporary off the
199 // record profile, unless in guest session (where off the record profile is 199 // record profile, unless in guest session (where off the record profile is
200 // the right one). 200 // the right one).
201 profile_ = ProfileManager::GetActiveUserProfile(); 201 profile_ = ProfileManager::GetActiveUserProfile();
202 if (!profile_->IsGuestSession() && !profile_->IsSystemProfile()) 202 if (!profile_->IsGuestSession() && !profile_->IsSystemProfile())
203 profile_ = profile_->GetOriginalProfile(); 203 profile_ = profile_->GetOriginalProfile();
204 204
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 } 1207 }
1208 1208
1209 void ChromeLauncherControllerImpl::OnSyncModelUpdated() { 1209 void ChromeLauncherControllerImpl::OnSyncModelUpdated() {
1210 UpdateAppLaunchersFromPref(); 1210 UpdateAppLaunchersFromPref();
1211 } 1211 }
1212 1212
1213 void ChromeLauncherControllerImpl::ScheduleUpdateAppLaunchersFromPref() { 1213 void ChromeLauncherControllerImpl::ScheduleUpdateAppLaunchersFromPref() {
1214 base::ThreadTaskRunnerHandle::Get()->PostTask( 1214 base::ThreadTaskRunnerHandle::Get()->PostTask(
1215 FROM_HERE, 1215 FROM_HERE,
1216 base::Bind(&ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref, 1216 base::Bind(&ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref,
1217 base::Unretained(this))); 1217 weak_ptr_factory_.GetWeakPtr()));
1218 } 1218 }
1219 1219
1220 void ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref() { 1220 void ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref() {
1221 // There are various functions which will trigger a |SyncPinPosition| call 1221 // There are various functions which will trigger a |SyncPinPosition| call
1222 // like a direct call to |DoPinAppWithID|, or an indirect call to the menu 1222 // like a direct call to |DoPinAppWithID|, or an indirect call to the menu
1223 // model which will use weights to re-arrange the icons to new positions. 1223 // model which will use weights to re-arrange the icons to new positions.
1224 // Since this function is meant to synchronize the "is state" with the 1224 // Since this function is meant to synchronize the "is state" with the
1225 // "sync state", it makes no sense to store any changes by this function back 1225 // "sync state", it makes no sense to store any changes by this function back
1226 // into the pref state. Therefore we tell |persistPinnedState| to ignore any 1226 // into the pref state. Therefore we tell |persistPinnedState| to ignore any
1227 // invocations while we are running. 1227 // invocations while we are running.
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 if (index == -1) 1712 if (index == -1)
1713 continue; 1713 continue;
1714 ash::ShelfItem item = model_->items()[index]; 1714 ash::ShelfItem item = model_->items()[index];
1715 item.image = image; 1715 item.image = image;
1716 if (arc_deferred_launcher_) 1716 if (arc_deferred_launcher_)
1717 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image); 1717 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image);
1718 model_->Set(index, item); 1718 model_->Set(index, item);
1719 // It's possible we're waiting on more than one item, so don't break. 1719 // It's possible we're waiting on more than one item, so don't break.
1720 } 1720 }
1721 } 1721 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698