This source file includes following definitions.
- Show
- GetCompositor
- Draw
- Create
#include "ui/compositor/test/test_compositor_host.h"
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "ui/compositor/compositor.h"
#include "ui/gfx/rect.h"
namespace ui {
class TestCompositorHostOzone : public TestCompositorHost {
public:
TestCompositorHostOzone(const gfx::Rect& bounds);
virtual ~TestCompositorHostOzone();
private:
virtual void Show() OVERRIDE;
virtual ui::Compositor* GetCompositor() OVERRIDE;
void Draw();
gfx::Rect bounds_;
scoped_ptr<ui::Compositor> compositor_;
DISALLOW_COPY_AND_ASSIGN(TestCompositorHostOzone);
};
TestCompositorHostOzone::TestCompositorHostOzone(const gfx::Rect& bounds)
: bounds_(bounds) {}
TestCompositorHostOzone::~TestCompositorHostOzone() {}
void TestCompositorHostOzone::Show() {
compositor_.reset(new ui::Compositor(1));
compositor_->SetScaleAndSize(1.0f, bounds_.size());
}
ui::Compositor* TestCompositorHostOzone::GetCompositor() {
return compositor_.get();
}
void TestCompositorHostOzone::Draw() {
if (compositor_.get())
compositor_->Draw();
}
TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) {
return new TestCompositorHostOzone(bounds);
}
}