OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/file_path.h" |
| 10 #include "base/values.h" |
| 11 #include "content/public/browser/web_ui_message_handler.h" |
| 12 |
| 13 // Handles installing an extension when its file is dragged onto the page. |
| 14 class InstallExtensionHandler : public content::WebUIMessageHandler { |
| 15 public: |
| 16 InstallExtensionHandler(); |
| 17 virtual ~InstallExtensionHandler(); |
| 18 |
| 19 void GetLocalizedValues(DictionaryValue* localized_strings); |
| 20 |
| 21 // WebUIMessageHandler implementation. |
| 22 virtual void RegisterMessages() OVERRIDE; |
| 23 |
| 24 private: |
| 25 // Handles a notification from the JavaScript that a drag has started. This is |
| 26 // needed so that we can capture the file being dragged. If we wait until |
| 27 // we receive a drop notification, the drop data in the browser process will |
| 28 // have already been destroyed. |
| 29 void HandleStartDragMessage(const ListValue* args); |
| 30 |
| 31 // Handles a notification from the JavaScript that a drag has stopped. |
| 32 void HandleStopDragMessage(const ListValue* args); |
| 33 |
| 34 // Handles a notification from the JavaScript to install the file currently |
| 35 // being dragged. |
| 36 // |
| 37 // IMPORTANT: We purposefully do not allow the JavaScript to specify the file |
| 38 // to be installed as a precaution against the extension management page |
| 39 // getting XSS'd. |
| 40 void HandleInstallMessage(const ListValue* args); |
| 41 |
| 42 // The extension that will be installed when HandleInstallMessage() is called. |
| 43 FilePath file_to_install_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(InstallExtensionHandler); |
| 46 }; |
| 47 |
| 48 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_ |
OLD | NEW |