| 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 #ifndef EXTENSIONS_BROWSER_DEVICE_PERMISSIONS_PROMPT_H_ | 5 #ifndef EXTENSIONS_BROWSER_DEVICE_PERMISSIONS_PROMPT_H_ |
| 6 #define EXTENSIONS_BROWSER_DEVICE_PERMISSIONS_PROMPT_H_ | 6 #define EXTENSIONS_BROWSER_DEVICE_PERMISSIONS_PROMPT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | |
| 17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class BrowserContext; | 20 class BrowserContext; |
| 21 class WebContents; | 21 class WebContents; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace device { | 24 namespace device { |
| 25 class HidDeviceFilter; | 25 class HidDeviceFilter; |
| 26 class HidDeviceInfo; | 26 class HidDeviceInfo; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 void GrantDevicePermission(size_t index); | 92 void GrantDevicePermission(size_t index); |
| 93 | 93 |
| 94 virtual void Dismissed() = 0; | 94 virtual void Dismissed() = 0; |
| 95 | 95 |
| 96 // Allow the user to select multiple devices. | 96 // Allow the user to select multiple devices. |
| 97 bool multiple() const { return multiple_; } | 97 bool multiple() const { return multiple_; } |
| 98 | 98 |
| 99 protected: | 99 protected: |
| 100 virtual ~Prompt(); | 100 virtual ~Prompt(); |
| 101 | 101 |
| 102 void AddCheckedDevice(scoped_ptr<DeviceInfo> device, bool allowed); | 102 void AddCheckedDevice(std::unique_ptr<DeviceInfo> device, bool allowed); |
| 103 | 103 |
| 104 const Extension* extension() const { return extension_; } | 104 const Extension* extension() const { return extension_; } |
| 105 Observer* observer() const { return observer_; } | 105 Observer* observer() const { return observer_; } |
| 106 content::BrowserContext* browser_context() const { | 106 content::BrowserContext* browser_context() const { |
| 107 return browser_context_; | 107 return browser_context_; |
| 108 } | 108 } |
| 109 | 109 |
| 110 // Subclasses may fill this with a particular subclass of DeviceInfo and may | 110 // Subclasses may fill this with a particular subclass of DeviceInfo and may |
| 111 // assume that only that instances of that type are stored here. | 111 // assume that only that instances of that type are stored here. |
| 112 std::vector<scoped_ptr<DeviceInfo>> devices_; | 112 std::vector<std::unique_ptr<DeviceInfo>> devices_; |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 friend class base::RefCounted<Prompt>; | 115 friend class base::RefCounted<Prompt>; |
| 116 | 116 |
| 117 const extensions::Extension* extension_ = nullptr; | 117 const extensions::Extension* extension_ = nullptr; |
| 118 Observer* observer_ = nullptr; | 118 Observer* observer_ = nullptr; |
| 119 content::BrowserContext* browser_context_ = nullptr; | 119 content::BrowserContext* browser_context_ = nullptr; |
| 120 bool multiple_ = false; | 120 bool multiple_ = false; |
| 121 | 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(Prompt); | 122 DISALLOW_COPY_AND_ASSIGN(Prompt); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 // Parameters available to the UI implementation. | 157 // Parameters available to the UI implementation. |
| 158 scoped_refptr<Prompt> prompt_; | 158 scoped_refptr<Prompt> prompt_; |
| 159 | 159 |
| 160 DISALLOW_COPY_AND_ASSIGN(DevicePermissionsPrompt); | 160 DISALLOW_COPY_AND_ASSIGN(DevicePermissionsPrompt); |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 } // namespace extensions | 163 } // namespace extensions |
| 164 | 164 |
| 165 #endif // EXTENSIONS_BROWSER_API_DEVICE_PERMISSIONS_PROMPT_H_ | 165 #endif // EXTENSIONS_BROWSER_API_DEVICE_PERMISSIONS_PROMPT_H_ |
| OLD | NEW |