OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/developer_private/developer_private_api.
h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 // the extension's directory. If it tries to, abort. | 1303 // the extension's directory. If it tries to, abort. |
1304 base::FilePath path_suffix = | 1304 base::FilePath path_suffix = |
1305 base::FilePath::FromUTF8Unsafe(properties.path_suffix); | 1305 base::FilePath::FromUTF8Unsafe(properties.path_suffix); |
1306 if (path_suffix.empty() || path_suffix.ReferencesParent()) | 1306 if (path_suffix.empty() || path_suffix.ReferencesParent()) |
1307 return RespondNow(Error(kInvalidPathError)); | 1307 return RespondNow(Error(kInvalidPathError)); |
1308 | 1308 |
1309 if (properties.path_suffix == kManifestFile && !properties.manifest_key) | 1309 if (properties.path_suffix == kManifestFile && !properties.manifest_key) |
1310 return RespondNow(Error(kManifestKeyIsRequiredError)); | 1310 return RespondNow(Error(kManifestKeyIsRequiredError)); |
1311 | 1311 |
1312 base::PostTaskWithTraitsAndReplyWithResult( | 1312 base::PostTaskWithTraitsAndReplyWithResult( |
1313 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 1313 FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, |
1314 base::TaskPriority::USER_VISIBLE), | |
1315 base::Bind(&ReadFileToString, extension->path().Append(path_suffix)), | 1314 base::Bind(&ReadFileToString, extension->path().Append(path_suffix)), |
1316 base::Bind(&DeveloperPrivateRequestFileSourceFunction::Finish, this)); | 1315 base::Bind(&DeveloperPrivateRequestFileSourceFunction::Finish, this)); |
1317 | 1316 |
1318 return RespondLater(); | 1317 return RespondLater(); |
1319 } | 1318 } |
1320 | 1319 |
1321 void DeveloperPrivateRequestFileSourceFunction::Finish( | 1320 void DeveloperPrivateRequestFileSourceFunction::Finish( |
1322 const std::string& file_contents) { | 1321 const std::string& file_contents) { |
1323 const developer::RequestFileSourceProperties& properties = | 1322 const developer::RequestFileSourceProperties& properties = |
1324 params_->properties; | 1323 params_->properties; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 update.extension_id, update.command_name, *update.keybinding); | 1576 update.extension_id, update.command_name, *update.keybinding); |
1578 } | 1577 } |
1579 | 1578 |
1580 return RespondNow(NoArguments()); | 1579 return RespondNow(NoArguments()); |
1581 } | 1580 } |
1582 | 1581 |
1583 | 1582 |
1584 } // namespace api | 1583 } // namespace api |
1585 | 1584 |
1586 } // namespace extensions | 1585 } // namespace extensions |
OLD | NEW |