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

Side by Side Diff: chrome/browser/usb/usb_chooser_controller.cc

Issue 2062333002: mojo::Callback -> base::Callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "chrome/browser/usb/usb_chooser_controller.h" 5 #include "chrome/browser/usb/usb_chooser_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 88 Profile::FromBrowserContext(web_contents->GetBrowserContext());
89 UsbChooserContext* chooser_context = 89 UsbChooserContext* chooser_context =
90 UsbChooserContextFactory::GetForProfile(profile); 90 UsbChooserContextFactory::GetForProfile(profile);
91 chooser_context->GrantDevicePermission( 91 chooser_context->GrantDevicePermission(
92 render_frame_host_->GetLastCommittedURL().GetOrigin(), embedding_origin, 92 render_frame_host_->GetLastCommittedURL().GetOrigin(), embedding_origin,
93 devices_[index].first->guid()); 93 devices_[index].first->guid());
94 94
95 device::usb::DeviceInfoPtr device_info_ptr = 95 device::usb::DeviceInfoPtr device_info_ptr =
96 device::usb::DeviceInfo::From(*devices_[index].first); 96 device::usb::DeviceInfo::From(*devices_[index].first);
97 callback_.Run(std::move(device_info_ptr)); 97 callback_.Run(std::move(device_info_ptr));
98 callback_.reset(); // Reset |callback_| so that it is only run once. 98 callback_.Reset(); // Reset |callback_| so that it is only run once.
99 99
100 RecordWebUsbChooserClosure( 100 RecordWebUsbChooserClosure(
101 devices_[index].first->serial_number().empty() 101 devices_[index].first->serial_number().empty()
102 ? WEBUSB_CHOOSER_CLOSED_EPHEMERAL_PERMISSION_GRANTED 102 ? WEBUSB_CHOOSER_CLOSED_EPHEMERAL_PERMISSION_GRANTED
103 : WEBUSB_CHOOSER_CLOSED_PERMISSION_GRANTED); 103 : WEBUSB_CHOOSER_CLOSED_PERMISSION_GRANTED);
104 } 104 }
105 105
106 void UsbChooserController::Cancel() { 106 void UsbChooserController::Cancel() {
107 RecordWebUsbChooserClosure(devices_.size() == 0 107 RecordWebUsbChooserClosure(devices_.size() == 0
108 ? WEBUSB_CHOOSER_CLOSED_CANCELLED_NO_DEVICES 108 ? WEBUSB_CHOOSER_CLOSED_CANCELLED_NO_DEVICES
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 bool UsbChooserController::DisplayDevice( 155 bool UsbChooserController::DisplayDevice(
156 scoped_refptr<device::UsbDevice> device) const { 156 scoped_refptr<device::UsbDevice> device) const {
157 return device::UsbDeviceFilter::MatchesAny(device, filters_) && 157 return device::UsbDeviceFilter::MatchesAny(device, filters_) &&
158 (base::CommandLine::ForCurrentProcess()->HasSwitch( 158 (base::CommandLine::ForCurrentProcess()->HasSwitch(
159 switches::kDisableWebUsbSecurity) || 159 switches::kDisableWebUsbSecurity) ||
160 device::FindInWebUsbAllowedOrigins( 160 device::FindInWebUsbAllowedOrigins(
161 device->webusb_allowed_origins(), 161 device->webusb_allowed_origins(),
162 render_frame_host_->GetLastCommittedURL().GetOrigin())); 162 render_frame_host_->GetLastCommittedURL().GetOrigin()));
163 } 163 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/usb_chooser_dialog_android.cc ('k') | chrome/renderer/chrome_render_thread_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698