OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/apps/drive/drive_app_mapping.h" | 5 #include "chrome/browser/apps/drive/drive_app_mapping.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/prefs/scoped_user_pref_update.h" | 8 #include "base/prefs/scoped_user_pref_update.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 DriveAppMapping::DriveAppMapping(PrefService* prefs) : prefs_(prefs) { | 36 DriveAppMapping::DriveAppMapping(PrefService* prefs) : prefs_(prefs) { |
37 GetUninstalledIdsFromPref(); | 37 GetUninstalledIdsFromPref(); |
38 } | 38 } |
39 | 39 |
40 DriveAppMapping::~DriveAppMapping() { | 40 DriveAppMapping::~DriveAppMapping() { |
41 } | 41 } |
42 | 42 |
43 // static | 43 // static |
44 void DriveAppMapping::RegisterProfilePrefs( | 44 void DriveAppMapping::RegisterProfilePrefs( |
45 user_prefs::PrefRegistrySyncable* registry) { | 45 user_prefs::PrefRegistrySyncable* registry) { |
46 registry->RegisterDictionaryPref( | 46 registry->RegisterDictionaryPref(prefs::kAppLauncherDriveAppMapping); |
47 prefs::kAppLauncherDriveAppMapping, | 47 registry->RegisterListPref(prefs::kAppLauncherUninstalledDriveApps); |
48 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
49 registry->RegisterListPref( | |
50 prefs::kAppLauncherUninstalledDriveApps, | |
51 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
52 } | 48 } |
53 | 49 |
54 void DriveAppMapping::Add(const std::string& drive_app_id, | 50 void DriveAppMapping::Add(const std::string& drive_app_id, |
55 const std::string& chrome_app_id, | 51 const std::string& chrome_app_id, |
56 bool generated) { | 52 bool generated) { |
57 DictionaryPrefUpdate update(prefs_, prefs::kAppLauncherDriveAppMapping); | 53 DictionaryPrefUpdate update(prefs_, prefs::kAppLauncherDriveAppMapping); |
58 update->SetWithoutPathExpansion( | 54 update->SetWithoutPathExpansion( |
59 drive_app_id, CreateInfoDict(chrome_app_id, generated).release()); | 55 drive_app_id, CreateInfoDict(chrome_app_id, generated).release()); |
60 } | 56 } |
61 | 57 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 uninstalled_app_ids_.insert(app_id); | 158 uninstalled_app_ids_.insert(app_id); |
163 } | 159 } |
164 } | 160 } |
165 | 161 |
166 void DriveAppMapping::UpdateUninstalledList() { | 162 void DriveAppMapping::UpdateUninstalledList() { |
167 ListPrefUpdate update(prefs_, prefs::kAppLauncherUninstalledDriveApps); | 163 ListPrefUpdate update(prefs_, prefs::kAppLauncherUninstalledDriveApps); |
168 update->Clear(); | 164 update->Clear(); |
169 for (const auto& app_id : uninstalled_app_ids_) | 165 for (const auto& app_id : uninstalled_app_ids_) |
170 update->AppendString(app_id); | 166 update->AppendString(app_id); |
171 } | 167 } |
OLD | NEW |