summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-21 21:42:29 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-21 21:42:29 +0000
commitd92c84f41f4635433aaffa6f2d5eb3ff8f5d3a9e (patch)
treec853a02524348e69157adcb29761405bda2c5369
parent9651f7f897fb73b2201a77b08ed3534ee9a5aa80 (diff)
downloadchromium_src-d92c84f41f4635433aaffa6f2d5eb3ff8f5d3a9e.zip
chromium_src-d92c84f41f4635433aaffa6f2d5eb3ff8f5d3a9e.tar.gz
chromium_src-d92c84f41f4635433aaffa6f2d5eb3ff8f5d3a9e.tar.bz2
- Remove whitespace at the end of the line
- A few spelling mistakes in the comments - Fix the order of initilization in the class (gcc warning) - use the string utility to convert between string type (gcc warning) - Ifdef the keyboard/mouse/painting which is currently only implemented on Windows Review URL: http://codereview.chromium.org/7827 Patch from Torchmobile Inc.. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3690 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/SConscript2
-rw-r--r--webkit/glue/webplugin_impl.cc64
-rw-r--r--webkit/glue/webplugin_impl.h16
3 files changed, 51 insertions, 31 deletions
diff --git a/webkit/glue/SConscript b/webkit/glue/SConscript
index 74881d9..f1a4c38 100644
--- a/webkit/glue/SConscript
+++ b/webkit/glue/SConscript
@@ -58,6 +58,7 @@ input_files = [
'webframeloaderclient_impl.cc',
'webhistoryitem_impl.cc',
'webkit_glue.cc',
+ 'webplugin_impl.cc',
'webtextinput_impl.cc',
'weburlrequest_impl.cc',
'webwidget_impl.cc',
@@ -82,7 +83,6 @@ if env['PLATFORM'] == 'win32':
'plugins/webplugin_delegate_impl.cc',
'webdropdata.cc',
'webinputevent_win.cc',
- 'webplugin_impl.cc',
])
env.ChromeStaticLibrary('glue', input_files)
diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc
index 46453c6..bdd6441 100644
--- a/webkit/glue/webplugin_impl.cc
+++ b/webkit/glue/webplugin_impl.cc
@@ -21,7 +21,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "FrameView.h"
#include "GraphicsContext.h"
#include "HTMLNames.h"
-#include "HTMLPluginElement.h"
+#include "HTMLPlugInElement.h"
#include "IntRect.h"
#include "KURL.h"
#include "KeyboardEvent.h"
@@ -50,12 +50,14 @@ MSVC_POP_WARNING();
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webplugin_impl.h"
#include "webkit/glue/plugins/plugin_host.h"
+#if defined(OS_WIN)
#include "webkit/glue/plugins/plugin_instance.h"
+#endif
#include "webkit/glue/stacking_order_iterator.h"
#include "webkit/glue/webview_impl.h"
#include "googleurl/src/gurl.h"
-// This class handles invididual multipart responses. It is instantiated when
+// This class handles individual multipart responses. It is instantiated when
// we receive HTTP status code 206 in the HTTP response. This indicates
// that the response could have multiple parts each separated by a boundary
// specified in the response header.
@@ -63,7 +65,7 @@ class MultiPartResponseClient : public WebCore::ResourceHandleClient {
public:
MultiPartResponseClient(WebPluginResourceClient* resource_client)
: resource_client_(resource_client) {
- Clear();
+ Clear();
}
// Called when the multipart parser encounters an embedded multipart
@@ -87,7 +89,7 @@ class MultiPartResponseClient : public WebCore::ResourceHandleClient {
resource_client_->DidReceiveData(
data, data_length, byte_range_lower_bound_);
}
-
+
void Clear() {
resource_response_ = WebCore::ResourceResponse();
byte_range_lower_bound_ = 0;
@@ -192,12 +194,12 @@ void WebPluginContainer::windowCutoutRects(const WebCore::IntRect& bounds,
void WebPluginContainer::didReceiveResponse(
const WebCore::ResourceResponse& response) {
-
+
HttpResponseInfo http_response_info;
ReadHttpResponseInfo(response, &http_response_info);
impl_->delegate_->DidReceiveManualResponse(
- http_response_info.url,
+ http_response_info.url,
base::SysWideToNativeMB(http_response_info.mime_type),
base::SysWideToNativeMB(impl_->GetAllHeaders(response)),
http_response_info.expected_length,
@@ -230,7 +232,7 @@ void WebPluginContainer::ReadHttpResponseInfo(
// If the length comes in as -1, then it indicates that it was not
// read off the HTTP headers. We replicate Safari webkit behavior here,
// which is to set it to 0.
- http_response->expected_length =
+ http_response->expected_length =
static_cast<uint32>(std::max(response.expectedContentLength(), 0LL));
WebCore::String content_encoding =
response.httpHeaderField("Content-Encoding");
@@ -267,15 +269,15 @@ WebPluginImpl::WebPluginImpl(WebCore::Element* element,
WebFrameImpl* webframe,
WebPluginDelegate* delegate,
const GURL& plugin_url)
- : element_(element),
+ : windowless_(false),
+ window_(NULL),
+ element_(element),
webframe_(webframe),
delegate_(delegate),
- windowless_(false),
- window_(NULL),
force_geometry_update_(false),
visible_(false),
- widget_(NULL),
received_first_paint_notification_(false),
+ widget_(NULL),
plugin_url_(plugin_url) {
}
@@ -395,11 +397,11 @@ RoutingStatus WebPluginImpl::RouteToFrame(const char *method,
if (!frame())
return NOT_ROUTED;
- // Take special action for javascript URLs
+ // Take special action for JavaScript URLs
WebCore::String str_target = target;
if (is_javascript_url) {
WebCore::Frame *frameTarget = frame()->tree()->find(str_target);
- // For security reasons, do not allow javascript on frames
+ // For security reasons, do not allow JavaScript on frames
// other than this frame.
if (frameTarget != frame()) {
// FIXME - might be good to log this into a security
@@ -686,16 +688,22 @@ void WebPluginImpl::paint(WebCore::GraphicsContext* gc,
gc->translate(static_cast<float>(origin.x()),
static_cast<float>(origin.y()));
+#if defined(OS_WIN)
// HDC is only used when in windowless mode.
HDC hdc = gc->platformContext()->canvas()->beginPlatformPaint();
+#else
+ NOTIMPLEMENTED();
+#endif
WebCore::IntRect window_rect =
WebCore::IntRect(view->contentsToWindow(damage_rect.location()),
damage_rect.size());
+#if defined(OS_WIN)
delegate_->Paint(hdc, webkit_glue::FromIntRect(window_rect));
gc->platformContext()->canvas()->endPlatformPaint();
+#endif
gc->restore();
}
@@ -707,9 +715,13 @@ void WebPluginImpl::print(WebCore::GraphicsContext* gc) {
return;
gc->save();
+#if defined(OS_WIN)
HDC hdc = gc->platformContext()->canvas()->beginPlatformPaint();
delegate_->Print(hdc);
gc->platformContext()->canvas()->endPlatformPaint();
+#else
+ NOTIMPLEMENTED();
+#endif
gc->restore();
}
@@ -742,6 +754,7 @@ void WebPluginImpl::handleEvent(WebCore::Event* event) {
}
void WebPluginImpl::handleMouseEvent(WebCore::MouseEvent* event) {
+#if defined(OS_WIN)
DCHECK(parent()->isFrameView());
WebCore::IntPoint p =
static_cast<WebCore::FrameView*>(parent())->contentsToWindow(
@@ -825,9 +838,13 @@ void WebPluginImpl::handleMouseEvent(WebCore::MouseEvent* event) {
// event. We need to reflect the changed cursor in the frame view as the
// the mouse is moved in the boundaries of the windowless plugin.
parent()->setCursor(WebCore::PlatformCursor(current_web_cursor));
+#else
+ NOTIMPLEMENTED();
+#endif
}
void WebPluginImpl::handleKeyboardEvent(WebCore::KeyboardEvent* event) {
+#if defined(OS_WIN)
NPEvent np_event;
np_event.wParam = event->keyCode();
@@ -846,6 +863,9 @@ void WebPluginImpl::handleKeyboardEvent(WebCore::KeyboardEvent* event) {
WebCursor current_web_cursor;
if (!delegate_->HandleEvent(&np_event, &current_web_cursor))
event->setDefaultHandled();
+#else
+ NOTIMPLEMENTED();
+#endif
}
NPObject* WebPluginImpl::GetPluginScriptableObject() {
@@ -884,16 +904,16 @@ std::wstring WebPluginImpl::GetAllHeaders(
result.append(L"HTTP ");
result.append(FormatNumber(response.httpStatusCode()));
result.append(L" ");
- result.append(status.characters(), status.length());
+ result.append(webkit_glue::StringToStdWString(status));
result.append(L"\n");
WebCore::HTTPHeaderMap::const_iterator it =
response.httpHeaderFields().begin();
for (; it != response.httpHeaderFields().end(); ++it) {
if (!it->first.isEmpty() && !it->second.isEmpty()) {
- result.append(std::wstring(it->first.characters(), it->first.length()));
+ result.append(webkit_glue::StringToStdWString(it->first));
result.append(L": ");
- result.append(std::wstring(it->second.characters(), it->second.length()));
+ result.append(webkit_glue::StringToStdWString(it->second));
result.append(L"\n");
}
}
@@ -913,7 +933,7 @@ void WebPluginImpl::didReceiveResponse(WebCore::ResourceHandle* handle,
WebPluginContainer::ReadHttpResponseInfo(response, &http_response_info);
bool cancel = false;
-
+
if (response.httpStatusCode() == kHttpPartialResponseStatusCode) {
HandleHttpMultipartResponse(response, client);
return;
@@ -970,7 +990,7 @@ void WebPluginImpl::didReceiveData(WebCore::ResourceHandle* handle,
void WebPluginImpl::didFinishLoading(WebCore::ResourceHandle* handle) {
WebPluginResourceClient* client = GetClientFromHandle(handle);
if (client) {
- MultiPartResponseHandlerMap::iterator index =
+ MultiPartResponseHandlerMap::iterator index =
multi_part_response_map_.find(client);
if (index != multi_part_response_map_.end()) {
delete (*index).second;
@@ -1172,7 +1192,7 @@ bool WebPluginImpl::InitiateHTTPRequest(int resource_id,
if (!WebCore::FrameLoader::shouldHideReferrer(kurl, referrer))
info.request.setHTTPReferrer(referrer);
- if (lstrcmpA(method, "POST") == 0) {
+ if (strcmp(method, "POST") == 0) {
// Adds headers or form data to a request. This must be called before
// we initiate the actual request.
SetPostData(&info.request, buf, buf_len);
@@ -1222,9 +1242,9 @@ void WebPluginImpl::HandleHttpMultipartResponse(
MultiPartResponseClient* multi_part_response_client =
new MultiPartResponseClient(client);
- MultipartResponseDelegate* multi_part_response_handler =
- new MultipartResponseDelegate(multi_part_response_client, NULL,
- response,
+ MultipartResponseDelegate* multi_part_response_handler =
+ new MultipartResponseDelegate(multi_part_response_client, NULL,
+ response,
multipart_boundary);
multi_part_response_map_[client] = multi_part_response_handler;
}
diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h
index 56fa705..827fa8c 100644
--- a/webkit/glue/webplugin_impl.h
+++ b/webkit/glue/webplugin_impl.h
@@ -74,8 +74,8 @@ class WebPluginContainer : public WebCore::Widget {
// can be used by any platform.
void windowCutoutRects(const WebCore::IntRect& bounds,
WTF::Vector<WebCore::IntRect>* cutouts) const;
-
- // These methods are invoked from webkit when it has data to be sent to the
+
+ // These methods are invoked from webkit when it has data to be sent to the
// plugin. The plugin in this case does not initiate a download for the data.
void didReceiveResponse(const WebCore::ResourceResponse& response);
void didReceiveData(const char *buffer, int length);
@@ -88,7 +88,7 @@ class WebPluginContainer : public WebCore::Widget {
uint32 last_modified;
uint32 expected_length;
};
- // Helper function to read fields in a HTTP response structure.
+ // Helper function to read fields in a HTTP response structure.
// These fields are written to the HttpResponseInfo structure passed in.
static void ReadHttpResponseInfo(const WebCore::ResourceResponse& response,
HttpResponseInfo* http_response);
@@ -118,7 +118,7 @@ class WebPluginImpl : public WebPlugin,
virtual NPObject* GetPluginScriptableObject();
- // Helper function for sorting post data.
+ // Helper function for sorting post data.
static bool SetPostData(WebCore::ResourceRequest* request,
const char *buf,
uint32 length);
@@ -137,10 +137,10 @@ class WebPluginImpl : public WebPlugin,
// Executes the script passed in. The notify_needed and notify_data arguments
// are passed in by the plugin process. These indicate whether the plugin
- // expects a notification on script execution. We pass them back to the
+ // expects a notification on script execution. We pass them back to the
// plugin as is. This avoids having to track the notification arguments
// in the plugin process.
- bool ExecuteScript(const std::string& url, const std::wstring& script,
+ bool ExecuteScript(const std::string& url, const std::wstring& script,
bool notify_needed, int notify_data, bool popups_allowed);
// Given a download request, check if we need to route the output
@@ -258,7 +258,7 @@ class WebPluginImpl : public WebPlugin,
WebCore::IntRect* clip_rect,
std::vector<gfx::Rect>* cutout_rects);
- void HandleURLRequest(const char *method,
+ void HandleURLRequest(const char *method,
bool is_javascript_url,
const char* target, unsigned int len,
const char* buf, bool is_file_data,
@@ -268,7 +268,7 @@ class WebPluginImpl : public WebPlugin,
void CancelDocumentLoad();
void InitiateHTTPRangeRequest(const char* url, const char* range_info,
- HANDLE existing_stream, bool notify_needed,
+ HANDLE existing_stream, bool notify_needed,
HANDLE notify_data);
// Handles HTTP multipart responses, i.e. responses received with a HTTP