diff options
Diffstat (limited to 'content')
38 files changed, 1337 insertions, 25 deletions
diff --git a/content/browser/in_process_webkit/browser_webkitclient_impl.cc b/content/browser/in_process_webkit/browser_webkitclient_impl.cc index 2d086680..4506fc2 100644 --- a/content/browser/in_process_webkit/browser_webkitclient_impl.cc +++ b/content/browser/in_process_webkit/browser_webkitclient_impl.cc @@ -6,10 +6,10 @@ #include "base/file_util.h" #include "base/logging.h" -#include "chrome/common/indexed_db_key.h" -#include "chrome/common/serialized_script_value.h" #include "content/browser/in_process_webkit/dom_storage_message_filter.h" #include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" +#include "content/common/indexed_db_key.h" +#include "content/common/serialized_script_value.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" diff --git a/content/browser/in_process_webkit/dom_storage_area.h b/content/browser/in_process_webkit/dom_storage_area.h index e451f8b..d7e7d8c 100644 --- a/content/browser/in_process_webkit/dom_storage_area.h +++ b/content/browser/in_process_webkit/dom_storage_area.h @@ -11,7 +11,7 @@ #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/string16.h" -#include "chrome/common/dom_storage_common.h" +#include "content/common/dom_storage_common.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h" diff --git a/content/browser/in_process_webkit/dom_storage_context.cc b/content/browser/in_process_webkit/dom_storage_context.cc index 245c08c..96b83c7 100644 --- a/content/browser/in_process_webkit/dom_storage_context.cc +++ b/content/browser/in_process_webkit/dom_storage_context.cc @@ -10,12 +10,12 @@ #include "base/file_util.h" #include "base/string_util.h" #include "chrome/browser/extensions/extension_special_storage_policy.h" -#include "chrome/common/dom_storage_common.h" #include "chrome/common/url_constants.h" #include "content/browser/browser_thread.h" #include "content/browser/in_process_webkit/dom_storage_area.h" #include "content/browser/in_process_webkit/dom_storage_namespace.h" #include "content/browser/in_process_webkit/webkit_context.h" +#include "content/common/dom_storage_common.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "webkit/glue/webkit_glue.h" diff --git a/content/browser/in_process_webkit/dom_storage_message_filter.cc b/content/browser/in_process_webkit/dom_storage_message_filter.cc index 3043dbb..6d92998 100644 --- a/content/browser/in_process_webkit/dom_storage_message_filter.cc +++ b/content/browser/in_process_webkit/dom_storage_message_filter.cc @@ -8,13 +8,13 @@ #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/browser_render_process_host.h" -#include "chrome/common/dom_storage_messages.h" #include "chrome/common/url_constants.h" #include "content/browser/browser_thread.h" #include "content/browser/in_process_webkit/dom_storage_area.h" #include "content/browser/in_process_webkit/dom_storage_context.h" #include "content/browser/in_process_webkit/dom_storage_namespace.h" #include "content/browser/renderer_host/render_view_host_notification_task.h" +#include "content/common/dom_storage_messages.h" #include "googleurl/src/gurl.h" using WebKit::WebStorageArea; diff --git a/content/browser/in_process_webkit/dom_storage_message_filter.h b/content/browser/in_process_webkit/dom_storage_message_filter.h index 0140eef..7113d8f 100644 --- a/content/browser/in_process_webkit/dom_storage_message_filter.h +++ b/content/browser/in_process_webkit/dom_storage_message_filter.h @@ -10,11 +10,10 @@ #include "base/ref_counted.h" #include "base/tracked.h" #include "chrome/browser/content_settings/host_content_settings_map.h" -#include "chrome/common/dom_storage_common.h" #include "content/browser/browser_message_filter.h" #include "content/browser/in_process_webkit/dom_storage_area.h" #include "content/browser/in_process_webkit/webkit_context.h" -#include "ipc/ipc_message.h" +#include "content/common/dom_storage_common.h" class DOMStorageContext; class GURL; diff --git a/content/browser/in_process_webkit/dom_storage_namespace.h b/content/browser/in_process_webkit/dom_storage_namespace.h index b05a317..3abe334 100644 --- a/content/browser/in_process_webkit/dom_storage_namespace.h +++ b/content/browser/in_process_webkit/dom_storage_namespace.h @@ -9,7 +9,7 @@ #include "base/hash_tables.h" #include "base/scoped_ptr.h" #include "base/string16.h" -#include "chrome/common/dom_storage_common.h" +#include "content/common/dom_storage_common.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" class DOMStorageArea; diff --git a/content/browser/in_process_webkit/indexed_db_callbacks.cc b/content/browser/in_process_webkit/indexed_db_callbacks.cc index 52787fd..74ae15b 100644 --- a/content/browser/in_process_webkit/indexed_db_callbacks.cc +++ b/content/browser/in_process_webkit/indexed_db_callbacks.cc @@ -4,7 +4,7 @@ #include "content/browser/in_process_webkit/indexed_db_callbacks.h" -#include "chrome/common/indexed_db_messages.h" +#include "content/common/indexed_db_messages.h" IndexedDBCallbacksBase::IndexedDBCallbacksBase( IndexedDBDispatcherHost* dispatcher_host, diff --git a/content/browser/in_process_webkit/indexed_db_database_callbacks.cc b/content/browser/in_process_webkit/indexed_db_database_callbacks.cc index 29103ce..2c23aa5 100644 --- a/content/browser/in_process_webkit/indexed_db_database_callbacks.cc +++ b/content/browser/in_process_webkit/indexed_db_database_callbacks.cc @@ -4,8 +4,8 @@ #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" -#include "chrome/common/indexed_db_messages.h" #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" +#include "content/common/indexed_db_messages.h" IndexedDBDatabaseCallbacks::IndexedDBDatabaseCallbacks( IndexedDBDispatcherHost* dispatcher_host, diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc index 3fde86f..7581c4d7 100644 --- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -11,13 +11,13 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/browser_render_process_host.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/indexed_db_messages.h" #include "content/browser/browser_thread.h" #include "content/browser/in_process_webkit/indexed_db_callbacks.h" #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h" #include "content/browser/renderer_host/render_message_filter.h" #include "content/browser/renderer_host/render_view_host_notification_task.h" +#include "content/common/indexed_db_messages.h" #include "chrome/common/result_codes.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h" diff --git a/content/browser/in_process_webkit/indexed_db_key_utility_client.cc b/content/browser/in_process_webkit/indexed_db_key_utility_client.cc index a8f8e5b..d3e0300 100644 --- a/content/browser/in_process_webkit/indexed_db_key_utility_client.cc +++ b/content/browser/in_process_webkit/indexed_db_key_utility_client.cc @@ -8,8 +8,8 @@ #include "base/synchronization/waitable_event.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/utility_process_host.h" -#include "chrome/common/indexed_db_key.h" -#include "chrome/common/serialized_script_value.h" +#include "content/common/indexed_db_key.h" +#include "content/common/serialized_script_value.h" // This class is used to obtain IndexedDBKeys from SerializedScriptValues // given an IDBKeyPath. It uses UtilityProcess to do this inside a sandbox diff --git a/content/browser/in_process_webkit/indexed_db_transaction_callbacks.cc b/content/browser/in_process_webkit/indexed_db_transaction_callbacks.cc index 0690068..c806242 100644 --- a/content/browser/in_process_webkit/indexed_db_transaction_callbacks.cc +++ b/content/browser/in_process_webkit/indexed_db_transaction_callbacks.cc @@ -4,8 +4,8 @@ #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h" -#include "chrome/common/indexed_db_messages.h" #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" +#include "content/common/indexed_db_messages.h" IndexedDBTransactionCallbacks::IndexedDBTransactionCallbacks( IndexedDBDispatcherHost* dispatcher_host, diff --git a/content/browser/renderer_host/clipboard_message_filter.cc b/content/browser/renderer_host/clipboard_message_filter.cc index 741d435..a48d918 100644 --- a/content/browser/renderer_host/clipboard_message_filter.cc +++ b/content/browser/renderer_host/clipboard_message_filter.cc @@ -6,7 +6,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/clipboard_dispatcher.h" -#include "chrome/common/clipboard_messages.h" +#include "content/common/clipboard_messages.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message_macros.h" diff --git a/content/browser/renderer_host/pepper_file_message_filter.cc b/content/browser/renderer_host/pepper_file_message_filter.cc index b951b5d..a4f1535 100644 --- a/content/browser/renderer_host/pepper_file_message_filter.cc +++ b/content/browser/renderer_host/pepper_file_message_filter.cc @@ -11,9 +11,9 @@ #include "base/process_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/browser_render_process_host.h" -#include "chrome/common/pepper_file_messages.h" #include "content/browser/browser_thread.h" #include "content/browser/child_process_security_policy.h" +#include "content/common/pepper_file_messages.h" #include "ipc/ipc_platform_file.h" #include "webkit/plugins/ppapi/file_path.h" diff --git a/content/browser/renderer_host/pepper_message_filter.cc b/content/browser/renderer_host/pepper_message_filter.cc index d19029a..ef6a37f 100644 --- a/content/browser/renderer_host/pepper_message_filter.cc +++ b/content/browser/renderer_host/pepper_message_filter.cc @@ -10,8 +10,8 @@ #include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/browser_render_process_host.h" -#include "chrome/common/pepper_messages.h" #include "content/browser/browser_thread.h" +#include "content/common/pepper_messages.h" #include "net/base/address_list.h" #include "net/base/host_port_pair.h" #include "net/base/host_resolver.h" diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index 53fda27..b50318b 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -14,10 +14,10 @@ #include "base/ref_counted.h" #include "base/string16.h" #include "chrome/common/content_settings_types.h" -#include "chrome/common/dom_storage_common.h" #include "chrome/common/translate_errors.h" #include "chrome/common/view_types.h" #include "chrome/common/window_container_type.h" +#include "content/common/dom_storage_common.h" #include "ipc/ipc_channel.h" #include "net/base/load_states.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc index 3f4f200..5707937 100644 --- a/content/browser/renderer_host/test_render_view_host.cc +++ b/content/browser/renderer_host/test_render_view_host.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "chrome/browser/browser_url_handler.h" -#include "chrome/common/dom_storage_common.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" #include "chrome/test/testing_profile.h" @@ -13,6 +12,7 @@ #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/test_tab_contents.h" #include "content/common/content_client.h" +#include "content/common/dom_storage_common.h" #include "ui/gfx/rect.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webpreferences.h" diff --git a/content/browser/speech/speech_input_dispatcher_host.cc b/content/browser/speech/speech_input_dispatcher_host.cc index d721fee..b589e3b 100644 --- a/content/browser/speech/speech_input_dispatcher_host.cc +++ b/content/browser/speech/speech_input_dispatcher_host.cc @@ -5,7 +5,7 @@ #include "content/browser/speech/speech_input_dispatcher_host.h" #include "base/lazy_instance.h" -#include "chrome/common/speech_input_messages.h" +#include "content/common/speech_input_messages.h" namespace speech_input { diff --git a/content/browser/speech/speech_input_manager.h b/content/browser/speech/speech_input_manager.h index c990e8c..342f2c1 100644 --- a/content/browser/speech/speech_input_manager.h +++ b/content/browser/speech/speech_input_manager.h @@ -6,7 +6,7 @@ #define CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ #include "base/basictypes.h" -#include "chrome/common/speech_input_result.h" +#include "content/common/speech_input_result.h" #include "ui/gfx/rect.h" namespace speech_input { diff --git a/content/browser/speech/speech_recognition_request.h b/content/browser/speech/speech_recognition_request.h index 3bb6298..5c94fba 100644 --- a/content/browser/speech/speech_recognition_request.h +++ b/content/browser/speech/speech_recognition_request.h @@ -12,7 +12,7 @@ #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "chrome/common/net/url_fetcher.h" -#include "chrome/common/speech_input_result.h" +#include "content/common/speech_input_result.h" #include "googleurl/src/gurl.h" class URLFetcher; diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index 2cd09b8..cedc485 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -17,7 +17,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_preferences_util.h" #include "chrome/common/bindings_policy.h" -#include "chrome/common/dom_storage_common.h" #include "chrome/common/net/url_request_context_getter.h" #include "chrome/common/page_transition_types.h" #include "chrome/common/render_messages_params.h" @@ -31,6 +30,7 @@ #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/common/dom_storage_common.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" #include "net/base/escape.h" diff --git a/content/common/clipboard_messages.h b/content/common/clipboard_messages.h new file mode 100644 index 0000000..7fe14af --- /dev/null +++ b/content/common/clipboard_messages.h @@ -0,0 +1,64 @@ +// Copyright (c) 2011 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. + +// Multiply-included message file, so no include guard. + +#include <string> +#include <vector> + +#include "content/common/common_param_traits.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" +#include "ui/base/clipboard/clipboard.h" + +#define IPC_MESSAGE_START ClipboardMsgStart + +IPC_ENUM_TRAITS(ui::Clipboard::Buffer) + +// Clipboard IPC messages sent from the renderer to the browser. + +// This message is used when the object list does not contain a bitmap. +IPC_MESSAGE_CONTROL1(ClipboardHostMsg_WriteObjectsAsync, + ui::Clipboard::ObjectMap /* objects */) +// This message is used when the object list contains a bitmap. +// It is synchronized so that the renderer knows when it is safe to +// free the shared memory used to transfer the bitmap. +IPC_SYNC_MESSAGE_CONTROL2_0(ClipboardHostMsg_WriteObjectsSync, + ui::Clipboard::ObjectMap /* objects */, + base::SharedMemoryHandle /* bitmap handle */) +IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_IsFormatAvailable, + std::string /* format */, + ui::Clipboard::Buffer /* buffer */, + bool /* result */) +IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadAvailableTypes, + ui::Clipboard::Buffer /* buffer */, + std::vector<string16> /* types */, + bool /* contains filenames */) +IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_ReadText, + ui::Clipboard::Buffer /* buffer */, + string16 /* result */) +IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_ReadAsciiText, + ui::Clipboard::Buffer /* buffer */, + std::string /* result */) +IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadHTML, + ui::Clipboard::Buffer /* buffer */, + string16 /* markup */, + GURL /* url */) +IPC_SYNC_MESSAGE_CONTROL1_1(ClipboardHostMsg_ReadImage, + ui::Clipboard::Buffer /* buffer */, + std::string /* PNG-encoded image */) +#if defined(OS_MACOSX) +IPC_MESSAGE_CONTROL1(ClipboardHostMsg_FindPboardWriteStringAsync, + string16 /* text */) +#endif +IPC_SYNC_MESSAGE_CONTROL2_3(ClipboardHostMsg_ReadData, + ui::Clipboard::Buffer /* buffer */, + string16 /* type */, + bool /* succeeded */, + string16 /* data */, + string16 /* metadata */) +IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadFilenames, + ui::Clipboard::Buffer /* buffer */, + bool /* result */, + std::vector<string16> /* filenames */) diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h index f068598..d6ac72f36 100644 --- a/content/common/content_message_generator.h +++ b/content/common/content_message_generator.h @@ -6,14 +6,18 @@ #include "content/common/appcache_messages.h" #include "content/common/child_process_messages.h" +#include "content/common/clipboard_messages.h" #include "content/common/database_messages.h" +#include "content/common/dom_storage_messages.h" #include "content/common/file_system_messages.h" #include "content/common/file_utilities_messages.h" -#include "content/common/p2p_messages.h" -#include "content/common/plugin_messages.h" #include "content/common/gpu_messages.h" +#include "content/common/indexed_db_messages.h" #include "content/common/mime_registry_messages.h" +#include "content/common/p2p_messages.h" +#include "content/common/plugin_messages.h" #include "content/common/resource_messages.h" +#include "content/common/speech_input_messages.h" #include "content/common/socket_stream_messages.h" #include "content/common/webblob_messages.h" #include "content/common/worker_messages.h" diff --git a/content/common/dom_storage_common.h b/content/common/dom_storage_common.h new file mode 100644 index 0000000..64d35e5 --- /dev/null +++ b/content/common/dom_storage_common.h @@ -0,0 +1,21 @@ +// Copyright (c) 2010 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. + +#ifndef CONTENT_COMMON_DOM_STORAGE_COMMON_H_ +#define CONTENT_COMMON_DOM_STORAGE_COMMON_H_ +#pragma once + +#include "build/build_config.h" + +#include "base/basictypes.h" + +const int64 kLocalStorageNamespaceId = 0; +const int64 kInvalidSessionStorageNamespaceId = kLocalStorageNamespaceId; + +enum DOMStorageType { + DOM_STORAGE_LOCAL = 0, + DOM_STORAGE_SESSION +}; + +#endif // CONTENT_COMMON_DOM_STORAGE_COMMON_H_ diff --git a/content/common/dom_storage_messages.h b/content/common/dom_storage_messages.h new file mode 100644 index 0000000..9d656f6 --- /dev/null +++ b/content/common/dom_storage_messages.h @@ -0,0 +1,93 @@ +// Copyright (c) 2010 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. + +// Multiply-included message file, no traditional include guard. +#include "content/common/dom_storage_common.h" +#include "googleurl/src/gurl.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h" + +#define IPC_MESSAGE_START DOMStorageMsgStart + +// Signals a storage event. +IPC_STRUCT_BEGIN(DOMStorageMsg_Event_Params) + // The key that generated the storage event. Null if clear() was called. + IPC_STRUCT_MEMBER(NullableString16, key) + + // The old value of this key. Null on clear() or if it didn't have a value. + IPC_STRUCT_MEMBER(NullableString16, old_value) + + // The new value of this key. Null on removeItem() or clear(). + IPC_STRUCT_MEMBER(NullableString16, new_value) + + // The origin this is associated with. + IPC_STRUCT_MEMBER(string16, origin) + + // The URL of the page that caused the storage event. + IPC_STRUCT_MEMBER(GURL, url) + + // The storage type of this event. + IPC_STRUCT_MEMBER(DOMStorageType, storage_type) +IPC_STRUCT_END() + +IPC_ENUM_TRAITS(DOMStorageType) +IPC_ENUM_TRAITS(WebKit::WebStorageArea::Result) + +// DOM Storage messages sent from the browser to the renderer. + +// Storage events are broadcast to renderer processes. +IPC_MESSAGE_CONTROL1(DOMStorageMsg_Event, + DOMStorageMsg_Event_Params) + + +// DOM Storage messages sent from the renderer to the browser. + + +// Get the storage area id for a particular origin within a namespace. +IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_StorageAreaId, + int64 /* namespace_id */, + string16 /* origin */, + int64 /* storage_area_id */) + +// Get the length of a storage area. +IPC_SYNC_MESSAGE_CONTROL1_1(DOMStorageHostMsg_Length, + int64 /* storage_area_id */, + unsigned /* length */) + +// Get a the ith key within a storage area. +IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_Key, + int64 /* storage_area_id */, + unsigned /* index */, + NullableString16 /* key */) + +// Get a value based on a key from a storage area. +IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_GetItem, + int64 /* storage_area_id */, + string16 /* key */, + NullableString16 /* value */) + +// Set a value that's associated with a key in a storage area. +IPC_SYNC_MESSAGE_CONTROL5_2(DOMStorageHostMsg_SetItem, + int /* routing_id */, + int64 /* storage_area_id */, + string16 /* key */, + string16 /* value */, + GURL /* url */, + WebKit::WebStorageArea::Result /* result */, + NullableString16 /* old_value */) + +// Remove the value associated with a key in a storage area. +IPC_SYNC_MESSAGE_CONTROL3_1(DOMStorageHostMsg_RemoveItem, + int64 /* storage_area_id */, + string16 /* key */, + GURL /* url */, + NullableString16 /* old_value */) + +// Clear the storage area. +IPC_SYNC_MESSAGE_CONTROL2_1(DOMStorageHostMsg_Clear, + int64 /* storage_area_id */, + GURL /* url */, + bool /* something_cleared */) + diff --git a/content/common/indexed_db_key.cc b/content/common/indexed_db_key.cc new file mode 100644 index 0000000..ee02fa1 --- /dev/null +++ b/content/common/indexed_db_key.cc @@ -0,0 +1,71 @@ +// Copyright (c) 2010 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. + +#include "content/common/indexed_db_key.h" + +#include "base/logging.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" + +using WebKit::WebIDBKey; + +IndexedDBKey::IndexedDBKey() + : type_(WebIDBKey::InvalidType), + date_(0), + number_(0) { +} + +IndexedDBKey::IndexedDBKey(const WebIDBKey& key) { + Set(key); +} + +IndexedDBKey::~IndexedDBKey() { +} + +void IndexedDBKey::SetNull() { + type_ = WebIDBKey::NullType; +} + +void IndexedDBKey::SetInvalid() { + type_ = WebIDBKey::InvalidType; +} + +void IndexedDBKey::SetString(const string16& string) { + type_ = WebIDBKey::StringType; + string_ = string; +} + +void IndexedDBKey::SetDate(double date) { + type_ = WebIDBKey::DateType; + date_ = date; +} + +void IndexedDBKey::SetNumber(double number) { + type_ = WebIDBKey::NumberType; + number_ = number; +} + +void IndexedDBKey::Set(const WebIDBKey& key) { + type_ = key.type(); + string_ = key.type() == WebIDBKey::StringType ? + static_cast<string16>(key.string()) : string16(); + number_ = key.type() == WebIDBKey::NumberType ? key.number() : 0; + date_ = key.type() == WebIDBKey::DateType ? key.date() : 0; +} + +IndexedDBKey::operator WebIDBKey() const { + switch (type_) { + case WebIDBKey::NullType: + return WebIDBKey::createNull(); + case WebIDBKey::StringType: + return WebIDBKey::createString(string_); + case WebIDBKey::DateType: + return WebIDBKey::createDate(date_); + case WebIDBKey::NumberType: + return WebIDBKey::createNumber(number_); + case WebIDBKey::InvalidType: + return WebIDBKey::createInvalid(); + } + NOTREACHED(); + return WebIDBKey::createInvalid(); +} diff --git a/content/common/indexed_db_key.h b/content/common/indexed_db_key.h new file mode 100644 index 0000000..04a4b60 --- /dev/null +++ b/content/common/indexed_db_key.h @@ -0,0 +1,40 @@ +// Copyright (c) 2010 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. + +#ifndef CONTENT_COMMON_INDEXED_DB_KEY_H_ +#define CONTENT_COMMON_INDEXED_DB_KEY_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/string16.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" + +class IndexedDBKey { + public: + IndexedDBKey(); // Defaults to WebKit::WebIDBKey::InvalidType. + explicit IndexedDBKey(const WebKit::WebIDBKey& key); + ~IndexedDBKey(); + + void SetNull(); + void SetInvalid(); + void SetString(const string16& string); + void SetDate(double date); + void SetNumber(double number); + void Set(const WebKit::WebIDBKey& key); + + WebKit::WebIDBKey::Type type() const { return type_; } + const string16& string() const { return string_; } + double date() const { return date_; } + double number() const { return number_; } + + operator WebKit::WebIDBKey() const; + + private: + WebKit::WebIDBKey::Type type_; + string16 string_; + double date_; + double number_; +}; + +#endif // CONTENT_COMMON_INDEXED_DB_KEY_H_ diff --git a/content/common/indexed_db_messages.h b/content/common/indexed_db_messages.h new file mode 100644 index 0000000..0a6b37d --- /dev/null +++ b/content/common/indexed_db_messages.h @@ -0,0 +1,433 @@ +// Copyright (c) 2010 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. + +// Message definition file, included multiple times, hence no include guard. + +#include <vector> + +#include "content/common/indexed_db_key.h" +#include "content/common/indexed_db_param_traits.h" +#include "content/common/serialized_script_value.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" + +#define IPC_MESSAGE_START IndexedDBMsgStart + +// Argument structures used in messages + +IPC_ENUM_TRAITS(WebKit::WebIDBObjectStore::PutMode) + +// Used to open an indexed database. +IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryOpen_Params) + // The routing ID of the view initiating the open. + IPC_STRUCT_MEMBER(int32, routing_id) + // The response should have this id. + IPC_STRUCT_MEMBER(int32, response_id) + // The origin doing the initiating. + IPC_STRUCT_MEMBER(string16, origin) + // The name of the database. + IPC_STRUCT_MEMBER(string16, name) + // The maximum size of the database. + IPC_STRUCT_MEMBER(uint64, maximum_size) +IPC_STRUCT_END() + +// Used to delete an indexed database. +IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryDeleteDatabase_Params) + // The routing ID of the view initiating the deletion. + IPC_STRUCT_MEMBER(int32, routing_id) + // The response should have this id. + IPC_STRUCT_MEMBER(int32, response_id) + // The origin doing the initiating. + IPC_STRUCT_MEMBER(string16, origin) + // The name of the database. + IPC_STRUCT_MEMBER(string16, name) +IPC_STRUCT_END() + +// Used to create an object store. +IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabaseCreateObjectStore_Params) + // The name of the object store. + IPC_STRUCT_MEMBER(string16, name) + // The keyPath of the object store. + IPC_STRUCT_MEMBER(NullableString16, key_path) + // Whether the object store created should have a key generator. + IPC_STRUCT_MEMBER(bool, auto_increment) + // The transaction this is associated with. + IPC_STRUCT_MEMBER(int32, transaction_id) + // The database the object store belongs to. + IPC_STRUCT_MEMBER(int32, idb_database_id) +IPC_STRUCT_END() + +// Used to open both cursors and object cursors in IndexedDB. +IPC_STRUCT_BEGIN(IndexedDBHostMsg_IndexOpenCursor_Params) + // The response should have this id. + IPC_STRUCT_MEMBER(int32, response_id) + // The serialized lower key. + IPC_STRUCT_MEMBER(IndexedDBKey, lower_key) + // The serialized upper key. + IPC_STRUCT_MEMBER(IndexedDBKey, upper_key) + // Is the lower bound open? + IPC_STRUCT_MEMBER(bool, lower_open) + // Is the upper bound open? + IPC_STRUCT_MEMBER(bool, upper_open) + // The direction of this cursor. + IPC_STRUCT_MEMBER(int32, direction) + // The index the index belongs to. + IPC_STRUCT_MEMBER(int32, idb_index_id) + // The transaction this request belongs to. + IPC_STRUCT_MEMBER(int, transaction_id) +IPC_STRUCT_END() + +// Used to set a value in an object store. +IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStorePut_Params) + // The object store's id. + IPC_STRUCT_MEMBER(int32, idb_object_store_id) + // The id any response should contain. + IPC_STRUCT_MEMBER(int32, response_id) + // The value to set. + IPC_STRUCT_MEMBER(SerializedScriptValue, serialized_value) + // The key to set it on (may not be "valid"/set in some cases). + IPC_STRUCT_MEMBER(IndexedDBKey, key) + // Whether this is an add or a put. + IPC_STRUCT_MEMBER(WebKit::WebIDBObjectStore::PutMode, put_mode) + // The transaction it's associated with. + IPC_STRUCT_MEMBER(int, transaction_id) +IPC_STRUCT_END() + +// Used to create an index. +IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStoreCreateIndex_Params) + // The name of the index. + IPC_STRUCT_MEMBER(string16, name) + // The keyPath of the index. + IPC_STRUCT_MEMBER(NullableString16, key_path) + // Whether the index created has unique keys. + IPC_STRUCT_MEMBER(bool, unique) + // The transaction this is associated with. + IPC_STRUCT_MEMBER(int32, transaction_id) + // The object store the index belongs to. + IPC_STRUCT_MEMBER(int32, idb_object_store_id) +IPC_STRUCT_END() + +// Used to open an IndexedDB cursor. +IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStoreOpenCursor_Params) + // The response should have this id. + IPC_STRUCT_MEMBER(int32, response_id) + // The serialized lower key. + IPC_STRUCT_MEMBER(IndexedDBKey, lower_key) + // The serialized upper key. + IPC_STRUCT_MEMBER(IndexedDBKey, upper_key) + // Is the lower bound open? + IPC_STRUCT_MEMBER(bool, lower_open) + // Is the upper bound open? + IPC_STRUCT_MEMBER(bool, upper_open) + // The direction of this cursor. + IPC_STRUCT_MEMBER(int32, direction) + // The object store the cursor belongs to. + IPC_STRUCT_MEMBER(int32, idb_object_store_id) + // The transaction this request belongs to. + IPC_STRUCT_MEMBER(int, transaction_id) +IPC_STRUCT_END() + +// Indexed DB messages sent from the browser to the renderer. + +// IDBCallback message handlers. +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBCursor, + int32 /* response_id */, + int32 /* cursor_id */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBDatabase, + int32 /* response_id */, + int32 /* idb_database_id */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIndexedDBKey, + int32 /* response_id */, + IndexedDBKey /* indexed_db_key */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBIndex, + int32 /* response_id */, + int32 /* idb_index_id */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessIDBTransaction, + int32 /* response_id */, + int32 /* idb_transaction_id */) +IPC_MESSAGE_CONTROL2(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, + int32 /* response_id */, + SerializedScriptValue /* serialized_script_value */) +IPC_MESSAGE_CONTROL3(IndexedDBMsg_CallbacksError, + int32 /* response_id */, + int /* code */, + string16 /* message */) +IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksBlocked, + int32 /* response_id */) + +// IDBTransactionCallback message handlers. +IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksAbort, + int32 /* transaction_id */) +IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksComplete, + int32 /* transaction_id */) +IPC_MESSAGE_CONTROL1(IndexedDBMsg_TransactionCallbacksTimeout, + int32 /* transaction_id */) + +IPC_MESSAGE_CONTROL2(IndexedDBMsg_DatabaseCallbacksVersionChange, + int32, /* database_id */ + string16) /* new_version */ + +// Indexed DB messages sent from the renderer to the browser. + +// WebIDBCursor::direction() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorDirection, + int32, /* idb_cursor_id */ + int32 /* direction */) + +// WebIDBCursor::key() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorKey, + int32, /* idb_cursor_id */ + IndexedDBKey /* key */) + +// WebIDBCursor::primaryKey() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_CursorPrimaryKey, + int32, /* idb_cursor_id */ + IndexedDBKey /* primary_key */) + +// WebIDBCursor::value() message. +IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_CursorValue, + int32, /* idb_cursor_id */ + SerializedScriptValue, /* script_value */ + IndexedDBKey /* key */) + +// WebIDBCursor::update() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorUpdate, + int32, /* idb_cursor_id */ + int32, /* response_id */ + SerializedScriptValue, /* value */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBCursor::continue() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_CursorContinue, + int32, /* idb_cursor_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBCursor::remove() message. +IPC_SYNC_MESSAGE_CONTROL2_1(IndexedDBHostMsg_CursorDelete, + int32, /* idb_cursor_id */ + int32, /* response_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBFactory::open() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_FactoryOpen, + IndexedDBHostMsg_FactoryOpen_Params) + +// WebIDBFactory::deleteDatabase() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_FactoryDeleteDatabase, + IndexedDBHostMsg_FactoryDeleteDatabase_Params) + +// WebIDBDatabase::name() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseName, + int32, /* idb_database_id */ + string16 /* name */) + +// WebIDBDatabase::version() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseVersion, + int32, /* idb_database_id */ + string16 /* version */) + +// WebIDBDatabase::objectStoreNames() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseObjectStoreNames, + int32, /* idb_database_id */ + std::vector<string16> /* objectStoreNames */) + +// WebIDBDatabase::createObjectStore() message. +IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_DatabaseCreateObjectStore, + IndexedDBHostMsg_DatabaseCreateObjectStore_Params, + int32, /* object_store_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBDatabase::removeObjectStore() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseDeleteObjectStore, + int32, /* idb_database_id */ + string16, /* name */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBDatabase::setVersion() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseSetVersion, + int32, /* idb_database_id */ + int32, /* response_id */ + string16, /* version */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBDatabase::transaction() message. +// TODO: make this message async. Have the renderer create a +// temporary ID and keep a map in the browser process of real +// IDs to temporary IDs. We can then update the transaction +// to its real ID asynchronously. +IPC_SYNC_MESSAGE_CONTROL4_2(IndexedDBHostMsg_DatabaseTransaction, + int32, /* idb_database_id */ + std::vector<string16>, /* object_stores */ + int32, /* mode */ + int32, /* timeout */ + int32, /* idb_transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBDatabase::open() message. +IPC_MESSAGE_CONTROL2(IndexedDBHostMsg_DatabaseOpen, + int32, /* idb_database_id */ + int32 /* response_id */) + +// WebIDBDatabase::close() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseClose, + int32 /* idb_database_id */) + +// WebIDBDatabase::~WebIDBDatabase() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseDestroyed, + int32 /* idb_database_id */) + +// WebIDBIndex::name() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexName, + int32, /* idb_index_id */ + string16 /* name */) + +// WebIDBIndex::storeName() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexStoreName, + int32, /* idb_index_id */ + string16 /* store_name */) + +// WebIDBIndex::keyPath() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexKeyPath, + int32, /* idb_index_id */ + NullableString16 /* key_path */) + +// WebIDBIndex::unique() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexUnique, + int32, /* idb_unique_id */ + bool /* unique */) + +// WebIDBIndex::openObjectCursor() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexOpenObjectCursor, + IndexedDBHostMsg_IndexOpenCursor_Params, + WebKit::WebExceptionCode /* ec */) + +// WebIDBIndex::openKeyCursor() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_IndexOpenKeyCursor, + IndexedDBHostMsg_IndexOpenCursor_Params, + WebKit::WebExceptionCode /* ec */) + +// WebIDBIndex::getObject() message. +IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_IndexGetObject, + int32, /* idb_index_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBIndex::getKey() message. +IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_IndexGetKey, + int32, /* idb_index_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBIndex::~WebIDBIndex() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_IndexDestroyed, + int32 /* idb_index_id */) + +// WebIDBObjectStore::name() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreName, + int32, /* idb_object_store_id */ + string16 /* name */) + +// WebIDBObjectStore::keyPath() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreKeyPath, + int32, /* idb_object_store_id */ + NullableString16 /* keyPath */) + +// WebIDBObjectStore::indexNames() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreIndexNames, + int32, /* idb_object_store_id */ + std::vector<string16> /* index_names */) + +// WebIDBObjectStore::get() message. +IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreGet, + int32, /* idb_object_store_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::put() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStorePut, + IndexedDBHostMsg_ObjectStorePut_Params, + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::delete() message. +IPC_SYNC_MESSAGE_CONTROL4_1(IndexedDBHostMsg_ObjectStoreDelete, + int32, /* idb_object_store_id */ + int32, /* response_id */ + IndexedDBKey, /* key */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::clear() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_ObjectStoreClear, + int32, /* idb_object_store_id */ + int32, /* response_id */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::createIndex() message. +IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_ObjectStoreCreateIndex, + IndexedDBHostMsg_ObjectStoreCreateIndex_Params, + int32, /* index_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::index() message. +IPC_SYNC_MESSAGE_CONTROL2_2(IndexedDBHostMsg_ObjectStoreIndex, + int32, /* idb_object_store_id */ + string16, /* name */ + int32, /* idb_index_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::deleteIndex() message. +IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_ObjectStoreDeleteIndex, + int32, /* idb_object_store_id */ + string16, /* name */ + int32, /* transaction_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::openCursor() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_ObjectStoreOpenCursor, + IndexedDBHostMsg_ObjectStoreOpenCursor_Params, + WebKit::WebExceptionCode /* ec */) + +// WebIDBObjectStore::~WebIDBObjectStore() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_ObjectStoreDestroyed, + int32 /* idb_object_store_id */) + +// WebIDBDatabase::~WebIDBCursor() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_CursorDestroyed, + int32 /* idb_cursor_id */) + +// IDBTransaction::ObjectStore message. +IPC_SYNC_MESSAGE_CONTROL2_2(IndexedDBHostMsg_TransactionObjectStore, + int32, /* transaction_id */ + string16, /* name */ + int32, /* object_store_id */ + WebKit::WebExceptionCode /* ec */) + +// WebIDBTransaction::mode() message. +IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_TransactionMode, + int32, /* idb_transaction_id */ + int /* mode */) + +// WebIDBTransaction::abort() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionAbort, + int32 /* idb_transaction_id */) + +// IDBTransaction::DidCompleteTaskEvents() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDidCompleteTaskEvents, + int32 /* idb_transaction_id */) + +// WebIDBTransaction::~WebIDBTransaction() message. +IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_TransactionDestroyed, + int32 /* idb_transaction_id */) diff --git a/content/common/indexed_db_param_traits.cc b/content/common/indexed_db_param_traits.cc new file mode 100644 index 0000000..4c9d5ab --- /dev/null +++ b/content/common/indexed_db_param_traits.cc @@ -0,0 +1,105 @@ +// Copyright (c) 2010 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. + +#include "content/common/indexed_db_param_traits.h" + +#include "content/common/indexed_db_key.h" +#include "content/common/serialized_script_value.h" +#include "ipc/ipc_message_utils.h" + +namespace IPC { + +void ParamTraits<SerializedScriptValue>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.is_null()); + WriteParam(m, p.is_invalid()); + WriteParam(m, p.data()); +} + +bool ParamTraits<SerializedScriptValue>::Read(const Message* m, + void** iter, + param_type* r) { + bool is_null; + bool is_invalid; + string16 data; + bool ok = + ReadParam(m, iter, &is_null) && + ReadParam(m, iter, &is_invalid) && + ReadParam(m, iter, &data); + if (!ok) + return false; + r->set_is_null(is_null); + r->set_is_invalid(is_invalid); + r->set_data(data); + return true; +} + +void ParamTraits<SerializedScriptValue>::Log(const param_type& p, + std::string* l) { + l->append("<SerializedScriptValue>("); + LogParam(p.is_null(), l); + l->append(", "); + LogParam(p.is_invalid(), l); + l->append(", "); + LogParam(p.data(), l); + l->append(")"); +} + +void ParamTraits<IndexedDBKey>::Write(Message* m, const param_type& p) { + WriteParam(m, int(p.type())); + // TODO(jorlow): Technically, we only need to pack the type being used. + WriteParam(m, p.string()); + WriteParam(m, p.date()); + WriteParam(m, p.number()); +} + +bool ParamTraits<IndexedDBKey>::Read(const Message* m, + void** iter, + param_type* r) { + int type; + string16 string; + double date; + double number; + bool ok = + ReadParam(m, iter, &type) && + ReadParam(m, iter, &string) && + ReadParam(m, iter, &date) && + ReadParam(m, iter, &number); + + if (!ok) + return false; + switch (type) { + case WebKit::WebIDBKey::NullType: + r->SetNull(); + return true; + case WebKit::WebIDBKey::StringType: + r->SetString(string); + return true; + case WebKit::WebIDBKey::DateType: + r->SetDate(date); + return true; + case WebKit::WebIDBKey::NumberType: + r->SetNumber(number); + return true; + case WebKit::WebIDBKey::InvalidType: + r->SetInvalid(); + return true; + } + NOTREACHED(); + return false; +} + +void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) { + l->append("<IndexedDBKey>("); + LogParam(int(p.type()), l); + l->append(", "); + LogParam(p.string(), l); + l->append(", "); + LogParam(p.date(), l); + l->append(", "); + LogParam(p.number(), l); + l->append(")"); +} + +} // namespace IPC diff --git a/content/common/indexed_db_param_traits.h b/content/common/indexed_db_param_traits.h new file mode 100644 index 0000000..2045bdd --- /dev/null +++ b/content/common/indexed_db_param_traits.h @@ -0,0 +1,40 @@ +// Copyright (c) 2010 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. + +#ifndef CONTENT_COMMON_INDEXED_DB_PARAM_TRAITS_H_ +#define CONTENT_COMMON_INDEXED_DB_PARAM_TRAITS_H_ +#pragma once + +#include "ipc/ipc_message.h" +#include "ipc/ipc_param_traits.h" + +class IndexedDBKey; +class SerializedScriptValue; + +namespace IPC { + +// These datatypes are used by utility_messages.h and render_messages.h. +// Unfortunately we can't move it to common: MSVC linker complains about +// WebKit datatypes that are not linked on npchrome_frame (even though it's +// never actually used by that target). + +template <> +struct ParamTraits<SerializedScriptValue> { + typedef SerializedScriptValue param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<IndexedDBKey> { + typedef IndexedDBKey param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +} // namespace IPC + +#endif // CONTENT_COMMON_INDEXED_DB_PARAM_TRAITS_H_ diff --git a/content/common/pepper_file_messages.cc b/content/common/pepper_file_messages.cc new file mode 100644 index 0000000..f84ba89 --- /dev/null +++ b/content/common/pepper_file_messages.cc @@ -0,0 +1,62 @@ +// Copyright (c) 2011 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. + +#define IPC_MESSAGE_IMPL +#include "content/common/pepper_file_messages.h" + +namespace IPC { + +void ParamTraits<webkit::ppapi::DirEntry>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.is_dir); +} + +bool ParamTraits<webkit::ppapi::DirEntry>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->is_dir); +} + +void ParamTraits<webkit::ppapi::DirEntry>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.name, l); + l->append(", "); + LogParam(p.is_dir, l); + l->append(")"); +} + +void ParamTraits<webkit::ppapi::PepperFilePath>::Write(Message* m, + const param_type& p) { + WriteParam(m, static_cast<unsigned>(p.domain())); + WriteParam(m, p.path()); +} + +bool ParamTraits<webkit::ppapi::PepperFilePath>::Read(const Message* m, + void** iter, + param_type* p) { + unsigned domain; + FilePath path; + if (!ReadParam(m, iter, &domain) || !ReadParam(m, iter, &path)) + return false; + if (domain > webkit::ppapi::PepperFilePath::DOMAIN_MAX_VALID) + return false; + + *p = webkit::ppapi::PepperFilePath( + static_cast<webkit::ppapi::PepperFilePath::Domain>(domain), path); + return true; +} + +void ParamTraits<webkit::ppapi::PepperFilePath>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(static_cast<unsigned>(p.domain()), l); + l->append(", "); + LogParam(p.path(), l); + l->append(")"); +} + +} // namespace IPC diff --git a/content/common/pepper_file_messages.h b/content/common/pepper_file_messages.h new file mode 100644 index 0000000..2825623 --- /dev/null +++ b/content/common/pepper_file_messages.h @@ -0,0 +1,79 @@ +// Copyright (c) 2011 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. + +// Multiply-included message file, no traditional include guard. +#include "content/common/common_param_traits.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" +#include "ipc/ipc_platform_file.h" +#include "webkit/plugins/ppapi/dir_contents.h" +#include "webkit/plugins/ppapi/file_path.h" + +// Singly-included section, still not converted +#ifndef CHROME_COMMON_PEPPER_FILE_MESSAGES_H_ +#define CHROME_COMMON_PEPPER_FILE_MESSAGES_H_ + +namespace IPC { + +// Also needed for Serializing DirContents, which is just a vector of DirEntry. +template <> +struct ParamTraits<webkit::ppapi::DirEntry> { + typedef webkit::ppapi::DirEntry param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<webkit::ppapi::PepperFilePath> { + typedef webkit::ppapi::PepperFilePath param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +} // namespace IPC + +#endif // CHROME_COMMON_PEPPER_FILE_MESSAGES_H_ + +#define IPC_MESSAGE_START PepperFileMsgStart + +// Trusted Pepper Filesystem messages from the renderer to the browser. + +// Open the file. +IPC_SYNC_MESSAGE_CONTROL2_2(PepperFileMsg_OpenFile, + webkit::ppapi::PepperFilePath /* path */, + int /* flags */, + base::PlatformFileError /* error_code */, + IPC::PlatformFileForTransit /* result */) + +// Rename the file. +IPC_SYNC_MESSAGE_CONTROL2_1(PepperFileMsg_RenameFile, + webkit::ppapi::PepperFilePath /* from_path */, + webkit::ppapi::PepperFilePath /* to_path */, + base::PlatformFileError /* error_code */) + +// Delete the file. +IPC_SYNC_MESSAGE_CONTROL2_1(PepperFileMsg_DeleteFileOrDir, + webkit::ppapi::PepperFilePath /* path */, + bool /* recursive */, + base::PlatformFileError /* error_code */) + +// Create the directory. +IPC_SYNC_MESSAGE_CONTROL1_1(PepperFileMsg_CreateDir, + webkit::ppapi::PepperFilePath /* path */, + base::PlatformFileError /* error_code */) + +// Query the file's info. +IPC_SYNC_MESSAGE_CONTROL1_2(PepperFileMsg_QueryFile, + webkit::ppapi::PepperFilePath /* path */, + base::PlatformFileInfo, /* info */ + base::PlatformFileError /* error_code */) + +// Get the directory's contents. +IPC_SYNC_MESSAGE_CONTROL1_2(PepperFileMsg_GetDirContents, + webkit::ppapi::PepperFilePath /* path */, + webkit::ppapi::DirContents, /* contents */ + base::PlatformFileError /* error_code */) + diff --git a/content/common/pepper_messages.cc b/content/common/pepper_messages.cc new file mode 100644 index 0000000..b2a8f63 --- /dev/null +++ b/content/common/pepper_messages.cc @@ -0,0 +1,41 @@ +// Copyright (c) 2011 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. + +#include "ppapi/c/private/ppb_flash_net_connector.h" + +#define IPC_MESSAGE_IMPL +#include "content/common/pepper_messages.h" + +namespace IPC { + +void ParamTraits<PP_Flash_NetAddress>::Write(Message* m, const param_type& p) { + WriteParam(m, p.size); + m->WriteBytes(p.data, static_cast<int>(p.size)); +} + +bool ParamTraits<PP_Flash_NetAddress>::Read(const Message* m, + void** iter, + param_type* p) { + uint16 size; + if (!ReadParam(m, iter, &size)) + return false; + if (size > sizeof(p->data)) + return false; + p->size = size; + + const char* data; + if (!m->ReadBytes(iter, &data, size)) + return false; + memcpy(p->data, data, size); + return true; +} + +void ParamTraits<PP_Flash_NetAddress>::Log(const param_type& p, + std::string* l) { + l->append("<PP_Flash_NetAddress ("); + LogParam(p.size, l); + l->append(" bytes)>"); +} + +} // namespace IPC diff --git a/content/common/pepper_messages.h b/content/common/pepper_messages.h new file mode 100644 index 0000000..440a2c8 --- /dev/null +++ b/content/common/pepper_messages.h @@ -0,0 +1,52 @@ +// Copyright (c) 2011 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. + +// Multiply-included message file, no traditional include guard +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" +#include "ipc/ipc_platform_file.h" +#include "ppapi/c/private/ppb_flash_net_connector.h" + +// Singly-included section, not yet converted. +#ifndef CONTENT_COMMON_PEPPER_MESSAGES_H_ +#define CONTENT_COMMON_PEPPER_MESSAGES_H_ + +namespace IPC { + +template <> +struct ParamTraits<PP_Flash_NetAddress> { + typedef PP_Flash_NetAddress param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +} // namespace IPC + +#endif // CONTENT_COMMON_PEPPER_MESSAGES_H_ + +#define IPC_MESSAGE_START PepperMsgStart + +// Pepper (non-file-system) messages sent from the browser to the renderer. + +// The response to PepperMsg_ConnectTcp(Address). +IPC_MESSAGE_ROUTED4(PepperMsg_ConnectTcpACK, + int /* request_id */, + IPC::PlatformFileForTransit /* socket */, + PP_Flash_NetAddress /* local_addr */, + PP_Flash_NetAddress /* remote_addr */) + +// Pepper (non-file-system) messages sent from the renderer to the browser. + +IPC_MESSAGE_CONTROL4(PepperMsg_ConnectTcp, + int /* routing_id */, + int /* request_id */, + std::string /* host */, + uint16 /* port */) + +IPC_MESSAGE_CONTROL3(PepperMsg_ConnectTcpAddress, + int /* routing_id */, + int /* request_id */, + PP_Flash_NetAddress /* addr */) + diff --git a/content/common/serialized_script_value.cc b/content/common/serialized_script_value.cc new file mode 100644 index 0000000..4d6a658 --- /dev/null +++ b/content/common/serialized_script_value.cc @@ -0,0 +1,42 @@ +// Copyright (c) 2010 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. + +#include "content/common/serialized_script_value.h" + +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" + +using WebKit::WebSerializedScriptValue; + +SerializedScriptValue::SerializedScriptValue() + : is_null_(true), + is_invalid_(false) { +} + +SerializedScriptValue::SerializedScriptValue( + bool is_null, bool is_invalid, const string16& data) + : is_null_(is_null), + is_invalid_(is_invalid), + data_(data) { +} + +SerializedScriptValue::SerializedScriptValue( + const WebSerializedScriptValue& value) { + set_web_serialized_script_value(value); +} + +SerializedScriptValue::operator WebSerializedScriptValue() const { + if (is_null_) + return WebSerializedScriptValue(); + if (is_invalid_) + return WebSerializedScriptValue::createInvalid(); + return WebSerializedScriptValue::fromString(data_); +} + +void SerializedScriptValue::set_web_serialized_script_value( + const WebSerializedScriptValue& value) { + is_null_ = value.isNull(); + is_invalid_ = value.isNull() ? false : value.toString().isNull(); + data_ = value.isNull() ? string16() : static_cast<string16>(value.toString()); +} diff --git a/content/common/serialized_script_value.h b/content/common/serialized_script_value.h new file mode 100644 index 0000000..7352298 --- /dev/null +++ b/content/common/serialized_script_value.h @@ -0,0 +1,41 @@ +// Copyright (c) 2010 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. + +#ifndef CONTENT_COMMON_SERIALIZED_SCRIPT_VALUE_H_ +#define CONTENT_COMMON_SERIALIZED_SCRIPT_VALUE_H_ +#pragma once + +#include "base/string16.h" + +namespace WebKit { +class WebSerializedScriptValue; +} + +class SerializedScriptValue { + public: + SerializedScriptValue(); + SerializedScriptValue(bool is_null, bool is_invalid, const string16& data); + explicit SerializedScriptValue(const WebKit::WebSerializedScriptValue& value); + + void set_is_null(bool is_null) { is_null_ = is_null; } + bool is_null() const { return is_null_; } + + void set_is_invalid(bool is_invalid) { is_invalid_ = is_invalid; } + bool is_invalid() const { return is_invalid_; } + + void set_data(const string16& data) { data_ = data; } + const string16& data() const { return data_; } + + void set_web_serialized_script_value( + const WebKit::WebSerializedScriptValue& value); + + operator WebKit::WebSerializedScriptValue() const; + + private: + bool is_null_; // Is this null? If so, none of the other properties are valid. + bool is_invalid_; // Is data_ valid? + string16 data_; // The wire string format of the serialized script value. +}; + +#endif // CONTENT_COMMON_SERIALIZED_SCRIPT_VALUE_H_ diff --git a/content/common/speech_input_messages.h b/content/common/speech_input_messages.h new file mode 100644 index 0000000..df7f90f --- /dev/null +++ b/content/common/speech_input_messages.h @@ -0,0 +1,76 @@ +// Copyright (c) 2011 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. + +// Multiply-included message file, hence no include guard. + +#include <string> + +#include "content/common/speech_input_result.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" +#include "ui/gfx/rect.h" + +#define IPC_MESSAGE_START SpeechInputMsgStart + +// Used to start a speech recognition session. +IPC_STRUCT_BEGIN(SpeechInputHostMsg_StartRecognition_Params) + // The render view requesting speech recognition. + IPC_STRUCT_MEMBER(int, render_view_id) + // Request ID used within the render view. + IPC_STRUCT_MEMBER(int, request_id) + // Position of the UI element in page coordinates. + IPC_STRUCT_MEMBER(gfx::Rect, element_rect) + // Language to use for speech recognition. + IPC_STRUCT_MEMBER(std::string, language) + // Speech grammar given by the speech input element. + IPC_STRUCT_MEMBER(std::string, grammar) + // URL of the page (or iframe if applicable). + IPC_STRUCT_MEMBER(std::string, origin_url) +IPC_STRUCT_END() + +IPC_STRUCT_TRAITS_BEGIN(speech_input::SpeechInputResultItem) + IPC_STRUCT_TRAITS_MEMBER(utterance) + IPC_STRUCT_TRAITS_MEMBER(confidence) +IPC_STRUCT_TRAITS_END() + +// Speech input messages sent from the renderer to the browser. + +// Requests the speech input service to start speech recognition on behalf of +// the given |render_view_id|. +IPC_MESSAGE_CONTROL1(SpeechInputHostMsg_StartRecognition, + SpeechInputHostMsg_StartRecognition_Params) + +// Requests the speech input service to cancel speech recognition on behalf of +// the given |render_view_id|. If speech recognition is not happening or +// is happening on behalf of some other render view, this call does nothing. +IPC_MESSAGE_CONTROL2(SpeechInputHostMsg_CancelRecognition, + int /* render_view_id */, + int /* request_id */) + +// Requests the speech input service to stop audio recording on behalf of +// the given |render_view_id|. Any audio recorded so far will be fed to the +// speech recognizer. If speech recognition is not happening nor or is +// happening on behalf of some other render view, this call does nothing. +IPC_MESSAGE_CONTROL2(SpeechInputHostMsg_StopRecording, + int /* render_view_id */, + int /* request_id */) + +// Speech input messages sent from the browser to the renderer. + +// Relay a speech recognition result, either partial or final. +IPC_MESSAGE_ROUTED2(SpeechInputMsg_SetRecognitionResult, + int /* request_id */, + speech_input::SpeechInputResultArray /* result */) + +// Indicate that speech recognizer has stopped recording and started +// recognition. +IPC_MESSAGE_ROUTED1(SpeechInputMsg_RecordingComplete, + int /* request_id */) + +// Indicate that speech recognizer has completed recognition. This will be +// the last message sent in response to a +// ViewHostMsg_SpeechInput_StartRecognition. +IPC_MESSAGE_ROUTED1(SpeechInputMsg_RecognitionComplete, + int /* request_id */) + diff --git a/content/common/speech_input_result.h b/content/common/speech_input_result.h new file mode 100644 index 0000000..ed85959 --- /dev/null +++ b/content/common/speech_input_result.h @@ -0,0 +1,33 @@ +// Copyright (c) 2010 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. + +#ifndef CONTENT_COMMON_SPEECH_INPUT_RESULT_H_ +#define CONTENT_COMMON_SPEECH_INPUT_RESULT_H_ + +#include <vector> + +#include "base/basictypes.h" +#include "base/string16.h" + +namespace speech_input { + +struct SpeechInputResultItem { + string16 utterance; + double confidence; + + SpeechInputResultItem() + : confidence(0.0) { + } + + SpeechInputResultItem(const string16 utterance_value, double confidence_value) + : utterance(utterance_value), + confidence(confidence_value) { + } +}; + +typedef std::vector<SpeechInputResultItem> SpeechInputResultArray; + +} // namespace speech_input + +#endif // CONTENT_COMMON_SPEECH_INPUT_RESULT_H_ diff --git a/content/content_common.gypi b/content/content_common.gypi index baa119f4..e2ff9ee 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -37,6 +37,7 @@ 'common/child_thread.h', 'common/chrome_application_mac.h', 'common/chrome_application_mac.mm', + 'common/clipboard_messages.h', 'common/common_param_traits.cc', 'common/common_param_traits.h', 'common/content_message_generator.cc', @@ -58,6 +59,8 @@ 'common/debug_flags.h', 'common/dx_diag_node.cc', 'common/dx_diag_node.h', + 'common/dom_storage_common.h', + 'common/dom_storage_messages.h', 'common/file_system/file_system_dispatcher.cc', 'common/file_system/file_system_dispatcher.h', 'common/file_system/webfilesystem_callback_dispatcher.cc', @@ -78,6 +81,11 @@ 'common/hi_res_timer_manager_posix.cc', 'common/hi_res_timer_manager_win.cc', 'common/hi_res_timer_manager.h', + 'common/indexed_db_key.cc', + 'common/indexed_db_key.h', + 'common/indexed_db_messages.h', + 'common/indexed_db_param_traits.cc', + 'common/indexed_db_param_traits.h', 'common/main_function_params.h', 'common/message_router.cc', 'common/message_router.h', @@ -94,6 +102,10 @@ 'common/notification_type.h', 'common/p2p_messages.h', 'common/p2p_sockets.h', + 'common/pepper_file_messages.cc', + 'common/pepper_file_messages.h', + 'common/pepper_messages.cc', + 'common/pepper_messages.h', 'common/plugin_carbon_interpose_constants_mac.cc', 'common/plugin_carbon_interpose_constants_mac.h', 'common/plugin_messages.h', @@ -112,10 +124,14 @@ 'common/sandbox_mac.mm', 'common/section_util_win.cc', 'common/section_util_win.h', + 'common/serialized_script_value.cc', + 'common/serialized_script_value.h', 'common/socket_stream.h', 'common/socket_stream_dispatcher.cc', 'common/socket_stream_dispatcher.h', 'common/socket_stream_messages.h', + 'common/speech_input_messages.h', + 'common/speech_input_result.h', 'common/web_database_observer_impl.cc', 'common/web_database_observer_impl.h', 'common/webblobregistry_impl.cc', |