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 #ifndef CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 bool RunSync() override; | 289 bool RunSync() override; |
290 | 290 |
291 // Overridden from ExtensionInstallPrompt::Delegate | 291 // Overridden from ExtensionInstallPrompt::Delegate |
292 void InstallUIProceed() override; | 292 void InstallUIProceed() override; |
293 void InstallUIAbort(bool user_initiated) override; | 293 void InstallUIAbort(bool user_initiated) override; |
294 | 294 |
295 scoped_ptr<ExtensionInstallPrompt> prompt_; | 295 scoped_ptr<ExtensionInstallPrompt> prompt_; |
296 std::string extension_id_; | 296 std::string extension_id_; |
297 }; | 297 }; |
298 | 298 |
299 class DeveloperPrivateChooseEntryFunction : public ChromeAsyncExtensionFunction, | 299 class DeveloperPrivateChooseEntryFunction : public UIThreadExtensionFunction, |
300 public EntryPickerClient { | 300 public EntryPickerClient { |
301 protected: | 301 protected: |
302 ~DeveloperPrivateChooseEntryFunction() override; | 302 ~DeveloperPrivateChooseEntryFunction() override; |
303 bool RunAsync() override; | |
304 bool ShowPicker(ui::SelectFileDialog::Type picker_type, | 303 bool ShowPicker(ui::SelectFileDialog::Type picker_type, |
305 const base::FilePath& last_directory, | |
306 const base::string16& select_title, | 304 const base::string16& select_title, |
307 const ui::SelectFileDialog::FileTypeInfo& info, | 305 const ui::SelectFileDialog::FileTypeInfo& info, |
308 int file_type_index); | 306 int file_type_index); |
309 | |
310 // EntryPickerClient functions. | |
311 void FileSelected(const base::FilePath& path) override = 0; | |
312 void FileSelectionCanceled() override = 0; | |
313 }; | 307 }; |
314 | 308 |
315 | 309 |
316 class DeveloperPrivateLoadUnpackedFunction | 310 class DeveloperPrivateLoadUnpackedFunction |
317 : public DeveloperPrivateChooseEntryFunction { | 311 : public DeveloperPrivateChooseEntryFunction { |
318 public: | 312 public: |
319 DECLARE_EXTENSION_FUNCTION("developerPrivate.loadUnpacked", | 313 DECLARE_EXTENSION_FUNCTION("developerPrivate.loadUnpacked", |
320 DEVELOPERPRIVATE_LOADUNPACKED); | 314 DEVELOPERPRIVATE_LOADUNPACKED); |
321 | 315 |
322 protected: | 316 protected: |
323 ~DeveloperPrivateLoadUnpackedFunction() override; | 317 ~DeveloperPrivateLoadUnpackedFunction() override; |
324 bool RunAsync() override; | 318 ResponseAction Run() override; |
325 | 319 |
326 // EntryPickerCLient implementation. | 320 // EntryPickerClient: |
327 void FileSelected(const base::FilePath& path) override; | 321 void FileSelected(const base::FilePath& path) override; |
328 void FileSelectionCanceled() override; | 322 void FileSelectionCanceled() override; |
329 }; | 323 }; |
330 | 324 |
331 class DeveloperPrivateChoosePathFunction | 325 class DeveloperPrivateChoosePathFunction |
332 : public DeveloperPrivateChooseEntryFunction { | 326 : public DeveloperPrivateChooseEntryFunction { |
333 public: | 327 public: |
334 DECLARE_EXTENSION_FUNCTION("developerPrivate.choosePath", | 328 DECLARE_EXTENSION_FUNCTION("developerPrivate.choosePath", |
335 DEVELOPERPRIVATE_CHOOSEPATH); | 329 DEVELOPERPRIVATE_CHOOSEPATH); |
336 | 330 |
337 protected: | 331 protected: |
338 ~DeveloperPrivateChoosePathFunction() override; | 332 ~DeveloperPrivateChoosePathFunction() override; |
339 bool RunAsync() override; | 333 ResponseAction Run() override; |
340 | 334 |
341 // EntryPickerClient functions. | 335 // EntryPickerClient: |
342 void FileSelected(const base::FilePath& path) override; | 336 void FileSelected(const base::FilePath& path) override; |
343 void FileSelectionCanceled() override; | 337 void FileSelectionCanceled() override; |
344 }; | 338 }; |
345 | 339 |
346 class DeveloperPrivatePackDirectoryFunction | 340 class DeveloperPrivatePackDirectoryFunction |
347 : public ChromeAsyncExtensionFunction, | 341 : public DeveloperPrivateAPIFunction, |
348 public PackExtensionJob::Client { | 342 public PackExtensionJob::Client { |
349 | 343 |
350 public: | 344 public: |
351 DECLARE_EXTENSION_FUNCTION("developerPrivate.packDirectory", | 345 DECLARE_EXTENSION_FUNCTION("developerPrivate.packDirectory", |
352 DEVELOPERPRIVATE_PACKDIRECTORY); | 346 DEVELOPERPRIVATE_PACKDIRECTORY); |
353 | 347 |
354 DeveloperPrivatePackDirectoryFunction(); | 348 DeveloperPrivatePackDirectoryFunction(); |
355 | 349 |
356 // ExtensionPackJob::Client implementation. | 350 // ExtensionPackJob::Client implementation. |
357 void OnPackSuccess(const base::FilePath& crx_file, | 351 void OnPackSuccess(const base::FilePath& crx_file, |
358 const base::FilePath& key_file) override; | 352 const base::FilePath& key_file) override; |
359 void OnPackFailure(const std::string& error, | 353 void OnPackFailure(const std::string& error, |
360 ExtensionCreator::ErrorType error_type) override; | 354 ExtensionCreator::ErrorType error_type) override; |
361 | 355 |
362 protected: | 356 protected: |
363 ~DeveloperPrivatePackDirectoryFunction() override; | 357 ~DeveloperPrivatePackDirectoryFunction() override; |
364 bool RunAsync() override; | 358 ResponseAction Run() override; |
365 | 359 |
366 private: | 360 private: |
367 scoped_refptr<PackExtensionJob> pack_job_; | 361 scoped_refptr<PackExtensionJob> pack_job_; |
368 std::string item_path_str_; | 362 std::string item_path_str_; |
369 std::string key_path_str_; | 363 std::string key_path_str_; |
370 }; | 364 }; |
371 | 365 |
372 class DeveloperPrivateIsProfileManagedFunction | 366 class DeveloperPrivateIsProfileManagedFunction |
373 : public ChromeSyncExtensionFunction { | 367 : public ChromeSyncExtensionFunction { |
374 public: | 368 public: |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 463 |
470 // ExtensionFunction: | 464 // ExtensionFunction: |
471 bool RunAsync() override; | 465 bool RunAsync() override; |
472 }; | 466 }; |
473 | 467 |
474 } // namespace api | 468 } // namespace api |
475 | 469 |
476 } // namespace extensions | 470 } // namespace extensions |
477 | 471 |
478 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API
_H_ | 472 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API
_H_ |
OLD | NEW |