| 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 "chrome/browser/extensions/api/file_system/file_system_api.h" |    8 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 
|    9 #include "chrome/browser/extensions/extension_function.h" |    9 #include "chrome/browser/extensions/extension_function.h" | 
|   10 #include "chrome/browser/extensions/extension_install_prompt.h" |   10 #include "chrome/browser/extensions/extension_install_prompt.h" | 
|   11 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |   11 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 
 |   12 #include "chrome/browser/extensions/pack_extension_job.h" | 
|   12 #include "chrome/browser/extensions/requirements_checker.h" |   13 #include "chrome/browser/extensions/requirements_checker.h" | 
|   13 #include "chrome/browser/profiles/profile_keyed_service.h" |   14 #include "chrome/browser/profiles/profile_keyed_service.h" | 
|   14 #include "content/public/browser/notification_observer.h" |   15 #include "content/public/browser/notification_observer.h" | 
|   15 #include "content/public/browser/notification_registrar.h" |   16 #include "content/public/browser/notification_registrar.h" | 
|   16 #include "content/public/browser/render_view_host.h" |   17 #include "content/public/browser/render_view_host.h" | 
|   17 #include "ui/base/dialogs/select_file_dialog.h" |   18 #include "ui/base/dialogs/select_file_dialog.h" | 
|   18  |   19  | 
|   19 class ExtensionService; |   20 class ExtensionService; | 
|   20  |   21  | 
|   21 namespace extensions { |   22 namespace extensions { | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   56  |   57  | 
|   57   explicit DeveloperPrivateAPI(Profile* profile); |   58   explicit DeveloperPrivateAPI(Profile* profile); | 
|   58   virtual ~DeveloperPrivateAPI(); |   59   virtual ~DeveloperPrivateAPI(); | 
|   59  |   60  | 
|   60   void AddItemsInfo(const ExtensionSet& items, |   61   void AddItemsInfo(const ExtensionSet& items, | 
|   61                     ExtensionSystem* system, |   62                     ExtensionSystem* system, | 
|   62                     ItemInfoList* item_list); |   63                     ItemInfoList* item_list); | 
|   63  |   64  | 
|   64   void LoadUnpacked(const FilePath& path); |   65   void LoadUnpacked(const FilePath& path); | 
|   65  |   66  | 
|   66   FilePath& getLastUnpackedDirectory() { return last_unpacked_directory_; } |   67   FilePath& GetLastUnpackedDirectory() { return last_unpacked_directory_; } | 
|   67  |   68  | 
|   68   bool UninstallItem(const std::string extension_id, Browser* browser); |   69   bool UninstallItem(const std::string extension_id, Browser* browser); | 
|   69  |   70  | 
|   70   // ProfileKeyedService implementation |   71   // ProfileKeyedService implementation | 
|   71   virtual void Shutdown() OVERRIDE; |   72   virtual void Shutdown() OVERRIDE; | 
|   72  |   73  | 
|   73   // content::NotificationObserver implementation. |   74   // content::NotificationObserver implementation. | 
|   74   virtual void Observe(int type, |   75   virtual void Observe(int type, | 
|   75                        const content::NotificationSource& source, |   76                        const content::NotificationSource& source, | 
|   76                        const content::NotificationDetails& details) OVERRIDE; |   77                        const content::NotificationDetails& details) OVERRIDE; | 
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  219  public: |  220  public: | 
|  220   DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.uninstall"); |  221   DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.uninstall"); | 
|  221  |  222  | 
|  222  protected: |  223  protected: | 
|  223   virtual ~DeveloperPrivateUninstallFunction(); |  224   virtual ~DeveloperPrivateUninstallFunction(); | 
|  224  |  225  | 
|  225   // ExtensionFunction: |  226   // ExtensionFunction: | 
|  226   virtual bool RunImpl() OVERRIDE; |  227   virtual bool RunImpl() OVERRIDE; | 
|  227 }; |  228 }; | 
|  228  |  229  | 
|  229 class DeveloperPrivateChooseEntryFunction : public SyncExtensionFunction { |  230 class DeveloperPrivateChooseEntryFunction : public AsyncExtensionFunction { | 
|  230  protected: |  231  protected: | 
|  231   virtual ~DeveloperPrivateChooseEntryFunction(); |  232   virtual ~DeveloperPrivateChooseEntryFunction(); | 
|  232   virtual bool RunImpl() OVERRIDE; |  233   virtual bool RunImpl() OVERRIDE; | 
|  233   bool ShowPicker(ui::SelectFileDialog::Type picker_type, |  234   bool ShowPicker(ui::SelectFileDialog::Type picker_type, | 
|  234                   const FilePath& last_directory, |  235                   const FilePath& last_directory, | 
|  235                   const string16& select_title); |  236                   const string16& select_title, | 
 |  237                   const ui::SelectFileDialog::FileTypeInfo& info, | 
 |  238                   int file_type_index | 
 |  239                   ); | 
|  236  |  240  | 
|  237   friend EntryPicker; |  241   friend EntryPicker; | 
|  238   // FileSelected and FileSelectionCanceled are called by the entry picker. |  242   // FileSelected and FileSelectionCanceled are called by the entry picker. | 
|  239   void FileSelected(const FilePath& path); |  243   virtual void FileSelected(const FilePath& path) = 0; | 
|  240   void FileSelectionCanceled(); |  244   virtual void FileSelectionCanceled() = 0; | 
|  241  private: |  245  private: | 
|  242 }; |  246 }; | 
|  243  |  247  | 
|  244  |  248  | 
|  245 class DeveloperPrivateLoadUnpackedFunction |  249 class DeveloperPrivateLoadUnpackedFunction | 
|  246     : public DeveloperPrivateChooseEntryFunction { |  250     : public DeveloperPrivateChooseEntryFunction { | 
|  247  public: |  251  public: | 
|  248   DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.loadUnpacked"); |  252   DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.loadUnpacked"); | 
|  249  |  253  | 
|  250  protected: |  254  protected: | 
|  251   virtual ~DeveloperPrivateLoadUnpackedFunction(); |  255   virtual ~DeveloperPrivateLoadUnpackedFunction(); | 
|  252   virtual bool RunImpl() OVERRIDE; |  256   virtual bool RunImpl() OVERRIDE; | 
|  253  |  257  | 
 |  258   virtual void FileSelected(const FilePath& path) OVERRIDE; | 
 |  259   virtual void FileSelectionCanceled() OVERRIDE; | 
 |  260 }; | 
 |  261  | 
 |  262 class DeveloperPrivateChoosePathFunction | 
 |  263     : public DeveloperPrivateChooseEntryFunction { | 
 |  264  public: | 
 |  265   DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.choosePath"); | 
 |  266  | 
 |  267  protected: | 
 |  268   virtual ~DeveloperPrivateChoosePathFunction(); | 
 |  269   virtual bool RunImpl() OVERRIDE; | 
 |  270  | 
 |  271   virtual void FileSelected(const FilePath& path) OVERRIDE; | 
 |  272   virtual void FileSelectionCanceled() OVERRIDE; | 
 |  273 }; | 
 |  274  | 
 |  275 class DeveloperPrivatePackDirectoryFunction | 
 |  276     : public AsyncExtensionFunction, | 
 |  277       public extensions::PackExtensionJob::Client { | 
 |  278  | 
 |  279  public: | 
 |  280   DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.packDirectory"); | 
 |  281  | 
 |  282   DeveloperPrivatePackDirectoryFunction(); | 
 |  283  | 
 |  284   // ExtensionPackJob::Client implementation. | 
 |  285   virtual void OnPackSuccess(const FilePath& crx_file, | 
 |  286                              const FilePath& key_file) OVERRIDE; | 
 |  287   virtual void OnPackFailure( | 
 |  288       const std::string& error, | 
 |  289       extensions::ExtensionCreator::ErrorType error_type) OVERRIDE; | 
 |  290  | 
 |  291  protected: | 
 |  292   virtual ~DeveloperPrivatePackDirectoryFunction(); | 
 |  293   virtual bool RunImpl() OVERRIDE; | 
 |  294  | 
 |  295  private: | 
 |  296   scoped_refptr<extensions::PackExtensionJob> pack_job_; | 
 |  297   std::string item_path_str_; | 
 |  298   std::string key_path_str_; | 
 |  299  | 
|  254 }; |  300 }; | 
|  255  |  301  | 
|  256 class DeveloperPrivateGetStringsFunction : public SyncExtensionFunction { |  302 class DeveloperPrivateGetStringsFunction : public SyncExtensionFunction { | 
|  257   public: |  303   public: | 
|  258    DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.getStrings"); |  304    DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.getStrings"); | 
|  259  |  305  | 
|  260   protected: |  306   protected: | 
|  261    virtual ~DeveloperPrivateGetStringsFunction(); |  307    virtual ~DeveloperPrivateGetStringsFunction(); | 
|  262  |  308  | 
|  263    // ExtensionFunction |  309    // ExtensionFunction | 
|  264    virtual bool RunImpl() OVERRIDE; |  310    virtual bool RunImpl() OVERRIDE; | 
|  265 }; |  311 }; | 
|  266  |  312  | 
|  267 }  // namespace api |  313 }  // namespace api | 
|  268  |  314  | 
|  269 }  // namespace extensions |  315 }  // namespace extensions | 
|  270  |  316  | 
|  271 #endif  // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API
     _H_ |  317 #endif  // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API
     _H_ | 
| OLD | NEW |