Chromium Code Reviews| 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 #include "content/public/browser/desktop_media_id.h" | 5 #include "content/public/browser/desktop_media_id.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 audio_share == other.audio_share; | 119 audio_share == other.audio_share; |
| 120 #endif | 120 #endif |
| 121 } | 121 } |
| 122 | 122 |
| 123 // static | 123 // static |
| 124 // Input string should in format: | 124 // Input string should in format: |
| 125 // for WebContents: | 125 // for WebContents: |
| 126 // web-contents-media-stream://"render_process_id":"render_process_id" | 126 // web-contents-media-stream://"render_process_id":"render_process_id" |
| 127 // for no aura screen and window: screen:"window_id" or window:"window_id" | 127 // for no aura screen and window: screen:"window_id" or window:"window_id" |
| 128 // for aura screen and window: screen:"window_id:aura_id" or | 128 // for aura screen and window: screen:"window_id:aura_id" or |
| 129 // window:"window_id:aura_id". | 129 // window:"window_id:aura_id". |
|
dcheng
2016/09/16 22:36:04
It doesn't have to be done in this CL... but can w
qiangchen
2016/09/16 22:45:52
Good suggestion. But I think one reason we use str
| |
| 130 DesktopMediaID DesktopMediaID::Parse(const std::string& str) { | 130 DesktopMediaID DesktopMediaID::Parse(const std::string& str) { |
| 131 // For WebContents type. | 131 // For WebContents type. |
| 132 WebContentsMediaCaptureId web_id = WebContentsMediaCaptureId::Parse(str); | 132 WebContentsMediaCaptureId web_id; |
| 133 if (!web_id.is_null()) | 133 if (WebContentsMediaCaptureId::Parse(str, &web_id)) |
| 134 return DesktopMediaID(TYPE_WEB_CONTENTS, 0, web_id); | 134 return DesktopMediaID(TYPE_WEB_CONTENTS, 0, web_id); |
| 135 | 135 |
| 136 // For screen and window types. | 136 // For screen and window types. |
| 137 std::vector<std::string> parts = base::SplitString( | 137 std::vector<std::string> parts = base::SplitString( |
| 138 str, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 138 str, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 139 | 139 |
| 140 #if defined(USE_AURA) | 140 #if defined(USE_AURA) |
| 141 if (parts.size() != 3) | 141 if (parts.size() != 3) |
| 142 return DesktopMediaID(); | 142 return DesktopMediaID(); |
| 143 #else | 143 #else |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 | 194 |
| 195 #if defined(USE_AURA) | 195 #if defined(USE_AURA) |
| 196 prefix.append(":"); | 196 prefix.append(":"); |
| 197 prefix.append(base::Int64ToString(aura_id)); | 197 prefix.append(base::Int64ToString(aura_id)); |
| 198 #endif // defined(USE_AURA) | 198 #endif // defined(USE_AURA) |
| 199 | 199 |
| 200 return prefix; | 200 return prefix; |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace content | 203 } // namespace content |
| OLD | NEW |