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

Side by Side Diff: chrome/browser/ui/ash/chrome_launcher_prefs.cc

Issue 2416133002: Implement local storage for App List in case app sync is off. (Closed)
Patch Set: method renamed Created 4 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chrome_launcher_prefs.h" 5 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 } 591 }
592 592
593 return legacy_pins; 593 return legacy_pins;
594 } 594 }
595 595
596 std::vector<AppLauncherId> GetPinnedAppsFromPrefs( 596 std::vector<AppLauncherId> GetPinnedAppsFromPrefs(
597 const PrefService* prefs, 597 const PrefService* prefs,
598 LauncherControllerHelper* helper) { 598 LauncherControllerHelper* helper) {
599 app_list::AppListSyncableService* app_service = 599 app_list::AppListSyncableService* app_service =
600 app_list::AppListSyncableServiceFactory::GetForProfile(helper->profile()); 600 app_list::AppListSyncableServiceFactory::GetForProfile(helper->profile());
601 // Some unit tests may not have it. 601 // Some unit tests may not have it or service may not be initialized.
602 if (!app_service) 602 if (!app_service || !app_service->IsInitialized())
603 return std::vector<AppLauncherId>(); 603 return std::vector<AppLauncherId>();
604 604
605 std::vector<PinInfo> pin_infos; 605 std::vector<PinInfo> pin_infos;
606 606
607 AppTracker policy_apps; 607 AppTracker policy_apps;
608 GetAppsPinnedByPolicy(prefs, helper, &policy_apps); 608 GetAppsPinnedByPolicy(prefs, helper, &policy_apps);
609 609
610 // Empty pins indicates that sync based pin model is used for the first 610 // Empty pins indicates that sync based pin model is used for the first
611 // time. In normal workflow we have at least Chrome browser pin info. 611 // time. In normal workflow we have at least Chrome browser pin info.
612 bool first_run = true; 612 bool first_run = true;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 pin_position = position_before.CreateAfter(); 738 pin_position = position_before.CreateAfter();
739 else if (position_after.IsValid()) 739 else if (position_after.IsValid())
740 pin_position = position_after.CreateBefore(); 740 pin_position = position_after.CreateBefore();
741 else 741 else
742 pin_position = syncer::StringOrdinal::CreateInitialOrdinal(); 742 pin_position = syncer::StringOrdinal::CreateInitialOrdinal();
743 app_service->SetPinPosition(app_launcher_id_str, pin_position); 743 app_service->SetPinPosition(app_launcher_id_str, pin_position);
744 } 744 }
745 745
746 } // namespace launcher 746 } // namespace launcher
747 } // namespace ash 747 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698