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

Side by Side Diff: chrome/browser/extensions/api/storage/storage_schema_manifest_handler.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/api/storage/storage_schema_manifest_handler. h" 5 #include "chrome/browser/extensions/api/storage/storage_schema_manifest_handler. h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 std::string path; 40 std::string path;
41 extension->manifest()->GetString(kStorageManagedSchema, &path); 41 extension->manifest()->GetString(kStorageManagedSchema, &path);
42 base::FilePath file = base::FilePath::FromUTF8Unsafe(path); 42 base::FilePath file = base::FilePath::FromUTF8Unsafe(path);
43 if (file.IsAbsolute() || file.ReferencesParent()) { 43 if (file.IsAbsolute() || file.ReferencesParent()) {
44 *error = base::StringPrintf("%s must be a relative path without ..", 44 *error = base::StringPrintf("%s must be a relative path without ..",
45 kStorageManagedSchema); 45 kStorageManagedSchema);
46 return scoped_ptr<policy::PolicySchema>(); 46 return scoped_ptr<policy::PolicySchema>();
47 } 47 }
48 file = extension->path().AppendASCII(path); 48 file = extension->path().AppendASCII(path);
49 if (!file_util::PathExists(file)) { 49 if (!base::PathExists(file)) {
50 *error = 50 *error =
51 base::StringPrintf("File does not exist: %s", file.value().c_str()); 51 base::StringPrintf("File does not exist: %s", file.value().c_str());
52 return scoped_ptr<policy::PolicySchema>(); 52 return scoped_ptr<policy::PolicySchema>();
53 } 53 }
54 std::string content; 54 std::string content;
55 if (!file_util::ReadFileToString(file, &content)) { 55 if (!file_util::ReadFileToString(file, &content)) {
56 *error = base::StringPrintf("Can't read %s", file.value().c_str()); 56 *error = base::StringPrintf("Can't read %s", file.value().c_str());
57 return scoped_ptr<policy::PolicySchema>(); 57 return scoped_ptr<policy::PolicySchema>();
58 } 58 }
59 return policy::PolicySchema::Parse(content, error); 59 return policy::PolicySchema::Parse(content, error);
(...skipping 15 matching lines...) Expand all
75 std::string* error, 75 std::string* error,
76 std::vector<InstallWarning>* warnings) const { 76 std::vector<InstallWarning>* warnings) const {
77 return !!GetSchema(extension, error); 77 return !!GetSchema(extension, error);
78 } 78 }
79 79
80 const std::vector<std::string> StorageSchemaManifestHandler::Keys() const { 80 const std::vector<std::string> StorageSchemaManifestHandler::Keys() const {
81 return SingleKey(kStorageManagedSchema); 81 return SingleKey(kStorageManagedSchema);
82 } 82 }
83 83
84 } // namespace extensions 84 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698