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

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

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | Annotate | Revision Log
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"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/prefs/pref_registry_simple.h" 13 #include "base/prefs/pref_registry_simple.h"
14 #include "base/prefs/pref_service.h" 14 #include "base/prefs/pref_service.h"
15 #include "base/prefs/scoped_user_pref_update.h" 15 #include "base/prefs/scoped_user_pref_update.h"
16 #include "base/sequenced_task_runner.h" 16 #include "base/sequenced_task_runner.h"
17 #include "base/sys_info.h" 17 #include "base/sys_info.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/chromeos/login/users/user_manager.h"
20 #include "chrome/browser/chromeos/profiles/profile_helper.h" 19 #include "chrome/browser/chromeos/profiles/profile_helper.h"
21 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
22 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/common/extensions/extension_constants.h" 22 #include "chrome/common/extensions/extension_constants.h"
24 #include "chrome/common/extensions/manifest_url_handler.h" 23 #include "chrome/common/extensions/manifest_url_handler.h"
25 #include "chromeos/chromeos_switches.h" 24 #include "chromeos/chromeos_switches.h"
25 #include "components/user_manager/user_manager.h"
26 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 #include "extensions/browser/extension_prefs.h" 27 #include "extensions/browser/extension_prefs.h"
28 #include "extensions/browser/extension_system.h" 28 #include "extensions/browser/extension_system.h"
29 #include "extensions/common/extension.h" 29 #include "extensions/common/extension.h"
30 #include "extensions/common/file_util.h" 30 #include "extensions/common/file_util.h"
31 #include "extensions/common/manifest.h" 31 #include "extensions/common/manifest.h"
32 32
33 using content::BrowserThread; 33 using content::BrowserThread;
34 34
35 namespace extensions { 35 namespace extensions {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 void ExtensionAssetsManagerChromeOS::CheckSharedExtension( 274 void ExtensionAssetsManagerChromeOS::CheckSharedExtension(
275 const std::string& id, 275 const std::string& id,
276 const std::string& version, 276 const std::string& version,
277 const base::FilePath& unpacked_extension_root, 277 const base::FilePath& unpacked_extension_root,
278 const base::FilePath& local_install_dir, 278 const base::FilePath& local_install_dir,
279 Profile* profile, 279 Profile* profile,
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->GetProfileName(); 283 const std::string& user_id = profile->GetProfileName();
284 chromeos::UserManager* user_manager = chromeos::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(user_id) ||
291 !user_manager->IsLoggedInAsRegularUser()) { 291 !user_manager->IsLoggedInAsRegularUser()) {
292 // Don't cache anything in shared location for ephemeral user or special 292 // Don't cache anything in shared location for ephemeral user or special
293 // user types. 293 // user types.
294 ExtensionAssetsManagerChromeOS::GetFileTaskRunner(profile)->PostTask( 294 ExtensionAssetsManagerChromeOS::GetFileTaskRunner(profile)->PostTask(
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 const base::FilePath& shared_version_dir) { 490 const base::FilePath& shared_version_dir) {
491 CHECK(GetSharedInstallDir().IsParent(shared_version_dir)); 491 CHECK(GetSharedInstallDir().IsParent(shared_version_dir));
492 base::DeleteFile(shared_version_dir, true); // recursive. 492 base::DeleteFile(shared_version_dir, true); // recursive.
493 } 493 }
494 494
495 // static 495 // static
496 bool ExtensionAssetsManagerChromeOS::CleanUpExtension( 496 bool ExtensionAssetsManagerChromeOS::CleanUpExtension(
497 const std::string& id, 497 const std::string& id,
498 base::DictionaryValue* extension_info, 498 base::DictionaryValue* extension_info,
499 std::multimap<std::string, base::FilePath>* live_extension_paths) { 499 std::multimap<std::string, base::FilePath>* live_extension_paths) {
500 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); 500 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
501 if (!user_manager) { 501 if (!user_manager) {
502 NOTREACHED(); 502 NOTREACHED();
503 return false; 503 return false;
504 } 504 }
505 505
506 std::vector<std::string> versions; 506 std::vector<std::string> versions;
507 versions.reserve(extension_info->size()); 507 versions.reserve(extension_info->size());
508 for (base::DictionaryValue::Iterator it(*extension_info); 508 for (base::DictionaryValue::Iterator it(*extension_info);
509 !it.IsAtEnd(); it.Advance()) { 509 !it.IsAtEnd(); it.Advance()) {
510 versions.push_back(it.key()); 510 versions.push_back(it.key());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 std::make_pair(id, base::FilePath(shared_path))); 566 std::make_pair(id, base::FilePath(shared_path)));
567 } else { 567 } else {
568 extension_info->RemoveWithoutPathExpansion(*it, NULL); 568 extension_info->RemoveWithoutPathExpansion(*it, NULL);
569 } 569 }
570 } 570 }
571 571
572 return true; 572 return true;
573 } 573 }
574 574
575 } // namespace extensions 575 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698