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

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

Issue 1115213004: Add chrome.hid.getUserSelectedDevices API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller .h" 5 #import "chrome/browser/ui/cocoa/extensions/device_permissions_dialog_controller .h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
11 #include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h" 11 #include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h"
12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h"
13 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h" 13 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h"
14 #import "chrome/browser/ui/cocoa/extensions/device_permissions_view_controller.h " 14 #import "chrome/browser/ui/cocoa/extensions/device_permissions_view_controller.h "
15 #include "components/web_modal/web_contents_modal_dialog_manager.h"
15 #include "device/usb/usb_device.h" 16 #include "device/usb/usb_device.h"
16 17
17 using extensions::DevicePermissionsPrompt; 18 using extensions::DevicePermissionsPrompt;
18 19
19 DevicePermissionsDialogController::DevicePermissionsDialogController( 20 DevicePermissionsDialogController::DevicePermissionsDialogController(
20 content::WebContents* web_contents, 21 content::WebContents* web_contents,
21 scoped_refptr<DevicePermissionsPrompt::Prompt> prompt) 22 scoped_refptr<DevicePermissionsPrompt::Prompt> prompt)
22 : prompt_(prompt) { 23 : prompt_(prompt) {
23 view_controller_.reset( 24 view_controller_.reset(
24 [[DevicePermissionsViewController alloc] initWithController:this 25 [[DevicePermissionsViewController alloc] initWithController:this
(...skipping 23 matching lines...) Expand all
48 [view_controller_ devicesChanged]; 49 [view_controller_ devicesChanged];
49 } 50 }
50 51
51 void DevicePermissionsDialogController::OnConstrainedWindowClosed( 52 void DevicePermissionsDialogController::OnConstrainedWindowClosed(
52 ConstrainedWindowMac* window) { 53 ConstrainedWindowMac* window) {
53 prompt_->Dismissed(); 54 prompt_->Dismissed();
54 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); 55 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
55 } 56 }
56 57
57 void ChromeDevicePermissionsPrompt::ShowDialog() { 58 void ChromeDevicePermissionsPrompt::ShowDialog() {
58 // These objects will delete themselves when the dialog closes. 59 web_modal::WebContentsModalDialogManager* manager =
59 new DevicePermissionsDialogController(web_contents(), prompt()); 60 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents());
61 if (manager) {
62 // These objects will delete themselves when the dialog closes.
63 new DevicePermissionsDialogController(web_contents(), prompt());
64 } else {
65 base::ThreadTaskRunnerHandle::Get()->PostTask(
66 FROM_HERE,
67 base::Bind(&DevicePermissionsPrompt::Prompt::Dismissed, prompt()));
68 }
60 } 69 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698