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

Side by Side Diff: content/public/common/desktop_media_id.cc

Issue 23726015: All together now (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_cap
Patch Set: Created 7 years, 3 months 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 unified diff | Download patch
« no previous file with comments | « content/public/common/desktop_media_id.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/desktop_media_id.h" 5 #include "content/public/common/desktop_media_id.h"
6 6
7 namespace content { 7 namespace content {
8 8
9 // static 9 // static
10 DesktopMediaID DesktopMediaID::Parse(const std::string& str) { 10 DesktopMediaID DesktopMediaID::Parse(const std::string& str) {
11 if (str == "screen") 11 if (str == "screen")
12 return DesktopMediaID(TYPE_SCREEN, 0); 12 return DesktopMediaID(TYPE_SCREEN, 0);
13 13
14 std::string window_prefix("window:"); 14 std::string window_prefix("window:");
15 if (StartsWithASCII(str, window_prefix, true)) { 15 if (StartsWithASCII(str, window_prefix, true)) {
16 int64 id; 16 int64 id;
17 if (!base::StringToInt64(str.substr(window_prefix.size()), &id)) 17 if (!base::StringToInt64(str.substr(window_prefix.size()), &id))
18 return DesktopMediaID(TYPE_NONE, 0); 18 return DesktopMediaID(TYPE_NONE, 0);
19 return DesktopMediaID(TYPE_WINDOW, id); 19 return DesktopMediaID(TYPE_WINDOW, id);
20 } 20 }
21 21
22 return DesktopMediaID(TYPE_NONE, 0); 22 return DesktopMediaID(TYPE_NONE, 0);
23 } 23 }
24 24
25 std::string DesktopMediaID::ToString() { 25 std::string DesktopMediaID::ToString() const {
26 switch (type) { 26 switch (type) {
27 case TYPE_NONE: 27 case TYPE_NONE:
28 NOTREACHED(); 28 NOTREACHED();
29 return std::string(); 29 return std::string();
30 30
31 case TYPE_SCREEN: 31 case TYPE_SCREEN:
32 return "screen"; 32 return "screen";
33 33
34 case TYPE_WINDOW: 34 case TYPE_WINDOW:
35 return "window:" + base::Int64ToString(id); 35 return "window:" + base::Int64ToString(id);
36 } 36 }
37 NOTREACHED(); 37 NOTREACHED();
38 return std::string(); 38 return std::string();
39 } 39 }
40 40
41 } // namespace content 41 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/desktop_media_id.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698