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

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

Issue 2127203002: Change WebBluetooth chooser OK button's label to be "Pair" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@support_chrome_extension_chooser_title
Patch Set: rebase Created 4 years, 5 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 | « chrome/browser/usb/usb_chooser_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 usb_service->GetDevices(base::Bind(&UsbChooserController::GotUsbDeviceList, 65 usb_service->GetDevices(base::Bind(&UsbChooserController::GotUsbDeviceList,
66 weak_factory_.GetWeakPtr())); 66 weak_factory_.GetWeakPtr()));
67 } 67 }
68 68
69 UsbChooserController::~UsbChooserController() { 69 UsbChooserController::~UsbChooserController() {
70 if (!callback_.is_null()) 70 if (!callback_.is_null())
71 callback_.Run(nullptr); 71 callback_.Run(nullptr);
72 } 72 }
73 73
74 base::string16 UsbChooserController::GetOkButtonLabel() const {
75 return l10n_util::GetStringUTF16(IDS_USB_DEVICE_CHOOSER_CONNECT_BUTTON_TEXT);
76 }
77
74 size_t UsbChooserController::NumOptions() const { 78 size_t UsbChooserController::NumOptions() const {
75 return devices_.size(); 79 return devices_.size();
76 } 80 }
77 81
78 base::string16 UsbChooserController::GetOption(size_t index) const { 82 base::string16 UsbChooserController::GetOption(size_t index) const {
79 DCHECK_LT(index, devices_.size()); 83 DCHECK_LT(index, devices_.size());
80 const base::string16& device_name = devices_[index].second; 84 const base::string16& device_name = devices_[index].second;
81 const auto& it = device_name_map_.find(device_name); 85 const auto& it = device_name_map_.find(device_name);
82 DCHECK(it != device_name_map_.end()); 86 DCHECK(it != device_name_map_.end());
83 return it->second == 1 87 return it->second == 1
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 175
172 bool UsbChooserController::DisplayDevice( 176 bool UsbChooserController::DisplayDevice(
173 scoped_refptr<device::UsbDevice> device) const { 177 scoped_refptr<device::UsbDevice> device) const {
174 return device::UsbDeviceFilter::MatchesAny(device, filters_) && 178 return device::UsbDeviceFilter::MatchesAny(device, filters_) &&
175 (base::CommandLine::ForCurrentProcess()->HasSwitch( 179 (base::CommandLine::ForCurrentProcess()->HasSwitch(
176 switches::kDisableWebUsbSecurity) || 180 switches::kDisableWebUsbSecurity) ||
177 device::FindInWebUsbAllowedOrigins( 181 device::FindInWebUsbAllowedOrigins(
178 device->webusb_allowed_origins(), 182 device->webusb_allowed_origins(),
179 render_frame_host_->GetLastCommittedURL().GetOrigin())); 183 render_frame_host_->GetLastCommittedURL().GetOrigin()));
180 } 184 }
OLDNEW
« no previous file with comments | « chrome/browser/usb/usb_chooser_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698