| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_CLIENT_PEPPER_FAKE_BROWSER_H_ | |
| 6 #define REMOTING_CLIENT_PEPPER_FAKE_BROWSER_H_ | |
| 7 | |
| 8 #include "base/scoped_ptr.h" | |
| 9 #include "base/singleton.h" | |
| 10 #include "third_party/npapi/bindings/nphostapi.h" | |
| 11 #include "third_party/npapi/bindings/npapi_extensions.h" | |
| 12 | |
| 13 // Each ARGB pixel is stored in a 4-byte uint32. | |
| 14 #define ARGB_PIXEL_SIZE 4 | |
| 15 | |
| 16 class FakeBrowser { | |
| 17 public: | |
| 18 NPNetscapeFuncs* GetBrowserFuncs() { return browser_funcs_.get(); } | |
| 19 NPNExtensions* GetExtensions() { return extensions_.get(); } | |
| 20 | |
| 21 NPDevice* GetDevice2d() { return device2d_.get(); } | |
| 22 void ForceStrideInDeviceContext(bool forceStride); | |
| 23 | |
| 24 NPWindow* GetWindow() { return window_.get(); } | |
| 25 void GetWindowInfo(int* width, int* height) { | |
| 26 *width = width_; | |
| 27 *height = height_; | |
| 28 } | |
| 29 | |
| 30 uint32* AllocPixelBuffer(int stride); | |
| 31 void FreePixelBuffer(); | |
| 32 | |
| 33 uint32* GetPixelBuffer() { return pixel_buffer_.get(); } | |
| 34 int GetPixelBufferStride() { return stride_; } | |
| 35 | |
| 36 private: | |
| 37 // Singleton private bits. | |
| 38 friend struct DefaultSingletonTraits<FakeBrowser>; | |
| 39 FakeBrowser(); | |
| 40 virtual ~FakeBrowser(); | |
| 41 | |
| 42 // Browser callback functions. | |
| 43 scoped_ptr<NPNetscapeFuncs> browser_funcs_; | |
| 44 | |
| 45 // Browser extension callbacks. | |
| 46 scoped_ptr<NPNExtensions> extensions_; | |
| 47 | |
| 48 // The rendering device (provided by the browser to the plugin). | |
| 49 scoped_ptr<NPDevice> device2d_; | |
| 50 | |
| 51 // Window (provided by the browser to the plugin). | |
| 52 scoped_ptr<NPWindow> window_; | |
| 53 | |
| 54 // Pixel buffer to store the device2d_ (and window_) pixels. | |
| 55 scoped_array<uint32> pixel_buffer_; | |
| 56 int width_, height_, stride_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(FakeBrowser); | |
| 59 }; | |
| 60 | |
| 61 #endif // REMOTING_CLIENT_PEPPER_FAKE_BROWSER_H_ | |
| OLD | NEW |