| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef REMOTING_CLIENT_CHROMOTING_VIEW_H_ | 5 #ifndef REMOTING_CLIENT_CHROMOTING_VIEW_H_ |
| 6 #define REMOTING_CLIENT_CHROMOTING_VIEW_H_ | 6 #define REMOTING_CLIENT_CHROMOTING_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include "base/basictypes.h" |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "media/base/video_frame.h" | |
| 12 #include "remoting/protocol/connection_to_host.h" | 9 #include "remoting/protocol/connection_to_host.h" |
| 13 | 10 |
| 14 namespace remoting { | 11 namespace remoting { |
| 15 | 12 |
| 16 static const uint32 kCreatedColor = 0xffccccff; | 13 static const uint32 kCreatedColor = 0xffccccff; |
| 17 static const uint32 kDisconnectedColor = 0xff00ccff; | 14 static const uint32 kDisconnectedColor = 0xff00ccff; |
| 18 static const uint32 kFailedColor = 0xffcc00ff; | 15 static const uint32 kFailedColor = 0xffcc00ff; |
| 19 | 16 |
| 20 // ChromotingView defines the behavior of an object that draws a view of the | 17 // ChromotingView defines the behavior of an object that draws a view of the |
| 21 // remote desktop. Its main function is to render the update stream onto the | 18 // remote desktop. Its main function is to render the update stream onto the |
| 22 // screen. | 19 // screen. |
| 23 class ChromotingView { | 20 class ChromotingView { |
| 24 public: | 21 public: |
| 25 ChromotingView(); | 22 virtual ~ChromotingView() {} |
| 26 virtual ~ChromotingView(); | |
| 27 | |
| 28 // Get screen dimensions. | |
| 29 // TODO(garykac): This will need to be extended to support multi-monitors. | |
| 30 void GetScreenSize(int* width, int* height); | |
| 31 | 23 |
| 32 // Initialize the common structures for the view. | 24 // Initialize the common structures for the view. |
| 33 virtual bool Initialize() = 0; | 25 virtual bool Initialize() = 0; |
| 34 | 26 |
| 35 // Free up resources allocated by this view. | 27 // Free up resources allocated by this view. |
| 36 virtual void TearDown() = 0; | 28 virtual void TearDown() = 0; |
| 37 | 29 |
| 38 // Tells the ChromotingView to paint the current image on the screen. | 30 // Tells the ChromotingView to paint the current image on the screen. |
| 39 virtual void Paint() = 0; | 31 virtual void Paint() = 0; |
| 40 | 32 |
| 41 // Fill the screen with one single static color, and ignore updates. | 33 // Fill the screen with one single static color, and ignore updates. |
| 42 // Useful for debugging. | 34 // Useful for debugging. |
| 43 virtual void SetSolidFill(uint32 color) = 0; | 35 virtual void SetSolidFill(uint32 color) = 0; |
| 44 | 36 |
| 45 // Removes a previously set solid fill. If no fill was previous set, this | 37 // Removes a previously set solid fill. If no fill was previous set, this |
| 46 // does nothing. | 38 // does nothing. |
| 47 virtual void UnsetSolidFill() = 0; | 39 virtual void UnsetSolidFill() = 0; |
| 48 | 40 |
| 49 // Record the update the state of the connection, updating the UI as needed. | 41 // Record the update the state of the connection, updating the UI as needed. |
| 50 virtual void SetConnectionState(protocol::ConnectionToHost::State state, | 42 virtual void SetConnectionState(protocol::ConnectionToHost::State state, |
| 51 protocol::ConnectionToHost::Error error) = 0; | 43 protocol::ConnectionToHost::Error error) = 0; |
| 52 | |
| 53 // Return the horizontal scale factor of this view. | |
| 54 virtual double GetHorizontalScaleRatio() const = 0; | |
| 55 | |
| 56 // Return the vertical scale factor of this view. | |
| 57 virtual double GetVerticalScaleRatio() const = 0; | |
| 58 | |
| 59 protected: | |
| 60 // Framebuffer for the decoder. | |
| 61 scoped_refptr<media::VideoFrame> frame_; | |
| 62 | |
| 63 // Dimensions of |frame_| bitmap. | |
| 64 int frame_width_; | |
| 65 int frame_height_; | |
| 66 }; | 44 }; |
| 67 | 45 |
| 68 } // namespace remoting | 46 } // namespace remoting |
| 69 | 47 |
| 70 #endif // REMOTING_CLIENT_CHROMOTING_VIEW_H_ | 48 #endif // REMOTING_CLIENT_CHROMOTING_VIEW_H_ |
| OLD | NEW |