Chromium Code Reviews| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 public: | 223 public: |
| 223 DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.uninstall"); | 224 DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.uninstall"); |
| 224 | 225 |
| 225 protected: | 226 protected: |
| 226 virtual ~DeveloperPrivateUninstallFunction(); | 227 virtual ~DeveloperPrivateUninstallFunction(); |
| 227 | 228 |
| 228 // ExtensionFunction: | 229 // ExtensionFunction: |
| 229 virtual bool RunImpl() OVERRIDE; | 230 virtual bool RunImpl() OVERRIDE; |
| 230 }; | 231 }; |
| 231 | 232 |
| 232 class DeveloperPrivateChooseEntryFunction : public SyncExtensionFunction { | 233 class DeveloperPrivateChooseEntryFunction : public AsyncExtensionFunction { |
| 233 protected: | 234 protected: |
| 234 virtual ~DeveloperPrivateChooseEntryFunction(); | 235 virtual ~DeveloperPrivateChooseEntryFunction(); |
| 235 virtual bool RunImpl() OVERRIDE; | 236 virtual bool RunImpl() OVERRIDE; |
| 236 bool ShowPicker(ui::SelectFileDialog::Type picker_type, | 237 bool ShowPicker(ui::SelectFileDialog::Type picker_type, |
| 237 const FilePath& last_directory, | 238 const FilePath& last_directory, |
| 238 const string16& select_title); | 239 const string16& select_title, |
| 240 const ui::SelectFileDialog::FileTypeInfo& info, | |
| 241 int file_type_index | |
| 242 ); | |
| 239 | 243 |
| 240 friend EntryPicker; | 244 friend EntryPicker; |
| 241 // FileSelected and FileSelectionCanceled are called by the entry picker. | 245 // FileSelected and FileSelectionCanceled are called by the entry picker. |
| 242 void FileSelected(const FilePath& path); | 246 virtual void FileSelected(const FilePath& path); |
| 243 void FileSelectionCanceled(); | 247 virtual void FileSelectionCanceled(); |
| 244 private: | 248 private: |
| 245 }; | 249 }; |
| 246 | 250 |
| 247 | 251 |
| 248 class DeveloperPrivateLoadUnpackedFunction | 252 class DeveloperPrivateLoadUnpackedFunction |
| 249 : public DeveloperPrivateChooseEntryFunction { | 253 : public DeveloperPrivateChooseEntryFunction { |
| 250 public: | 254 public: |
| 251 DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.loadUnpacked"); | 255 DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.loadUnpacked"); |
| 252 | 256 |
| 253 protected: | 257 protected: |
| 254 virtual ~DeveloperPrivateLoadUnpackedFunction(); | 258 virtual ~DeveloperPrivateLoadUnpackedFunction(); |
| 255 virtual bool RunImpl() OVERRIDE; | 259 virtual bool RunImpl() OVERRIDE; |
| 260 }; | |
| 261 | |
| 262 class DeveloperPrivateChooseItemFunction | |
| 263 : public DeveloperPrivateChooseEntryFunction { | |
|
asargent_no_longer_on_chrome
2013/01/09 00:48:05
I'm a little wary of using inheritance of another
miket_OOO
2013/01/09 18:52:41
I agree with Antony's suggestion. This kind of inh
Gaurav
2013/01/12 01:08:26
Done.
Gaurav
2013/01/12 01:08:26
Done.
| |
| 264 public: | |
| 265 DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.chooseItem"); | |
| 266 | |
| 267 protected: | |
| 268 virtual ~DeveloperPrivateChooseItemFunction(); | |
| 269 virtual bool RunImpl() OVERRIDE; | |
| 270 | |
| 271 virtual void FileSelected(const FilePath& path) OVERRIDE; | |
| 272 virtual void FileSelectionCanceled() OVERRIDE; | |
| 273 }; | |
| 274 | |
| 275 class DeveloperPrivatePackItemFunction | |
| 276 : public AsyncExtensionFunction, | |
| 277 public extensions::PackExtensionJob::Client { | |
| 278 | |
| 279 public: | |
| 280 DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.packItem"); | |
| 281 | |
| 282 DeveloperPrivatePackItemFunction(); | |
| 283 | |
| 284 // ExtensionPackJob::Client implementation. | |
| 285 virtual void OnPackSuccess(const FilePath& crx_file, | |
| 286 const FilePath& key_file) OVERRIDE; | |
| 287 virtual void OnPackFailure(const std::string& error, | |
| 288 extensions::ExtensionCreator::ErrorType) OVERRIDE; | |
|
miket_OOO
2013/01/09 18:52:41
Even if you don't need it, please include a parame
Gaurav
2013/01/12 01:08:26
Done.
| |
| 289 | |
| 290 protected: | |
| 291 virtual ~DeveloperPrivatePackItemFunction(); | |
| 292 virtual bool RunImpl() OVERRIDE; | |
| 293 | |
| 294 private: | |
| 295 scoped_refptr<extensions::PackExtensionJob> pack_job_; | |
| 296 std::string item_path_str_; | |
| 297 std::string key_path_str_; | |
| 256 | 298 |
| 257 }; | 299 }; |
| 258 | 300 |
| 259 class DeveloperPrivateGetStringsFunction : public SyncExtensionFunction { | 301 class DeveloperPrivateGetStringsFunction : public SyncExtensionFunction { |
| 260 public: | 302 public: |
| 261 DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.getStrings"); | 303 DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.getStrings"); |
| 262 | 304 |
| 263 protected: | 305 protected: |
| 264 virtual ~DeveloperPrivateGetStringsFunction(); | 306 virtual ~DeveloperPrivateGetStringsFunction(); |
| 265 | 307 |
| 266 // ExtensionFunction | 308 // ExtensionFunction |
| 267 virtual bool RunImpl() OVERRIDE; | 309 virtual bool RunImpl() OVERRIDE; |
| 268 }; | 310 }; |
| 269 | 311 |
| 270 } // namespace api | 312 } // namespace api |
| 271 | 313 |
| 272 } // namespace extensions | 314 } // namespace extensions |
| 273 | 315 |
| 274 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API _H_ | 316 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API _H_ |
| OLD | NEW |