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

Side by Side Diff: chrome/browser/chromeos/policy/device_local_account.cc

Issue 2691063002: arc: Use AndroidKioskAppInfoProto.display_name() as ARC++ Kiosk app name. (Closed)
Patch Set: fix post-merge nits from http://crrev.com/2451793002 Created 3 years, 10 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/chromeos/policy/device_local_account.h" 5 #include "chrome/browser/chromeos/policy/device_local_account.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 17 matching lines...) Expand all
28 28
29 const char kPublicAccountDomainPrefix[] = "public-accounts"; 29 const char kPublicAccountDomainPrefix[] = "public-accounts";
30 const char kKioskAppAccountDomainPrefix[] = "kiosk-apps"; 30 const char kKioskAppAccountDomainPrefix[] = "kiosk-apps";
31 const char kArcKioskAppAccountDomainPrefix[] = "arc-kiosk-apps"; 31 const char kArcKioskAppAccountDomainPrefix[] = "arc-kiosk-apps";
32 const char kDeviceLocalAccountDomainSuffix[] = ".device-local.localhost"; 32 const char kDeviceLocalAccountDomainSuffix[] = ".device-local.localhost";
33 33
34 } // namespace 34 } // namespace
35 35
36 ArcKioskAppBasicInfo::ArcKioskAppBasicInfo(const std::string& package_name, 36 ArcKioskAppBasicInfo::ArcKioskAppBasicInfo(const std::string& package_name,
37 const std::string& class_name, 37 const std::string& class_name,
38 const std::string& action) 38 const std::string& action,
39 : package_name_(package_name), class_name_(class_name), action_(action) {} 39 const std::string& display_name)
40 : package_name_(package_name),
41 class_name_(class_name),
42 action_(action),
43 display_name_(display_name) {}
40 44
41 ArcKioskAppBasicInfo::ArcKioskAppBasicInfo(const ArcKioskAppBasicInfo& other) = 45 ArcKioskAppBasicInfo::ArcKioskAppBasicInfo(const ArcKioskAppBasicInfo& other) =
42 default; 46 default;
43 47
44 ArcKioskAppBasicInfo::ArcKioskAppBasicInfo() {} 48 ArcKioskAppBasicInfo::ArcKioskAppBasicInfo() {}
45 49
46 ArcKioskAppBasicInfo::~ArcKioskAppBasicInfo() {} 50 ArcKioskAppBasicInfo::~ArcKioskAppBasicInfo() {}
47 51
48 bool ArcKioskAppBasicInfo::operator==(const ArcKioskAppBasicInfo& other) const { 52 bool ArcKioskAppBasicInfo::operator==(const ArcKioskAppBasicInfo& other) const {
49 return this->package_name_ == other.package_name_ && 53 return this->package_name_ == other.package_name_ &&
50 this->action_ == other.action_ && 54 this->action_ == other.action_ &&
51 this->class_name_ == other.class_name_; 55 this->class_name_ == other.class_name_ &&
56 this->display_name_ == other.display_name_;
52 } 57 }
53 58
54 DeviceLocalAccount::DeviceLocalAccount(Type type, 59 DeviceLocalAccount::DeviceLocalAccount(Type type,
55 const std::string& account_id, 60 const std::string& account_id,
56 const std::string& kiosk_app_id, 61 const std::string& kiosk_app_id,
57 const std::string& kiosk_app_update_url) 62 const std::string& kiosk_app_update_url)
58 : type(type), 63 : type(type),
59 account_id(account_id), 64 account_id(account_id),
60 user_id(GenerateDeviceLocalAccountUserId(account_id, type)), 65 user_id(GenerateDeviceLocalAccountUserId(account_id, type)),
61 kiosk_app_id(kiosk_app_id), 66 kiosk_app_id(kiosk_app_id),
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if (!it->arc_kiosk_app_info.class_name().empty()) { 168 if (!it->arc_kiosk_app_info.class_name().empty()) {
164 entry->SetStringWithoutPathExpansion( 169 entry->SetStringWithoutPathExpansion(
165 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskClass, 170 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskClass,
166 it->arc_kiosk_app_info.class_name()); 171 it->arc_kiosk_app_info.class_name());
167 } 172 }
168 if (!it->arc_kiosk_app_info.action().empty()) { 173 if (!it->arc_kiosk_app_info.action().empty()) {
169 entry->SetStringWithoutPathExpansion( 174 entry->SetStringWithoutPathExpansion(
170 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskAction, 175 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskAction,
171 it->arc_kiosk_app_info.action()); 176 it->arc_kiosk_app_info.action());
172 } 177 }
178 if (!it->arc_kiosk_app_info.display_name().empty()) {
179 entry->SetStringWithoutPathExpansion(
180 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskDisplayName,
181 it->arc_kiosk_app_info.display_name());
182 }
173 } 183 }
174 list.Append(std::move(entry)); 184 list.Append(std::move(entry));
175 } 185 }
176 186
177 service->Set(chromeos::kAccountsPrefDeviceLocalAccounts, list); 187 service->Set(chromeos::kAccountsPrefDeviceLocalAccounts, list);
178 } 188 }
179 189
180 std::vector<DeviceLocalAccount> GetDeviceLocalAccounts( 190 std::vector<DeviceLocalAccount> GetDeviceLocalAccounts(
181 chromeos::CrosSettings* cros_settings) { 191 chromeos::CrosSettings* cros_settings) {
182 std::vector<DeviceLocalAccount> accounts; 192 std::vector<DeviceLocalAccount> accounts;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 253
244 accounts.push_back( 254 accounts.push_back(
245 DeviceLocalAccount(DeviceLocalAccount::TYPE_KIOSK_APP, account_id, 255 DeviceLocalAccount(DeviceLocalAccount::TYPE_KIOSK_APP, account_id,
246 kiosk_app_id, kiosk_app_update_url)); 256 kiosk_app_id, kiosk_app_update_url));
247 break; 257 break;
248 } 258 }
249 case DeviceLocalAccount::TYPE_ARC_KIOSK_APP: { 259 case DeviceLocalAccount::TYPE_ARC_KIOSK_APP: {
250 std::string package_name; 260 std::string package_name;
251 std::string class_name; 261 std::string class_name;
252 std::string action; 262 std::string action;
263 std::string display_name;
253 if (!entry->GetStringWithoutPathExpansion( 264 if (!entry->GetStringWithoutPathExpansion(
254 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskPackage, 265 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskPackage,
255 &package_name)) { 266 &package_name)) {
256 LOG(ERROR) << "Missing package name in ARC kiosk type device-local " 267 LOG(ERROR) << "Missing package name in ARC kiosk type device-local "
257 "account at index " 268 "account at index "
258 << i << "."; 269 << i << ".";
259 continue; 270 continue;
260 } 271 }
261 entry->GetStringWithoutPathExpansion( 272 entry->GetStringWithoutPathExpansion(
262 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskClass, 273 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskClass,
263 &class_name); 274 &class_name);
264 entry->GetStringWithoutPathExpansion( 275 entry->GetStringWithoutPathExpansion(
265 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskAction, 276 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskAction,
266 &action); 277 &action);
278 entry->GetStringWithoutPathExpansion(
279 chromeos::kAccountsPrefDeviceLocalAccountsKeyArcKioskDisplayName,
280 &display_name);
267 const ArcKioskAppBasicInfo arc_kiosk_app(package_name, class_name, 281 const ArcKioskAppBasicInfo arc_kiosk_app(package_name, class_name,
268 action); 282 action, display_name);
269 283
270 accounts.push_back(DeviceLocalAccount(arc_kiosk_app, account_id)); 284 accounts.push_back(DeviceLocalAccount(arc_kiosk_app, account_id));
271 break; 285 break;
272 } 286 }
273 case DeviceLocalAccount::TYPE_COUNT: 287 case DeviceLocalAccount::TYPE_COUNT:
274 NOTREACHED(); 288 NOTREACHED();
275 } 289 }
276 } 290 }
277 return accounts; 291 return accounts;
278 } 292 }
279 293
280 } // namespace policy 294 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698