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

Side by Side Diff: chrome/browser/extensions/extension_assets_manager_chromeos.cc

Issue 1412813003: This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Fix Win GN build. Created 5 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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/extensions/extension_assets_manager_chromeos.h" 5 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 InstallExtensionCallback callback) { 280 InstallExtensionCallback callback) {
281 DCHECK_CURRENTLY_ON(BrowserThread::UI); 281 DCHECK_CURRENTLY_ON(BrowserThread::UI);
282 282
283 const std::string& user_id = profile->GetProfileUserName(); 283 const std::string& user_id = profile->GetProfileUserName();
284 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 284 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
285 if (!user_manager) { 285 if (!user_manager) {
286 NOTREACHED(); 286 NOTREACHED();
287 return; 287 return;
288 } 288 }
289 289
290 if (user_manager->IsUserNonCryptohomeDataEphemeral(user_id) || 290 if (user_manager->IsUserNonCryptohomeDataEphemeral(
291 AccountId::FromUserEmail(user_id)) ||
291 !user_manager->IsLoggedInAsUserWithGaiaAccount()) { 292 !user_manager->IsLoggedInAsUserWithGaiaAccount()) {
292 // Don't cache anything in shared location for ephemeral user or special 293 // Don't cache anything in shared location for ephemeral user or special
293 // user types. 294 // user types.
294 ExtensionAssetsManagerChromeOS::GetFileTaskRunner(profile)->PostTask( 295 ExtensionAssetsManagerChromeOS::GetFileTaskRunner(profile)->PostTask(
295 FROM_HERE, 296 FROM_HERE,
296 base::Bind(&ExtensionAssetsManagerChromeOS::InstallLocalExtension, 297 base::Bind(&ExtensionAssetsManagerChromeOS::InstallLocalExtension,
297 id, 298 id,
298 version, 299 version,
299 unpacked_extension_root, 300 unpacked_extension_root,
300 local_install_dir, 301 local_install_dir,
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 return false; 524 return false;
524 } 525 }
525 526
526 size_t num_users = users->GetSize(); 527 size_t num_users = users->GetSize();
527 for (size_t i = 0; i < num_users; i++) { 528 for (size_t i = 0; i < num_users; i++) {
528 std::string user_id; 529 std::string user_id;
529 if (!users->GetString(i, &user_id)) { 530 if (!users->GetString(i, &user_id)) {
530 NOTREACHED(); 531 NOTREACHED();
531 return false; 532 return false;
532 } 533 }
533 const user_manager::User* user = user_manager->FindUser(user_id); 534 const user_manager::User* user =
535 user_manager->FindUser(AccountId::FromUserEmail(user_id));
534 bool not_used = false; 536 bool not_used = false;
535 if (!user) { 537 if (!user) {
536 not_used = true; 538 not_used = true;
537 } else if (user->is_logged_in()) { 539 } else if (user->is_logged_in()) {
538 // For logged in user also check that this path is actually used as 540 // For logged in user also check that this path is actually used as
539 // installed extension or as delayed install. 541 // installed extension or as delayed install.
540 Profile* profile = 542 Profile* profile =
541 chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user); 543 chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user);
542 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile); 544 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile);
543 if (!extension_prefs || extension_prefs->pref_service()->ReadOnly()) 545 if (!extension_prefs || extension_prefs->pref_service()->ReadOnly())
(...skipping 22 matching lines...) Expand all
566 std::make_pair(id, base::FilePath(shared_path))); 568 std::make_pair(id, base::FilePath(shared_path)));
567 } else { 569 } else {
568 extension_info->RemoveWithoutPathExpansion(*it, NULL); 570 extension_info->RemoveWithoutPathExpansion(*it, NULL);
569 } 571 }
570 } 572 }
571 573
572 return true; 574 return true;
573 } 575 }
574 576
575 } // namespace extensions 577 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698