Index: chrome/browser/ui/webui/extensions/install_extension_handler.h |
diff --git a/chrome/browser/ui/webui/extensions/install_extension_handler.h b/chrome/browser/ui/webui/extensions/install_extension_handler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..26aa349b70cf2c6dab83d76af1a99c5410c8327f |
--- /dev/null |
+++ b/chrome/browser/ui/webui/extensions/install_extension_handler.h |
@@ -0,0 +1,48 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_ |
+#define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_ |
+#pragma once |
+ |
+#include "base/file_path.h" |
+#include "base/values.h" |
+#include "content/public/browser/web_ui_message_handler.h" |
+ |
+// Handles installing an extension when its file is dragged onto the page. |
+class InstallExtensionHandler : public content::WebUIMessageHandler { |
+ public: |
+ InstallExtensionHandler(); |
+ virtual ~InstallExtensionHandler(); |
+ |
+ void GetLocalizedValues(DictionaryValue* localized_strings); |
+ |
+ // WebUIMessageHandler implementation. |
+ virtual void RegisterMessages() OVERRIDE; |
+ |
+ private: |
+ // Handles a notification from the JavaScript that a drag has started. This is |
+ // needed so that we can capture the file being dragged. If we wait until |
+ // we receive a drop notification, the drop data in the browser process will |
+ // have already been destroyed. |
+ void HandleStartDragMessage(const ListValue* args); |
+ |
+ // Handles a notification from the JavaScript that a drag has stopped. |
+ void HandleStopDragMessage(const ListValue* args); |
+ |
+ // Handles a notification from the JavaScript to install the file currently |
+ // being dragged. |
+ // |
+ // IMPORTANT: We purposefully do not allow the JavaScript to specify the file |
+ // to be installed as a precaution against the extension management page |
+ // getting XSS'd. |
+ void HandleInstallMessage(const ListValue* args); |
+ |
+ // The extension that will be installed when HandleInstallMessage() is called. |
+ FilePath file_to_install_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(InstallExtensionHandler); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_ |