OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
9 | 9 |
10 namespace remoting { | 10 namespace remoting { |
11 | 11 |
12 class HostMessage; | 12 class HostMessage; |
13 | 13 |
14 // ChromotingView defines the behavior of an object that draws a view of the | 14 // ChromotingView defines the behavior of an object that draws a view of the |
15 // remote desktop. Its main function is to choose the right decoder and render | 15 // remote desktop. Its main function is to choose the right decoder and render |
16 // the update stream onto the screen. | 16 // the update stream onto the screen. |
17 class ChromotingView { | 17 class ChromotingView { |
18 public: | 18 public: |
19 virtual ~ChromotingView() {} | 19 virtual ~ChromotingView() {} |
20 | 20 |
| 21 // Initialize the common structures for the view. |
| 22 virtual bool Initialize() = 0; |
| 23 |
| 24 // Free up resources allocated by this view. |
| 25 virtual void TearDown() = 0; |
| 26 |
21 // Tells the ChromotingView to paint the current image on the screen. | 27 // Tells the ChromotingView to paint the current image on the screen. |
22 // TODO(hclam): Add rects as parameter if needed. | 28 // TODO(hclam): Add rects as parameter if needed. |
23 virtual void Paint() = 0; | 29 virtual void Paint() = 0; |
24 | 30 |
25 // Fill the screen with one single static color, and ignore updates. | 31 // Fill the screen with one single static color, and ignore updates. |
26 // Useful for debugging. | 32 // Useful for debugging. |
27 virtual void SetSolidFill(uint32 color) = 0; | 33 virtual void SetSolidFill(uint32 color) = 0; |
28 | 34 |
29 // Removes a previously set solid fill. If no fill was previous set, this | 35 // Removes a previously set solid fill. If no fill was previous set, this |
30 // does nothing. | 36 // does nothing. |
31 virtual void UnsetSolidFill() = 0; | 37 virtual void UnsetSolidFill() = 0; |
32 | 38 |
33 // Reposition and resize the viewport into the backing store. If the viewport | 39 // Reposition and resize the viewport into the backing store. If the viewport |
34 // extends past the end of the backing store, it is filled with black. | 40 // extends past the end of the backing store, it is filled with black. |
35 virtual void SetViewport(int x, int y, int width, int height) = 0; | 41 virtual void SetViewport(int x, int y, int width, int height) = 0; |
36 | 42 |
37 // Resize the underlying image that is displayed. This should match the size | 43 // Resize the underlying image that contains the host screen buffer. |
38 // of the output from the decoder. | 44 // This should match the size of the output from the decoder. |
39 // | 45 // |
40 // TODO(ajwong): We need a better name. Look at how Java represents this | 46 // TODO(garykac): This handles only 1 screen. We need multi-screen support. |
41 // stuff? | 47 virtual void SetHostScreenSize(int width, int height) = 0; |
42 virtual void SetBackingStoreSize(int width, int height) = 0; | |
43 | 48 |
44 // Handle the BeginUpdateStream message. | 49 // Handle the BeginUpdateStream message. |
45 virtual void HandleBeginUpdateStream(HostMessage* msg) = 0; | 50 virtual void HandleBeginUpdateStream(HostMessage* msg) = 0; |
46 | 51 |
47 // Handle the UpdateStreamPacket message. | 52 // Handle the UpdateStreamPacket message. |
48 virtual void HandleUpdateStreamPacket(HostMessage* msg) = 0; | 53 virtual void HandleUpdateStreamPacket(HostMessage* msg) = 0; |
49 | 54 |
50 // Handle the EndUpdateStream message. | 55 // Handle the EndUpdateStream message. |
51 virtual void HandleEndUpdateStream(HostMessage* msg) = 0; | 56 virtual void HandleEndUpdateStream(HostMessage* msg) = 0; |
52 }; | 57 }; |
53 | 58 |
54 } // namespace remoting | 59 } // namespace remoting |
55 | 60 |
56 #endif // REMOTING_CLIENT_CHROMOTING_VIEW_H_ | 61 #endif // REMOTING_CLIENT_CHROMOTING_VIEW_H_ |
OLD | NEW |