Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Side by Side Diff: chrome/browser/extensions/api/developer_private/developer_private_api.h

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 class DeveloperPrivateGetItemsInfoFunction 155 class DeveloperPrivateGetItemsInfoFunction
156 : public ChromeAsyncExtensionFunction { 156 : public ChromeAsyncExtensionFunction {
157 public: 157 public:
158 DECLARE_EXTENSION_FUNCTION("developerPrivate.getItemsInfo", 158 DECLARE_EXTENSION_FUNCTION("developerPrivate.getItemsInfo",
159 DEVELOPERPRIVATE_GETITEMSINFO) 159 DEVELOPERPRIVATE_GETITEMSINFO)
160 160
161 protected: 161 protected:
162 virtual ~DeveloperPrivateGetItemsInfoFunction(); 162 virtual ~DeveloperPrivateGetItemsInfoFunction();
163 163
164 // ExtensionFunction: 164 // ExtensionFunction:
165 virtual bool RunImpl() OVERRIDE; 165 virtual bool RunAsync() OVERRIDE;
166 166
167 private: 167 private:
168 scoped_ptr<developer::ItemInfo> CreateItemInfo(const Extension& item, 168 scoped_ptr<developer::ItemInfo> CreateItemInfo(const Extension& item,
169 bool item_is_enabled); 169 bool item_is_enabled);
170 170
171 void GetIconsOnFileThread( 171 void GetIconsOnFileThread(
172 ItemInfoList item_list, 172 ItemInfoList item_list,
173 std::map<std::string, ExtensionResource> itemIdToIconResourceMap); 173 std::map<std::string, ExtensionResource> itemIdToIconResourceMap);
174 174
175 // Helper that lists the current inspectable html pages for the extension. 175 // Helper that lists the current inspectable html pages for the extension.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 virtual bool RunSync() OVERRIDE; 284 virtual bool RunSync() OVERRIDE;
285 285
286 private: 286 private:
287 scoped_ptr<RequirementsChecker> requirements_checker_; 287 scoped_ptr<RequirementsChecker> requirements_checker_;
288 }; 288 };
289 289
290 class DeveloperPrivateChooseEntryFunction : public ChromeAsyncExtensionFunction, 290 class DeveloperPrivateChooseEntryFunction : public ChromeAsyncExtensionFunction,
291 public EntryPickerClient { 291 public EntryPickerClient {
292 protected: 292 protected:
293 virtual ~DeveloperPrivateChooseEntryFunction(); 293 virtual ~DeveloperPrivateChooseEntryFunction();
294 virtual bool RunImpl() OVERRIDE; 294 virtual bool RunAsync() OVERRIDE;
295 bool ShowPicker(ui::SelectFileDialog::Type picker_type, 295 bool ShowPicker(ui::SelectFileDialog::Type picker_type,
296 const base::FilePath& last_directory, 296 const base::FilePath& last_directory,
297 const base::string16& select_title, 297 const base::string16& select_title,
298 const ui::SelectFileDialog::FileTypeInfo& info, 298 const ui::SelectFileDialog::FileTypeInfo& info,
299 int file_type_index); 299 int file_type_index);
300 300
301 // EntryPickerClient functions. 301 // EntryPickerClient functions.
302 virtual void FileSelected(const base::FilePath& path) = 0; 302 virtual void FileSelected(const base::FilePath& path) = 0;
303 virtual void FileSelectionCanceled() = 0; 303 virtual void FileSelectionCanceled() = 0;
304 }; 304 };
305 305
306 306
307 class DeveloperPrivateLoadUnpackedFunction 307 class DeveloperPrivateLoadUnpackedFunction
308 : public DeveloperPrivateChooseEntryFunction { 308 : public DeveloperPrivateChooseEntryFunction {
309 public: 309 public:
310 DECLARE_EXTENSION_FUNCTION("developerPrivate.loadUnpacked", 310 DECLARE_EXTENSION_FUNCTION("developerPrivate.loadUnpacked",
311 DEVELOPERPRIVATE_LOADUNPACKED); 311 DEVELOPERPRIVATE_LOADUNPACKED);
312 312
313 protected: 313 protected:
314 virtual ~DeveloperPrivateLoadUnpackedFunction(); 314 virtual ~DeveloperPrivateLoadUnpackedFunction();
315 virtual bool RunImpl() OVERRIDE; 315 virtual bool RunAsync() OVERRIDE;
316 316
317 // EntryPickerCLient implementation. 317 // EntryPickerCLient implementation.
318 virtual void FileSelected(const base::FilePath& path) OVERRIDE; 318 virtual void FileSelected(const base::FilePath& path) OVERRIDE;
319 virtual void FileSelectionCanceled() OVERRIDE; 319 virtual void FileSelectionCanceled() OVERRIDE;
320 }; 320 };
321 321
322 class DeveloperPrivateChoosePathFunction 322 class DeveloperPrivateChoosePathFunction
323 : public DeveloperPrivateChooseEntryFunction { 323 : public DeveloperPrivateChooseEntryFunction {
324 public: 324 public:
325 DECLARE_EXTENSION_FUNCTION("developerPrivate.choosePath", 325 DECLARE_EXTENSION_FUNCTION("developerPrivate.choosePath",
326 DEVELOPERPRIVATE_CHOOSEPATH); 326 DEVELOPERPRIVATE_CHOOSEPATH);
327 327
328 protected: 328 protected:
329 virtual ~DeveloperPrivateChoosePathFunction(); 329 virtual ~DeveloperPrivateChoosePathFunction();
330 virtual bool RunImpl() OVERRIDE; 330 virtual bool RunAsync() OVERRIDE;
331 331
332 // EntryPickerClient functions. 332 // EntryPickerClient functions.
333 virtual void FileSelected(const base::FilePath& path) OVERRIDE; 333 virtual void FileSelected(const base::FilePath& path) OVERRIDE;
334 virtual void FileSelectionCanceled() OVERRIDE; 334 virtual void FileSelectionCanceled() OVERRIDE;
335 }; 335 };
336 336
337 class DeveloperPrivatePackDirectoryFunction 337 class DeveloperPrivatePackDirectoryFunction
338 : public ChromeAsyncExtensionFunction, 338 : public ChromeAsyncExtensionFunction,
339 public PackExtensionJob::Client { 339 public PackExtensionJob::Client {
340 340
341 public: 341 public:
342 DECLARE_EXTENSION_FUNCTION("developerPrivate.packDirectory", 342 DECLARE_EXTENSION_FUNCTION("developerPrivate.packDirectory",
343 DEVELOPERPRIVATE_PACKDIRECTORY); 343 DEVELOPERPRIVATE_PACKDIRECTORY);
344 344
345 DeveloperPrivatePackDirectoryFunction(); 345 DeveloperPrivatePackDirectoryFunction();
346 346
347 // ExtensionPackJob::Client implementation. 347 // ExtensionPackJob::Client implementation.
348 virtual void OnPackSuccess(const base::FilePath& crx_file, 348 virtual void OnPackSuccess(const base::FilePath& crx_file,
349 const base::FilePath& key_file) OVERRIDE; 349 const base::FilePath& key_file) OVERRIDE;
350 virtual void OnPackFailure(const std::string& error, 350 virtual void OnPackFailure(const std::string& error,
351 ExtensionCreator::ErrorType error_type) OVERRIDE; 351 ExtensionCreator::ErrorType error_type) OVERRIDE;
352 352
353 protected: 353 protected:
354 virtual ~DeveloperPrivatePackDirectoryFunction(); 354 virtual ~DeveloperPrivatePackDirectoryFunction();
355 virtual bool RunImpl() OVERRIDE; 355 virtual bool RunAsync() OVERRIDE;
356 356
357 private: 357 private:
358 scoped_refptr<PackExtensionJob> pack_job_; 358 scoped_refptr<PackExtensionJob> pack_job_;
359 std::string item_path_str_; 359 std::string item_path_str_;
360 std::string key_path_str_; 360 std::string key_path_str_;
361 }; 361 };
362 362
363 class DeveloperPrivateIsProfileManagedFunction 363 class DeveloperPrivateIsProfileManagedFunction
364 : public ChromeSyncExtensionFunction { 364 : public ChromeSyncExtensionFunction {
365 public: 365 public:
(...skipping 12 matching lines...) Expand all
378 public: 378 public:
379 DECLARE_EXTENSION_FUNCTION("developerPrivate.loadDirectory", 379 DECLARE_EXTENSION_FUNCTION("developerPrivate.loadDirectory",
380 DEVELOPERPRIVATE_LOADUNPACKEDCROS); 380 DEVELOPERPRIVATE_LOADUNPACKEDCROS);
381 381
382 DeveloperPrivateLoadDirectoryFunction(); 382 DeveloperPrivateLoadDirectoryFunction();
383 383
384 protected: 384 protected:
385 virtual ~DeveloperPrivateLoadDirectoryFunction(); 385 virtual ~DeveloperPrivateLoadDirectoryFunction();
386 386
387 // ExtensionFunction: 387 // ExtensionFunction:
388 virtual bool RunImpl() OVERRIDE; 388 virtual bool RunAsync() OVERRIDE;
389 389
390 void ClearExistingDirectoryContent(const base::FilePath& project_path); 390 void ClearExistingDirectoryContent(const base::FilePath& project_path);
391 391
392 void ReadSyncFileSystemDirectory(const base::FilePath& project_path, 392 void ReadSyncFileSystemDirectory(const base::FilePath& project_path,
393 const base::FilePath& destination_path); 393 const base::FilePath& destination_path);
394 394
395 void ReadSyncFileSystemDirectoryCb( 395 void ReadSyncFileSystemDirectoryCb(
396 const base::FilePath& project_path, 396 const base::FilePath& project_path,
397 const base::FilePath& destination_path, 397 const base::FilePath& destination_path,
398 base::File::Error result, 398 base::File::Error result,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 public: 435 public:
436 DECLARE_EXTENSION_FUNCTION("developerPrivate.requestFileSource", 436 DECLARE_EXTENSION_FUNCTION("developerPrivate.requestFileSource",
437 DEVELOPERPRIVATE_REQUESTFILESOURCE); 437 DEVELOPERPRIVATE_REQUESTFILESOURCE);
438 438
439 DeveloperPrivateRequestFileSourceFunction(); 439 DeveloperPrivateRequestFileSourceFunction();
440 440
441 protected: 441 protected:
442 virtual ~DeveloperPrivateRequestFileSourceFunction(); 442 virtual ~DeveloperPrivateRequestFileSourceFunction();
443 443
444 // ExtensionFunction: 444 // ExtensionFunction:
445 virtual bool RunImpl() OVERRIDE; 445 virtual bool RunAsync() OVERRIDE;
446 446
447 private: 447 private:
448 void LaunchCallback(const base::DictionaryValue& results); 448 void LaunchCallback(const base::DictionaryValue& results);
449 }; 449 };
450 450
451 class DeveloperPrivateOpenDevToolsFunction 451 class DeveloperPrivateOpenDevToolsFunction
452 : public ChromeAsyncExtensionFunction { 452 : public ChromeAsyncExtensionFunction {
453 public: 453 public:
454 DECLARE_EXTENSION_FUNCTION("developerPrivate.openDevTools", 454 DECLARE_EXTENSION_FUNCTION("developerPrivate.openDevTools",
455 DEVELOPERPRIVATE_OPENDEVTOOLS); 455 DEVELOPERPRIVATE_OPENDEVTOOLS);
456 456
457 DeveloperPrivateOpenDevToolsFunction(); 457 DeveloperPrivateOpenDevToolsFunction();
458 458
459 protected: 459 protected:
460 virtual ~DeveloperPrivateOpenDevToolsFunction(); 460 virtual ~DeveloperPrivateOpenDevToolsFunction();
461 461
462 // ExtensionFunction: 462 // ExtensionFunction:
463 virtual bool RunImpl() OVERRIDE; 463 virtual bool RunAsync() OVERRIDE;
464 }; 464 };
465 465
466 } // namespace api 466 } // namespace api
467 467
468 } // namespace extensions 468 } // namespace extensions
469 469
470 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API _H_ 470 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698