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

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

Issue 481433005: Extensions: Move id_util functions to crx_file component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert last patchset. function returns Extension* and can't use an assert. 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 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/extensions/extension_garbage_collector.h" 5 #include "chrome/browser/extensions/extension_garbage_collector.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_enumerator.h" 9 #include "base/files/file_enumerator.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/sequenced_task_runner.h" 13 #include "base/sequenced_task_runner.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "chrome/browser/extensions/extension_garbage_collector_factory.h" 17 #include "chrome/browser/extensions/extension_garbage_collector_factory.h"
18 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/extensions/extension_util.h" 19 #include "chrome/browser/extensions/extension_util.h"
20 #include "chrome/browser/extensions/install_tracker.h" 20 #include "chrome/browser/extensions/install_tracker.h"
21 #include "chrome/browser/extensions/pending_extension_manager.h" 21 #include "chrome/browser/extensions/pending_extension_manager.h"
22 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" 22 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h"
23 #include "components/crx_file/id_util.h"
23 #include "content/public/browser/browser_context.h" 24 #include "content/public/browser/browser_context.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/storage_partition.h" 26 #include "content/public/browser/storage_partition.h"
26 #include "extensions/browser/extension_prefs.h" 27 #include "extensions/browser/extension_prefs.h"
27 #include "extensions/browser/extension_registry.h" 28 #include "extensions/browser/extension_registry.h"
28 #include "extensions/browser/extension_system.h" 29 #include "extensions/browser/extension_system.h"
29 #include "extensions/common/extension.h" 30 #include "extensions/common/extension.h"
30 #include "extensions/common/file_util.h" 31 #include "extensions/common/file_util.h"
31 #include "extensions/common/one_shot_event.h" 32 #include "extensions/common/one_shot_event.h"
32 33
(...skipping 17 matching lines...) Expand all
50 // of an extension install. 51 // of an extension install.
51 if (basename.value() == file_util::kTempDirectoryName) { 52 if (basename.value() == file_util::kTempDirectoryName) {
52 base::DeleteFile(path, true); // Recursive. 53 base::DeleteFile(path, true); // Recursive.
53 return; 54 return;
54 } 55 }
55 56
56 // Parse directory name as a potential extension ID. 57 // Parse directory name as a potential extension ID.
57 std::string extension_id; 58 std::string extension_id;
58 if (base::IsStringASCII(basename.value())) { 59 if (base::IsStringASCII(basename.value())) {
59 extension_id = base::UTF16ToASCII(basename.LossyDisplayName()); 60 extension_id = base::UTF16ToASCII(basename.LossyDisplayName());
60 if (!Extension::IdIsValid(extension_id)) 61 if (!crx_file::id_util::IdIsValid(extension_id))
61 extension_id.clear(); 62 extension_id.clear();
62 } 63 }
63 64
64 // Delete directories that aren't valid IDs. 65 // Delete directories that aren't valid IDs.
65 if (extension_id.empty()) { 66 if (extension_id.empty()) {
66 base::DeleteFile(path, true); // Recursive. 67 base::DeleteFile(path, true); // Recursive.
67 return; 68 return;
68 } 69 }
69 70
70 typedef ExtensionPathsMultimap::const_iterator Iter; 71 typedef ExtensionPathsMultimap::const_iterator Iter;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // accounting. 252 // accounting.
252 NOTREACHED(); 253 NOTREACHED();
253 254
254 // Don't let the count go negative to avoid garbage collecting when 255 // Don't let the count go negative to avoid garbage collecting when
255 // an install is actually in progress. 256 // an install is actually in progress.
256 crx_installs_in_progress_ = 0; 257 crx_installs_in_progress_ = 0;
257 } 258 }
258 } 259 }
259 260
260 } // namespace extensions 261 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698