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

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

Issue 1773113002: Fixed a few places that incorrectly assumed that profile was initialized (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment Created 4 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "chrome/browser/chromeos/profiles/profile_helper.h" 7 #include "chrome/browser/chromeos/profiles/profile_helper.h"
8 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" 8 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h"
9 #include "chrome/browser/extensions/extension_garbage_collector_chromeos.h" 9 #include "chrome/browser/extensions/extension_garbage_collector_chromeos.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 bool ExtensionGarbageCollectorChromeOS::CanGarbageCollectSharedExtensions() { 53 bool ExtensionGarbageCollectorChromeOS::CanGarbageCollectSharedExtensions() {
54 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 54 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
55 if (!user_manager) { 55 if (!user_manager) {
56 NOTREACHED(); 56 NOTREACHED();
57 return false; 57 return false;
58 } 58 }
59 59
60 const user_manager::UserList& active_users = user_manager->GetLoggedInUsers(); 60 const user_manager::UserList& active_users = user_manager->GetLoggedInUsers();
61 for (size_t i = 0; i < active_users.size(); i++) { 61 for (size_t i = 0; i < active_users.size(); i++) {
62 // If the profile for one of the active users is still initializing, we
63 // can't garbage collect.
64 if (!active_users[i]->is_profile_created())
65 return false;
62 Profile* profile = 66 Profile* profile =
63 chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(active_users[i]); 67 chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(active_users[i]);
64 ExtensionGarbageCollectorChromeOS* gc = 68 ExtensionGarbageCollectorChromeOS* gc =
65 ExtensionGarbageCollectorChromeOS::Get(profile); 69 ExtensionGarbageCollectorChromeOS::Get(profile);
66 if (gc && gc->crx_installs_in_progress_ > 0) 70 if (gc && gc->crx_installs_in_progress_ > 0)
67 return false; 71 return false;
68 } 72 }
69 73
70 return true; 74 return true;
71 } 75 }
72 76
73 void ExtensionGarbageCollectorChromeOS::GarbageCollectSharedExtensions() { 77 void ExtensionGarbageCollectorChromeOS::GarbageCollectSharedExtensions() {
74 std::multimap<std::string, base::FilePath> paths; 78 std::multimap<std::string, base::FilePath> paths;
75 if (ExtensionAssetsManagerChromeOS::CleanUpSharedExtensions(&paths)) { 79 if (ExtensionAssetsManagerChromeOS::CleanUpSharedExtensions(&paths)) {
76 ExtensionService* service = 80 ExtensionService* service =
77 ExtensionSystem::Get(context_)->extension_service(); 81 ExtensionSystem::Get(context_)->extension_service();
78 if (!service->GetFileTaskRunner()->PostTask( 82 if (!service->GetFileTaskRunner()->PostTask(
79 FROM_HERE, 83 FROM_HERE,
80 base::Bind(&GarbageCollectExtensionsOnFileThread, 84 base::Bind(&GarbageCollectExtensionsOnFileThread,
81 ExtensionAssetsManagerChromeOS::GetSharedInstallDir(), 85 ExtensionAssetsManagerChromeOS::GetSharedInstallDir(),
82 paths))) { 86 paths))) {
83 NOTREACHED(); 87 NOTREACHED();
84 } 88 }
85 } 89 }
86 } 90 }
87 91
88 } // namespace extensions 92 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698