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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 void DriveAppMapping::RegisterProfilePrefs( | 46 void DriveAppMapping::RegisterProfilePrefs( |
47 user_prefs::PrefRegistrySyncable* registry) { | 47 user_prefs::PrefRegistrySyncable* registry) { |
48 registry->RegisterDictionaryPref(prefs::kAppLauncherDriveAppMapping); | 48 registry->RegisterDictionaryPref(prefs::kAppLauncherDriveAppMapping); |
49 registry->RegisterListPref(prefs::kAppLauncherUninstalledDriveApps); | 49 registry->RegisterListPref(prefs::kAppLauncherUninstalledDriveApps); |
50 } | 50 } |
51 | 51 |
52 void DriveAppMapping::Add(const std::string& drive_app_id, | 52 void DriveAppMapping::Add(const std::string& drive_app_id, |
53 const std::string& chrome_app_id, | 53 const std::string& chrome_app_id, |
54 bool generated) { | 54 bool generated) { |
55 DictionaryPrefUpdate update(prefs_, prefs::kAppLauncherDriveAppMapping); | 55 DictionaryPrefUpdate update(prefs_, prefs::kAppLauncherDriveAppMapping); |
56 update->SetWithoutPathExpansion( | 56 update->SetWithoutPathExpansion(drive_app_id, |
57 drive_app_id, CreateInfoDict(chrome_app_id, generated).release()); | 57 CreateInfoDict(chrome_app_id, generated)); |
58 } | 58 } |
59 | 59 |
60 void DriveAppMapping::Remove(const std::string& drive_app_id) { | 60 void DriveAppMapping::Remove(const std::string& drive_app_id) { |
61 DictionaryPrefUpdate update(prefs_, prefs::kAppLauncherDriveAppMapping); | 61 DictionaryPrefUpdate update(prefs_, prefs::kAppLauncherDriveAppMapping); |
62 update->RemoveWithoutPathExpansion(drive_app_id, NULL); | 62 update->RemoveWithoutPathExpansion(drive_app_id, NULL); |
63 } | 63 } |
64 | 64 |
65 std::string DriveAppMapping::GetChromeApp( | 65 std::string DriveAppMapping::GetChromeApp( |
66 const std::string& drive_app_id) const { | 66 const std::string& drive_app_id) const { |
67 const base::DictionaryValue* mapping = | 67 const base::DictionaryValue* mapping = |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 uninstalled_app_ids_.insert(app_id); | 160 uninstalled_app_ids_.insert(app_id); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 void DriveAppMapping::UpdateUninstalledList() { | 164 void DriveAppMapping::UpdateUninstalledList() { |
165 ListPrefUpdate update(prefs_, prefs::kAppLauncherUninstalledDriveApps); | 165 ListPrefUpdate update(prefs_, prefs::kAppLauncherUninstalledDriveApps); |
166 update->Clear(); | 166 update->Clear(); |
167 for (const auto& app_id : uninstalled_app_ids_) | 167 for (const auto& app_id : uninstalled_app_ids_) |
168 update->AppendString(app_id); | 168 update->AppendString(app_id); |
169 } | 169 } |
OLD | NEW |