OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/thread.h" | 10 #include "base/thread.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 const FilePath& path, | 73 const FilePath& path, |
74 scoped_refptr<ExtensionsServiceFrontendInterface> frontend) { | 74 scoped_refptr<ExtensionsServiceFrontendInterface> frontend) { |
75 // Find all child directories in the install directory and load their | 75 // Find all child directories in the install directory and load their |
76 // manifests. Post errors and results to the frontend. | 76 // manifests. Post errors and results to the frontend. |
77 scoped_ptr<ExtensionList> extensions(new ExtensionList); | 77 scoped_ptr<ExtensionList> extensions(new ExtensionList); |
78 file_util::FileEnumerator enumerator(path, | 78 file_util::FileEnumerator enumerator(path, |
79 false, // not recursive | 79 false, // not recursive |
80 file_util::FileEnumerator::DIRECTORIES); | 80 file_util::FileEnumerator::DIRECTORIES); |
81 for (FilePath child_path = enumerator.Next(); !child_path.value().empty(); | 81 for (FilePath child_path = enumerator.Next(); !child_path.value().empty(); |
82 child_path = enumerator.Next()) { | 82 child_path = enumerator.Next()) { |
83 FilePath manifest_path = child_path.Append(Extension::kManifestFilename); | 83 FilePath manifest_path = |
| 84 child_path.AppendASCII(Extension::kManifestFilename); |
84 if (!file_util::PathExists(manifest_path)) { | 85 if (!file_util::PathExists(manifest_path)) { |
85 ReportExtensionLoadError(frontend.get(), child_path.ToWStringHack(), | 86 ReportExtensionLoadError(frontend.get(), child_path.ToWStringHack(), |
86 Extension::kInvalidManifestError); | 87 Extension::kInvalidManifestError); |
87 continue; | 88 continue; |
88 } | 89 } |
89 | 90 |
90 JSONFileValueSerializer serializer(manifest_path.ToWStringHack()); | 91 JSONFileValueSerializer serializer(manifest_path.ToWStringHack()); |
91 std::string error; | 92 std::string error; |
92 scoped_ptr<Value> root(serializer.Deserialize(&error)); | 93 scoped_ptr<Value> root(serializer.Deserialize(&error)); |
93 if (!root.get()) { | 94 if (!root.get()) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 message)); | 128 message)); |
128 } | 129 } |
129 | 130 |
130 void ExtensionsServiceBackend::ReportExtensionsLoaded( | 131 void ExtensionsServiceBackend::ReportExtensionsLoaded( |
131 ExtensionsServiceFrontendInterface *frontend, ExtensionList* extensions) { | 132 ExtensionsServiceFrontendInterface *frontend, ExtensionList* extensions) { |
132 frontend->GetMessageLoop()->PostTask(FROM_HERE, NewRunnableMethod( | 133 frontend->GetMessageLoop()->PostTask(FROM_HERE, NewRunnableMethod( |
133 frontend, | 134 frontend, |
134 &ExtensionsServiceFrontendInterface::OnExtensionsLoadedFromDirectory, | 135 &ExtensionsServiceFrontendInterface::OnExtensionsLoadedFromDirectory, |
135 extensions)); | 136 extensions)); |
136 } | 137 } |
OLD | NEW |