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

Unified Diff: chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller.h

Issue 633793002: Prompt for granting permission to access USB devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename UsbDevicesChosen -> OnUsbDevicesChosen. Created 6 years, 2 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/cocoa/extensions/device_permissions_dialog_controller.h
diff --git a/chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller.h b/chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..ac0138fc57831da785b660f63edd382b45c205c0
--- /dev/null
+++ b/chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller.h
@@ -0,0 +1,57 @@
+// Copyright 2014 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_COCOA_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_CONTROLER_H_
+#define CHROME_BROWSER_UI_COCOA_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_CONTROLER_H_
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/mac/scoped_nsobject.h"
+#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
+#include "extensions/browser/api/device_permissions_prompt.h"
+
+namespace content {
+class WebContents;
+}
+
+@class DevicePermissionsViewController;
+
+// Displays an device permissions selector prompt as a modal sheet constrained
+// to the window/tab displaying the given web contents.
+class DevicePermissionsDialogController
+ : public extensions::DevicePermissionsPrompt::Delegate,
+ public extensions::DevicePermissionsPrompt::Prompt::Observer,
+ public ConstrainedWindowMacDelegate {
+ public:
+ DevicePermissionsDialogController(
+ content::WebContents* web_contents,
+ extensions::DevicePermissionsPrompt::Delegate* delegate,
+ scoped_refptr<extensions::DevicePermissionsPrompt::Prompt> prompt);
+ virtual ~DevicePermissionsDialogController();
+
+ // extensions::DevicePermissionsPrompt::Delegate implementation.
+ virtual void OnUsbDevicesChosen(
+ const std::vector<scoped_refptr<device::UsbDevice>>& devices) override;
+
+ // extensions::DevicePermissionsPrompt::Prompt::Observer implementation.
+ virtual void OnDevicesChanged() override;
+
+ // ConstrainedWindowMacDelegate implementation.
+ virtual void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override;
+
+ ConstrainedWindowMac* constrained_window() const {
+ return constrained_window_.get();
+ }
+ DevicePermissionsViewController* view_controller() const {
+ return view_controller_;
+ }
+
+ private:
+ extensions::DevicePermissionsPrompt::Delegate* delegate_;
+ scoped_refptr<extensions::DevicePermissionsPrompt::Prompt> prompt_;
+ base::scoped_nsobject<DevicePermissionsViewController> view_controller_;
+ scoped_ptr<ConstrainedWindowMac> constrained_window_;
+};
+
+#endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_CONTROLER_H_

Powered by Google App Engine
This is Rietveld 408576698