Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 package org.chromium.chrome.browser.preferences.website; | 5 package org.chromium.chrome.browser.preferences.website; |
| 6 | 6 |
| 7 import java.io.Serializable; | 7 import java.io.Serializable; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * USB device information for a given origin. | 10 * USB device information for a given origin. |
| 11 * | |
| 12 * These objects are compared only by the identity of the device, not by which s ite has permission | |
| 13 * to access it. | |
| 11 */ | 14 */ |
| 12 public class UsbInfo implements Serializable { | 15 public class UsbInfo implements Serializable { |
| 13 private final String mOrigin; | 16 private final String mOrigin; |
| 14 private final String mEmbedder; | 17 private final String mEmbedder; |
| 15 private final String mName; | 18 private final String mName; |
| 16 private final String mObject; | 19 private final String mObject; |
| 17 | 20 |
| 18 UsbInfo(String origin, String embedder, String name, String object) { | 21 UsbInfo(String origin, String embedder, String name, String object) { |
| 19 mOrigin = origin; | 22 mOrigin = origin; |
| 20 mEmbedder = embedder; | 23 mEmbedder = embedder; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 42 public String getName() { | 45 public String getName() { |
| 43 return mName; | 46 return mName; |
| 44 } | 47 } |
| 45 | 48 |
| 46 /** | 49 /** |
| 47 * Revokes permission for the origin to access the USB device. | 50 * Revokes permission for the origin to access the USB device. |
| 48 */ | 51 */ |
| 49 public void revoke() { | 52 public void revoke() { |
| 50 WebsitePreferenceBridge.nativeRevokeUsbPermission(mOrigin, mEmbedder, mO bject); | 53 WebsitePreferenceBridge.nativeRevokeUsbPermission(mOrigin, mEmbedder, mO bject); |
| 51 } | 54 } |
| 55 | |
| 56 @Override | |
| 57 public int hashCode() { | |
| 58 return mObject.hashCode(); | |
|
Ted C
2016/08/15 20:31:59
I find this to be somewhat odd.
Why not just expo
Reilly Grant (use Gerrit)
2016/08/16 17:41:59
Good idea, done.
| |
| 59 } | |
| 60 | |
| 61 @Override | |
| 62 public boolean equals(Object obj) { | |
| 63 if (obj instanceof UsbInfo) { | |
| 64 UsbInfo other = (UsbInfo) obj; | |
| 65 return mObject.equals(other.mObject); | |
| 66 } | |
| 67 return false; | |
| 68 } | |
| 52 } | 69 } |
| OLD | NEW |