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

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

Issue 615133002: Add support for a virtual display on ChromeOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix remaining comment periods (thanks achuithb@) Created 5 years, 10 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
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/browser/desktop_media_id.h" 5 #include "content/public/browser/desktop_media_id.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 #endif // defined(USE_AURA) 75 #endif // defined(USE_AURA)
76 76
77 } // namespace 77 } // namespace
78 78
79 namespace content { 79 namespace content {
80 80
81 const char kScreenPrefix[] = "screen"; 81 const char kScreenPrefix[] = "screen";
82 const char kWindowPrefix[] = "window"; 82 const char kWindowPrefix[] = "window";
83 const char kAuraWindowPrefix[] = "aura_window"; 83 const char kAuraWindowPrefix[] = "aura_window";
84 const char kAuraVirtualScreenPrefix[] = "aura_virtual_screen";
84 85
85 #if defined(USE_AURA) 86 #if defined(USE_AURA)
86 87
87 // static 88 // static
88 DesktopMediaID DesktopMediaID::RegisterAuraWindow(aura::Window* window) { 89 DesktopMediaID DesktopMediaID::RegisterAuraWindow(aura::Window* window) {
89 return DesktopMediaID( 90 return DesktopMediaID(
90 TYPE_AURA_WINDOW, 91 TYPE_AURA_WINDOW,
91 AuraWindowRegistry::GetInstance()->RegisterWindow(window)); 92 AuraWindowRegistry::GetInstance()->RegisterWindow(window));
92 } 93 }
93 94
(...skipping 13 matching lines...) Expand all
107 if (parts.size() != 2) 108 if (parts.size() != 2)
108 return DesktopMediaID(TYPE_NONE, 0); 109 return DesktopMediaID(TYPE_NONE, 0);
109 110
110 Type type = TYPE_NONE; 111 Type type = TYPE_NONE;
111 if (parts[0] == kScreenPrefix) { 112 if (parts[0] == kScreenPrefix) {
112 type = TYPE_SCREEN; 113 type = TYPE_SCREEN;
113 } else if (parts[0] == kWindowPrefix) { 114 } else if (parts[0] == kWindowPrefix) {
114 type = TYPE_WINDOW; 115 type = TYPE_WINDOW;
115 } else if (parts[0] == kAuraWindowPrefix) { 116 } else if (parts[0] == kAuraWindowPrefix) {
116 type = TYPE_AURA_WINDOW; 117 type = TYPE_AURA_WINDOW;
118 } else if (parts[0] == kAuraVirtualScreenPrefix) {
119 type = TYPE_AURA_VIRTUAL_SCREEN;
117 } else { 120 } else {
118 return DesktopMediaID(TYPE_NONE, 0); 121 return DesktopMediaID(TYPE_NONE, 0);
119 } 122 }
120 123
121 int64 id; 124 int64 id;
122 if (!base::StringToInt64(parts[1], &id)) 125 if (!base::StringToInt64(parts[1], &id))
123 return DesktopMediaID(TYPE_NONE, 0); 126 return DesktopMediaID(TYPE_NONE, 0);
124 127
125 return DesktopMediaID(type, id); 128 return DesktopMediaID(type, id);
126 } 129 }
127 130
128 std::string DesktopMediaID::ToString() { 131 std::string DesktopMediaID::ToString() {
129 std::string prefix; 132 std::string prefix;
130 switch (type) { 133 switch (type) {
131 case TYPE_NONE: 134 case TYPE_NONE:
132 NOTREACHED(); 135 NOTREACHED();
133 return std::string(); 136 return std::string();
134 case TYPE_SCREEN: 137 case TYPE_SCREEN:
135 prefix = kScreenPrefix; 138 prefix = kScreenPrefix;
136 break; 139 break;
137 case TYPE_WINDOW: 140 case TYPE_WINDOW:
138 prefix = kWindowPrefix; 141 prefix = kWindowPrefix;
139 break; 142 break;
140 case TYPE_AURA_WINDOW: 143 case TYPE_AURA_WINDOW:
141 prefix = kAuraWindowPrefix; 144 prefix = kAuraWindowPrefix;
142 break; 145 break;
146 case TYPE_AURA_VIRTUAL_SCREEN:
147 prefix = kAuraVirtualScreenPrefix;
148 break;
143 } 149 }
144 DCHECK(!prefix.empty()); 150 DCHECK(!prefix.empty());
145 151
146 prefix.append(":"); 152 prefix.append(":");
147 prefix.append(base::Int64ToString(id)); 153 prefix.append(base::Int64ToString(id));
148 154
149 return prefix; 155 return prefix;
150 } 156 }
151 157
152 } // namespace content 158 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698