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

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

Issue 11794034: Adds functionality to pack an extension / app from the app. (Closed) Base URL: http://git.chromium.org/chromium/src.git@bacha_lo
Patch Set: Rebased and Addressed comments. Created 7 years, 10 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
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 "chrome/browser/extensions/api/developer_private/entry_picker.h" 8 #include "chrome/browser/extensions/api/developer_private/entry_picker.h"
9 #include "chrome/browser/extensions/api/file_system/file_system_api.h" 9 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
10 #include "chrome/browser/extensions/extension_function.h" 10 #include "chrome/browser/extensions/extension_function.h"
11 #include "chrome/browser/extensions/extension_install_prompt.h" 11 #include "chrome/browser/extensions/extension_install_prompt.h"
12 #include "chrome/browser/extensions/extension_uninstall_dialog.h" 12 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
13 #include "chrome/browser/extensions/pack_extension_job.h"
13 #include "chrome/browser/extensions/requirements_checker.h" 14 #include "chrome/browser/extensions/requirements_checker.h"
14 #include "chrome/browser/profiles/profile_keyed_service.h" 15 #include "chrome/browser/profiles/profile_keyed_service.h"
15 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
18 #include "ui/shell_dialogs/select_file_dialog.h" 19 #include "ui/shell_dialogs/select_file_dialog.h"
19 20
20 class ExtensionService; 21 class ExtensionService;
21 22
22 namespace extensions { 23 namespace extensions {
(...skipping 30 matching lines...) Expand all
53 public content::NotificationObserver { 54 public content::NotificationObserver {
54 public: 55 public:
55 // Convenience method to get the DeveloperPrivateAPI for a profile. 56 // Convenience method to get the DeveloperPrivateAPI for a profile.
56 static DeveloperPrivateAPI* Get(Profile* profile); 57 static DeveloperPrivateAPI* Get(Profile* profile);
57 58
58 explicit DeveloperPrivateAPI(Profile* profile); 59 explicit DeveloperPrivateAPI(Profile* profile);
59 virtual ~DeveloperPrivateAPI(); 60 virtual ~DeveloperPrivateAPI();
60 61
61 void SetLastUnpackedDirectory(const FilePath& path); 62 void SetLastUnpackedDirectory(const FilePath& path);
62 63
63 FilePath& getLastUnpackedDirectory() { return last_unpacked_directory_; } 64 FilePath& GetLastUnpackedDirectory() { return last_unpacked_directory_; }
64 65
65 // ProfileKeyedService implementation 66 // ProfileKeyedService implementation
66 virtual void Shutdown() OVERRIDE; 67 virtual void Shutdown() OVERRIDE;
67 68
68 // content::NotificationObserver implementation. 69 // content::NotificationObserver implementation.
69 virtual void Observe(int type, 70 virtual void Observe(int type,
70 const content::NotificationSource& source, 71 const content::NotificationSource& source,
71 const content::NotificationDetails& details) OVERRIDE; 72 const content::NotificationDetails& details) OVERRIDE;
72 73
73 private: 74 private:
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // Callback for requirements checker. 189 // Callback for requirements checker.
189 void OnRequirementsChecked(std::string extension_id, 190 void OnRequirementsChecked(std::string extension_id,
190 std::vector<std::string> requirements_errors); 191 std::vector<std::string> requirements_errors);
191 // ExtensionFunction: 192 // ExtensionFunction:
192 virtual bool RunImpl() OVERRIDE; 193 virtual bool RunImpl() OVERRIDE;
193 194
194 private: 195 private:
195 scoped_ptr<extensions::RequirementsChecker> requirements_checker_; 196 scoped_ptr<extensions::RequirementsChecker> requirements_checker_;
196 }; 197 };
197 198
198 class DeveloperPrivateChooseEntryFunction : public SyncExtensionFunction, 199 class DeveloperPrivateChooseEntryFunction : public AsyncExtensionFunction,
199 public EntryPickerClient { 200 public EntryPickerClient {
200 protected: 201 protected:
201 virtual ~DeveloperPrivateChooseEntryFunction(); 202 virtual ~DeveloperPrivateChooseEntryFunction();
202 virtual bool RunImpl() OVERRIDE; 203 virtual bool RunImpl() OVERRIDE;
203 bool ShowPicker(ui::SelectFileDialog::Type picker_type, 204 bool ShowPicker(ui::SelectFileDialog::Type picker_type,
204 const FilePath& last_directory, 205 const FilePath& last_directory,
205 const string16& select_title); 206 const string16& select_title,
207 const ui::SelectFileDialog::FileTypeInfo& info,
208 int file_type_index);
206 209
207 // EntryPickerCLient functions. 210 // EntryPickerClient functions.
208 virtual void FileSelected(const FilePath& path) = 0; 211 virtual void FileSelected(const FilePath& path) = 0;
209 virtual void FileSelectionCanceled() = 0; 212 virtual void FileSelectionCanceled() = 0;
210 }; 213 };
211 214
212 215
213 class DeveloperPrivateLoadUnpackedFunction 216 class DeveloperPrivateLoadUnpackedFunction
214 : public DeveloperPrivateChooseEntryFunction { 217 : public DeveloperPrivateChooseEntryFunction {
215 public: 218 public:
216 DECLARE_EXTENSION_FUNCTION("developerPrivate.loadUnpacked", 219 DECLARE_EXTENSION_FUNCTION("developerPrivate.loadUnpacked",
217 DEVELOPERPRIVATE_LOADUNPACKED); 220 DEVELOPERPRIVATE_LOADUNPACKED);
218 221
219 protected: 222 protected:
220 virtual ~DeveloperPrivateLoadUnpackedFunction(); 223 virtual ~DeveloperPrivateLoadUnpackedFunction();
221 virtual bool RunImpl() OVERRIDE; 224 virtual bool RunImpl() OVERRIDE;
222 225
223 // EntryPickerCLient implementation. 226 // EntryPickerCLient implementation.
224 virtual void FileSelected(const FilePath& path) OVERRIDE; 227 virtual void FileSelected(const FilePath& path) OVERRIDE;
225 virtual void FileSelectionCanceled() OVERRIDE; 228 virtual void FileSelectionCanceled() OVERRIDE;
229 };
226 230
231 class DeveloperPrivateChoosePathFunction
232 : public DeveloperPrivateChooseEntryFunction {
233 public:
234 DECLARE_EXTENSION_FUNCTION("developerPrivate.choosePath",
235 DEVELOPERPRIVATE_CHOOSEPATH);
236
237 protected:
238 virtual ~DeveloperPrivateChoosePathFunction();
239 virtual bool RunImpl() OVERRIDE;
240
241 // EntryPickerClient functions.
242 virtual void FileSelected(const FilePath& path) OVERRIDE;
243 virtual void FileSelectionCanceled() OVERRIDE;
244 };
245
246 class DeveloperPrivatePackDirectoryFunction
247 : public AsyncExtensionFunction,
248 public extensions::PackExtensionJob::Client {
249
250 public:
251 DECLARE_EXTENSION_FUNCTION("developerPrivate.packDirectory",
252 DEVELOPERPRIVATE_PACKDIRECTORY);
253
254 DeveloperPrivatePackDirectoryFunction();
255
256 // ExtensionPackJob::Client implementation.
257 virtual void OnPackSuccess(const FilePath& crx_file,
258 const FilePath& key_file) OVERRIDE;
259 virtual void OnPackFailure(
260 const std::string& error,
261 extensions::ExtensionCreator::ErrorType error_type) OVERRIDE;
262
263 protected:
264 virtual ~DeveloperPrivatePackDirectoryFunction();
265 virtual bool RunImpl() OVERRIDE;
266
267 private:
268 scoped_refptr<extensions::PackExtensionJob> pack_job_;
269 std::string item_path_str_;
270 std::string key_path_str_;
asargent_no_longer_on_chrome 2013/02/09 00:38:45 naming suggestion: consider omitting the "_str" pa
Gaurav 2013/02/11 20:01:55 Added str as when they are used they might be conf
asargent_no_longer_on_chrome 2013/02/11 20:07:27 Yep, I assumed that's why you had that suffix. If
227 }; 271 };
228 272
229 class DeveloperPrivateGetStringsFunction : public SyncExtensionFunction { 273 class DeveloperPrivateGetStringsFunction : public SyncExtensionFunction {
230 public: 274 public:
231 DECLARE_EXTENSION_FUNCTION("developerPrivate.getStrings", 275 DECLARE_EXTENSION_FUNCTION("developerPrivate.getStrings",
232 DEVELOPERPRIVATE_GETSTRINGS); 276 DEVELOPERPRIVATE_GETSTRINGS);
233 277
234 protected: 278 protected:
235 virtual ~DeveloperPrivateGetStringsFunction(); 279 virtual ~DeveloperPrivateGetStringsFunction();
236 280
237 // ExtensionFunction 281 // ExtensionFunction
238 virtual bool RunImpl() OVERRIDE; 282 virtual bool RunImpl() OVERRIDE;
239 }; 283 };
240 284
241 } // namespace api 285 } // namespace api
242 286
243 } // namespace extensions 287 } // namespace extensions
244 288
245 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API _H_ 289 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698