Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / webui / extensions / install_extension_handler.h
blobe77d45dff34be867dfd948108bede6ef34f803f0
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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_
8 #include "base/files/file_path.h"
9 #include "base/strings/string16.h"
10 #include "base/values.h"
11 #include "content/public/browser/web_ui_message_handler.h"
13 namespace content {
14 class WebUIDataSource;
17 namespace extensions {
19 // Handles installing an extension when its file is dragged onto the page.
20 class InstallExtensionHandler : public content::WebUIMessageHandler {
21 public:
22 InstallExtensionHandler();
23 ~InstallExtensionHandler() override;
25 void GetLocalizedValues(content::WebUIDataSource* source);
27 // WebUIMessageHandler implementation.
28 void RegisterMessages() override;
30 private:
31 // Handles a notification from the JavaScript that a drag has started. This is
32 // needed so that we can capture the file being dragged. If we wait until
33 // we receive a drop notification, the drop data in the browser process will
34 // have already been destroyed.
35 void HandleStartDragMessage(const base::ListValue* args);
37 // Handles a notification from the JavaScript that a drag has stopped.
38 void HandleStopDragMessage(const base::ListValue* args);
40 // Handles a notification from the JavaScript to install the file currently
41 // being dragged.
43 // IMPORTANT: We purposefully do not allow the JavaScript to specify the file
44 // to be installed as a precaution against the extension management page
45 // getting XSS'd.
46 void HandleInstallMessage(const base::ListValue* args);
48 // Handles a notification from the JavaScript to install the directory
49 // currently being dragged.
50 void HandleInstallDirectoryMessage(const base::ListValue* args);
52 // The path to the file that will be installed when HandleInstallMessage() is
53 // called.
54 base::FilePath file_to_install_;
55 base::FilePath file_display_name_;
57 DISALLOW_COPY_AND_ASSIGN(InstallExtensionHandler);
60 } // namespace extensions
62 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_