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

Unified Diff: components/plugins/renderer/webview_plugin.cc

Issue 23606022: Move renderer plugin code into a new component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move renderer plugin code into a new component - fix ios builds Created 7 years, 2 months 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 | « components/plugins/renderer/webview_plugin.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/plugins/renderer/webview_plugin.cc
diff --git a/chrome/renderer/plugins/webview_plugin.cc b/components/plugins/renderer/webview_plugin.cc
similarity index 81%
rename from chrome/renderer/plugins/webview_plugin.cc
rename to components/plugins/renderer/webview_plugin.cc
index 2853a3133eca5d6fe3f91798240c68a8a5e32cd2..4c2355cedd166912771797eb431246e889210705 100644
--- a/chrome/renderer/plugins/webview_plugin.cc
+++ b/components/plugins/renderer/webview_plugin.cc
@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/renderer/plugins/webview_plugin.h"
+#include "components/plugins/renderer/webview_plugin.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
+#include "base/safe_numerics.h"
#include "content/public/renderer/web_preferences.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/public/platform/WebSize.h"
@@ -42,9 +43,7 @@ using WebKit::WebVector;
using WebKit::WebView;
WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate)
- : delegate_(delegate),
- container_(NULL),
- finished_loading_(false) {
+ : delegate_(delegate), container_(NULL), finished_loading_(false) {
web_view_ = WebView::create(this);
web_view_->initializeMainFrame(this);
}
@@ -61,21 +60,24 @@ WebViewPlugin* WebViewPlugin::Create(WebViewPlugin::Delegate* delegate,
return plugin;
}
-WebViewPlugin::~WebViewPlugin() {
- web_view_->close();
-}
+WebViewPlugin::~WebViewPlugin() { web_view_->close(); }
void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) {
if (!response_.isNull()) {
plugin->didReceiveResponse(response_);
size_t total_bytes = 0;
- for (std::list<std::string>::iterator it = data_.begin();
- it != data_.end(); ++it) {
- plugin->didReceiveData(it->c_str(), it->length());
+ for (std::list<std::string>::iterator it = data_.begin(); it != data_.end();
+ ++it) {
+ plugin->didReceiveData(
+ it->c_str(), base::checked_numeric_cast<int, size_t>(it->length()));
total_bytes += it->length();
}
- UMA_HISTOGRAM_MEMORY_KB("PluginDocument.Memory", (total_bytes / 1024));
- UMA_HISTOGRAM_COUNTS("PluginDocument.NumChunks", data_.size());
+ UMA_HISTOGRAM_MEMORY_KB(
+ "PluginDocument.Memory",
+ (base::checked_numeric_cast<int, size_t>(total_bytes / 1024)));
+ UMA_HISTOGRAM_COUNTS(
+ "PluginDocument.NumChunks",
+ (base::checked_numeric_cast<int, size_t>(data_.size())));
}
if (finished_loading_) {
plugin->didFinishLoading();
@@ -90,9 +92,7 @@ void WebViewPlugin::RestoreTitleText() {
container_->element().setAttribute("title", old_title_);
}
-WebPluginContainer* WebViewPlugin::container() const {
- return container_;
-}
+WebPluginContainer* WebViewPlugin::container() const { return container_; }
bool WebViewPlugin::initialize(WebPluginContainer* container) {
container_ = container;
@@ -110,17 +110,11 @@ void WebViewPlugin::destroy() {
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
-NPObject* WebViewPlugin::scriptableObject() {
- return NULL;
-}
+NPObject* WebViewPlugin::scriptableObject() { return NULL; }
-struct _NPP* WebViewPlugin::pluginNPP() {
- return NULL;
-}
+struct _NPP* WebViewPlugin::pluginNPP() { return NULL; }
-bool WebViewPlugin::getFormValue(WebString& value) {
- return false;
-}
+bool WebViewPlugin::getFormValue(WebString& value) { return false; }
void WebViewPlugin::paint(WebCanvas* canvas, const WebRect& rect) {
gfx::Rect paint_rect = gfx::IntersectRects(rect_, rect);
@@ -139,18 +133,17 @@ void WebViewPlugin::paint(WebCanvas* canvas, const WebRect& rect) {
}
// Coordinates are relative to the containing window.
-void WebViewPlugin::updateGeometry(
- const WebRect& frame_rect, const WebRect& clip_rect,
- const WebVector<WebRect>& cut_out_rects, bool is_visible) {
+void WebViewPlugin::updateGeometry(const WebRect& frame_rect,
+ const WebRect& clip_rect,
+ const WebVector<WebRect>& cut_out_rects,
+ bool is_visible) {
if (static_cast<gfx::Rect>(frame_rect) != rect_) {
rect_ = frame_rect;
web_view_->resize(WebSize(frame_rect.width, frame_rect.height));
}
}
-bool WebViewPlugin::acceptsInputEvents() {
- return true;
-}
+bool WebViewPlugin::acceptsInputEvents() { return true; }
bool WebViewPlugin::handleInputEvent(const WebInputEvent& event,
WebCursorInfo& cursor) {
@@ -193,9 +186,7 @@ void WebViewPlugin::didFailLoading(const WebURLError& error) {
error_.reset(new WebURLError(error));
}
-bool WebViewPlugin::acceptsLoadDrops() {
- return false;
-}
+bool WebViewPlugin::acceptsLoadDrops() { return false; }
void WebViewPlugin::setToolTipText(const WebString& text,
WebKit::WebTextDirection hint) {
« no previous file with comments | « components/plugins/renderer/webview_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698