summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/common.vcproj4
-rw-r--r--chrome/common/render_messages.h242
-rw-r--r--chrome/common/render_messages_internal.h9
-rw-r--r--chrome/common/webkit_param_traits.h295
4 files changed, 305 insertions, 245 deletions
diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj
index 1a99f60..f392f7d 100644
--- a/chrome/common/common.vcproj
+++ b/chrome/common/common.vcproj
@@ -818,6 +818,10 @@
>
</File>
<File
+ RelativePath=".\webkit_param_traits.h"
+ >
+ </File>
+ <File
RelativePath=".\win_safe_util.cc"
>
</File>
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 717303b..38af203 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -19,15 +19,12 @@
#include "chrome/common/modal_dialog_event.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/transport_dib.h"
+#include "chrome/common/webkit_param_traits.h"
#include "googleurl/src/gurl.h"
#include "media/audio/audio_output.h"
#include "net/base/upload_data.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_status.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFindInPageRequest.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/glue/autofill_form.h"
#include "webkit/glue/context_menu.h"
#include "webkit/glue/feed.h"
@@ -35,7 +32,6 @@
#include "webkit/glue/password_form.h"
#include "webkit/glue/password_form_dom_manager.h"
#include "webkit/glue/resource_loader_bridge.h"
-#include "webkit/glue/screen_info.h"
#include "webkit/glue/webaccessibility.h"
#include "webkit/glue/webdropdata.h"
#include "webkit/glue/webplugin.h"
@@ -372,66 +368,6 @@ struct ViewHostMsg_Audio_CreateStream {
namespace IPC {
template <>
-struct ParamTraits<WebKit::WebString> {
- typedef WebKit::WebString param_type;
- static void Write(Message* m, const param_type& p) {
- m->WriteData(reinterpret_cast<const char*>(p.data()),
- static_cast<int>(p.length() * sizeof(WebKit::WebUChar)));
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- const char* data;
- int data_len;
- if (!m->ReadData(iter, &data, &data_len))
- return false;
- p->assign(reinterpret_cast<const WebKit::WebUChar*>(data),
- static_cast<size_t>(data_len / sizeof(WebKit::WebUChar)));
- return true;
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(UTF16ToWideHack(p));
- }
-};
-
-template <>
-struct ParamTraits<WebKit::WebConsoleMessage::Level> {
- typedef WebKit::WebConsoleMessage::Level param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, static_cast<int>(p));
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- int value;
- if (!ReadParam(m, iter, &value))
- return false;
- *r = static_cast<param_type>(value);
- return true;
- }
- static void Log(const param_type& p, std::wstring* l) {
- LogParam(static_cast<int>(p), l);
- }
-};
-
-template <>
-struct ParamTraits<WebKit::WebConsoleMessage> {
- typedef WebKit::WebConsoleMessage param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.level);
- WriteParam(m, p.text);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- return
- ReadParam(m, iter, &r->level) &&
- ReadParam(m, iter, &r->text);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.level, l);
- l->append(L", ");
- LogParam(p.text, l);
- l->append(L")");
- }
-};
-
-template <>
struct ParamTraits<ResourceType::Type> {
typedef ResourceType::Type param_type;
static void Write(Message* m, const param_type& p) {
@@ -546,58 +482,6 @@ struct ParamTraits<ContextNode> {
}
};
-template <>
-struct ParamTraits<WebKit::WebInputEvent::Type> {
- typedef WebKit::WebInputEvent::Type param_type;
- static void Write(Message* m, const param_type& p) {
- m->WriteInt(p);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<WebKit::WebInputEvent::Type>(type);
- return true;
- }
- static void Log(const param_type& p, std::wstring* l) {
- std::wstring type;
- switch (p) {
- case WebKit::WebInputEvent::MouseDown:
- type = L"MouseDown";
- break;
- case WebKit::WebInputEvent::MouseUp:
- type = L"MouseUp";
- break;
- case WebKit::WebInputEvent::MouseMove:
- type = L"MouseMove";
- break;
- case WebKit::WebInputEvent::MouseLeave:
- type = L"MouseLeave";
- break;
- case WebKit::WebInputEvent::MouseDoubleClick:
- type = L"MouseDoubleClick";
- break;
- case WebKit::WebInputEvent::MouseWheel:
- type = L"MouseWheel";
- break;
- case WebKit::WebInputEvent::RawKeyDown:
- type = L"RawKeyDown";
- break;
- case WebKit::WebInputEvent::KeyDown:
- type = L"KeyDown";
- break;
- case WebKit::WebInputEvent::KeyUp:
- type = L"KeyUp";
- break;
- default:
- type = L"None";
- break;
- }
-
- LogParam(type, l);
- }
-};
-
// Traits for ViewHostMsg_UpdateFeedList_Params structure to pack/unpack.
template <>
struct ParamTraits<ViewHostMsg_UpdateFeedList_Params> {
@@ -1260,83 +1144,6 @@ struct ParamTraits<scoped_refptr<net::UploadData> > {
}
};
-// Traits for WebKit::WebCache::UsageStats
-template <>
-struct ParamTraits<WebKit::WebCache::UsageStats> {
- typedef WebKit::WebCache::UsageStats param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.minDeadCapacity);
- WriteParam(m, p.maxDeadCapacity);
- WriteParam(m, p.capacity);
- WriteParam(m, p.liveSize);
- WriteParam(m, p.deadSize);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- return
- ReadParam(m, iter, &r->minDeadCapacity) &&
- ReadParam(m, iter, &r->maxDeadCapacity) &&
- ReadParam(m, iter, &r->capacity) &&
- ReadParam(m, iter, &r->liveSize) &&
- ReadParam(m, iter, &r->deadSize);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<WebCache::UsageStats>");
- }
-};
-
-template <>
-struct ParamTraits<WebKit::WebCache::ResourceTypeStat> {
- typedef WebKit::WebCache::ResourceTypeStat param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.count);
- WriteParam(m, p.size);
- WriteParam(m, p.liveSize);
- WriteParam(m, p.decodedSize);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- bool result =
- ReadParam(m, iter, &r->count) &&
- ReadParam(m, iter, &r->size) &&
- ReadParam(m, iter, &r->liveSize) &&
- ReadParam(m, iter, &r->decodedSize);
- return result;
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"%d %d %d %d", p.count, p.size, p.liveSize,
- p.decodedSize));
- }
-};
-
-template <>
-struct ParamTraits<WebKit::WebCache::ResourceTypeStats> {
- typedef WebKit::WebCache::ResourceTypeStats param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.images);
- WriteParam(m, p.cssStyleSheets);
- WriteParam(m, p.scripts);
- WriteParam(m, p.xslStyleSheets);
- WriteParam(m, p.fonts);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- bool result =
- ReadParam(m, iter, &r->images) &&
- ReadParam(m, iter, &r->cssStyleSheets) &&
- ReadParam(m, iter, &r->scripts) &&
- ReadParam(m, iter, &r->xslStyleSheets) &&
- ReadParam(m, iter, &r->fonts);
- return result;
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<WebCoreStats>");
- LogParam(p.images, l);
- LogParam(p.cssStyleSheets, l);
- LogParam(p.scripts, l);
- LogParam(p.xslStyleSheets, l);
- LogParam(p.fonts, l);
- l->append(L"</WebCoreStats>");
- }
-};
-
// Traits for PasswordFormDomManager::FillData.
template <>
struct ParamTraits<PasswordFormDomManager::FillData> {
@@ -1810,30 +1617,6 @@ struct ParamTraits<WebDropData> {
}
};
-// Traits for ScreenInfo
-template <>
-struct ParamTraits<webkit_glue::ScreenInfo> {
- typedef webkit_glue::ScreenInfo param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.depth);
- WriteParam(m, p.depth_per_component);
- WriteParam(m, p.is_monochrome);
- WriteParam(m, p.rect);
- WriteParam(m, p.available_rect);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->depth) &&
- ReadParam(m, iter, &p->depth_per_component) &&
- ReadParam(m, iter, &p->is_monochrome) &&
- ReadParam(m, iter, &p->rect) &&
- ReadParam(m, iter, &p->available_rect);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<webkit_glue::ScreenInfo>");
- }
-};
-
template<>
struct ParamTraits<ModalDialogEvent> {
typedef ModalDialogEvent param_type;
@@ -1985,29 +1768,6 @@ struct ParamTraits<AudioOutputStream::State> {
}
};
-template <>
-struct ParamTraits<WebKit::WebFindInPageRequest> {
- typedef WebKit::WebFindInPageRequest param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.identifier);
- WriteParam(m, p.text);
- WriteParam(m, p.forward);
- WriteParam(m, p.matchCase);
- WriteParam(m, p.findNext);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->identifier) &&
- ReadParam(m, iter, &p->text) &&
- ReadParam(m, iter, &p->forward) &&
- ReadParam(m, iter, &p->matchCase) &&
- ReadParam(m, iter, &p->findNext);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<FindInPageRequest>");
- }
-};
-
} // namespace IPC
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index ff0217d..5a32a0b 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -19,7 +19,6 @@
#include "chrome/common/transport_dib.h"
#include "skia/include/SkBitmap.h"
#include "webkit/glue/dom_operations.h"
-#include "webkit/glue/screen_info.h"
#include "webkit/glue/webcursor.h"
#include "webkit/glue/webplugin.h"
@@ -882,10 +881,12 @@ IPC_BEGIN_MESSAGES(ViewHost)
LOGFONT /* font data */)
#endif // defined(OS_WIN)
- // Returns ScreenInfo corresponding to the given window.
+ // Returns WebScreenInfo corresponding to the view.
+ // TODO(darin): Change this to be a routed message so we don't need to pass
+ // the view id.
IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetScreenInfo,
- gfx::NativeViewId /* window */,
- webkit_glue::ScreenInfo /* results */)
+ gfx::NativeViewId /* native view id */,
+ WebKit::WebScreenInfo /* results */)
// Send the tooltip text for the current mouse position to the browser.
IPC_MESSAGE_ROUTED1(ViewHostMsg_SetTooltipText,
diff --git a/chrome/common/webkit_param_traits.h b/chrome/common/webkit_param_traits.h
new file mode 100644
index 0000000..d41bccc
--- /dev/null
+++ b/chrome/common/webkit_param_traits.h
@@ -0,0 +1,295 @@
+// Copyright (c) 2009 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.
+//
+// This file contains ParamTraits templates to support serialization of WebKit
+// data types over IPC.
+
+#ifndef CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_
+#define CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_
+
+#include "chrome/common/ipc_message_utils.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFindInPageRequest.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
+
+namespace IPC {
+
+template <>
+struct ParamTraits<WebKit::WebRect> {
+ typedef WebKit::WebRect param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.x);
+ WriteParam(m, p.y);
+ WriteParam(m, p.width);
+ WriteParam(m, p.height);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->x) &&
+ ReadParam(m, iter, &p->y) &&
+ ReadParam(m, iter, &p->width) &&
+ ReadParam(m, iter, &p->height);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.x, l);
+ l->append(L", ");
+ LogParam(p.y, l);
+ l->append(L", ");
+ LogParam(p.width, l);
+ l->append(L", ");
+ LogParam(p.height, l);
+ l->append(L")");
+ }
+};
+
+template <>
+struct ParamTraits<WebKit::WebScreenInfo> {
+ typedef WebKit::WebScreenInfo param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.depth);
+ WriteParam(m, p.depthPerComponent);
+ WriteParam(m, p.isMonochrome);
+ WriteParam(m, p.rect);
+ WriteParam(m, p.availableRect);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->depth) &&
+ ReadParam(m, iter, &p->depthPerComponent) &&
+ ReadParam(m, iter, &p->isMonochrome) &&
+ ReadParam(m, iter, &p->rect) &&
+ ReadParam(m, iter, &p->availableRect);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.depth, l);
+ l->append(L", ");
+ LogParam(p.depthPerComponent, l);
+ l->append(L", ");
+ LogParam(p.isMonochrome, l);
+ l->append(L", ");
+ LogParam(p.rect, l);
+ l->append(L", ");
+ LogParam(p.availableRect, l);
+ l->append(L")");
+ }
+};
+
+template <>
+struct ParamTraits<WebKit::WebString> {
+ typedef WebKit::WebString param_type;
+ static void Write(Message* m, const param_type& p) {
+ m->WriteData(reinterpret_cast<const char*>(p.data()),
+ static_cast<int>(p.length() * sizeof(WebKit::WebUChar)));
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ const char* data;
+ int data_len;
+ if (!m->ReadData(iter, &data, &data_len))
+ return false;
+ p->assign(reinterpret_cast<const WebKit::WebUChar*>(data),
+ static_cast<size_t>(data_len / sizeof(WebKit::WebUChar)));
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(UTF16ToWideHack(p));
+ }
+};
+
+template <>
+struct ParamTraits<WebKit::WebConsoleMessage::Level> {
+ typedef WebKit::WebConsoleMessage::Level param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, static_cast<int>(p));
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ int value;
+ if (!ReadParam(m, iter, &value))
+ return false;
+ *r = static_cast<param_type>(value);
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ LogParam(static_cast<int>(p), l);
+ }
+};
+
+template <>
+struct ParamTraits<WebKit::WebConsoleMessage> {
+ typedef WebKit::WebConsoleMessage param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.level);
+ WriteParam(m, p.text);
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ return
+ ReadParam(m, iter, &r->level) &&
+ ReadParam(m, iter, &r->text);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.level, l);
+ l->append(L", ");
+ LogParam(p.text, l);
+ l->append(L")");
+ }
+};
+
+template <>
+struct ParamTraits<WebKit::WebFindInPageRequest> {
+ typedef WebKit::WebFindInPageRequest param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.identifier);
+ WriteParam(m, p.text);
+ WriteParam(m, p.forward);
+ WriteParam(m, p.matchCase);
+ WriteParam(m, p.findNext);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->identifier) &&
+ ReadParam(m, iter, &p->text) &&
+ ReadParam(m, iter, &p->forward) &&
+ ReadParam(m, iter, &p->matchCase) &&
+ ReadParam(m, iter, &p->findNext);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<FindInPageRequest>");
+ }
+};
+
+template <>
+struct ParamTraits<WebKit::WebInputEvent::Type> {
+ typedef WebKit::WebInputEvent::Type param_type;
+ static void Write(Message* m, const param_type& p) {
+ m->WriteInt(p);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ int type;
+ if (!m->ReadInt(iter, &type))
+ return false;
+ *p = static_cast<WebKit::WebInputEvent::Type>(type);
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ std::wstring type;
+ switch (p) {
+ case WebKit::WebInputEvent::MouseDown:
+ type = L"MouseDown";
+ break;
+ case WebKit::WebInputEvent::MouseUp:
+ type = L"MouseUp";
+ break;
+ case WebKit::WebInputEvent::MouseMove:
+ type = L"MouseMove";
+ break;
+ case WebKit::WebInputEvent::MouseLeave:
+ type = L"MouseLeave";
+ break;
+ case WebKit::WebInputEvent::MouseDoubleClick:
+ type = L"MouseDoubleClick";
+ break;
+ case WebKit::WebInputEvent::MouseWheel:
+ type = L"MouseWheel";
+ break;
+ case WebKit::WebInputEvent::RawKeyDown:
+ type = L"RawKeyDown";
+ break;
+ case WebKit::WebInputEvent::KeyDown:
+ type = L"KeyDown";
+ break;
+ case WebKit::WebInputEvent::KeyUp:
+ type = L"KeyUp";
+ break;
+ default:
+ type = L"None";
+ break;
+ }
+ LogParam(type, l);
+ }
+};
+
+// Traits for WebKit::WebCache::UsageStats
+template <>
+struct ParamTraits<WebKit::WebCache::UsageStats> {
+ typedef WebKit::WebCache::UsageStats param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.minDeadCapacity);
+ WriteParam(m, p.maxDeadCapacity);
+ WriteParam(m, p.capacity);
+ WriteParam(m, p.liveSize);
+ WriteParam(m, p.deadSize);
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ return
+ ReadParam(m, iter, &r->minDeadCapacity) &&
+ ReadParam(m, iter, &r->maxDeadCapacity) &&
+ ReadParam(m, iter, &r->capacity) &&
+ ReadParam(m, iter, &r->liveSize) &&
+ ReadParam(m, iter, &r->deadSize);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<WebCache::UsageStats>");
+ }
+};
+
+template <>
+struct ParamTraits<WebKit::WebCache::ResourceTypeStat> {
+ typedef WebKit::WebCache::ResourceTypeStat param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.count);
+ WriteParam(m, p.size);
+ WriteParam(m, p.liveSize);
+ WriteParam(m, p.decodedSize);
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ bool result =
+ ReadParam(m, iter, &r->count) &&
+ ReadParam(m, iter, &r->size) &&
+ ReadParam(m, iter, &r->liveSize) &&
+ ReadParam(m, iter, &r->decodedSize);
+ return result;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(StringPrintf(L"%d %d %d %d", p.count, p.size, p.liveSize,
+ p.decodedSize));
+ }
+};
+
+template <>
+struct ParamTraits<WebKit::WebCache::ResourceTypeStats> {
+ typedef WebKit::WebCache::ResourceTypeStats param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.images);
+ WriteParam(m, p.cssStyleSheets);
+ WriteParam(m, p.scripts);
+ WriteParam(m, p.xslStyleSheets);
+ WriteParam(m, p.fonts);
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ bool result =
+ ReadParam(m, iter, &r->images) &&
+ ReadParam(m, iter, &r->cssStyleSheets) &&
+ ReadParam(m, iter, &r->scripts) &&
+ ReadParam(m, iter, &r->xslStyleSheets) &&
+ ReadParam(m, iter, &r->fonts);
+ return result;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<WebCoreStats>");
+ LogParam(p.images, l);
+ LogParam(p.cssStyleSheets, l);
+ LogParam(p.scripts, l);
+ LogParam(p.xslStyleSheets, l);
+ LogParam(p.fonts, l);
+ l->append(L"</WebCoreStats>");
+ }
+};
+
+} // namespace IPC
+
+#endif // CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_