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_ |