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

Unified Diff: content/public/browser/web_contents_media_capture_id.cc

Issue 1503563004: Desktop chrome tab capture-chooseDesktopMedia() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review round 1 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/web_contents_media_capture_id.cc
diff --git a/content/browser/media/capture/web_contents_capture_util.cc b/content/public/browser/web_contents_media_capture_id.cc
similarity index 59%
rename from content/browser/media/capture/web_contents_capture_util.cc
rename to content/public/browser/web_contents_media_capture_id.cc
index 0edaf4a047d49df0af47ad674b54089a107340f7..cf36f4c520296a044bb623dafca94d2ef3fa4a6e 100644
--- a/content/browser/media/capture/web_contents_capture_util.cc
+++ b/content/public/browser/web_contents_media_capture_id.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/media/capture/web_contents_capture_util.h"
+#include "content/public/browser/web_contents_media_capture_id.h"
#include "base/basictypes.h"
#include "base/strings/string_number_conversions.h"
@@ -10,14 +10,49 @@
#include "base/strings/string_util.h"
namespace content {
+bool WebContentsMediaCaptureId::operator<(
+ const WebContentsMediaCaptureId& other) const {
+ return std::tie(render_process_id, main_render_frame_id) <
+ std::tie(other.render_process_id, other.main_render_frame_id);
+}
+
+bool WebContentsMediaCaptureId::operator==(
+ const WebContentsMediaCaptureId& other) const {
+ return std::tie(render_process_id, main_render_frame_id) ==
+ std::tie(other.render_process_id, other.main_render_frame_id);
+}
+
+bool WebContentsMediaCaptureId::is_null() const {
+ return (render_process_id < 0) || (main_render_frame_id < 0);
+}
+
+std::string WebContentsMediaCaptureId::ToString() const {
+ std::string s = kTabPrefix;
+ s.append("://");
+ s.append(base::Int64ToString(render_process_id));
+ s.append(":");
+ s.append(base::Int64ToString(main_render_frame_id));
+
+ return s;
+}
+
+WebContentsMediaCaptureId WebContentsMediaCaptureId::Parse(
+ const std::string& str){
+ int render_process_id;
+ int main_render_frame_id;
+ if(ExtractTabCaptureTarget(str, &render_process_id, &main_render_frame_id))
miu 2015/12/12 00:00:33 style: Space after "if" and before open parenthesi
GeorgeZ 2015/12/14 18:33:07 Done.
+ return WebContentsMediaCaptureId(render_process_id, main_render_frame_id);
+ else
+ return WebContentsMediaCaptureId();
+}
-bool WebContentsCaptureUtil::IsWebContentsDeviceId(
+bool WebContentsMediaCaptureId::IsWebContentsDeviceId(
const std::string& device_id) {
int ignored;
return ExtractTabCaptureTarget(device_id, &ignored, &ignored);
}
-bool WebContentsCaptureUtil::ExtractTabCaptureTarget(
+bool WebContentsMediaCaptureId::ExtractTabCaptureTarget(
const std::string& device_id_param,
int* render_process_id,
int* main_render_frame_id) {
@@ -44,7 +79,7 @@ bool WebContentsCaptureUtil::ExtractTabCaptureTarget(
base::StringToInt(component2, main_render_frame_id));
}
-bool WebContentsCaptureUtil::IsAutoThrottlingOptionSet(
+bool WebContentsMediaCaptureId::IsAutoThrottlingOptionSet(
const std::string& device_id) {
if (!IsWebContentsDeviceId(device_id))
return false;

Powered by Google App Engine
This is Rietveld 408576698