| Index: chrome/browser/ui/webui/options/extension_settings_handler.h
|
| ===================================================================
|
| --- chrome/browser/ui/webui/options/extension_settings_handler.h (revision 99349)
|
| +++ chrome/browser/ui/webui/options/extension_settings_handler.h (working copy)
|
| @@ -9,11 +9,10 @@
|
| #include <string>
|
| #include <vector>
|
|
|
| -#include "base/memory/scoped_ptr.h"
|
| +#include "chrome/browser/extensions/extension_install_ui.h"
|
| #include "chrome/browser/extensions/extension_uninstall_dialog.h"
|
| -#include "chrome/browser/extensions/pack_extension_job.h"
|
| #include "chrome/browser/ui/shell_dialogs.h"
|
| -#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
|
| +#include "chrome/browser/ui/webui/options/options_ui.h"
|
| #include "chrome/browser/ui/webui/chrome_web_ui.h"
|
| #include "chrome/common/extensions/extension_resource.h"
|
| #include "content/common/notification_observer.h"
|
| @@ -47,31 +46,11 @@
|
| bool incognito;
|
| };
|
|
|
| -class ExtensionsUIHTMLSource : public ChromeURLDataManager::DataSource {
|
| +// Extension Settings UI handler.
|
| +class ExtensionSettingsHandler : public OptionsPageUIHandler,
|
| + public SelectFileDialog::Listener,
|
| + public ExtensionUninstallDialog::Delegate {
|
| public:
|
| - ExtensionsUIHTMLSource();
|
| -
|
| - // Called when the network layer has requested a resource underneath
|
| - // the path we registered.
|
| - virtual void StartDataRequest(const std::string& path,
|
| - bool is_incognito,
|
| - int request_id);
|
| - virtual std::string GetMimeType(const std::string&) const;
|
| -
|
| - private:
|
| - ~ExtensionsUIHTMLSource() {}
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(ExtensionsUIHTMLSource);
|
| -};
|
| -
|
| -// The handler for JavaScript messages related to the "extensions" view.
|
| -class ExtensionsDOMHandler : public WebUIMessageHandler,
|
| - public NotificationObserver,
|
| - public PackExtensionJob::Client,
|
| - public SelectFileDialog::Listener,
|
| - public ExtensionUninstallDialog::Delegate {
|
| - public:
|
| -
|
| // Helper class that loads the icons for the extensions in the management UI.
|
| // We do this with native code instead of just using chrome-extension:// URLs
|
| // for two reasons:
|
| @@ -82,7 +61,7 @@
|
| // look disabled.
|
| class IconLoader : public base::RefCountedThreadSafe<IconLoader> {
|
| public:
|
| - explicit IconLoader(ExtensionsDOMHandler* handler);
|
| + explicit IconLoader(ExtensionSettingsHandler* handler);
|
|
|
| // Load |icons|. Will call handler->OnIconsLoaded when complete. IconLoader
|
| // takes ownership of both arguments.
|
| @@ -103,15 +82,12 @@
|
| void ReportResultOnUIThread(base::DictionaryValue* json);
|
|
|
| // The handler we will report back to.
|
| - ExtensionsDOMHandler* handler_;
|
| + ExtensionSettingsHandler* handler_;
|
| };
|
|
|
| - explicit ExtensionsDOMHandler(ExtensionService* extension_service);
|
| - virtual ~ExtensionsDOMHandler();
|
| + ExtensionSettingsHandler();
|
| + virtual ~ExtensionSettingsHandler();
|
|
|
| - // WebUIMessageHandler implementation.
|
| - virtual void RegisterMessages();
|
| -
|
| // Extension Detail JSON Struct for page. (static for ease of testing).
|
| // Note: service can be NULL in unit tests.
|
| static base::DictionaryValue* CreateExtensionDetailValue(
|
| @@ -126,17 +102,6 @@
|
| const UserScript& script,
|
| const FilePath& extension_path);
|
|
|
| - // ExtensionPackJob::Client
|
| - virtual void OnPackSuccess(const FilePath& crx_file,
|
| - const FilePath& key_file);
|
| -
|
| - virtual void OnPackFailure(const std::string& error);
|
| -
|
| - // ExtensionUninstallDialog::Delegate:
|
| - virtual void ExtensionDialogAccepted();
|
| - virtual void ExtensionDialogCanceled();
|
| -
|
| - private:
|
| // Callback for "requestExtensionsData" message.
|
| void HandleRequestExtensionsData(const base::ListValue* args);
|
|
|
| @@ -190,16 +155,31 @@
|
|
|
| // SelectFileDialog::Listener
|
| virtual void FileSelected(const FilePath& path,
|
| - int index, void* params);
|
| + int index, void* params) OVERRIDE;
|
| virtual void MultiFilesSelected(
|
| - const std::vector<FilePath>& files, void* params);
|
| - virtual void FileSelectionCanceled(void* params) {}
|
| + const std::vector<FilePath>& files, void* params) OVERRIDE;
|
| + virtual void FileSelectionCanceled(void* params) OVERRIDE {}
|
|
|
| - // NotificationObserver
|
| + // WebUIMessageHandler implementation.
|
| + virtual void RegisterMessages() OVERRIDE;
|
| + virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
|
| +
|
| + // OptionsUIHandler implementation.
|
| + virtual void GetLocalizedValues(
|
| + base::DictionaryValue* localized_strings) OVERRIDE;
|
| + virtual void Initialize() OVERRIDE;
|
| +
|
| + // NotificationObserver implementation.
|
| virtual void Observe(int type,
|
| const NotificationSource& source,
|
| - const NotificationDetails& details);
|
| + const NotificationDetails& details) OVERRIDE;
|
|
|
| + // ExtensionUninstallDialog::Delegate implementation, used for receiving
|
| + // notification about uninstall confirmation dialog selections.
|
| + virtual void ExtensionDialogAccepted() OVERRIDE;
|
| + virtual void ExtensionDialogCanceled() OVERRIDE;
|
| +
|
| + private:
|
| // Helper that lists the current active html pages for an extension.
|
| std::vector<ExtensionPage> GetActivePagesForExtension(
|
| const Extension* extension);
|
| @@ -227,14 +207,11 @@
|
| ExtensionUninstallDialog* GetExtensionUninstallDialog();
|
|
|
| // Our model. Outlives us since it's owned by our containing profile.
|
| - ExtensionService* const extension_service_;
|
| + ExtensionService* extension_service_;
|
|
|
| // Used to pick the directory when loading an extension.
|
| scoped_refptr<SelectFileDialog> load_extension_dialog_;
|
|
|
| - // Used to package the extension.
|
| - scoped_refptr<PackExtensionJob> pack_job_;
|
| -
|
| // Used to load icons asynchronously on the file thread.
|
| scoped_refptr<IconLoader> icon_loader_;
|
|
|
| @@ -244,10 +221,6 @@
|
| // The id of the extension we are prompting the user about.
|
| std::string extension_id_prompting_;
|
|
|
| - // We monitor changes to the extension system so that we can reload when
|
| - // necessary.
|
| - NotificationRegistrar registrar_;
|
| -
|
| // If true, we will ignore notifications in ::Observe(). This is needed
|
| // to prevent reloading the page when we were the cause of the
|
| // notification.
|
| @@ -260,19 +233,7 @@
|
| // it from the active views.
|
| RenderViewHost* deleting_rvh_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(ExtensionsDOMHandler);
|
| + DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler);
|
| };
|
|
|
| -class ExtensionsUI : public ChromeWebUI {
|
| - public:
|
| - explicit ExtensionsUI(TabContents* contents);
|
| -
|
| - static RefCountedMemory* GetFaviconResourceBytes();
|
| -
|
| - static void RegisterUserPrefs(PrefService* prefs);
|
| -
|
| - private:
|
| - DISALLOW_COPY_AND_ASSIGN(ExtensionsUI);
|
| -};
|
| -
|
| #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_
|
|
|