summaryrefslogtreecommitdiffstats
path: root/remoting/client/pepper/fake_browser.h
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/client/pepper/fake_browser.h')
-rw-r--r--remoting/client/pepper/fake_browser.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/remoting/client/pepper/fake_browser.h b/remoting/client/pepper/fake_browser.h
new file mode 100644
index 0000000..b9f2e15
--- /dev/null
+++ b/remoting/client/pepper/fake_browser.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_CLIENT_PEPPER_FAKE_BROWSER_H_
+#define REMOTING_CLIENT_PEPPER_FAKE_BROWSER_H_
+
+#include "base/scoped_ptr.h"
+#include "base/singleton.h"
+#include "third_party/npapi/bindings/nphostapi.h"
+#include "third_party/npapi/bindings/npapi_extensions.h"
+
+// Each ARGB pixel is stored in a 4-byte uint32.
+#define ARGB_PIXEL_SIZE 4
+
+class FakeBrowser {
+ public:
+ NPNetscapeFuncs* GetBrowserFuncs() { return browser_funcs_.get(); }
+ NPNExtensions* GetExtensions() { return extensions_.get(); }
+
+ NPDevice* GetDevice2d() { return device2d_.get(); }
+ void ForceStrideInDeviceContext(bool forceStride);
+
+ NPWindow* GetWindow() { return window_.get(); }
+ void GetWindowInfo(int* width, int* height) {
+ *width = width_;
+ *height = height_;
+ }
+
+ uint32* AllocPixelBuffer(int stride);
+ void FreePixelBuffer();
+
+ uint32* GetPixelBuffer() { return pixel_buffer_.get(); }
+ int GetPixelBufferStride() { return stride_; }
+
+ private:
+ // Singleton private bits.
+ friend struct DefaultSingletonTraits<FakeBrowser>;
+ FakeBrowser();
+ virtual ~FakeBrowser();
+
+ // Browser callback functions.
+ scoped_ptr<NPNetscapeFuncs> browser_funcs_;
+
+ // Browser extension callbacks.
+ scoped_ptr<NPNExtensions> extensions_;
+
+ // The rendering device (provided by the browser to the plugin).
+ scoped_ptr<NPDevice> device2d_;
+
+ // Window (provided by the browser to the plugin).
+ scoped_ptr<NPWindow> window_;
+
+ // Pixel buffer to store the device2d_ (and window_) pixels.
+ scoped_array<uint32> pixel_buffer_;
+ int width_, height_, stride_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeBrowser);
+};
+
+#endif // REMOTING_CLIENT_PEPPER_FAKE_BROWSER_H_