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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller.h

Issue 1097603003: Remove knowledge of USB devices from permission prompt implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_CONTROLER_H _ 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_CONTROLER_H _
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_CONTROLER_H _ 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_CONTROLER_H _
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" 11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
12 #include "extensions/browser/api/device_permissions_prompt.h" 12 #include "extensions/browser/api/device_permissions_prompt.h"
13 13
14 namespace content { 14 namespace content {
15 class WebContents; 15 class WebContents;
16 } 16 }
17 17
18 @class DevicePermissionsViewController; 18 @class DevicePermissionsViewController;
19 19
20 // Displays an device permissions selector prompt as a modal sheet constrained 20 // Displays an device permissions selector prompt as a modal sheet constrained
21 // to the window/tab displaying the given web contents. 21 // to the window/tab displaying the given web contents.
22 class DevicePermissionsDialogController 22 class DevicePermissionsDialogController
23 : public extensions::DevicePermissionsPrompt::Delegate, 23 : public extensions::DevicePermissionsPrompt::Prompt::Observer,
24 public extensions::DevicePermissionsPrompt::Prompt::Observer,
25 public ConstrainedWindowMacDelegate { 24 public ConstrainedWindowMacDelegate {
26 public: 25 public:
27 DevicePermissionsDialogController( 26 DevicePermissionsDialogController(
28 content::WebContents* web_contents, 27 content::WebContents* web_contents,
29 extensions::DevicePermissionsPrompt::Delegate* delegate,
30 scoped_refptr<extensions::DevicePermissionsPrompt::Prompt> prompt); 28 scoped_refptr<extensions::DevicePermissionsPrompt::Prompt> prompt);
31 ~DevicePermissionsDialogController() override; 29 ~DevicePermissionsDialogController() override;
32 30
33 // extensions::DevicePermissionsPrompt::Delegate implementation. 31 void Dismissed();
34 void OnUsbDevicesChosen(
35 const std::vector<scoped_refptr<device::UsbDevice>>& devices) override;
36 32
37 // extensions::DevicePermissionsPrompt::Prompt::Observer implementation. 33 // extensions::DevicePermissionsPrompt::Prompt::Observer implementation.
38 void OnDevicesChanged() override; 34 void OnDevicesChanged() override;
39 35
40 // ConstrainedWindowMacDelegate implementation. 36 // ConstrainedWindowMacDelegate implementation.
41 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override; 37 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override;
42 38
43 ConstrainedWindowMac* constrained_window() const {
44 return constrained_window_.get();
45 }
46 DevicePermissionsViewController* view_controller() const {
47 return view_controller_;
48 }
49
50 private: 39 private:
51 extensions::DevicePermissionsPrompt::Delegate* delegate_;
52 scoped_refptr<extensions::DevicePermissionsPrompt::Prompt> prompt_; 40 scoped_refptr<extensions::DevicePermissionsPrompt::Prompt> prompt_;
53 base::scoped_nsobject<DevicePermissionsViewController> view_controller_; 41 base::scoped_nsobject<DevicePermissionsViewController> view_controller_;
54 scoped_ptr<ConstrainedWindowMac> constrained_window_; 42 scoped_ptr<ConstrainedWindowMac> constrained_window_;
55 }; 43 };
56 44
57 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_CONTROLE R_H_ 45 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_DEVICE_PERMISSIONS_DIALOG_CONTROLE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698