Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: webkit/plugins/ppapi/ppb_scrollbar_impl.cc

Issue 5828003: Move the Pepper implementation from webkit/glue/plugins/pepper_* to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/ppb_scrollbar_impl.h ('k') | webkit/plugins/ppapi/ppb_transport_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_scrollbar_impl.cc
===================================================================
--- webkit/plugins/ppapi/ppb_scrollbar_impl.cc (revision 0)
+++ webkit/plugins/ppapi/ppb_scrollbar_impl.cc (working copy)
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/glue/plugins/pepper_scrollbar.h"
+#include "webkit/plugins/ppapi/ppb_scrollbar_impl.h"
#include "base/logging.h"
#include "base/message_loop.h"
@@ -12,11 +12,11 @@
#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "third_party/WebKit/WebKit/chromium/public/WebScrollbar.h"
#include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
-#include "webkit/glue/plugins/pepper_common.h"
-#include "webkit/glue/plugins/pepper_event_conversion.h"
-#include "webkit/glue/plugins/pepper_image_data.h"
-#include "webkit/glue/plugins/pepper_plugin_instance.h"
-#include "webkit/glue/plugins/pepper_plugin_module.h"
+#include "webkit/plugins/ppapi/common.h"
+#include "webkit/plugins/ppapi/event_conversion.h"
+#include "webkit/plugins/ppapi/plugin_instance.h"
+#include "webkit/plugins/ppapi/plugin_module.h"
+#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
#include "webkit/glue/webkit_glue.h"
#if defined(OS_WIN)
@@ -27,7 +27,8 @@
using WebKit::WebRect;
using WebKit::WebScrollbar;
-namespace pepper {
+namespace webkit {
+namespace ppapi {
namespace {
@@ -36,13 +37,13 @@
if (!instance)
return 0;
- scoped_refptr<Scrollbar> scrollbar(new Scrollbar(instance,
- PPBoolToBool(vertical)));
+ scoped_refptr<PPB_Scrollbar_Impl> scrollbar(
+ new PPB_Scrollbar_Impl(instance, PPBoolToBool(vertical)));
return scrollbar->GetReference();
}
PP_Bool IsScrollbar(PP_Resource resource) {
- return BoolToPPBool(!!Resource::GetAs<Scrollbar>(resource));
+ return BoolToPPBool(!!Resource::GetAs<PPB_Scrollbar_Impl>(resource));
}
uint32_t GetThickness() {
@@ -50,20 +51,23 @@
}
uint32_t GetValue(PP_Resource resource) {
- scoped_refptr<Scrollbar> scrollbar(Resource::GetAs<Scrollbar>(resource));
+ scoped_refptr<PPB_Scrollbar_Impl> scrollbar(
+ Resource::GetAs<PPB_Scrollbar_Impl>(resource));
if (!scrollbar)
return 0;
return scrollbar->GetValue();
}
void SetValue(PP_Resource resource, uint32_t value) {
- scoped_refptr<Scrollbar> scrollbar(Resource::GetAs<Scrollbar>(resource));
+ scoped_refptr<PPB_Scrollbar_Impl> scrollbar(
+ Resource::GetAs<PPB_Scrollbar_Impl>(resource));
if (scrollbar)
scrollbar->SetValue(value);
}
void SetDocumentSize(PP_Resource resource, uint32_t size) {
- scoped_refptr<Scrollbar> scrollbar(Resource::GetAs<Scrollbar>(resource));
+ scoped_refptr<PPB_Scrollbar_Impl> scrollbar(
+ Resource::GetAs<PPB_Scrollbar_Impl>(resource));
if (scrollbar)
scrollbar->SetDocumentSize(size);
}
@@ -71,13 +75,15 @@
void SetTickMarks(PP_Resource resource,
const PP_Rect* tick_marks,
uint32_t count) {
- scoped_refptr<Scrollbar> scrollbar(Resource::GetAs<Scrollbar>(resource));
+ scoped_refptr<PPB_Scrollbar_Impl> scrollbar(
+ Resource::GetAs<PPB_Scrollbar_Impl>(resource));
if (scrollbar)
scrollbar->SetTickMarks(tick_marks, count);
}
void ScrollBy(PP_Resource resource, PP_ScrollBy_Dev unit, int32_t multiplier) {
- scoped_refptr<Scrollbar> scrollbar(Resource::GetAs<Scrollbar>(resource));
+ scoped_refptr<PPB_Scrollbar_Impl> scrollbar(
+ Resource::GetAs<PPB_Scrollbar_Impl>(resource));
if (scrollbar)
scrollbar->ScrollBy(unit, multiplier);
}
@@ -95,38 +101,39 @@
} // namespace
-Scrollbar::Scrollbar(PluginInstance* instance, bool vertical)
- : Widget(instance) {
+PPB_Scrollbar_Impl::PPB_Scrollbar_Impl(PluginInstance* instance, bool vertical)
+ : PPB_Widget_Impl(instance) {
scrollbar_.reset(WebScrollbar::create(
static_cast<WebKit::WebScrollbarClient*>(this),
vertical ? WebScrollbar::Vertical : WebScrollbar::Horizontal));
}
-Scrollbar::~Scrollbar() {
+PPB_Scrollbar_Impl::~PPB_Scrollbar_Impl() {
}
// static
-const PPB_Scrollbar_Dev* Scrollbar::GetInterface() {
+const PPB_Scrollbar_Dev* PPB_Scrollbar_Impl::GetInterface() {
return &ppb_scrollbar;
}
-Scrollbar* Scrollbar::AsScrollbar() {
+PPB_Scrollbar_Impl* PPB_Scrollbar_Impl::AsPPB_Scrollbar_Impl() {
return this;
}
-uint32_t Scrollbar::GetValue() {
+uint32_t PPB_Scrollbar_Impl::GetValue() {
return scrollbar_->value();
}
-void Scrollbar::SetValue(uint32_t value) {
+void PPB_Scrollbar_Impl::SetValue(uint32_t value) {
scrollbar_->setValue(value);
}
-void Scrollbar::SetDocumentSize(uint32_t size) {
+void PPB_Scrollbar_Impl::SetDocumentSize(uint32_t size) {
scrollbar_->setDocumentSize(size);
}
-void Scrollbar::SetTickMarks(const PP_Rect* tick_marks, uint32_t count) {
+void PPB_Scrollbar_Impl::SetTickMarks(const PP_Rect* tick_marks,
+ uint32_t count) {
tickmarks_.resize(count);
for (uint32 i = 0; i < count; ++i) {
tickmarks_[i] = WebRect(tick_marks[i].point.x,
@@ -138,7 +145,7 @@
Invalidate(&rect);
}
-void Scrollbar::ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) {
+void PPB_Scrollbar_Impl::ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) {
WebScrollbar::ScrollDirection direction = multiplier >= 0 ?
WebScrollbar::ScrollForward : WebScrollbar::ScrollBackward;
float fmultiplier = 1.0;
@@ -159,7 +166,7 @@
scrollbar_->scroll(direction, granularity, fmultiplier);
}
-bool Scrollbar::Paint(const PP_Rect* rect, ImageData* image) {
+bool PPB_Scrollbar_Impl::Paint(const PP_Rect* rect, PPB_ImageData_Impl* image) {
gfx::Rect gfx_rect(rect->point.x,
rect->point.y,
rect->size.width,
@@ -179,7 +186,7 @@
return true;
}
-bool Scrollbar::HandleEvent(const PP_InputEvent* event) {
+bool PPB_Scrollbar_Impl::HandleEvent(const PP_InputEvent* event) {
scoped_ptr<WebInputEvent> web_input_event(CreateWebInputEvent(*event));
if (!web_input_event.get())
return false;
@@ -187,14 +194,14 @@
return scrollbar_->handleInputEvent(*web_input_event.get());
}
-void Scrollbar::SetLocationInternal(const PP_Rect* location) {
+void PPB_Scrollbar_Impl::SetLocationInternal(const PP_Rect* location) {
scrollbar_->setLocation(WebRect(location->point.x,
location->point.y,
location->size.width,
location->size.height));
}
-void Scrollbar::valueChanged(WebKit::WebScrollbar* scrollbar) {
+void PPB_Scrollbar_Impl::valueChanged(WebKit::WebScrollbar* scrollbar) {
const PPP_Scrollbar_Dev* ppp_scrollbar =
static_cast<const PPP_Scrollbar_Dev*>(
module()->GetPluginInterface(PPP_SCROLLBAR_DEV_INTERFACE));
@@ -205,22 +212,23 @@
instance()->pp_instance(), resource.id, scrollbar_->value());
}
-void Scrollbar::invalidateScrollbarRect(WebKit::WebScrollbar* scrollbar,
- const WebKit::WebRect& rect) {
+void PPB_Scrollbar_Impl::invalidateScrollbarRect(
+ WebKit::WebScrollbar* scrollbar,
+ const WebKit::WebRect& rect) {
gfx::Rect gfx_rect(rect.x,
rect.y,
rect.width,
rect.height);
dirty_ = dirty_.Union(gfx_rect);
// Can't call into the client to tell them about the invalidate right away,
- // since the Scrollbar code is still in the middle of updating its internal
- // state.
+ // since the PPB_Scrollbar_Impl code is still in the middle of updating its
+ // internal state.
MessageLoop::current()->PostTask(
FROM_HERE,
- NewRunnableMethod(this, &Scrollbar::NotifyInvalidate));
+ NewRunnableMethod(this, &PPB_Scrollbar_Impl::NotifyInvalidate));
}
-void Scrollbar::getTickmarks(
+void PPB_Scrollbar_Impl::getTickmarks(
WebKit::WebScrollbar* scrollbar,
WebKit::WebVector<WebKit::WebRect>* tick_marks) const {
if (tickmarks_.empty()) {
@@ -231,7 +239,7 @@
}
}
-void Scrollbar::NotifyInvalidate() {
+void PPB_Scrollbar_Impl::NotifyInvalidate() {
if (dirty_.IsEmpty())
return;
PP_Rect pp_rect;
@@ -243,4 +251,6 @@
Invalidate(&pp_rect);
}
-} // namespace pepper
+} // namespace ppapi
+} // namespace webkit
+
« no previous file with comments | « webkit/plugins/ppapi/ppb_scrollbar_impl.h ('k') | webkit/plugins/ppapi/ppb_transport_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698