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

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

Issue 270183002: Move IsStringUTF8/ASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more minor nit Created 6 years, 7 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"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 base::FilePath basename = path.BaseName(); 47 base::FilePath basename = path.BaseName();
48 // Clean up temporary files left if Chrome crashed or quit in the middle 48 // Clean up temporary files left if Chrome crashed or quit in the middle
49 // of an extension install. 49 // of an extension install.
50 if (basename.value() == file_util::kTempDirectoryName) { 50 if (basename.value() == file_util::kTempDirectoryName) {
51 base::DeleteFile(path, true); // Recursive. 51 base::DeleteFile(path, true); // Recursive.
52 return; 52 return;
53 } 53 }
54 54
55 // Parse directory name as a potential extension ID. 55 // Parse directory name as a potential extension ID.
56 std::string extension_id; 56 std::string extension_id;
57 if (IsStringASCII(basename.value())) { 57 if (base::IsStringASCII(basename.value())) {
58 extension_id = base::UTF16ToASCII(basename.LossyDisplayName()); 58 extension_id = base::UTF16ToASCII(basename.LossyDisplayName());
59 if (!Extension::IdIsValid(extension_id)) 59 if (!Extension::IdIsValid(extension_id))
60 extension_id.clear(); 60 extension_id.clear();
61 } 61 }
62 62
63 // Delete directories that aren't valid IDs. 63 // Delete directories that aren't valid IDs.
64 if (extension_id.empty()) { 64 if (extension_id.empty()) {
65 base::DeleteFile(path, true); // Recursive. 65 base::DeleteFile(path, true); // Recursive.
66 return; 66 return;
67 } 67 }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // accounting. 271 // accounting.
272 NOTREACHED(); 272 NOTREACHED();
273 273
274 // Don't let the count go negative to avoid garbage collecting when 274 // Don't let the count go negative to avoid garbage collecting when
275 // an install is actually in progress. 275 // an install is actually in progress.
276 crx_installs_in_progress_ = 0; 276 crx_installs_in_progress_ = 0;
277 } 277 }
278 } 278 }
279 279
280 } // namespace extensions 280 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/convert_user_script.cc ('k') | chrome/browser/extensions/url_request_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698