OLD | NEW |
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 #include "extensions/browser/api/device_permissions_prompt.h" | 5 #include "extensions/browser/api/device_permissions_prompt.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 devices_[index]->set_granted(); | 327 devices_[index]->set_granted(); |
328 } | 328 } |
329 | 329 |
330 DevicePermissionsPrompt::Prompt::~Prompt() { | 330 DevicePermissionsPrompt::Prompt::~Prompt() { |
331 } | 331 } |
332 | 332 |
333 void DevicePermissionsPrompt::Prompt::AddCheckedDevice( | 333 void DevicePermissionsPrompt::Prompt::AddCheckedDevice( |
334 scoped_ptr<DeviceInfo> device, | 334 scoped_ptr<DeviceInfo> device, |
335 bool allowed) { | 335 bool allowed) { |
336 if (allowed) { | 336 if (allowed) { |
337 devices_.push_back(device.release()); | 337 devices_.push_back(device.Pass()); |
338 if (observer_) { | 338 if (observer_) { |
339 observer_->OnDevicesChanged(); | 339 observer_->OnDevicesChanged(); |
340 } | 340 } |
341 } | 341 } |
342 } | 342 } |
343 | 343 |
344 DevicePermissionsPrompt::DevicePermissionsPrompt( | 344 DevicePermissionsPrompt::DevicePermissionsPrompt( |
345 content::WebContents* web_contents) | 345 content::WebContents* web_contents) |
346 : web_contents_(web_contents) { | 346 : web_contents_(web_contents) { |
347 } | 347 } |
(...skipping 17 matching lines...) Expand all Loading... |
365 content::BrowserContext* context, | 365 content::BrowserContext* context, |
366 bool multiple, | 366 bool multiple, |
367 const std::vector<HidDeviceFilter>& filters, | 367 const std::vector<HidDeviceFilter>& filters, |
368 const HidDevicesCallback& callback) { | 368 const HidDevicesCallback& callback) { |
369 prompt_ = new HidDevicePermissionsPrompt(extension, context, multiple, | 369 prompt_ = new HidDevicePermissionsPrompt(extension, context, multiple, |
370 filters, callback); | 370 filters, callback); |
371 ShowDialog(); | 371 ShowDialog(); |
372 } | 372 } |
373 | 373 |
374 } // namespace extensions | 374 } // namespace extensions |
OLD | NEW |