Index: content/public/browser/desktop_media_id.h |
diff --git a/content/public/browser/desktop_media_id.h b/content/public/browser/desktop_media_id.h |
index 921dc952387dab40ed5ea88d05efa491f26067d9..640a79a671c16f28d9a9273369dca3755ee1f2a6 100644 |
--- a/content/public/browser/desktop_media_id.h |
+++ b/content/public/browser/desktop_media_id.h |
@@ -23,16 +23,13 @@ namespace content { |
// stored in MediaStreamRequest::requested_video_device_id. |
struct CONTENT_EXPORT DesktopMediaID { |
public: |
- enum Type { |
- TYPE_NONE, |
- TYPE_SCREEN, |
- TYPE_WINDOW, |
- }; |
+ enum Type { TYPE_NONE, TYPE_SCREEN, TYPE_WINDOW, TYPE_TAB }; |
typedef intptr_t Id; |
// Represents an "unset" value for either |id| or |aura_id|. |
static const Id kNullId = 0; |
+ static const int kINVALIDID = -1; |
qiangchen
2015/12/07 22:45:56
Any reason kNullId isn't sufficient to use?
miu
2015/12/08 01:54:38
style: kInvalidId
GeorgeZ
2015/12/09 19:36:38
This is to make the code safe. render_processor_id
GeorgeZ
2015/12/09 19:36:38
Done.
|
#if defined(USE_AURA) |
// Assigns integer identifier to the |window| and returns its DesktopMediaID. |
@@ -55,23 +52,32 @@ struct CONTENT_EXPORT DesktopMediaID { |
// Operators so that DesktopMediaID can be used with STL containers. |
bool operator<(const DesktopMediaID& other) const { |
#if defined(USE_AURA) |
- return std::tie(type, id, aura_id) < |
- std::tie(other.type, other.id, other.aura_id); |
+ return std::tie(type, id, aura_id, main_render_frame_id, |
+ render_process_id) < |
+ std::tie(other.type, other.id, other.aura_id, |
+ other.main_render_frame_id, other.render_process_id); |
#else |
- return std::tie(type, id) < std::tie(other.type, other.id); |
+ return std::tie(type, id, main_render_frame_id, render_process_id) < |
+ std::tie(other.type, other.id, other.main_render_frame_id, |
+ other.render_process_id); |
#endif |
} |
+ |
bool operator==(const DesktopMediaID& other) const { |
#if defined(USE_AURA) |
- return type == other.type && id == other.id && aura_id == other.aura_id; |
+ return type == other.type && id == other.id && aura_id == other.aura_id && |
+ render_process_id == other.render_process_id && |
+ main_render_frame_id == other.main_render_frame_id; |
#else |
- return type == other.type && id == other.id; |
+ return type == other.type && id == other.id && |
+ render_process_id == other.render_process_id && |
+ main_render_frame_id == other.main_render_frame_id; |
#endif |
} |
bool is_null() { return type == TYPE_NONE; } |
- std::string ToString(); |
+ std::string ToString() const; |
Type type = TYPE_NONE; |
@@ -85,6 +91,10 @@ struct CONTENT_EXPORT DesktopMediaID { |
// TODO(miu): Make this an int, after clean-up for http://crbug.com/513490. |
Id aura_id = kNullId; |
#endif |
+ |
+ // Tab video and audio capture need render process id and render frame id. |
+ int render_process_id = kINVALIDID; |
+ int main_render_frame_id = kINVALIDID; |
}; |
} // namespace content |