Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: content/public/browser/desktop_media_id.h

Issue 1503563004: Desktop chrome tab capture-chooseDesktopMedia() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698