| 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" |
| 11 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" | 11 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" |
| 12 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 12 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
| 13 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | |
| 14 #include "chrome/browser/extensions/chrome_extension_function.h" | 13 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 15 #include "chrome/browser/extensions/error_console/error_console.h" | 14 #include "chrome/browser/extensions/error_console/error_console.h" |
| 16 #include "chrome/browser/extensions/extension_install_prompt.h" | 15 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 17 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 16 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 18 #include "chrome/browser/extensions/pack_extension_job.h" | 17 #include "chrome/browser/extensions/pack_extension_job.h" |
| 19 #include "chrome/browser/extensions/requirements_checker.h" | 18 #include "chrome/browser/extensions/requirements_checker.h" |
| 20 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 22 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
| 22 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 23 #include "extensions/browser/event_router.h" | 23 #include "extensions/browser/event_router.h" |
| 24 #include "ui/shell_dialogs/select_file_dialog.h" | 24 #include "ui/shell_dialogs/select_file_dialog.h" |
| 25 #include "webkit/browser/fileapi/file_system_context.h" | 25 #include "webkit/browser/fileapi/file_system_context.h" |
| 26 #include "webkit/browser/fileapi/file_system_operation.h" | 26 #include "webkit/browser/fileapi/file_system_operation.h" |
| 27 | 27 |
| 28 class ExtensionService; | 28 class ExtensionService; |
| 29 class Profile; | 29 class Profile; |
| 30 | 30 |
| 31 namespace extensions { | 31 namespace extensions { |
| 32 | 32 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // the Apps Developer Tool (which replaces the chrome://extensions page), we | 84 // the Apps Developer Tool (which replaces the chrome://extensions page), we |
| 85 // don't want to send information about the subscribing extension in an | 85 // don't want to send information about the subscribing extension in an |
| 86 // update. In particular, we want to avoid entering a loop, which could happen | 86 // update. In particular, we want to avoid entering a loop, which could happen |
| 87 // when, e.g., the Apps Developer Tool throws an error. | 87 // when, e.g., the Apps Developer Tool throws an error. |
| 88 std::set<std::string> extension_ids_; | 88 std::set<std::string> extension_ids_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(DeveloperPrivateEventRouter); | 90 DISALLOW_COPY_AND_ASSIGN(DeveloperPrivateEventRouter); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 // The profile-keyed service that manages the DeveloperPrivate API. | 93 // The profile-keyed service that manages the DeveloperPrivate API. |
| 94 class DeveloperPrivateAPI : public ProfileKeyedAPI, | 94 class DeveloperPrivateAPI : public BrowserContextKeyedAPI, |
| 95 public EventRouter::Observer { | 95 public EventRouter::Observer { |
| 96 public: | 96 public: |
| 97 static ProfileKeyedAPIFactory<DeveloperPrivateAPI>* GetFactoryInstance(); | 97 static BrowserContextKeyedAPIFactory<DeveloperPrivateAPI>* |
| 98 GetFactoryInstance(); |
| 98 | 99 |
| 99 // Convenience method to get the DeveloperPrivateAPI for a profile. | 100 // Convenience method to get the DeveloperPrivateAPI for a profile. |
| 100 static DeveloperPrivateAPI* Get(content::BrowserContext* context); | 101 static DeveloperPrivateAPI* Get(content::BrowserContext* context); |
| 101 | 102 |
| 102 explicit DeveloperPrivateAPI(content::BrowserContext* context); | 103 explicit DeveloperPrivateAPI(content::BrowserContext* context); |
| 103 virtual ~DeveloperPrivateAPI(); | 104 virtual ~DeveloperPrivateAPI(); |
| 104 | 105 |
| 105 void SetLastUnpackedDirectory(const base::FilePath& path); | 106 void SetLastUnpackedDirectory(const base::FilePath& path); |
| 106 | 107 |
| 107 base::FilePath& GetLastUnpackedDirectory() { | 108 base::FilePath& GetLastUnpackedDirectory() { |
| 108 return last_unpacked_directory_; | 109 return last_unpacked_directory_; |
| 109 } | 110 } |
| 110 | 111 |
| 111 // BrowserContextKeyedService implementation | 112 // BrowserContextKeyedService implementation |
| 112 virtual void Shutdown() OVERRIDE; | 113 virtual void Shutdown() OVERRIDE; |
| 113 | 114 |
| 114 // EventRouter::Observer implementation. | 115 // EventRouter::Observer implementation. |
| 115 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | 116 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; |
| 116 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; | 117 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; |
| 117 | 118 |
| 118 private: | 119 private: |
| 119 friend class ProfileKeyedAPIFactory<DeveloperPrivateAPI>; | 120 friend class BrowserContextKeyedAPIFactory<DeveloperPrivateAPI>; |
| 120 | 121 |
| 121 // ProfileKeyedAPI implementation. | 122 // BrowserContextKeyedAPI implementation. |
| 122 static const char* service_name() { return "DeveloperPrivateAPI"; } | 123 static const char* service_name() { return "DeveloperPrivateAPI"; } |
| 123 static const bool kServiceRedirectedInIncognito = true; | 124 static const bool kServiceRedirectedInIncognito = true; |
| 124 static const bool kServiceIsNULLWhileTesting = true; | 125 static const bool kServiceIsNULLWhileTesting = true; |
| 125 | 126 |
| 126 void RegisterNotifications(); | 127 void RegisterNotifications(); |
| 127 | 128 |
| 128 Profile* profile_; | 129 Profile* profile_; |
| 129 | 130 |
| 130 // Used to start the load |load_extension_dialog_| in the last directory that | 131 // Used to start the load |load_extension_dialog_| in the last directory that |
| 131 // was loaded. | 132 // was loaded. |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 463 |
| 463 // ExtensionFunction: | 464 // ExtensionFunction: |
| 464 virtual bool RunImpl() OVERRIDE; | 465 virtual bool RunImpl() OVERRIDE; |
| 465 }; | 466 }; |
| 466 | 467 |
| 467 } // namespace api | 468 } // namespace api |
| 468 | 469 |
| 469 } // namespace extensions | 470 } // namespace extensions |
| 470 | 471 |
| 471 #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 |