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

Unified Diff: chrome/browser/ui/webui/extensions/install_extension_handler.h

Issue 10378026: Reland 135525 - Add a first-class off-store install UI to chrome://extensions/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
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_
« no previous file with comments | « chrome/browser/ui/webui/extensions/extensions_ui.cc ('k') | chrome/browser/ui/webui/extensions/install_extension_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698