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" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/memory/ptr_util.h" |
13 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "chrome/browser/devtools/devtools_window.h" | 18 #include "chrome/browser/devtools/devtools_window.h" |
18 #include "chrome/browser/extensions/api/developer_private/developer_private_mang
le.h" | 19 #include "chrome/browser/extensions/api/developer_private/developer_private_mang
le.h" |
19 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" | 20 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" |
20 #include "chrome/browser/extensions/api/developer_private/extension_info_generat
or.h" | 21 #include "chrome/browser/extensions/api/developer_private/extension_info_generat
or.h" |
21 #include "chrome/browser/extensions/api/developer_private/show_permissions_dialo
g_helper.h" | 22 #include "chrome/browser/extensions/api/developer_private/show_permissions_dialo
g_helper.h" |
22 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 23 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 project_base_path_)); | 961 project_base_path_)); |
961 return true; | 962 return true; |
962 } | 963 } |
963 | 964 |
964 void DeveloperPrivateLoadDirectoryFunction::Load() { | 965 void DeveloperPrivateLoadDirectoryFunction::Load() { |
965 ExtensionService* service = GetExtensionService(GetProfile()); | 966 ExtensionService* service = GetExtensionService(GetProfile()); |
966 UnpackedInstaller::Create(service)->Load(project_base_path_); | 967 UnpackedInstaller::Create(service)->Load(project_base_path_); |
967 | 968 |
968 // TODO(grv) : The unpacked installer should fire an event when complete | 969 // TODO(grv) : The unpacked installer should fire an event when complete |
969 // and return the extension_id. | 970 // and return the extension_id. |
970 SetResult(new base::StringValue("-1")); | 971 SetResult(base::MakeUnique<base::StringValue>("-1")); |
971 SendResponse(true); | 972 SendResponse(true); |
972 } | 973 } |
973 | 974 |
974 void DeveloperPrivateLoadDirectoryFunction::ClearExistingDirectoryContent( | 975 void DeveloperPrivateLoadDirectoryFunction::ClearExistingDirectoryContent( |
975 const base::FilePath& project_path) { | 976 const base::FilePath& project_path) { |
976 | 977 |
977 // Clear the project directory before copying new files. | 978 // Clear the project directory before copying new files. |
978 base::DeleteFile(project_path, true /*recursive*/); | 979 base::DeleteFile(project_path, true /*recursive*/); |
979 | 980 |
980 pending_copy_operations_count_ = 1; | 981 pending_copy_operations_count_ = 1; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 void DeveloperPrivateChoosePathFunction::FileSelectionCanceled() { | 1149 void DeveloperPrivateChoosePathFunction::FileSelectionCanceled() { |
1149 // This isn't really an error, but we should keep it like this for | 1150 // This isn't really an error, but we should keep it like this for |
1150 // backward compatability. | 1151 // backward compatability. |
1151 Respond(Error(kFileSelectionCanceled)); | 1152 Respond(Error(kFileSelectionCanceled)); |
1152 Release(); | 1153 Release(); |
1153 } | 1154 } |
1154 | 1155 |
1155 DeveloperPrivateChoosePathFunction::~DeveloperPrivateChoosePathFunction() {} | 1156 DeveloperPrivateChoosePathFunction::~DeveloperPrivateChoosePathFunction() {} |
1156 | 1157 |
1157 bool DeveloperPrivateIsProfileManagedFunction::RunSync() { | 1158 bool DeveloperPrivateIsProfileManagedFunction::RunSync() { |
1158 SetResult(new base::FundamentalValue(GetProfile()->IsSupervised())); | 1159 SetResult( |
| 1160 base::MakeUnique<base::FundamentalValue>(GetProfile()->IsSupervised())); |
1159 return true; | 1161 return true; |
1160 } | 1162 } |
1161 | 1163 |
1162 DeveloperPrivateIsProfileManagedFunction:: | 1164 DeveloperPrivateIsProfileManagedFunction:: |
1163 ~DeveloperPrivateIsProfileManagedFunction() { | 1165 ~DeveloperPrivateIsProfileManagedFunction() { |
1164 } | 1166 } |
1165 | 1167 |
1166 DeveloperPrivateRequestFileSourceFunction:: | 1168 DeveloperPrivateRequestFileSourceFunction:: |
1167 DeveloperPrivateRequestFileSourceFunction() {} | 1169 DeveloperPrivateRequestFileSourceFunction() {} |
1168 | 1170 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 update.extension_id, update.command_name, *update.keybinding); | 1445 update.extension_id, update.command_name, *update.keybinding); |
1444 } | 1446 } |
1445 | 1447 |
1446 return RespondNow(NoArguments()); | 1448 return RespondNow(NoArguments()); |
1447 } | 1449 } |
1448 | 1450 |
1449 | 1451 |
1450 } // namespace api | 1452 } // namespace api |
1451 | 1453 |
1452 } // namespace extensions | 1454 } // namespace extensions |
OLD | NEW |