| 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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 project_base_path_)); | 972 project_base_path_)); |
| 973 return true; | 973 return true; |
| 974 } | 974 } |
| 975 | 975 |
| 976 void DeveloperPrivateLoadDirectoryFunction::Load() { | 976 void DeveloperPrivateLoadDirectoryFunction::Load() { |
| 977 ExtensionService* service = GetExtensionService(GetProfile()); | 977 ExtensionService* service = GetExtensionService(GetProfile()); |
| 978 UnpackedInstaller::Create(service)->Load(project_base_path_); | 978 UnpackedInstaller::Create(service)->Load(project_base_path_); |
| 979 | 979 |
| 980 // TODO(grv) : The unpacked installer should fire an event when complete | 980 // TODO(grv) : The unpacked installer should fire an event when complete |
| 981 // and return the extension_id. | 981 // and return the extension_id. |
| 982 SetResult(base::MakeUnique<base::StringValue>("-1")); | 982 SetResult(base::MakeUnique<base::Value>("-1")); |
| 983 SendResponse(true); | 983 SendResponse(true); |
| 984 } | 984 } |
| 985 | 985 |
| 986 void DeveloperPrivateLoadDirectoryFunction::ClearExistingDirectoryContent( | 986 void DeveloperPrivateLoadDirectoryFunction::ClearExistingDirectoryContent( |
| 987 const base::FilePath& project_path) { | 987 const base::FilePath& project_path) { |
| 988 | 988 |
| 989 // Clear the project directory before copying new files. | 989 // Clear the project directory before copying new files. |
| 990 base::DeleteFile(project_path, true /*recursive*/); | 990 base::DeleteFile(project_path, true /*recursive*/); |
| 991 | 991 |
| 992 pending_copy_operations_count_ = 1; | 992 pending_copy_operations_count_ = 1; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 file_type_index)) { | 1146 file_type_index)) { |
| 1147 return RespondNow(Error(kCouldNotShowSelectFileDialogError)); | 1147 return RespondNow(Error(kCouldNotShowSelectFileDialogError)); |
| 1148 } | 1148 } |
| 1149 | 1149 |
| 1150 AddRef(); // Balanced by FileSelected / FileSelectionCanceled. | 1150 AddRef(); // Balanced by FileSelected / FileSelectionCanceled. |
| 1151 return RespondLater(); | 1151 return RespondLater(); |
| 1152 } | 1152 } |
| 1153 | 1153 |
| 1154 void DeveloperPrivateChoosePathFunction::FileSelected( | 1154 void DeveloperPrivateChoosePathFunction::FileSelected( |
| 1155 const base::FilePath& path) { | 1155 const base::FilePath& path) { |
| 1156 Respond(OneArgument( | 1156 Respond(OneArgument(base::MakeUnique<base::Value>(path.LossyDisplayName()))); |
| 1157 base::MakeUnique<base::StringValue>(path.LossyDisplayName()))); | |
| 1158 Release(); | 1157 Release(); |
| 1159 } | 1158 } |
| 1160 | 1159 |
| 1161 void DeveloperPrivateChoosePathFunction::FileSelectionCanceled() { | 1160 void DeveloperPrivateChoosePathFunction::FileSelectionCanceled() { |
| 1162 // This isn't really an error, but we should keep it like this for | 1161 // This isn't really an error, but we should keep it like this for |
| 1163 // backward compatability. | 1162 // backward compatability. |
| 1164 Respond(Error(kFileSelectionCanceled)); | 1163 Respond(Error(kFileSelectionCanceled)); |
| 1165 Release(); | 1164 Release(); |
| 1166 } | 1165 } |
| 1167 | 1166 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 update.extension_id, update.command_name, *update.keybinding); | 1456 update.extension_id, update.command_name, *update.keybinding); |
| 1458 } | 1457 } |
| 1459 | 1458 |
| 1460 return RespondNow(NoArguments()); | 1459 return RespondNow(NoArguments()); |
| 1461 } | 1460 } |
| 1462 | 1461 |
| 1463 | 1462 |
| 1464 } // namespace api | 1463 } // namespace api |
| 1465 | 1464 |
| 1466 } // namespace extensions | 1465 } // namespace extensions |
| OLD | NEW |