| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_ | 6 #define CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <tuple> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 12 | 13 |
| 13 #if defined(USE_AURA) | 14 #if defined(USE_AURA) |
| 14 namespace aura { | 15 namespace aura { |
| 15 class Window; | 16 class Window; |
| 16 } // namespace aura | 17 } // namespace aura |
| 17 #endif // defined(USE_AURA) | 18 #endif // defined(USE_AURA) |
| 18 | 19 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 47 DesktopMediaID() = default; | 48 DesktopMediaID() = default; |
| 48 | 49 |
| 49 DesktopMediaID(Type type, Id id) | 50 DesktopMediaID(Type type, Id id) |
| 50 : type(type), | 51 : type(type), |
| 51 id(id) { | 52 id(id) { |
| 52 } | 53 } |
| 53 | 54 |
| 54 // Operators so that DesktopMediaID can be used with STL containers. | 55 // Operators so that DesktopMediaID can be used with STL containers. |
| 55 bool operator<(const DesktopMediaID& other) const { | 56 bool operator<(const DesktopMediaID& other) const { |
| 56 #if defined(USE_AURA) | 57 #if defined(USE_AURA) |
| 57 return (type < other.type || | 58 return std::tie(type, id, aura_id) < |
| 58 (type == other.type && | 59 std::tie(other.type, other.id, other.aura_id); |
| 59 (id < other.id || (id == other.id && | |
| 60 aura_id < other.aura_id)))); | |
| 61 #else | 60 #else |
| 62 return type < other.type || (type == other.type && id < other.id); | 61 return std::tie(type, id) < std::tie(other.type, other.id); |
| 63 #endif | 62 #endif |
| 64 } | 63 } |
| 65 bool operator==(const DesktopMediaID& other) const { | 64 bool operator==(const DesktopMediaID& other) const { |
| 66 #if defined(USE_AURA) | 65 #if defined(USE_AURA) |
| 67 return type == other.type && id == other.id && aura_id == other.aura_id; | 66 return type == other.type && id == other.id && aura_id == other.aura_id; |
| 68 #else | 67 #else |
| 69 return type == other.type && id == other.id; | 68 return type == other.type && id == other.id; |
| 70 #endif | 69 #endif |
| 71 } | 70 } |
| 72 | 71 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 84 Id id = kNullId; | 83 Id id = kNullId; |
| 85 #if defined(USE_AURA) | 84 #if defined(USE_AURA) |
| 86 // TODO(miu): Make this an int, after clean-up for http://crbug.com/513490. | 85 // TODO(miu): Make this an int, after clean-up for http://crbug.com/513490. |
| 87 Id aura_id = kNullId; | 86 Id aura_id = kNullId; |
| 88 #endif | 87 #endif |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 } // namespace content | 90 } // namespace content |
| 92 | 91 |
| 93 #endif // CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_ | 92 #endif // CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_ |
| OLD | NEW |