1 /* 2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef WEBRTC_BASE_WINDOWPICKER_H_ 12 #define WEBRTC_BASE_WINDOWPICKER_H_ 13 14 #include <string> 15 #include <vector> 16 17 #include "webrtc/base/window.h" 18 19 namespace rtc { 20 21 class WindowDescription { 22 public: 23 WindowDescription() : id_() {} 24 WindowDescription(const WindowId& id, const std::string& title) 25 : id_(id), title_(title) { 26 } 27 const WindowId& id() const { return id_; } 28 void set_id(const WindowId& id) { id_ = id; } 29 const std::string& title() const { return title_; } 30 void set_title(const std::string& title) { title_ = title; } 31 32 private: 33 WindowId id_; 34 std::string title_; 35 }; 36 37 class DesktopDescription { 38 public: 39 DesktopDescription() : id_() {} 40 DesktopDescription(const DesktopId& id, const std::string& title) 41 : id_(id), title_(title), primary_(false) { 42 } 43 const DesktopId& id() const { return id_; } 44 void set_id(const DesktopId& id) { id_ = id; } 45 const std::string& title() const { return title_; } 46 void set_title(const std::string& title) { title_ = title; } 47 // Indicates whether it is the primary desktop in the system. 48 bool primary() const { return primary_; } 49 void set_primary(bool primary) { primary_ = primary; } 50 51 private: 52 DesktopId id_; 53 std::string title_; 54 bool primary_; 55 }; 56 57 typedef std::vector<WindowDescription> WindowDescriptionList; 58 typedef std::vector<DesktopDescription> DesktopDescriptionList; 59 60 class WindowPicker { 61 public: 62 virtual ~WindowPicker() {} 63 virtual bool Init() = 0; 64 65 // TODO: Move this two methods to window.h when we no longer need to load 66 // CoreGraphics dynamically. 67 virtual bool IsVisible(const WindowId& id) = 0; 68 virtual bool MoveToFront(const WindowId& id) = 0; 69 70 // Gets a list of window description and appends to descriptions. 71 // Returns true if successful. 72 virtual bool GetWindowList(WindowDescriptionList* descriptions) = 0; 73 // Gets a list of desktop descriptions and appends to descriptions. 74 // Returns true if successful. 75 virtual bool GetDesktopList(DesktopDescriptionList* descriptions) = 0; 76 // Gets the width and height of a desktop. 77 // Returns true if successful. 78 virtual bool GetDesktopDimensions(const DesktopId& id, int* width, 79 int* height) = 0; 80 }; 81 82 } // namespace rtc 83 84 #endif // WEBRTC_BASE_WINDOWPICKER_H_ 85