diff options
author | Kristian Monsen <kristianm@google.com> | 2011-05-11 20:53:37 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2011-05-16 13:54:48 +0100 |
commit | 21d179b334e59e9a3bfcaed4c4430bef1bc5759d (patch) | |
tree | 64e2bb6da27af6a5c93ca34f6051584aafbfcb9e /chrome/common | |
parent | 0c63f00edd6ed0482fd5cbcea937ca088baf7858 (diff) | |
download | external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.zip external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.gz external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.bz2 |
Merge Chromium at 10.0.621.0: Initial merge by git.
Change-Id: I070cc91c608dfa4a968a5a54c173260765ac8097
Diffstat (limited to 'chrome/common')
247 files changed, 9931 insertions, 7546 deletions
diff --git a/chrome/common/DEPS b/chrome/common/DEPS index 18175ac..a4256b3 100644 --- a/chrome/common/DEPS +++ b/chrome/common/DEPS @@ -9,6 +9,7 @@ include_rules = [ "+sandbox/src", "+skia", "+webkit/glue", + "+webkit/plugins", # Other libraries. "+chrome/third_party/xdg_user_dirs", diff --git a/chrome/common/appcache/appcache_dispatcher.h b/chrome/common/appcache/appcache_dispatcher.h index f099183..f88a38a 100644 --- a/chrome/common/appcache/appcache_dispatcher.h +++ b/chrome/common/appcache/appcache_dispatcher.h @@ -9,20 +9,21 @@ #include <string> #include <vector> #include "chrome/common/appcache/appcache_backend_proxy.h" -#include "ipc/ipc_message.h" +#include "ipc/ipc_channel.h" #include "webkit/appcache/appcache_frontend_impl.h" // Dispatches appcache related messages sent to a child process from the // main browser process. There is one instance per child process. Messages // are dispatched on the main child thread. The ChildThread base class // creates an instance and delegates calls to it. -class AppCacheDispatcher { +class AppCacheDispatcher : public IPC::Channel::Listener { public: explicit AppCacheDispatcher(IPC::Message::Sender* sender) : backend_proxy_(sender) {} AppCacheBackendProxy* backend_proxy() { return &backend_proxy_; } + // IPC::Channel::Listener implementation bool OnMessageReceived(const IPC::Message& msg); private: diff --git a/chrome/common/automation_messages.cc b/chrome/common/automation_messages.cc index df6d0e2..8dcac0e 100644 --- a/chrome/common/automation_messages.cc +++ b/chrome/common/automation_messages.cc @@ -2,8 +2,673 @@ // 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 "chrome/common/automation_messages.h" -#define MESSAGES_INTERNAL_IMPL_FILE \ - "chrome/common/automation_messages_internal.h" -#include "ipc/ipc_message_impl_macros.h" + +AutomationURLRequest::AutomationURLRequest() + : resource_type(0), + load_flags(0) { +} + +AutomationURLRequest::AutomationURLRequest( + const std::string& in_url, + const std::string& in_method, + const std::string& in_referrer, + const std::string& in_extra_request_headers, + scoped_refptr<net::UploadData> in_upload_data, + int in_resource_type, + int in_load_flags) + : url(in_url), + method(in_method), + referrer(in_referrer), + extra_request_headers(in_extra_request_headers), + upload_data(in_upload_data), + resource_type(in_resource_type), + load_flags(in_load_flags) { +} + +AutomationURLRequest::~AutomationURLRequest() {} + +AutomationURLResponse::AutomationURLResponse() + : content_length(0), + redirect_status(0) { +} + +AutomationURLResponse::AutomationURLResponse(const std::string& in_mime_type, + const std::string& in_headers, + int64 in_content_length, + const base::Time& in_last_modified, + const std::string& in_redirect_url, + int in_redirect_status) + : mime_type(in_mime_type), + headers(in_headers), + content_length(in_content_length), + last_modified(in_last_modified), + redirect_url(in_redirect_url), + redirect_status(in_redirect_status) { +} + + +AutomationURLResponse::~AutomationURLResponse() {} + +ExternalTabSettings::ExternalTabSettings() + : parent(NULL), + dimensions(), + style(0), + is_off_the_record(false), + load_requests_via_automation(false), + handle_top_level_requests(false), + initial_url(), + referrer(), + infobars_enabled(false), + route_all_top_level_navigations(false) { +} + +ExternalTabSettings::ExternalTabSettings( + gfx::NativeWindow in_parent, + const gfx::Rect& in_dimensions, + unsigned int in_style, + bool in_is_off_the_record, + bool in_load_requests_via_automation, + bool in_handle_top_level_requests, + const GURL& in_initial_url, + const GURL& in_referrer, + bool in_infobars_enabled, + bool in_route_all_top_level_navigations) + : parent(in_parent), + dimensions(in_dimensions), + style(in_style), + is_off_the_record(in_is_off_the_record), + load_requests_via_automation(in_load_requests_via_automation), + handle_top_level_requests(in_handle_top_level_requests), + initial_url(in_initial_url), + referrer(in_referrer), + infobars_enabled(in_infobars_enabled), + route_all_top_level_navigations(in_route_all_top_level_navigations) { +} + +ExternalTabSettings::~ExternalTabSettings() {} + +NavigationInfo::NavigationInfo() + : navigation_type(0), + relative_offset(0), + navigation_index(0), + displayed_insecure_content(0), + ran_insecure_content(0) { +} + +NavigationInfo::NavigationInfo(int in_navigation_type, + int in_relative_offset, + int in_navigation_index, + const std::wstring& in_title, + const GURL& in_url, + const GURL& in_referrer, + SecurityStyle in_security_style, + bool in_displayed_insecure_content, + bool in_ran_insecure_content) + : navigation_type(in_navigation_type), + relative_offset(in_relative_offset), + navigation_index(in_navigation_index), + title(in_title), + url(in_url), + referrer(in_referrer), + security_style(in_security_style), + displayed_insecure_content(in_displayed_insecure_content), + ran_insecure_content(in_ran_insecure_content) { +} + +NavigationInfo::~NavigationInfo() {} + +MiniContextMenuParams::MiniContextMenuParams() + : screen_x(0), + screen_y(0) { +} + +MiniContextMenuParams::MiniContextMenuParams(int in_screen_x, + int in_screen_y, + const GURL& in_link_url, + const GURL& in_unfiltered_link_url, + const GURL& in_src_url, + const GURL& in_page_url, + const GURL& in_frame_url) + : screen_x(in_screen_x), + screen_y(in_screen_y), + link_url(in_link_url), + unfiltered_link_url(in_unfiltered_link_url), + src_url(in_src_url), + page_url(in_page_url), + frame_url(in_frame_url) { +} + +MiniContextMenuParams::~MiniContextMenuParams() {} + +AttachExternalTabParams::AttachExternalTabParams() + : cookie(0), + disposition(0), + user_gesture(false) { +} + +AttachExternalTabParams::AttachExternalTabParams( + uint64 in_cookie, + const GURL& in_url, + const gfx::Rect& in_dimensions, + int in_disposition, + bool in_user_gesture, + const std::string& in_profile_name) + : cookie(in_cookie), + url(in_url), + dimensions(in_dimensions), + disposition(in_disposition), + user_gesture(in_user_gesture), + profile_name(in_profile_name) { +} + +AttachExternalTabParams::~AttachExternalTabParams() {} + +namespace IPC { + +// static +void ParamTraits<AutomationMsg_Find_Params>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.unused); + WriteParam(m, p.search_string); + WriteParam(m, p.forward); + WriteParam(m, p.match_case); + WriteParam(m, p.find_next); +} + +// static +bool ParamTraits<AutomationMsg_Find_Params>::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->unused) && + ReadParam(m, iter, &p->search_string) && + ReadParam(m, iter, &p->forward) && + ReadParam(m, iter, &p->match_case) && + ReadParam(m, iter, &p->find_next); +} + +// static +void ParamTraits<AutomationMsg_Find_Params>::Log(const param_type& p, + std::string* l) { + l->append("<AutomationMsg_Find_Params>"); +} + +// static +void ParamTraits<AutomationMsg_NavigationResponseValues>::Write( + Message* m, + const param_type& p) { + m->WriteInt(p); +} + +// static +bool ParamTraits<AutomationMsg_NavigationResponseValues>::Read(const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<AutomationMsg_NavigationResponseValues>(type); + return true; +} + +// static +void ParamTraits<AutomationMsg_NavigationResponseValues>::Log( + const param_type& p, std::string* l) { + std::string control; + switch (p) { + case AUTOMATION_MSG_NAVIGATION_ERROR: + control = "AUTOMATION_MSG_NAVIGATION_ERROR"; + break; + case AUTOMATION_MSG_NAVIGATION_SUCCESS: + control = "AUTOMATION_MSG_NAVIGATION_SUCCESS"; + break; + case AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED: + control = "AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED"; + break; + default: + control = "UNKNOWN"; + break; + } + + LogParam(control, l); +} + +// static +void ParamTraits<AutomationMsg_ExtensionResponseValues>::Write( + Message* m, + const param_type& p) { + m->WriteInt(p); +} + +// static +bool ParamTraits<AutomationMsg_ExtensionResponseValues>::Read( + const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<AutomationMsg_ExtensionResponseValues>(type); + return true; +} + +// static +void ParamTraits<AutomationMsg_ExtensionResponseValues>::Log( + const param_type& p, + std::string* l) { + std::string control; + switch (p) { + case AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED: + control = "AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED"; + break; + case AUTOMATION_MSG_EXTENSION_INSTALL_FAILED: + control = "AUTOMATION_MSG_EXTENSION_INSTALL_FAILED"; + break; + default: + control = "UNKNOWN"; + break; + } + + LogParam(control, l); +} + +// static +void ParamTraits<AutomationMsg_ExtensionProperty>::Write(Message* m, + const param_type& p) { + m->WriteInt(p); +} + +// static +bool ParamTraits<AutomationMsg_ExtensionProperty>::Read(const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<AutomationMsg_ExtensionProperty>(type); + return true; +} + +// static +void ParamTraits<AutomationMsg_ExtensionProperty>::Log(const param_type& p, + std::string* l) { + std::string control; + switch (p) { + case AUTOMATION_MSG_EXTENSION_ID: + control = "AUTOMATION_MSG_EXTENSION_ID"; + break; + case AUTOMATION_MSG_EXTENSION_NAME: + control = "AUTOMATION_MSG_EXTENSION_NAME"; + break; + case AUTOMATION_MSG_EXTENSION_VERSION: + control = "AUTOMATION_MSG_EXTENSION_VERSION"; + break; + case AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX: + control = "AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX"; + break; + default: + control = "UNKNOWN"; + break; + } + + LogParam(control, l); +} + +// static +void ParamTraits<SecurityStyle>::Write(Message* m, const param_type& p) { + m->WriteInt(p); +} + +// static +bool ParamTraits<SecurityStyle>::Read(const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<SecurityStyle>(type); + return true; +} + +// static +void ParamTraits<SecurityStyle>::Log(const param_type& p, std::string* l) { + std::string control; + switch (p) { + case SECURITY_STYLE_UNKNOWN: + control = "SECURITY_STYLE_UNKNOWN"; + break; + case SECURITY_STYLE_UNAUTHENTICATED: + control = "SECURITY_STYLE_UNAUTHENTICATED"; + break; + case SECURITY_STYLE_AUTHENTICATION_BROKEN: + control = "SECURITY_STYLE_AUTHENTICATION_BROKEN"; + break; + case SECURITY_STYLE_AUTHENTICATED: + control = "SECURITY_STYLE_AUTHENTICATED"; + break; + default: + control = "UNKNOWN"; + break; + } + + LogParam(control, l); +} + +// static +void ParamTraits<PageType>::Write(Message* m, const param_type& p) { + m->WriteInt(p); +} + +// static +bool ParamTraits<PageType>::Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<PageType>(type); + return true; +} + +// static +void ParamTraits<PageType>::Log(const param_type& p, std::string* l) { + std::string control; + switch (p) { + case NORMAL_PAGE: + control = "NORMAL_PAGE"; + break; + case ERROR_PAGE: + control = "ERROR_PAGE"; + break; + case INTERSTITIAL_PAGE: + control = "INTERSTITIAL_PAGE"; + break; + default: + control = "UNKNOWN"; + break; + } + + LogParam(control, l); +} + +// static +void ParamTraits<AutomationURLRequest>::Write(Message* m, const param_type& p) { + WriteParam(m, p.url); + WriteParam(m, p.method); + WriteParam(m, p.referrer); + WriteParam(m, p.extra_request_headers); + WriteParam(m, p.upload_data); + WriteParam(m, p.resource_type); + WriteParam(m, p.load_flags); +} + +// static +bool ParamTraits<AutomationURLRequest>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->method) && + ReadParam(m, iter, &p->referrer) && + ReadParam(m, iter, &p->extra_request_headers) && + ReadParam(m, iter, &p->upload_data) && + ReadParam(m, iter, &p->resource_type) && + ReadParam(m, iter, &p->load_flags); +} + +// static +void ParamTraits<AutomationURLRequest>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.url, l); + l->append(", "); + LogParam(p.method, l); + l->append(", "); + LogParam(p.referrer, l); + l->append(", "); + LogParam(p.extra_request_headers, l); + l->append(", "); + LogParam(p.upload_data, l); + l->append(", "); + LogParam(p.resource_type, l); + l->append(", "); + LogParam(p.load_flags, l); + l->append(")"); +} + +// static +void ParamTraits<AutomationURLResponse>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.mime_type); + WriteParam(m, p.headers); + WriteParam(m, p.content_length); + WriteParam(m, p.last_modified); + WriteParam(m, p.redirect_url); + WriteParam(m, p.redirect_status); +} + +// static +bool ParamTraits<AutomationURLResponse>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->mime_type) && + ReadParam(m, iter, &p->headers) && + ReadParam(m, iter, &p->content_length) && + ReadParam(m, iter, &p->last_modified) && + ReadParam(m, iter, &p->redirect_url) && + ReadParam(m, iter, &p->redirect_status); +} + +// static +void ParamTraits<AutomationURLResponse>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.mime_type, l); + l->append(", "); + LogParam(p.headers, l); + l->append(", "); + LogParam(p.content_length, l); + l->append(", "); + LogParam(p.last_modified, l); + l->append(", "); + LogParam(p.redirect_url, l); + l->append(", "); + LogParam(p.redirect_status, l); + l->append(")"); +} + +// static +void ParamTraits<ExternalTabSettings>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.parent); + WriteParam(m, p.dimensions); + WriteParam(m, p.style); + WriteParam(m, p.is_off_the_record); + WriteParam(m, p.load_requests_via_automation); + WriteParam(m, p.handle_top_level_requests); + WriteParam(m, p.initial_url); + WriteParam(m, p.referrer); + WriteParam(m, p.infobars_enabled); + WriteParam(m, p.route_all_top_level_navigations); +} + +// static +bool ParamTraits<ExternalTabSettings>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->parent) && + ReadParam(m, iter, &p->dimensions) && + ReadParam(m, iter, &p->style) && + ReadParam(m, iter, &p->is_off_the_record) && + ReadParam(m, iter, &p->load_requests_via_automation) && + ReadParam(m, iter, &p->handle_top_level_requests) && + ReadParam(m, iter, &p->initial_url) && + ReadParam(m, iter, &p->referrer) && + ReadParam(m, iter, &p->infobars_enabled) && + ReadParam(m, iter, &p->route_all_top_level_navigations); +} + +// static +void ParamTraits<ExternalTabSettings>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.parent, l); + l->append(", "); + LogParam(p.dimensions, l); + l->append(", "); + LogParam(p.style, l); + l->append(", "); + LogParam(p.is_off_the_record, l); + l->append(", "); + LogParam(p.load_requests_via_automation, l); + l->append(", "); + LogParam(p.handle_top_level_requests, l); + l->append(", "); + LogParam(p.initial_url, l); + l->append(", "); + LogParam(p.referrer, l); + l->append(", "); + LogParam(p.infobars_enabled, l); + l->append(", "); + LogParam(p.route_all_top_level_navigations, l); + l->append(")"); +} + +// static +void ParamTraits<NavigationInfo>::Write(Message* m, const param_type& p) { + WriteParam(m, p.navigation_type); + WriteParam(m, p.relative_offset); + WriteParam(m, p.navigation_index); + WriteParam(m, p.title); + WriteParam(m, p.url); + WriteParam(m, p.referrer); + WriteParam(m, p.security_style); + WriteParam(m, p.displayed_insecure_content); + WriteParam(m, p.ran_insecure_content); +} + +// static +bool ParamTraits<NavigationInfo>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->navigation_type) && + ReadParam(m, iter, &p->relative_offset) && + ReadParam(m, iter, &p->navigation_index) && + ReadParam(m, iter, &p->title) && + ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->referrer) && + ReadParam(m, iter, &p->security_style) && + ReadParam(m, iter, &p->displayed_insecure_content) && + ReadParam(m, iter, &p->ran_insecure_content); +} + +// static +void ParamTraits<NavigationInfo>::Log(const param_type& p, std::string* l) { + l->append("("); + LogParam(p.navigation_type, l); + l->append(", "); + LogParam(p.relative_offset, l); + l->append(", "); + LogParam(p.navigation_index, l); + l->append(", "); + LogParam(p.title, l); + l->append(", "); + LogParam(p.url, l); + l->append(", "); + LogParam(p.referrer, l); + l->append(", "); + LogParam(p.security_style, l); + l->append(", "); + LogParam(p.displayed_insecure_content, l); + l->append(", "); + LogParam(p.ran_insecure_content, l); + l->append(")"); +} + +// static +void ParamTraits<MiniContextMenuParams>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.screen_x); + WriteParam(m, p.screen_y); + WriteParam(m, p.link_url); + WriteParam(m, p.unfiltered_link_url); + WriteParam(m, p.src_url); + WriteParam(m, p.page_url); + WriteParam(m, p.frame_url); +} + +// static +bool ParamTraits<MiniContextMenuParams>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->screen_x) && + ReadParam(m, iter, &p->screen_y) && + ReadParam(m, iter, &p->link_url) && + ReadParam(m, iter, &p->unfiltered_link_url) && + ReadParam(m, iter, &p->src_url) && + ReadParam(m, iter, &p->page_url) && + ReadParam(m, iter, &p->frame_url); +} + +// static +void ParamTraits<MiniContextMenuParams>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.screen_x, l); + l->append(", "); + LogParam(p.screen_y, l); + l->append(", "); + LogParam(p.link_url, l); + l->append(", "); + LogParam(p.unfiltered_link_url, l); + l->append(", "); + LogParam(p.src_url, l); + l->append(", "); + LogParam(p.page_url, l); + l->append(", "); + LogParam(p.frame_url, l); + l->append(")"); +} + +// static +void ParamTraits<AttachExternalTabParams>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.cookie); + WriteParam(m, p.url); + WriteParam(m, p.dimensions); + WriteParam(m, p.disposition); + WriteParam(m, p.user_gesture); + WriteParam(m, p.profile_name); +} + +// static +bool ParamTraits<AttachExternalTabParams>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->cookie) && + ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->dimensions) && + ReadParam(m, iter, &p->disposition) && + ReadParam(m, iter, &p->user_gesture) && + ReadParam(m, iter, &p->profile_name); +} + +// static +void ParamTraits<AttachExternalTabParams>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.cookie, l); + l->append(", "); + LogParam(p.url, l); + l->append(", "); + LogParam(p.dimensions, l); + l->append(", "); + LogParam(p.disposition, l); + l->append(", "); + LogParam(p.user_gesture, l); + l->append(","); + LogParam(p.profile_name, l); + l->append(")"); +} + +} // namespace IPC diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h index 0f8ec7c..7a9ba91 100644 --- a/chrome/common/automation_messages.h +++ b/chrome/common/automation_messages.h @@ -34,216 +34,218 @@ struct AutomationMsg_Find_Params { bool find_next; }; +struct AutomationURLResponse { + AutomationURLResponse(); + AutomationURLResponse(const std::string& mime_type, + const std::string& headers, + int64 content_length, + const base::Time& last_modified, + const std::string& redirect_url, + int redirect_status); + ~AutomationURLResponse(); + + std::string mime_type; + std::string headers; + int64 content_length; + base::Time last_modified; + std::string redirect_url; + int redirect_status; +}; + +struct ExternalTabSettings { + ExternalTabSettings(); + ExternalTabSettings(gfx::NativeWindow parent, + const gfx::Rect& dimensions, + unsigned int style, + bool is_off_the_record, + bool load_requests_via_automation, + bool handle_top_level_requests, + const GURL& initial_url, + const GURL& referrer, + bool infobars_enabled, + bool route_all_top_level_navigations); + ~ExternalTabSettings(); + + gfx::NativeWindow parent; + gfx::Rect dimensions; + unsigned int style; + bool is_off_the_record; + bool load_requests_via_automation; + bool handle_top_level_requests; + GURL initial_url; + GURL referrer; + bool infobars_enabled; + bool route_all_top_level_navigations; +}; + +struct NavigationInfo { + NavigationInfo(); + NavigationInfo(int navigation_type, + int relative_offset, + int navigation_index, + const std::wstring& title, + const GURL& url, + const GURL& referrer, + SecurityStyle security_style, + bool displayed_insecure_content, + bool ran_insecure_content); + ~NavigationInfo(); + + int navigation_type; + int relative_offset; + int navigation_index; + std::wstring title; + GURL url; + GURL referrer; + SecurityStyle security_style; + bool displayed_insecure_content; + bool ran_insecure_content; +}; + +// A stripped down version of ContextMenuParams in webkit/glue/context_menu.h. +struct MiniContextMenuParams { + MiniContextMenuParams(); + MiniContextMenuParams(int screen_x, + int screen_y, + const GURL& link_url, + const GURL& unfiltered_link_url, + const GURL& src_url, + const GURL& page_url, + const GURL& frame_url); + ~MiniContextMenuParams(); + + // The x coordinate for displaying the menu. + int screen_x; + + // The y coordinate for displaying the menu. + int screen_y; + + // This is the URL of the link that encloses the node the context menu was + // invoked on. + GURL link_url; + + // The link URL to be used ONLY for "copy link address". We don't validate + // this field in the frontend process. + GURL unfiltered_link_url; + + // This is the source URL for the element that the context menu was + // invoked on. Example of elements with source URLs are img, audio, and + // video. + GURL src_url; + + // This is the URL of the top level page that the context menu was invoked + // on. + GURL page_url; + + // This is the URL of the subframe that the context menu was invoked on. + GURL frame_url; +}; + +struct AttachExternalTabParams { + AttachExternalTabParams(); + AttachExternalTabParams(uint64 cookie, + const GURL& url, + const gfx::Rect& dimensions, + int disposition, + bool user_gesture, + const std::string& profile_name); + ~AttachExternalTabParams(); + + uint64 cookie; + GURL url; + gfx::Rect dimensions; + int disposition; + bool user_gesture; + std::string profile_name; +}; + +#if defined(OS_WIN) + +struct Reposition_Params { + HWND window; + HWND window_insert_after; + int left; + int top; + int width; + int height; + int flags; + bool set_parent; + HWND parent_window; +}; + +#endif // defined(OS_WIN) + +struct AutomationURLRequest { + AutomationURLRequest(); + AutomationURLRequest(const std::string& url, + const std::string& method, + const std::string& referrer, + const std::string& extra_request_headers, + scoped_refptr<net::UploadData> upload_data, + int resource_type, + int load_flags); + ~AutomationURLRequest(); + + std::string url; + std::string method; + std::string referrer; + std::string extra_request_headers; + scoped_refptr<net::UploadData> upload_data; + int resource_type; // see webkit/glue/resource_type.h + int load_flags; // see net/base/load_flags.h +}; + namespace IPC { template <> struct ParamTraits<AutomationMsg_Find_Params> { typedef AutomationMsg_Find_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.unused); - WriteParam(m, p.search_string); - WriteParam(m, p.forward); - WriteParam(m, p.match_case); - WriteParam(m, p.find_next); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->unused) && - ReadParam(m, iter, &p->search_string) && - ReadParam(m, iter, &p->forward) && - ReadParam(m, iter, &p->match_case) && - ReadParam(m, iter, &p->find_next); - } - static void Log(const param_type& p, std::string* l) { - l->append("<AutomationMsg_Find_Params>"); - } + 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<AutomationMsg_NavigationResponseValues> { typedef AutomationMsg_NavigationResponseValues 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<AutomationMsg_NavigationResponseValues>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case AUTOMATION_MSG_NAVIGATION_ERROR: - control = "AUTOMATION_MSG_NAVIGATION_ERROR"; - break; - case AUTOMATION_MSG_NAVIGATION_SUCCESS: - control = "AUTOMATION_MSG_NAVIGATION_SUCCESS"; - break; - case AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED: - control = "AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED"; - break; - default: - control = "UNKNOWN"; - break; - } - - LogParam(control, l); - } + 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<AutomationMsg_ExtensionResponseValues> { typedef AutomationMsg_ExtensionResponseValues 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<AutomationMsg_ExtensionResponseValues>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED: - control = "AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED"; - break; - case AUTOMATION_MSG_EXTENSION_INSTALL_FAILED: - control = "AUTOMATION_MSG_EXTENSION_INSTALL_FAILED"; - break; - default: - control = "UNKNOWN"; - break; - } - - LogParam(control, l); - } + 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<AutomationMsg_ExtensionProperty> { typedef AutomationMsg_ExtensionProperty 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<AutomationMsg_ExtensionProperty>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case AUTOMATION_MSG_EXTENSION_ID: - control = "AUTOMATION_MSG_EXTENSION_ID"; - break; - case AUTOMATION_MSG_EXTENSION_NAME: - control = "AUTOMATION_MSG_EXTENSION_NAME"; - break; - case AUTOMATION_MSG_EXTENSION_VERSION: - control = "AUTOMATION_MSG_EXTENSION_VERSION"; - break; - case AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX: - control = "AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX"; - break; - default: - control = "UNKNOWN"; - break; - } - - LogParam(control, l); - } + 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<SecurityStyle> { typedef SecurityStyle 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<SecurityStyle>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case SECURITY_STYLE_UNKNOWN: - control = "SECURITY_STYLE_UNKNOWN"; - break; - case SECURITY_STYLE_UNAUTHENTICATED: - control = "SECURITY_STYLE_UNAUTHENTICATED"; - break; - case SECURITY_STYLE_AUTHENTICATION_BROKEN: - control = "SECURITY_STYLE_AUTHENTICATION_BROKEN"; - break; - case SECURITY_STYLE_AUTHENTICATED: - control = "SECURITY_STYLE_AUTHENTICATED"; - break; - default: - control = "UNKNOWN"; - break; - } - - LogParam(control, l); - } + 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<PageType> { typedef PageType 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<PageType>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case NORMAL_PAGE: - control = "NORMAL_PAGE"; - break; - case ERROR_PAGE: - control = "ERROR_PAGE"; - break; - case INTERSTITIAL_PAGE: - control = "INTERSTITIAL_PAGE"; - break; - default: - control = "UNKNOWN"; - break; - } - - LogParam(control, l); - } + 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); }; #if defined(OS_WIN) -struct Reposition_Params { - HWND window; - HWND window_insert_after; - int left; - int top; - int width; - int height; - int flags; - bool set_parent; - HWND parent_window; -}; // Traits for SetWindowPos_Params structure to pack/unpack. template <> @@ -295,351 +297,61 @@ struct ParamTraits<Reposition_Params> { }; #endif // defined(OS_WIN) -struct AutomationURLRequest { - std::string url; - std::string method; - std::string referrer; - std::string extra_request_headers; - scoped_refptr<net::UploadData> upload_data; - int resource_type; // see webkit/glue/resource_type.h - int load_flags; // see net/base/load_flags.h -}; - // Traits for AutomationURLRequest structure to pack/unpack. template <> struct ParamTraits<AutomationURLRequest> { typedef AutomationURLRequest param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.url); - WriteParam(m, p.method); - WriteParam(m, p.referrer); - WriteParam(m, p.extra_request_headers); - WriteParam(m, p.upload_data); - WriteParam(m, p.resource_type); - WriteParam(m, p.load_flags); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->method) && - ReadParam(m, iter, &p->referrer) && - ReadParam(m, iter, &p->extra_request_headers) && - ReadParam(m, iter, &p->upload_data) && - ReadParam(m, iter, &p->resource_type) && - ReadParam(m, iter, &p->load_flags); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.url, l); - l->append(", "); - LogParam(p.method, l); - l->append(", "); - LogParam(p.referrer, l); - l->append(", "); - LogParam(p.extra_request_headers, l); - l->append(", "); - LogParam(p.upload_data, l); - l->append(", "); - LogParam(p.resource_type, l); - l->append(", "); - LogParam(p.load_flags, l); - l->append(")"); - } -}; - -struct AutomationURLResponse { - std::string mime_type; - std::string headers; - int64 content_length; - base::Time last_modified; - std::string redirect_url; - int redirect_status; + 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); }; // Traits for AutomationURLResponse structure to pack/unpack. template <> struct ParamTraits<AutomationURLResponse> { typedef AutomationURLResponse param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.mime_type); - WriteParam(m, p.headers); - WriteParam(m, p.content_length); - WriteParam(m, p.last_modified); - WriteParam(m, p.redirect_url); - WriteParam(m, p.redirect_status); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->mime_type) && - ReadParam(m, iter, &p->headers) && - ReadParam(m, iter, &p->content_length) && - ReadParam(m, iter, &p->last_modified) && - ReadParam(m, iter, &p->redirect_url) && - ReadParam(m, iter, &p->redirect_status); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.mime_type, l); - l->append(", "); - LogParam(p.headers, l); - l->append(", "); - LogParam(p.content_length, l); - l->append(", "); - LogParam(p.last_modified, l); - l->append(", "); - LogParam(p.redirect_url, l); - l->append(", "); - LogParam(p.redirect_status, l); - l->append(")"); - } -}; - -struct ExternalTabSettings { - gfx::NativeWindow parent; - gfx::Rect dimensions; - unsigned int style; - bool is_off_the_record; - bool load_requests_via_automation; - bool handle_top_level_requests; - GURL initial_url; - GURL referrer; - bool infobars_enabled; - bool route_all_top_level_navigations; + 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); }; // Traits for ExternalTabSettings structure to pack/unpack. template <> struct ParamTraits<ExternalTabSettings> { typedef ExternalTabSettings param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.parent); - WriteParam(m, p.dimensions); - WriteParam(m, p.style); - WriteParam(m, p.is_off_the_record); - WriteParam(m, p.load_requests_via_automation); - WriteParam(m, p.handle_top_level_requests); - WriteParam(m, p.initial_url); - WriteParam(m, p.referrer); - WriteParam(m, p.infobars_enabled); - WriteParam(m, p.route_all_top_level_navigations); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->parent) && - ReadParam(m, iter, &p->dimensions) && - ReadParam(m, iter, &p->style) && - ReadParam(m, iter, &p->is_off_the_record) && - ReadParam(m, iter, &p->load_requests_via_automation) && - ReadParam(m, iter, &p->handle_top_level_requests) && - ReadParam(m, iter, &p->initial_url) && - ReadParam(m, iter, &p->referrer) && - ReadParam(m, iter, &p->infobars_enabled) && - ReadParam(m, iter, &p->route_all_top_level_navigations); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.parent, l); - l->append(", "); - LogParam(p.dimensions, l); - l->append(", "); - LogParam(p.style, l); - l->append(", "); - LogParam(p.is_off_the_record, l); - l->append(", "); - LogParam(p.load_requests_via_automation, l); - l->append(", "); - LogParam(p.handle_top_level_requests, l); - l->append(", "); - LogParam(p.initial_url, l); - l->append(", "); - LogParam(p.referrer, l); - l->append(", "); - LogParam(p.infobars_enabled, l); - l->append(", "); - LogParam(p.route_all_top_level_navigations, l); - l->append(")"); - } -}; - -struct NavigationInfo { - int navigation_type; - int relative_offset; - int navigation_index; - std::wstring title; - GURL url; - GURL referrer; - SecurityStyle security_style; - bool displayed_insecure_content; - bool ran_insecure_content; + 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); }; // Traits for NavigationInfo structure to pack/unpack. template <> struct ParamTraits<NavigationInfo> { typedef NavigationInfo param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.navigation_type); - WriteParam(m, p.relative_offset); - WriteParam(m, p.navigation_index); - WriteParam(m, p.title); - WriteParam(m, p.url); - WriteParam(m, p.referrer); - WriteParam(m, p.security_style); - WriteParam(m, p.displayed_insecure_content); - WriteParam(m, p.ran_insecure_content); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->navigation_type) && - ReadParam(m, iter, &p->relative_offset) && - ReadParam(m, iter, &p->navigation_index) && - ReadParam(m, iter, &p->title) && - ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->referrer) && - ReadParam(m, iter, &p->security_style) && - ReadParam(m, iter, &p->displayed_insecure_content) && - ReadParam(m, iter, &p->ran_insecure_content); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.navigation_type, l); - l->append(", "); - LogParam(p.relative_offset, l); - l->append(", "); - LogParam(p.navigation_index, l); - l->append(", "); - LogParam(p.title, l); - l->append(", "); - LogParam(p.url, l); - l->append(", "); - LogParam(p.referrer, l); - l->append(", "); - LogParam(p.security_style, l); - l->append(", "); - LogParam(p.displayed_insecure_content, l); - l->append(", "); - LogParam(p.ran_insecure_content, l); - l->append(")"); - } -}; - -// A stripped down version of ContextMenuParams in webkit/glue/context_menu.h. -struct MiniContextMenuParams { - // The x coordinate for displaying the menu. - int screen_x; - - // The y coordinate for displaying the menu. - int screen_y; - - // This is the URL of the link that encloses the node the context menu was - // invoked on. - GURL link_url; - - // The link URL to be used ONLY for "copy link address". We don't validate - // this field in the frontend process. - GURL unfiltered_link_url; - - // This is the source URL for the element that the context menu was - // invoked on. Example of elements with source URLs are img, audio, and - // video. - GURL src_url; - - // This is the URL of the top level page that the context menu was invoked - // on. - GURL page_url; - - // This is the URL of the subframe that the context menu was invoked on. - GURL frame_url; + 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); }; // Traits for MiniContextMenuParams structure to pack/unpack. template <> struct ParamTraits<MiniContextMenuParams> { typedef MiniContextMenuParams param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.screen_x); - WriteParam(m, p.screen_y); - WriteParam(m, p.link_url); - WriteParam(m, p.unfiltered_link_url); - WriteParam(m, p.src_url); - WriteParam(m, p.page_url); - WriteParam(m, p.frame_url); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->screen_x) && - ReadParam(m, iter, &p->screen_y) && - ReadParam(m, iter, &p->link_url) && - ReadParam(m, iter, &p->unfiltered_link_url) && - ReadParam(m, iter, &p->src_url) && - ReadParam(m, iter, &p->page_url) && - ReadParam(m, iter, &p->frame_url); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.screen_x, l); - l->append(", "); - LogParam(p.screen_y, l); - l->append(", "); - LogParam(p.link_url, l); - l->append(", "); - LogParam(p.unfiltered_link_url, l); - l->append(", "); - LogParam(p.src_url, l); - l->append(", "); - LogParam(p.page_url, l); - l->append(", "); - LogParam(p.frame_url, l); - l->append(")"); - } -}; - -struct AttachExternalTabParams { - uint64 cookie; - GURL url; - gfx::Rect dimensions; - int disposition; - bool user_gesture; - std::string profile_name; + 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<AttachExternalTabParams> { typedef AttachExternalTabParams param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.cookie); - WriteParam(m, p.url); - WriteParam(m, p.dimensions); - WriteParam(m, p.disposition); - WriteParam(m, p.user_gesture); - WriteParam(m, p.profile_name); - } - - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->cookie) && - ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->dimensions) && - ReadParam(m, iter, &p->disposition) && - ReadParam(m, iter, &p->user_gesture) && - ReadParam(m, iter, &p->profile_name); - } - - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.cookie, l); - l->append(", "); - LogParam(p.url, l); - l->append(", "); - LogParam(p.dimensions, l); - l->append(", "); - LogParam(p.disposition, l); - l->append(", "); - LogParam(p.user_gesture, l); - l->append(","); - LogParam(p.profile_name, l); - l->append(")"); - } + 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 -#define MESSAGES_INTERNAL_FILE \ - "chrome/common/automation_messages_internal.h" -#include "ipc/ipc_message_macros.h" +#include "chrome/common/automation_messages_internal.h" #endif // CHROME_COMMON_AUTOMATION_MESSAGES_H__ diff --git a/chrome/common/automation_messages_internal.h b/chrome/common/automation_messages_internal.h index 6888ea4..a0a71ae 100644 --- a/chrome/common/automation_messages_internal.h +++ b/chrome/common/automation_messages_internal.h @@ -4,1456 +4,1437 @@ // Defines the IPC messages used by the automation interface. -// This header is meant to be included in multiple passes, hence no traditional -// header guard. -// See ipc_message_macros.h for explanation of the macros and passes. - #include <string> #include <vector> -#include "base/basictypes.h" #include "base/string16.h" #include "chrome/common/content_settings.h" #include "chrome/common/navigation_types.h" #include "chrome/test/automation/autocomplete_edit_proxy.h" -#include "gfx/point.h" #include "gfx/rect.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message_macros.h" #include "net/url_request/url_request_status.h" + + // NOTE: All IPC messages have either a routing_id of 0 (for asynchronous // messages), or one that's been assigned by the proxy (for calls // which expect a response). The routing_id shouldn't be used for // any other purpose in these message types. -// NOTE: All the new IPC messages should go at the end (before IPC_END_MESSAGES) -// The IPC message IDs are part of an enum and hence the value -// assumed to be constant across the builds may change. -// The messages AutomationMsg_WindowHWND* in particular should not change -// since the PageCyclerReferenceTest depends on the correctness of the -// message IDs across the builds. - -IPC_BEGIN_MESSAGES(Automation) - - // This message is fired when the AutomationProvider is up and running - // in the app (the app is not fully up at this point). The parameter to this - // message is the version string of the automation provider. This parameter - // is defined to be the version string as returned by - // chrome::VersionInfo::Version(). - // The client can choose to use this version string to decide whether or not - // it can talk to the provider. - IPC_MESSAGE_ROUTED1(AutomationMsg_Hello, std::string) - - // This message is fired when the initial tab(s) are finished loading. - IPC_MESSAGE_ROUTED0(AutomationMsg_InitialLoadsComplete) - - // This message notifies the AutomationProvider to append a new tab the - // window with the given handle. The return value contains the index of - // the new tab, or -1 if the request failed. - // The second parameter is the url to be loaded in the new tab. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_AppendTab, int, GURL, int) - - // This message requests the (zero-based) index for the currently - // active tab in the window with the given handle. The return value contains - // the index of the active tab, or -1 if the request failed. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ActiveTabIndex, int, int) - - // This message notifies the AutomationProvider to active the tab. - // The first parameter is the handle to window resource. - // The second parameter is the (zero-based) index to be activated - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_ActivateTab, int, int, int) - - // This message requests the cookie value for given url in the - // profile of the tab identified by the second parameter. The first - // parameter is the URL string. The response contains the length of the - // cookie value string. On failure, this length = -1. - IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_GetCookies, GURL, int, - int, std::string) - - // This message notifies the AutomationProvider to set and broadcast a cookie - // with given name and value for the given url in the profile of the tab - // identified by the third parameter. The first parameter is the URL - // string, and the second parameter is the cookie name and value to be set. - // The return value is a non-negative value on success. - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetCookie, GURL, std::string, - int, int) - - // This message notifies the AutomationProvider to navigate to a specified - // url in the tab with given handle. The first parameter is the handle to - // the tab resource. The second parameter is the target url. The return - // value contains a status code which is nonnegative on success. - // See AutomationMsg_NavigationResponseValues for the return value. - // - // Deprecated in favor of - // AutomationMsg_NavigateToURLBlockUntilNavigationsComplete. - // TODO(phajdan.jr): Remove when the reference build gets updated. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_NavigateToURL, int, GURL, - AutomationMsg_NavigationResponseValues) - - // This message is used to implement the asynchronous version of - // NavigateToURL. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_NavigationAsync, - int /* tab handle */, - GURL, - bool /* result */) - - // This message notifies the AutomationProvider to navigate back in session - // history in the tab with given handle. The first parameter is the handle - // to the tab resource. - // See AutomationMsg_NavigationResponseValues for the navigation response - // values. - // - // Deprecated in favor of AutomationMsg_GoBackBlockUntilNavigationsComplete. - // TODO(phajdan.jr): Remove when the reference build gets updated. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GoBack, int, - AutomationMsg_NavigationResponseValues) - - // This message notifies the AutomationProvider to navigate forward in session - // history in the tab with given handle. The first parameter is the handle - // to the tab resource. - // See AutomationMsg_NavigationResponseValues for the navigation response - // values. - // - // Deprecated in favor of - // AutomationMsg_GoForwardBlockUntilNavigationsComplete. - // TODO(phajdan.jr): Remove when the reference build gets updated. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GoForward, int, - AutomationMsg_NavigationResponseValues) - - // This message requests the number of browser windows that the app currently - // has open. The return value is the number of windows. - IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_BrowserWindowCount, int) - - // This message requests the handle (int64 app-unique identifier) of the - // window with the given (zero-based) index. On error, the returned handle - // value is 0. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_BrowserWindow, int, int) - - // This message requests the number of tabs in the window with the given - // handle. The return value contains the number of tabs, or -1 if the - // request failed. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_TabCount, int, int) - - // This message requests the handle of the tab with the given (zero-based) - // index in the given app window. First parameter specifies the given window - // handle, second specifies the given tab_index. On error, the returned handle - // value is 0. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_Tab, int, int, int) - - // This message requests the the title of the tab with the given handle. - // The return value contains the size of the title string. On error, this - // value should be -1 and empty string. Note that the title can be empty in - // which case the size would be 0. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_TabTitle, - int, - int, - std::wstring) - - // This message requests the url of the tab with the given handle. - // The return value contains a success flag and the URL string. The URL will - // be empty on failure, and it still may be empty on success. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_TabURL, - int /* tab handle */, - bool /* success flag */, - GURL) +// NOTE: All the new IPC messages should go at the end. +// The IPC message IDs need to match the reference builds. Since we know +// define the IDs based on __LINE__, to allow these IPC messages to be +// used to control an old version of Chrome we need the message IDs to +// remain the same. This means that you should not change the line number +// of any of the messages below. This will be fixed once Xcode supports +// __COUNTER__, in which case we can get rid of the __LINE__. + +#define IPC_MESSAGE_START AutomationMsgStart + +// This message is fired when the AutomationProvider is up and running +// in the app (the app is not fully up at this point). The parameter to this +// message is the version string of the automation provider. This parameter +// is defined to be the version string as returned by +// chrome::VersionInfo::Version(). +// The client can choose to use this version string to decide whether or not +// it can talk to the provider. +IPC_MESSAGE_CONTROL1(AutomationMsg_Hello, + std::string) + +// This message is fired when the initial tab(s) are finished loading. +IPC_MESSAGE_CONTROL0(AutomationMsg_InitialLoadsComplete) + +// This message notifies the AutomationProvider to append a new tab the +// window with the given handle. The return value contains the index of +// the new tab, or -1 if the request failed. +// The second parameter is the url to be loaded in the new tab. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_AppendTab, + int, + GURL, + int) + +// This message requests the (zero-based) index for the currently +// active tab in the window with the given handle. The return value contains +// the index of the active tab, or -1 if the request failed. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ActiveTabIndex, + int, + int) + +// This message notifies the AutomationProvider to active the tab. +// The first parameter is the handle to window resource. +// The second parameter is the (zero-based) index to be activated +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_ActivateTab, + int, + int, + int) + +// This message requests the cookie value for given url in the +// profile of the tab identified by the second parameter. The first +// parameter is the URL string. The response contains the length of the +// cookie value string. On failure, this length = -1. +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_GetCookies, + GURL, + int, + int, + std::string) + +// This message notifies the AutomationProvider to set and broadcast a cookie +// with given name and value for the given url in the profile of the tab +// identified by the third parameter. The first parameter is the URL +// string, and the second parameter is the cookie name and value to be set. +// The return value is a non-negative value on success. +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetCookie, + GURL, + std::string, + int, + int) + +// This message is used to implement the asynchronous version of +// NavigateToURL. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_NavigationAsync, + int /* tab handle */, + GURL, + bool /* result */) + +// This message requests the number of browser windows that the app currently +// has open. The return value is the number of windows. +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_BrowserWindowCount, + int) + +// This message requests the handle (int64 app-unique identifier) of the +// window with the given (zero-based) index. On error, the returned handle +// value is 0. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BrowserWindow, + int, + int) + +// This message requests the number of tabs in the window with the given +// handle. The return value contains the number of tabs, or -1 if the +// request failed. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabCount, + int, + int) + +// This message requests the handle of the tab with the given (zero-based) +// index in the given app window. First parameter specifies the given window +// handle, second specifies the given tab_index. On error, the returned handle +// value is 0. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_Tab, + int, + int, + int) + +// This message requests the the title of the tab with the given handle. +// The return value contains the size of the title string. On error, this +// value should be -1 and empty string. Note that the title can be empty in +// which case the size would be 0. +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_TabTitle, + int, + int, + std::wstring) + +// This message requests the url of the tab with the given handle. +// The return value contains a success flag and the URL string. The URL will +// be empty on failure, and it still may be empty on success. +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_TabURL, + int /* tab handle */, + bool /* success flag */, + GURL) + +// This message notifies the AutomationProxy that a handle that it has +// previously been given is now invalid. (For instance, if the handle +// represented a window which has now been closed.) The parameter +// value is the handle. +IPC_MESSAGE_CONTROL1(AutomationMsg_InvalidateHandle, + int) + +// This message notifies the AutomationProvider that a handle is no +// longer being used, so it can stop paying attention to the +// associated resource. The parameter value is the handle. +IPC_MESSAGE_CONTROL1(AutomationMsg_HandleUnused, + int) + +// This message tells the AutomationProvider to provide the given +// authentication data to the specified tab, in response to an HTTP/FTP +// authentication challenge. +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetAuth, + int /* tab handle */, + std::wstring /* username */, + std::wstring /* password */, + AutomationMsg_NavigationResponseValues /* status */) + +// This message tells the AutomationProvider to cancel the login in the +// specified tab. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_CancelAuth, + int /* tab handle */, + AutomationMsg_NavigationResponseValues /* status */) + +// Requests that the automation provider ask history for the most recent +// chain of redirects coming from the given URL. The response must be +// decoded by the caller manually; it contains an integer indicating the +// number of URLs, followed by that many wstrings indicating a chain of +// redirects. On failure, the count will be negative. +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_RedirectsFrom, + int /* tab handle */, + GURL /* source URL */, + bool /* succeeded */, + std::vector<GURL> /* redirects */) + +// This message asks the AutomationProvider whether a tab is waiting for +// login info. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_NeedsAuth, + int /* tab handle */, + bool /* status */) + +// This message requests that the AutomationProvider executes a JavaScript, +// which is sent embedded in a 'javascript:' URL. +// The javascript is executed in context of child frame whose xpath +// is passed as parameter (context_frame). The execution results in +// a serialized JSON string response. +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_DomOperation, + int /* tab handle */, + std::wstring /* context_frame */, + std::wstring /* the javascript to be executed */, + std::string /* the serialized json string containg + the result of a javascript + execution */) + +// Is the Download Shelf visible for the specified browser? +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ShelfVisibility, + int /* browser_handle */, + bool /* is_visible */) + +// This message requests the number of constrained windows in the tab with +// the given handle. The return value contains the number of constrained +// windows, or -1 if the request failed. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ConstrainedWindowCount, + int /* tab_handle */, + int /* constrained_window_count */) + +// This message requests the bounds of the specified View element in +// window coordinates. +// Request: +// int - the handle of the window in which the view appears +// int - the ID of the view, as specified in chrome/browser/ui/view_ids.h +// bool - whether the bounds should be returned in the screen coordinates +// (if true) or in the browser coordinates (if false). +// Response: +// bool - true if the view was found +// gfx::Rect - the bounds of the view, in window coordinates +IPC_SYNC_MESSAGE_CONTROL3_2(AutomationMsg_WindowViewBounds, + int, + int, + bool, + bool, + gfx::Rect) + +// This message sets the bounds of the window. +// Request: +// int - the handle of the window to resize +// gfx::Rect - the bounds of the window +// Response: +// bool - true if the resize was successful +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_SetWindowBounds, + int, + gfx::Rect, + bool) + +// TODO(port): Port these messages. +// +// This message requests that a drag be performed in window coordinate space +// Request: +// int - the handle of the window that's the context for this drag +// std::vector<gfx::Point> - the path of the drag in window coordinate +// space; it should have at least 2 points +// (start and end) +// int - the flags which identify the mouse button(s) for the drag, as +// defined in chrome/views/event.h +// Response: +// bool - true if the drag could be performed +IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_WindowDrag, + int, + std::vector<gfx::Point>, + int, + bool, + bool) + +// Similar to AutomationMsg_InitialLoadsComplete, this indicates that the +// new tab ui has completed the initial load of its data. +// Time is how many milliseconds the load took. +IPC_MESSAGE_CONTROL1(AutomationMsg_InitialNewTabUILoadComplete, + int /* time */) + +// This message sends a inspect element request for a given tab. The response +// contains the number of resources loaded by the inspector controller. +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_InspectElement, + int, /* tab_handle */ + int, /* x */ + int /* y */, + int) + +// This message requests the process ID of the tab that corresponds +// to the given automation handle. +// The return value has an integer corresponding to the PID of the tab's +// renderer, 0 if the tab currently has no renderer process, or -1 on error. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabProcessID, + int /* tab_handle */, + int /* process ID */) + +// This tells the browser to enable or disable the filtered network layer. +IPC_MESSAGE_CONTROL1(AutomationMsg_SetFilteredInet, + bool /* enabled */) + +// Gets the directory that downloads will occur in for the active profile. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_DownloadDirectory, + int /* tab_handle */, + FilePath /* directory */) + +// This message requests the id of the view that has the focus in the +// specified window. If no view is focused, -1 is returned. Note that the +// window should either be a ViewWindow or a Browser. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetFocusedViewID, + int /* view_handle */, + int /* focused_view_id */) + +// This message shows/hides the window. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_SetWindowVisible, + int /* view_handle */, + bool /* visible */, + bool /* success */) + +// Gets the active status of a window. +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_IsWindowActive, + int /* view_handle */, + bool /* success */, + bool /* active */) + +// Makes the specified window the active window. +IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_ActivateWindow, + int /* view_handle */) + +// Opens a new browser window. +// TODO(sky): remove this and replace with OpenNewBrowserWindowOfType. +// Doing this requires updating the reference build. +IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_OpenNewBrowserWindow, + bool /* show */ ) + +// This message requests the handle (int64 app-unique identifier) of the +// current active top window. On error, the returned handle value is 0. +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_ActiveWindow, + int) + +// This message requests the browser associated with the specified window +// handle. +// The return value contains a success flag and the handle of the browser. +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_BrowserForWindow, + int /* window handle */, + bool /* success flag */, + int /* browser handle */) + +// This message requests the window associated with the specified browser +// handle. +// The return value contains a success flag and the handle of the window. +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_WindowForBrowser, + int /* browser handle */, + bool /* success flag */, + int /* window handle */) + +// This message requests the AutocompleteEdit associated with the specified +// browser handle. +// The return value contains a success flag and the handle of the omnibox. +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_AutocompleteEditForBrowser, + int /* browser handle */, + bool /* success flag */, + int /* AutocompleteEdit handle */) + +// This message requests that a mouse click be performed in window coordinate +// space. +// Request: +// int - the handle of the window that's the context for this click +// gfx::Point - the point to click +// int - the flags which identify the mouse button(s) for the click, as +// defined in chrome/views/event.h +IPC_MESSAGE_CONTROL3(AutomationMsg_WindowClick, + int, + gfx::Point, + int) + +// This message requests that a key press be performed. +// Request: +// int - the handle of the window that's the context for this click +// int - the app::KeyboardCode of the key that was pressed. +// int - the flags which identify the modifiers (shift, ctrl, alt) +// associated for, as defined in chrome/views/event.h +IPC_MESSAGE_CONTROL3(AutomationMsg_WindowKeyPress, + int, + int, + int) + +// This message notifies the AutomationProvider to create a tab which is +// hosted by an external process. +// Request: +// ExternalTabSettings - settings for external tab +IPC_SYNC_MESSAGE_CONTROL1_4(AutomationMsg_CreateExternalTab, + ExternalTabSettings /* settings*/, + gfx::NativeWindow /* Tab container window */, + gfx::NativeWindow /* Tab window */, + int /* Handle to the new tab */, + int /* Session Id of the new tab */) + +// This message notifies the AutomationProvider to navigate to a specified +// url in the external tab with given handle. The first parameter is the +// handle to the tab resource. The second parameter is the target url. +// The third parameter is the referrer. +// The return value contains a status code which is nonnegative on success. +// see AutomationMsg_NavigationResponseValues for the navigation response. +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_NavigateInExternalTab, + int, + GURL, + GURL, + AutomationMsg_NavigationResponseValues) + +// This message is an outgoing message from Chrome to an external host. +// It is a notification that the NavigationState was changed +// Request: +// -int: The flags specifying what changed +// (see TabContents::InvalidateTypes) +// Response: +// None expected +IPC_MESSAGE_ROUTED2(AutomationMsg_NavigationStateChanged, + int, // TabContents::InvalidateTypes + NavigationInfo) // title, url etc. + +// This message is an outgoing message from Chrome to an external host. +// It is a notification that the target URL has changed (the target URL +// is the URL of the link that the user is hovering on) +// Request: +// -std::wstring: The new target URL +// Response: +// None expected +IPC_MESSAGE_ROUTED1(AutomationMsg_UpdateTargetUrl, + std::wstring) + +// This message notifies the AutomationProvider to show the specified html +// text in an interstitial page in the tab with given handle. The first +// parameter is the handle to the tab resource. The second parameter is the +// html text to be displayed. +// The return value contains a success flag. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_ShowInterstitialPage, + int, + std::string, + AutomationMsg_NavigationResponseValues) + +// This message notifies the AutomationProvider to hide the current +// interstitial page in the tab with given handle. The parameter is the +// handle to the tab resource. +// The return value contains a success flag. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_HideInterstitialPage, + int, + bool) + +// This message requests that a tab be closed. +// Request: +// - int: handle of the tab to close +// - bool: if true the proxy blocks until the tab has completely closed, +// otherwise the proxy only blocks until it initiates the close. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_CloseTab, + int, + bool, + bool) + +// This message requests that the browser be closed. +// Request: +// - int: handle of the browser which contains the tab +// Response: +// - bool: whether the operation was successfull. +// - bool: whether the browser process will be terminated as a result (if +// this was the last closed browser window). +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_CloseBrowser, + int, + bool, + bool) + +IPC_MESSAGE_CONTROL1(AutomationMsg_CloseBrowserRequestAsync, + int) #if defined(OS_WIN) - // TODO(estade): delete this unused message. - IPC_SYNC_MESSAGE_ROUTED0_0(AutomationMsg_WindowHWND) - - // This message requests the HWND of the tab that corresponds - // to the given automation handle. - // The return value contains the HWND value, which is 0 if the call fails. - // - // TODO(estade): The only test that uses this message is - // NPAPIVisiblePluginTester.SelfDeletePluginInvokeInSynchronousMouseMove. It - // can probably be done in another way, and this can be removed. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_TabHWND, - int /* tab_handle */, - HWND /* win32 Window Handle */) +// TODO(port): Port these messages. +// +// This message is an outgoing message from Chrome to an external host. +// It is a request to process a keyboard accelerator. +// Request: +// -MSG: The keyboard message +// Response: +// None expected +// TODO(sanjeevr): Ideally we need to add a response from the external +// host saying whether it processed the accelerator +IPC_MESSAGE_ROUTED1(AutomationMsg_HandleAccelerator, + MSG) + +// This message is sent by the container of an externally hosted tab to +// reflect any accelerator keys that it did not process. This gives the +// tab a chance to handle the keys +// Request: +// - int: handle of the tab +// -MSG: The keyboard message that the container did not handle +// Response: +// None expected +IPC_MESSAGE_CONTROL2(AutomationMsg_ProcessUnhandledAccelerator, + int, + MSG) #endif // defined(OS_WIN) - // This message notifies the AutomationProxy that a handle that it has - // previously been given is now invalid. (For instance, if the handle - // represented a window which has now been closed.) The parameter - // value is the handle. - IPC_MESSAGE_ROUTED1(AutomationMsg_InvalidateHandle, int) - - // This message notifies the AutomationProvider that a handle is no - // longer being used, so it can stop paying attention to the - // associated resource. The parameter value is the handle. - IPC_MESSAGE_ROUTED1(AutomationMsg_HandleUnused, int) - - // This message tells the AutomationProvider to provide the given - // authentication data to the specified tab, in response to an HTTP/FTP - // authentication challenge. - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetAuth, - int, // tab handle - std::wstring, // username - std::wstring, // password - AutomationMsg_NavigationResponseValues) // status - - // This message tells the AutomationProvider to cancel the login in the - // specified tab. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_CancelAuth, - int, // tab handle - AutomationMsg_NavigationResponseValues) // status - - // Requests that the automation provider ask history for the most recent - // chain of redirects coming from the given URL. The response must be - // decoded by the caller manually; it contains an integer indicating the - // number of URLs, followed by that many wstrings indicating a chain of - // redirects. On failure, the count will be negative. - IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_RedirectsFrom, - int, // tab handle - GURL, // source URL - bool /* succeeded */, - std::vector<GURL> /* redirects */) - - // This message asks the AutomationProvider whether a tab is waiting for - // login info. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_NeedsAuth, - int, // tab handle - bool) // status - - // This message requests the AutomationProvider to apply a certain - // accelerator. It is completely asynchronous with the resulting accelerator - // action. - IPC_SYNC_MESSAGE_ROUTED2_0(AutomationMsg_ApplyAccelerator, - int, // window handle - int) // accelerator id like (IDC_BACK, - // IDC_FORWARD, etc) - // The list can be found at - // chrome/app/chrome_command_ids.h - - // This message requests that the AutomationProvider executes a JavaScript, - // which is sent embedded in a 'javascript:' URL. - // The javascript is executed in context of child frame whose xpath - // is passed as parameter (context_frame). The execution results in - // a serialized JSON string response. - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_DomOperation, - int, // tab handle - std::wstring, // context_frame - std::wstring, // the javascript to be executed - std::string) // the serialized json string - // containing the result of a - // javascript execution - - // Is the Download Shelf visible for the specified browser? - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ShelfVisibility, - int /* browser_handle */, - bool /* is_visible */) - - // This message requests the number of constrained windows in the tab with - // the given handle. The return value contains the number of constrained - // windows, or -1 if the request failed. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ConstrainedWindowCount, - int /* tab_handle */, - int /* constrained_window_count */) - - // This message requests the bounds of the specified View element in - // window coordinates. - // Request: - // int - the handle of the window in which the view appears - // int - the ID of the view, as specified in chrome/browser/view_ids.h - // bool - whether the bounds should be returned in the screen coordinates - // (if true) or in the browser coordinates (if false). - // Response: - // bool - true if the view was found - // gfx::Rect - the bounds of the view, in window coordinates - IPC_SYNC_MESSAGE_ROUTED3_2(AutomationMsg_WindowViewBounds, int, int, - bool, bool, gfx::Rect) - - // This message sets the bounds of the window. - // Request: - // int - the handle of the window to resize - // gfx::Rect - the bounds of the window - // Response: - // bool - true if the resize was successful - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_SetWindowBounds, int, gfx::Rect, - bool) +// Sent by the external tab to the host to notify that the user has tabbed +// out of the tab. +// Request: +// - bool: |reverse| set to true when shift-tabbing out of the tab, false +// otherwise. +// Response: +// None expected +IPC_MESSAGE_ROUTED1(AutomationMsg_TabbedOut, + bool) + +// Sent by the external tab host to ask focus to be set to either the first +// or last element on the page. +// Request: +// - int: handle of the tab +// - bool: |reverse| +// true: Focus will be set to the last focusable element +// false: Focus will be set to the first focusable element +// - bool: |restore_focus_to_view| +// true: The renderer view associated with the current tab will be +// infomed that it is receiving focus. +// Response: +// None expected +IPC_MESSAGE_CONTROL3(AutomationMsg_SetInitialFocus, + int, + bool, + bool) + +// This message is an outgoing message from Chrome to an external host. +// It is a request to open a url +// Request: +// -GURL: The URL to open +// -GURL: The referrer +// -int: The WindowOpenDisposition that specifies where the URL should +// be opened (new tab, new window etc). +// Response: +// None expected +IPC_MESSAGE_ROUTED3(AutomationMsg_OpenURL, + GURL, + GURL, + int) + +// This message requests the provider to wait until the specified tab has +// finished restoring after session restore. +// Request: +// - int: handle of the tab +// Response: +// - bool: whether the operation was successful. +IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_WaitForTabToBeRestored, + int) + +// This message is an outgoing message from Chrome to an external host. +// It is a notification that a navigation happened +// Request: +// +// Response: +// None expected +IPC_MESSAGE_ROUTED1(AutomationMsg_DidNavigate, + NavigationInfo) + +// This message requests the different security states of the page displayed +// in the specified tab. +// Request: +// - int: handle of the tab +// Response: +// - bool: whether the operation was successful. +// - SecurityStyle: the security style of the tab. +// - int: the status of the server's ssl cert (0 means no errors or no ssl +// was used). +// - int: the insecure content state, 0 means no insecure contents. + +IPC_SYNC_MESSAGE_CONTROL1_4(AutomationMsg_GetSecurityState, + int, + bool, + SecurityStyle, + int, + int) + +// This message requests the page type of the page displayed in the specified +// tab (normal, error or interstitial). +// Request: +// - int: handle of the tab +// Response: +// - bool: whether the operation was successful. +// - PageType: the type of the page currently displayed. +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_GetPageType, + int, + bool, + PageType) + +// This message simulates the user action on the SSL blocking page showing in +// the specified tab. This message is only effective if an interstitial page +// is showing in the tab. +// Request: +// - int: handle of the tab +// - bool: whether to proceed or abort the navigation +// Response: +// - AutomationMsg_NavigationResponseValues: result of the operation. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_ActionOnSSLBlockingPage, + int, + bool, + AutomationMsg_NavigationResponseValues) + +// Message to request that a browser window is brought to the front and +// activated. +// Request: +// - int: handle of the browser window. +// Response: +// - bool: True if the browser is brought to the front. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BringBrowserToFront, + int, + bool) + +// Message to request whether a certain item is enabled of disabled in the +// menu in the browser window +// +// Request: +// - int: handle of the browser window. +// - int: IDC message identifier to query if enabled +// Response: +// - bool: True if the command is enabled on the menu +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_IsMenuCommandEnabled, + int, + int, + bool) + +// This message notifies the AutomationProvider to print the tab with given +// handle. The first parameter is the handle to the tab resource. The +// return value contains a bool which is true on success. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_PrintNow, + int, + bool) + +// This message notifies the AutomationProvider to reload the current page in +// the tab with given handle. The first parameter is the handle to the tab +// resource. The return value contains a status code which is nonnegative on +// success. +// see AutomationMsg_NavigationResponseValues for the navigation response. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_Reload, + int, + AutomationMsg_NavigationResponseValues) + +// This message requests the handle (int64 app-unique identifier) of the +// last active browser window, or the browser at index 0 if there is no last +// active browser, or it no longer exists. Returns 0 if no browser windows +// exist. +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_LastActiveBrowserWindow, + int) + +// This message notifies the AutomationProvider to save the page with given +// handle. The first parameter is the handle to the tab resource. The second +// parameter is the main HTML file name. The third parameter is the directory +// for saving resources. The fourth parameter is the saving type: 0 for HTML +// only; 1 for complete web page. +// The return value contains a bool which is true on success. +IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_SavePage, + int, + FilePath, + FilePath, + int, + bool) + +// This message requests the text currently being displayed in the +// AutocompleteEdit. The parameter is the handle to the AutocompleteEdit. +// The return value is a string indicating the text in the AutocompleteEdit. +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_AutocompleteEditGetText, + int /* autocomplete edit handle */, + bool /* the requested autocomplete edit exists */, + std::wstring /* omnibox text */) + +// This message sets the text being displayed in the AutocompleteEdit. The +// first parameter is the handle to the omnibox and the second parameter is +// the text to be displayed in the AutocompleteEdit. +// The return value has no parameters and is returned when the operation has +// completed. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_AutocompleteEditSetText, + int /* autocomplete edit handle */, + std::wstring /* text to set */, + bool /* the requested autocomplete edit exists */) + +// This message requests if a query to a autocomplete provider is still in +// progress. The first parameter in the request is the handle to the +// autocomplete edit. +// The first return value indicates if the request succeeded. +// The second return value indicates if a query is still in progress. +IPC_SYNC_MESSAGE_CONTROL1_2( \ + AutomationMsg_AutocompleteEditIsQueryInProgress, + int /* autocomplete edit handle*/, + bool /* the requested autocomplete edit exists */, + bool /* indicates if a query is in progress */) + +// This message requests a list of the autocomplete messages currently being +// displayed by the popup. The parameter in the request is a handle to the +// autocomplete edit. +// The first return value indicates if the request was successful, while +// while the second is the actual list of matches. +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_AutocompleteEditGetMatches, + int /* autocomplete edit handle*/, + bool /* the requested autocomplete edit exists */, + std::vector<AutocompleteMatchData> /* matches */) + +// This message requests the execution of a browser command in the browser +// for which the handle is specified. +// The return value contains a boolean, whether the command was dispatched. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WindowExecuteCommandAsync, + int /* automation handle */, + int /* browser command */, + bool /* success flag */) + +// This message requests the execution of a browser command in the browser +// for which the handle is specified. +// The return value contains a boolean, whether the command was dispatched +// and successful executed. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WindowExecuteCommand, + int /* automation handle */, + int /* browser command */, + bool /* success flag */) + + +// This message opens the Find window within a tab corresponding to the +// supplied tab handle. +IPC_MESSAGE_CONTROL1(AutomationMsg_OpenFindInPage, + int /* tab_handle */) + +// Posts a message from external host to chrome renderer. +IPC_MESSAGE_CONTROL4(AutomationMsg_HandleMessageFromExternalHost, + int /* automation handle */, + std::string /* message */, + std::string /* origin */, + std::string /* target */) + +// A message for an external host. +IPC_MESSAGE_ROUTED3(AutomationMsg_ForwardMessageToExternalHost, + std::string /* message */, + std::string /* origin */, + std::string /* target */) + +// This message starts a find within a tab corresponding to the supplied +// tab handle. The parameter |request| specifies what to search for. +// If an error occurs, |matches_found| will be -1. +// +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_Find, + int /* tab_handle */, + AutomationMsg_Find_Params /* params */, + int /* active_ordinal */, + int /* matches_found */) + +// Is the Find window fully visible (and not animating) for the specified +// tab? +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_FindWindowVisibility, + int /* tab_handle */, + bool /* is_visible */) + +// Where is the Find window located. |x| and |y| will be -1, -1 on failure. +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_FindWindowLocation, + int /* tab_handle */, + int /* x */, + int /* y */) + +// Is the Bookmark bar visible? The return value will indicate whether it is +// visible or not and whether it is being animated into (or out of its place). +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_BookmarkBarVisibility, + int /* browser_handle */, + bool, /* is_visible */ + bool /* still_animating */) + +// This message requests the number of related info bars opened. It +// returns -1 if an error occurred. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetInfoBarCount, + int /* tab_handle */, + int /* info bar count */) + +// This message triggers the action associated with the "accept" button in +// the info-bar at the specified index. If |wait for navigation| is true, it +// won't return until a navigation has occurred. +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_ClickInfoBarAccept, + int /* tab_handle */, + int /* info bar index */, + bool /* wait for navigation */, + + /* navigation result */ + AutomationMsg_NavigationResponseValues) + +// This message retrieves the last time a navigation occurred in the specified +// tab. The value is intended to be used with WaitForNavigation. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetLastNavigationTime, + int /* tab_handle */, + int64 /* last navigation time */) + +// This messages is used to block until a new navigation occurs (if there is +// none more recent then the time specified). +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WaitForNavigation, + int /* tab_handle */, + int64 /* last navigation time */, + + /* navigation result */ + AutomationMsg_NavigationResponseValues) + +// This messages sets an int-value preference. +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetIntPreference, + int /* browser handle */, + std::string /* pref name */, + int /* value */, + bool /* success */) + +// Queries whether an app modal dialog is currently being shown. (i.e. a +// javascript alert) and which buttons it contains. +IPC_SYNC_MESSAGE_CONTROL0_2(AutomationMsg_ShowingAppModalDialog, + bool /* showing dialog */, + int /* view::DelegateDialog::DialogButton */) + +// This message triggers the specified button for the currently showing +// modal dialog. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ClickAppModalDialogButton, + int /* view::DelegateDialog::DialogButton */, + bool /* success */) + +// This messages sets a string-value preference. +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetStringPreference, + int /* browser handle */, + std::string /* pref name */, + std::string /* pref value */, + bool) + +// This messages gets a boolean-value preference. +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_GetBooleanPreference, + int /* browser handle */, + std::string /* pref name */, + bool /* success */, + bool /* pref value */) + +// This messages sets a boolean-value preference. +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetBooleanPreference, + int /* browser handle */, + std::string /* pref name */, + bool /* pref value */, + bool /* success */) + +// Queries the current used encoding name of the page in the specified +// web content tab. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetPageCurrentEncoding, + int /* tab handle */, + std::string /* current used encoding name */) + +// Uses the specified encoding to override the encoding of the page in the +// specified web content tab. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_OverrideEncoding, + int /* tab handle */, + std::string /* overrided encoding name */, + bool /* success */) + +// Used to disable the dialog box that prompts the user for a path when +// saving a web page. +IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_SavePackageShouldPromptUser, + bool /* false if we want to not show the dialog */) + +// This message is an outgoing message from Chrome to an external host. +// It is a notification that a navigation failed +// Request: +// -int : The status code. +// -GURL: The URL we failed to navigate to. +// Response: +// None expected +IPC_MESSAGE_ROUTED2(AutomationMsg_NavigationFailed, + int, + GURL) #if defined(OS_WIN) - // TODO(port): Port these messages. - // - // This message requests that a drag be performed in window coordinate space - // Request: - // int - the handle of the window that's the context for this drag - // std::vector<gfx::Point> - the path of the drag in window coordinate - // space; it should have at least 2 points - // (start and end) - // int - the flags which identify the mouse button(s) for the drag, as - // defined in chrome/views/event.h - // Response: - // bool - true if the drag could be performed - IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_WindowDrag, - int, std::vector<gfx::Point>, int, bool, bool) +// This message is an outgoing message from an automation client to Chrome. +// It is used to reposition a chrome tab window. +IPC_MESSAGE_CONTROL2(AutomationMsg_TabReposition, + int /* tab handle */, + Reposition_Params /* SetWindowPos params */) #endif // defined(OS_WIN) - // Similar to AutomationMsg_InitialLoadsComplete, this indicates that the - // new tab ui has completed the initial load of its data. - // Time is how many milliseconds the load took. - IPC_MESSAGE_ROUTED1(AutomationMsg_InitialNewTabUILoadComplete, - int /* time */) - - // This message starts a find within a tab corresponding to the supplied - // tab handle. The return value contains the number of matches found on the - // page within the tab specified. The parameter 'search_string' specifies - // what string to search for, 'forward' specifies whether to search in - // forward direction (1=forward, 0=back), 'match_case' specifies case - // sensitivity - // (1=case sensitive, 0=case insensitive). If an error occurs, matches_found - // will be -1. - // - // NOTE: This message has been deprecated, please use the new message - // AutomationMsg_Find below. - // - IPC_SYNC_MESSAGE_ROUTED4_2(AutomationMsg_FindInPage, // DEPRECATED. - int, /* tab_handle */ - std::wstring, /* find_request */ - int, /* forward */ - int /* match_case */, - int /* active_ordinal */, - int /* matches_found */) - - // This message sends a inspect element request for a given tab. The response - // contains the number of resources loaded by the inspector controller. - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_InspectElement, - int, /* tab_handle */ - int, /* x */ - int /* y */, - int) - - // This message requests the process ID of the tab that corresponds - // to the given automation handle. - // The return value has an integer corresponding to the PID of the tab's - // renderer, 0 if the tab currently has no renderer process, or -1 on error. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_TabProcessID, - int /* tab_handle */, - int /* process ID */) - - // This tells the browser to enable or disable the filtered network layer. - IPC_MESSAGE_ROUTED1(AutomationMsg_SetFilteredInet, - bool /* enabled */) - - // Gets the directory that downloads will occur in for the active profile. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_DownloadDirectory, - int /* tab_handle */, - FilePath /* directory */) - - // This message requests the id of the view that has the focus in the - // specified window. If no view is focused, -1 is returned. Note that the - // window should either be a ViewWindow or a Browser. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GetFocusedViewID, - int /* view_handle */, - int /* focused_view_id */) - - // This message shows/hides the window. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_SetWindowVisible, - int /* view_handle */, - bool /* visible */, - bool /* success */) - - // Gets the active status of a window. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_IsWindowActive, - int /* view_handle */, - bool /* success */, - bool /* active */) - - // Makes the specified window the active window. - IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_ActivateWindow, - int /* view_handle */) - - // Opens a new browser window. - // TODO(sky): remove this and replace with OpenNewBrowserWindowOfType. - // Doing this requires updating the reference build. - IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_OpenNewBrowserWindow, - bool /* show */ ) - - // This message requests the handle (int64 app-unique identifier) of the - // current active top window. On error, the returned handle value is 0. - IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_ActiveWindow, int) - - // This message requests the browser associated with the specified window - // handle. - // The return value contains a success flag and the handle of the browser. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_BrowserForWindow, - int /* window handle */, - bool /* success flag */, - int /* browser handle */) - - // This message requests the window associated with the specified browser - // handle. - // The return value contains a success flag and the handle of the window. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_WindowForBrowser, - int /* browser handle */, - bool /* success flag */, - int /* window handle */) - - // This message requests the AutocompleteEdit associated with the specified - // browser handle. - // The return value contains a success flag and the handle of the omnibox. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_AutocompleteEditForBrowser, - int /* browser handle */, - bool /* success flag */, - int /* AutocompleteEdit handle */) +// Gets the title of the top level browser window. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WindowTitle, + int /* automation handle */, + string16 /* title text */ ) + +// Tab load complete +IPC_MESSAGE_ROUTED1(AutomationMsg_TabLoaded, + GURL) + +// This message requests the tabstrip index of the tab with the given handle. +// The return value contains the index, which will be -1 on failure. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabIndex, + int, + int) + +// This message requests the handle (int64 app-unique identifier) of +// a valid normal browser window, i.e. normal type and non-incognito mode. +// On error, the returned handle value is 0. +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_FindNormalBrowserWindow, + int) + +// This message requests the number of normal browser windows, i.e. normal +// type and non-incognito mode that the app currently has open. The return +// value is the number of windows. +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_NormalBrowserWindowCount, + int) + +// Used to put the browser into "extension automation mode" for a given +// set of Chrome Extensions API functions for the current profile, or turn +// off automation mode. The specified tab is used as the conduit for all +// automated API functions. It must be an external tab (as in +// AutomationMsg_CreateExternalTab). +IPC_MESSAGE_CONTROL2(AutomationMsg_SetEnableExtensionAutomation, + // Tab handle. + int, + // Empty to disable automation, non-empty to enable + // automation of the specified API functions, single + // entry of "*" to enable automation of all API + // functions. + std::vector<std::string>) + +// This message tells the browser to start using the new proxy configuration +// represented by the given JSON string. The parameters used in the JSON +// string are defined in automation_constants.h. +IPC_MESSAGE_CONTROL1(AutomationMsg_SetProxyConfig, + std::string /* proxy_config_json_string */) + +// Sets Download Shelf visibility for the specified browser. +IPC_SYNC_MESSAGE_CONTROL2_0(AutomationMsg_SetShelfVisibility, + int /* browser_handle */, + bool /* is_visible */) + +// This message requests the number of blocked popups in a certain tab with +// the given handle. The return value is the number of blocked popups, or -1 +// if this request failed. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BlockedPopupCount, + int /* tab_handle */, + int /* blocked_popup_count */) + +// This message retrieves the locale of the browser process. On success +// |chrome_locale| will contain the locale as reported by ICU. On failure +// |chrome_locale| is the empty string. +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetBrowserLocale, + string16 /* chrome_locale */) #if defined(OS_WIN) - // TODO(estade): This message is defined later on for Mac and Linux. This is - // to avoid adding a new IPC in the middle for those platforms (see comment - // at top). The message is exactly the same, so they should be remerged when - // all messages in this file have been made cross-platform (at which point we - // will need to check in new reference builds). - // - // This message requests that a mouse click be performed in window coordinate - // space. - // Request: - // int - the handle of the window that's the context for this click - // gfx::Point - the point to click - // int - the flags which identify the mouse button(s) for the click, as - // defined in chrome/views/event.h - IPC_MESSAGE_ROUTED3(AutomationMsg_WindowClick, int, gfx::Point, int) -#endif // defined(OS_WIN) - - // This message requests that a key press be performed. - // Request: - // int - the handle of the window that's the context for this click - // int - the app::KeyboardCode of the key that was pressed. - // int - the flags which identify the modifiers (shift, ctrl, alt) - // associated for, as defined in chrome/views/event.h - IPC_MESSAGE_ROUTED3(AutomationMsg_WindowKeyPress, int, int, int) - - // This message notifies the AutomationProvider to create a tab which is - // hosted by an external process. - // Request: - // ExternalTabSettings - settings for external tab - IPC_SYNC_MESSAGE_ROUTED1_4(AutomationMsg_CreateExternalTab, - IPC::ExternalTabSettings /* settings*/, - gfx::NativeWindow /* Tab container window */, - gfx::NativeWindow /* Tab window */, - int /* Handle to the new tab */, - int /* Session Id of the new tab */) - - // This message notifies the AutomationProvider to navigate to a specified - // url in the external tab with given handle. The first parameter is the - // handle to the tab resource. The second parameter is the target url. - // The third parameter is the referrer. - // The return value contains a status code which is nonnegative on success. - // see AutomationMsg_NavigationResponseValues for the navigation response. - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_NavigateInExternalTab, - int, - GURL, - GURL, - AutomationMsg_NavigationResponseValues) - - // This message is an outgoing message from Chrome to an external host. - // It is a notification that the NavigationState was changed - // Request: - // -int: The flags specifying what changed - // (see TabContents::InvalidateTypes) - // Response: - // None expected - IPC_MESSAGE_ROUTED3(AutomationMsg_NavigationStateChanged, - int, // tab handle - int, // TabContents::InvalidateTypes - IPC::NavigationInfo) // title, url etc. - - // This message is an outgoing message from Chrome to an external host. - // It is a notification that the target URL has changed (the target URL - // is the URL of the link that the user is hovering on) - // Request: - // -int: The tab handle - // -std::wstring: The new target URL - // Response: - // None expected - IPC_MESSAGE_ROUTED2(AutomationMsg_UpdateTargetUrl, int, std::wstring) - - // This message notifies the AutomationProvider to show the specified html - // text in an interstitial page in the tab with given handle. The first - // parameter is the handle to the tab resource. The second parameter is the - // html text to be displayed. - // The return value contains a success flag. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_ShowInterstitialPage, - int, - std::string, - AutomationMsg_NavigationResponseValues) - - // This message notifies the AutomationProvider to hide the current - // interstitial page in the tab with given handle. The parameter is the - // handle to the tab resource. - // The return value contains a success flag. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_HideInterstitialPage, int, - bool) - - // This message requests that a tab be closed. - // Request: - // - int: handle of the tab to close - // - bool: if true the proxy blocks until the tab has completely closed, - // otherwise the proxy only blocks until it initiates the close. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_CloseTab, int, bool, bool) - - // This message requests that the browser be closed. - // Request: - // - int: handle of the browser which contains the tab - // Response: - // - bool: whether the operation was successfull. - // - bool: whether the browser process will be terminated as a result (if - // this was the last closed browser window). - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_CloseBrowser, int, bool, - bool) - - IPC_MESSAGE_ROUTED1(AutomationMsg_CloseBrowserRequestAsync, int) - - // Unused. - // Response: - // None expected - IPC_MESSAGE_ROUTED1(AutomationMsg_Unused, int) - -#if defined(OS_WIN) - // TODO(port): Port these messages. - // - // This message is an outgoing message from Chrome to an external host. - // It is a request to process a keyboard accelerator. - // Request: - // -int: Tab handle - // -MSG: The keyboard message - // Response: - // None expected - // TODO(sanjeevr): Ideally we need to add a response from the external - // host saying whether it processed the accelerator - IPC_MESSAGE_ROUTED2(AutomationMsg_HandleAccelerator, int, MSG) - - // This message is sent by the container of an externally hosted tab to - // reflect any accelerator keys that it did not process. This gives the - // tab a chance to handle the keys - // Request: - // - int: handle of the tab - // -MSG: The keyboard message that the container did not handle - // Response: - // None expected - IPC_MESSAGE_ROUTED2(AutomationMsg_ProcessUnhandledAccelerator, int, MSG) -#endif // defined(OS_WIN) - - // Sent by the external tab to the host to notify that the user has tabbed - // out of the tab. - // Request: - // - int: Tab handle - // - bool: |reverse| set to true when shift-tabbing out of the tab, false - // otherwise. - // Response: - // None expected - IPC_MESSAGE_ROUTED2(AutomationMsg_TabbedOut, int, bool) - - // Sent by the external tab host to ask focus to be set to either the first - // or last element on the page. - // Request: - // - int: handle of the tab - // - bool: |reverse| - // true: Focus will be set to the last focusable element - // false: Focus will be set to the first focusable element - // - bool: |restore_focus_to_view| - // true: The renderer view associated with the current tab will be - // infomed that it is receiving focus. - // Response: - // None expected - IPC_MESSAGE_ROUTED3(AutomationMsg_SetInitialFocus, int, bool, bool) - - // This message is an outgoing message from Chrome to an external host. - // It is a request to open a url - // Request: - // -int: Tab handle - // -GURL: The URL to open - // -GURL: The referrer - // -int: The WindowOpenDisposition that specifies where the URL should - // be opened (new tab, new window etc). - // Response: - // None expected - IPC_MESSAGE_ROUTED4(AutomationMsg_OpenURL, int, GURL, GURL, int) - - // This message requests the provider to wait until the specified tab has - // finished restoring after session restore. - // Request: - // - int: handle of the tab - // Response: - // - bool: whether the operation was successful. - IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_WaitForTabToBeRestored, int) - - // This message is an outgoing message from Chrome to an external host. - // It is a notification that a navigation happened - // Request: - // -int: Tab handle - // - // Response: - // None expected - IPC_MESSAGE_ROUTED2(AutomationMsg_DidNavigate, int, IPC::NavigationInfo) - - // This message requests the different security states of the page displayed - // in the specified tab. - // Request: - // - int: handle of the tab - // Response: - // - bool: whether the operation was successful. - // - SecurityStyle: the security style of the tab. - // - int: the status of the server's ssl cert (0 means no errors or no ssl - // was used). - // - int: the insecure content state, 0 means no insecure contents. - - IPC_SYNC_MESSAGE_ROUTED1_4(AutomationMsg_GetSecurityState, - int, - bool, - SecurityStyle, - int, - int) - - // This message requests the page type of the page displayed in the specified - // tab (normal, error or interstitial). - // Request: - // - int: handle of the tab - // Response: - // - bool: whether the operation was successful. - // - PageType: the type of the page currently displayed. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_GetPageType, int, bool, PageType) - - // This message simulates the user action on the SSL blocking page showing in - // the specified tab. This message is only effective if an interstitial page - // is showing in the tab. - // Request: - // - int: handle of the tab - // - bool: whether to proceed or abort the navigation - // Response: - // - AutomationMsg_NavigationResponseValues: result of the operation. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_ActionOnSSLBlockingPage, int, bool, - AutomationMsg_NavigationResponseValues) - - // Message to request that a browser window is brought to the front and - // activated. - // Request: - // - int: handle of the browser window. - // Response: - // - bool: True if the browser is brought to the front. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_BringBrowserToFront, int, bool) - - // Message to request whether a certain item is enabled of disabled in the - // menu in the browser window - // - // Request: - // - int: handle of the browser window. - // - int: IDC message identifier to query if enabled - // Response: - // - bool: True if the command is enabled on the menu - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_IsMenuCommandEnabled, int, int, bool) - - // This message notifies the AutomationProvider to print the tab with given - // handle. The first parameter is the handle to the tab resource. The - // return value contains a bool which is true on success. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_PrintNow, int, bool) - - // This message notifies the AutomationProvider to reload the current page in - // the tab with given handle. The first parameter is the handle to the tab - // resource. The return value contains a status code which is nonnegative on - // success. - // see AutomationMsg_NavigationResponseValues for the navigation response. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_Reload, int, - AutomationMsg_NavigationResponseValues) - - // This message requests the handle (int64 app-unique identifier) of the - // last active browser window, or the browser at index 0 if there is no last - // active browser, or it no longer exists. Returns 0 if no browser windows - // exist. - IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_LastActiveBrowserWindow, int) - - // This message notifies the AutomationProvider to save the page with given - // handle. The first parameter is the handle to the tab resource. The second - // parameter is the main HTML file name. The third parameter is the directory - // for saving resources. The fourth parameter is the saving type: 0 for HTML - // only; 1 for complete web page. - // The return value contains a bool which is true on success. - IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_SavePage, int, FilePath, FilePath, - int, bool) - - // This message requests the text currently being displayed in the - // AutocompleteEdit. The parameter is the handle to the AutocompleteEdit. - // The return value is a string indicating the text in the AutocompleteEdit. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_AutocompleteEditGetText, - int /* autocomplete edit handle */, - bool /* the requested autocomplete edit exists */, - std::wstring /* omnibox text */) - - // This message sets the text being displayed in the AutocompleteEdit. The - // first parameter is the handle to the omnibox and the second parameter is - // the text to be displayed in the AutocompleteEdit. - // The return value has no parameters and is returned when the operation has - // completed. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_AutocompleteEditSetText, - int /* autocomplete edit handle */, - std::wstring /* text to set */, - bool /* the requested autocomplete edit exists */) - - // This message requests if a query to a autocomplete provider is still in - // progress. The first parameter in the request is the handle to the - // autocomplete edit. - // The first return value indicates if the request succeeded. - // The second return value indicates if a query is still in progress. - IPC_SYNC_MESSAGE_ROUTED1_2( \ - AutomationMsg_AutocompleteEditIsQueryInProgress, - int /* autocomplete edit handle*/, - bool /* the requested autocomplete edit exists */, - bool /* indicates if a query is in progress */) - - // This message requests a list of the autocomplete messages currently being - // displayed by the popup. The parameter in the request is a handle to the - // autocomplete edit. - // The first return value indicates if the request was successful, while - // while the second is the actual list of matches. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_AutocompleteEditGetMatches, - int /* autocomplete edit handle*/, - bool /* the requested autocomplete edit exists */, - std::vector<AutocompleteMatchData> /* matches */) - - // This message requests the execution of a browser command in the browser - // for which the handle is specified. - // The return value contains a boolean, whether the command was dispatched. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WindowExecuteCommandAsync, - int /* automation handle */, - int /* browser command */, - bool /* success flag */) - - // This message requests the execution of a browser command in the browser - // for which the handle is specified. - // The return value contains a boolean, whether the command was dispatched - // and successful executed. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WindowExecuteCommand, - int /* automation handle */, - int /* browser command */, - bool /* success flag */) - - - // This message opens the Find window within a tab corresponding to the - // supplied tab handle. - IPC_MESSAGE_ROUTED1(AutomationMsg_OpenFindInPage, - int /* tab_handle */) - - // Posts a message from external host to chrome renderer. - IPC_MESSAGE_ROUTED4(AutomationMsg_HandleMessageFromExternalHost, - int /* automation handle */, - std::string /* message */, - std::string /* origin */, - std::string /* target */) - - // A message for an external host. - IPC_MESSAGE_ROUTED4(AutomationMsg_ForwardMessageToExternalHost, - int, /* handle */ - std::string /* message */, - std::string /* origin */, - std::string /* target */) - - // This message starts a find within a tab corresponding to the supplied - // tab handle. The parameter |request| specifies what to search for. - // If an error occurs, |matches_found| will be -1. - // - IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_Find, - int /* tab_handle */, - AutomationMsg_Find_Params /* params */, - int /* active_ordinal */, - int /* matches_found */) - - // Is the Find window fully visible (and not animating) for the specified - // tab? - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_FindWindowVisibility, - int /* tab_handle */, - bool /* is_visible */) - - // Where is the Find window located. |x| and |y| will be -1, -1 on failure. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_FindWindowLocation, - int /* tab_handle */, - int /* x */, - int /* y */) - - // Is the Bookmark bar visible? The return value will indicate whether it is - // visible or not and whether it is being animated into (or out of its place). - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_BookmarkBarVisibility, - int /* browser_handle */, - bool, /* is_visible */ - bool /* still_animating */) - - // This message requests the number of related info bars opened. It - // returns -1 if an error occurred. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GetInfoBarCount, - int /* tab_handle */, - int /* info bar count */) - - // This message triggers the action associated with the "accept" button in - // the info-bar at the specified index. If |wait for navigation| is true, it - // won't return until a navigation has occurred. - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_ClickInfoBarAccept, - int /* tab_handle */, - int /* info bar index */, - bool /* wait for navigation */, - - /* navigation result */ - AutomationMsg_NavigationResponseValues) - - // This message retrieves the last time a navigation occurred in the specified - // tab. The value is intended to be used with WaitForNavigation. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GetLastNavigationTime, - int /* tab_handle */, - int64 /* last navigation time */) - - // This messages is used to block until a new navigation occurs (if there is - // none more recent then the time specified). - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WaitForNavigation, - int /* tab_handle */, - int64 /* last navigation time */, - - /* navigation result */ - AutomationMsg_NavigationResponseValues) - - // This messages sets an int-value preference. - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetIntPreference, - int /* browser handle */, - std::string /* pref name */, - int /* value */, - bool /* success */) - - // Queries whether an app modal dialog is currently being shown. (i.e. a - // javascript alert) and which buttons it contains. - IPC_SYNC_MESSAGE_ROUTED0_2(AutomationMsg_ShowingAppModalDialog, - bool /* showing dialog */, - int /* view::DelegateDialog::DialogButton */) - - // This message triggers the specified button for the currently showing - // modal dialog. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ClickAppModalDialogButton, - int /* view::DelegateDialog::DialogButton */, - bool /* success */) - - // This messages sets a string-value preference. - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetStringPreference, - int /* browser handle */, - std::string /* pref name */, - std::string /* pref value */, - bool) - - // This messages gets a boolean-value preference. - IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_GetBooleanPreference, - int /* browser handle */, - std::string /* pref name */, - bool /* success */, - bool /* pref value */) - - // This messages sets a boolean-value preference. - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetBooleanPreference, - int /* browser handle */, - std::string /* pref name */, - bool /* pref value */, - bool /* success */) - - // Queries the current used encoding name of the page in the specified - // web content tab. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GetPageCurrentEncoding, - int /* tab handle */, - std::string /* current used encoding name */) - - // Uses the specified encoding to override the encoding of the page in the - // specified web content tab. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_OverrideEncoding, - int /* tab handle */, - std::string /* overrided encoding name */, - bool /* success */) - - // Used to disable the dialog box that prompts the user for a path when - // saving a web page. - IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_SavePackageShouldPromptUser, - bool /* false if we want to not show the dialog */) - - // This message is an outgoing message from Chrome to an external host. - // It is a notification that a navigation failed - // Request: - // -int : Tab handle - // -int : The status code. - // -GURL: The URL we failed to navigate to. - // Response: - // None expected - IPC_MESSAGE_ROUTED3(AutomationMsg_NavigationFailed, int, int, GURL) - -#if defined(OS_WIN) - // This message is an outgoing message from an automation client to Chrome. - // It is used to reposition a chrome tab window. - IPC_MESSAGE_ROUTED2(AutomationMsg_TabReposition, - int /* tab handle */, - IPC::Reposition_Params /* SetWindowPos params */) -#endif // defined(OS_WIN) - - // Gets the title of the top level browser window. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_WindowTitle, - int /* automation handle */, - string16 /* title text */ ) - - // Tab load complete - IPC_MESSAGE_ROUTED2(AutomationMsg_TabLoaded, - int, // tab handle - GURL) - - // This message requests the tabstrip index of the tab with the given handle. - // The return value contains the index, which will be -1 on failure. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_TabIndex, int, int) - - // This message requests the handle (int64 app-unique identifier) of - // a valid normal browser window, i.e. normal type and non-incognito mode. - // On error, the returned handle value is 0. - IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_FindNormalBrowserWindow, int) - - // This message requests the number of normal browser windows, i.e. normal - // type and non-incognito mode that the app currently has open. The return - // value is the number of windows. - IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_NormalBrowserWindowCount, int) - - // Used to put the browser into "extension automation mode" for a given - // set of Chrome Extensions API functions for the current profile, or turn - // off automation mode. The specified tab is used as the conduit for all - // automated API functions. It must be an external tab (as in - // AutomationMsg_CreateExternalTab). - IPC_MESSAGE_ROUTED2(AutomationMsg_SetEnableExtensionAutomation, - // Tab handle. - int, - // Empty to disable automation, non-empty to enable - // automation of the specified API functions, single - // entry of "*" to enable automation of all API - // functions. - std::vector<std::string>) - - // This message tells the browser to start using the new proxy configuration - // represented by the given JSON string. The parameters used in the JSON - // string are defined in automation_constants.h. - IPC_MESSAGE_ROUTED1(AutomationMsg_SetProxyConfig, - std::string /* proxy_config_json_string */) - - // Sets Download Shelf visibility for the specified browser. - IPC_SYNC_MESSAGE_ROUTED2_0(AutomationMsg_SetShelfVisibility, - int /* browser_handle */, - bool /* is_visible */) - - // This message requests the number of blocked popups in a certain tab with - // the given handle. The return value is the number of blocked popups, or -1 - // if this request failed. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_BlockedPopupCount, - int /* tab_handle */, - int /* blocked_popup_count */) - - // This message retrieves the locale of the browser process. On success - // |chrome_locale| will contain the locale as reported by ICU. On failure - // |chrome_locale| is the empty string. - IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_GetBrowserLocale, - string16 /* chrome_locale */) - -#if defined(OS_WIN) - IPC_MESSAGE_ROUTED4(AutomationMsg_ForwardContextMenuToExternalHost, - int /* tab_handle */, - HANDLE /* source menu handle */, - int /* align flags */, - IPC::MiniContextMenuParams /* params */) - - IPC_MESSAGE_ROUTED2(AutomationMsg_ForwardContextMenuCommandToChrome, - int /* tab_handle */, - int /* selected_command */) +IPC_MESSAGE_ROUTED3(AutomationMsg_ForwardContextMenuToExternalHost, + HANDLE /* source menu handle */, + int /* align flags */, + MiniContextMenuParams /* params */) + +IPC_MESSAGE_CONTROL2(AutomationMsg_ForwardContextMenuCommandToChrome, + int /* tab_handle */, + int /* selected_command */) #endif // OS_WIN - // A URL request to be fetched via automation - IPC_MESSAGE_ROUTED3(AutomationMsg_RequestStart, - int /* tab_handle */, - int /* request_id */, - IPC::AutomationURLRequest /* request */) - - // Read data from a URL request to be fetched via automation - IPC_MESSAGE_ROUTED3(AutomationMsg_RequestRead, - int /* tab_handle */, - int /* request_id */, - int /* bytes_to_read */) - - // Response to a AutomationMsg_RequestStart message - IPC_MESSAGE_ROUTED3(AutomationMsg_RequestStarted, - int /* tab_handle */, - int /* request_id */, - IPC::AutomationURLResponse /* response */) - - // Data read via automation - IPC_MESSAGE_ROUTED3(AutomationMsg_RequestData, - int /* tab_handle */, - int /* request_id */, - std::string /* data */) - - IPC_MESSAGE_ROUTED3(AutomationMsg_RequestEnd, - int /* tab_handle */, - int /* request_id */, - URLRequestStatus /* status */) - - IPC_MESSAGE_ROUTED1(AutomationMsg_PrintAsync, - int /* tab_handle */) - - IPC_MESSAGE_ROUTED3(AutomationMsg_SetCookieAsync, - int /* tab_handle */, - GURL /* url */, - std::string /* cookie */) - - IPC_MESSAGE_ROUTED1(AutomationMsg_SelectAll, - int /* tab handle */) - - IPC_MESSAGE_ROUTED1(AutomationMsg_Cut, - int /* tab handle */) - - IPC_MESSAGE_ROUTED1(AutomationMsg_Copy, - int /* tab handle */) - - IPC_MESSAGE_ROUTED1(AutomationMsg_Paste, - int /* tab handle */) - - IPC_MESSAGE_ROUTED1(AutomationMsg_ReloadAsync, - int /* tab handle */) - - IPC_MESSAGE_ROUTED1(AutomationMsg_StopAsync, - int /* tab handle */) - - // Returns the number of times a filter was used to service an URL request. - // See AutomationMsg_SetFilteredInet. - IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_GetFilteredInetHitCount, - int /* hit_count */) - - // Is the browser in fullscreen mode? - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_IsFullscreen, - int /* browser_handle */, - bool /* is_fullscreen */) - - // Is the fullscreen bubble visible? - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_IsFullscreenBubbleVisible, - int /* browser_handle */, - bool /* is_visible */) - -#if defined(OS_POSIX) - // See previous definition of this message for explanation of why it is - // defined twice. - IPC_MESSAGE_ROUTED3(AutomationMsg_WindowClick, int, gfx::Point, int) -#endif - - // This message notifies the AutomationProvider to navigate to a specified - // url in the tab with given handle. The first parameter is the handle to - // the tab resource. The second parameter is the target url. The third - // parameter is the number of navigations that are required for a successful - // return value. See AutomationMsg_NavigationResponseValues for the return - // value. - IPC_SYNC_MESSAGE_ROUTED3_1( - AutomationMsg_NavigateToURLBlockUntilNavigationsComplete, int, GURL, int, - AutomationMsg_NavigationResponseValues) - - // This message notifies the AutomationProvider to navigate to a specified - // navigation entry index in the external tab with given handle. The first - // parameter is the handle to the tab resource. The second parameter is the - // index of navigation entry. - // The return value contains a status code which is nonnegative on success. - // see AutomationMsg_NavigationResponseValues for the navigation response. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_NavigateExternalTabAtIndex, int, int, - AutomationMsg_NavigationResponseValues) - - // This message requests the provider to wait until the window count - // reached the specified value. - // Request: - // - int: target browser window count - // Response: - // - bool: whether the operation was successful. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_WaitForBrowserWindowCountToBecome, - int, bool) - - // This message requests the provider to wait until an application modal - // dialog is shown. - // Response: - // - bool: whether the operation was successful - IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_WaitForAppModalDialogToBeShown, bool) - - // This message notifies the AutomationProvider to navigate back in session - // history in the tab with given handle. The first parameter is the handle - // to the tab resource. The second parameter is the number of navigations the - // provider will wait for. - // See AutomationMsg_NavigationResponseValues for the navigation response - // values. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_GoBackBlockUntilNavigationsComplete, - int, int, - AutomationMsg_NavigationResponseValues) - - // This message notifies the AutomationProvider to navigate forward in session - // history in the tab with given handle. The first parameter is the handle - // to the tab resource. The second parameter is the number of navigations - // the provider will wait for. - // See AutomationMsg_NavigationResponseValues for the navigation response - // values. - IPC_SYNC_MESSAGE_ROUTED2_1( - AutomationMsg_GoForwardBlockUntilNavigationsComplete, int, int, - AutomationMsg_NavigationResponseValues) - - // This message is used by automation clients to upload histogram data to the - // browser process. - IPC_MESSAGE_ROUTED1(AutomationMsg_RecordHistograms, - std::vector<std::string> /* histogram_list */) - - IPC_MESSAGE_ROUTED2(AutomationMsg_AttachExternalTab, - int /* 'source' tab_handle */, - IPC::AttachExternalTabParams) - - // Sent when the automation client connects to an existing tab. - IPC_SYNC_MESSAGE_ROUTED3_4(AutomationMsg_ConnectExternalTab, - uint64 /* cookie */, - bool /* allow/block tab*/, - gfx::NativeWindow /* parent window */, - gfx::NativeWindow /* Tab container window */, - gfx::NativeWindow /* Tab window */, - int /* Handle to the new tab */, - int /* Session Id of the new tab */) - -#if defined(OS_POSIX) - // TODO(estade): this should be merged with the windows message of the same - // name. See comment for WindowClick. - IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_WindowDrag, - int, std::vector<gfx::Point>, int, bool, bool) -#endif // defined(OS_POSIX) - - // This message gets the bounds of the window. - // Request: - // int - the handle of the window to query - // Response: - // gfx::Rect - the bounds of the window - // bool - true if the query was successful - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_GetWindowBounds, int, gfx::Rect, - bool) - - // Simulate an end of session. Normally this happens when the user - // shuts down the machine or logs off. - // Request: - // int - the handle of the browser - // Response: - // bool - true if succesful - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_TerminateSession, int, bool) - - // Returns whether the window is maximized. - // Request: - // int - the handle of the window - // Response: - // bool - true if the window is maximized - // bool - true if query is successful - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_IsWindowMaximized, int, bool, bool) - - IPC_MESSAGE_ROUTED2(AutomationMsg_SetPageFontSize, - int /* tab_handle */, - int /* The font size */) - - // Returns a metric event duration that was last recorded. Returns -1 if the - // event hasn't occurred yet. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GetMetricEventDuration, - std::string /* event_name */, - int /* duration ms */) - - // Sent by automation provider - go to history entry via automation. - IPC_MESSAGE_ROUTED2(AutomationMsg_RequestGoToHistoryEntryOffset, - int, // tab handle - int) // numbers of entries (negative or positive) - - // Silently install the extension in the given crx file. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_InstallExtension, - FilePath /* full path to crx file */, - AutomationMsg_ExtensionResponseValues) - - // Silently load the extension in the given directory. This expects an - // extension expanded into the directory, not a crx file. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_LoadExpandedExtension, - FilePath /* root directory of extension */, - AutomationMsg_ExtensionResponseValues) - - // Retrieves a list of the root directories of all enabled extensions - // that have been installed into Chrome by dropping a .crx file onto - // Chrome or an equivalent action (including loaded extensions). - // Other types of extensions are not included on the list (e.g. "component", - // "app" or "external" extensions) since since CEEE does not yet support them - // (and it actually only support a single extension in its profile for now). - IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_GetEnabledExtensions, - std::vector<FilePath>) - - // This message requests the type of the window with the given handle. The - // return value contains the type (Browser::Type), or -1 if the request - // failed. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_Type, int, int) - - // Opens a new browser window of a specific type. - IPC_SYNC_MESSAGE_ROUTED2_0(AutomationMsg_OpenNewBrowserWindowOfType, - int /* Type (Browser::Type) */, - bool /* show */ ) - - // This message requests that the mouse be moved to this location, in - // window coordinate space. - // Request: - // int - the handle of the window that's the context for this click - // gfx::Point - the location to move to - IPC_MESSAGE_ROUTED2(AutomationMsg_WindowMouseMove, int, gfx::Point) - - // Called when requests should be downloaded using a host browser's - // download mechanism when chrome is being embedded. - IPC_MESSAGE_ROUTED2(AutomationMsg_DownloadRequestInHost, - int /* tab_handle */, - int /* request_id */) - - // Shuts down the session service for the browser identified by - // |browser_handle|. On success |result| is set to true. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ShutdownSessionService, - int /* browser_handle */, - bool /* result */) - - IPC_MESSAGE_ROUTED1(AutomationMsg_SaveAsAsync, - int /* tab handle */) +// A URL request to be fetched via automation +IPC_MESSAGE_ROUTED2(AutomationMsg_RequestStart, + int /* request_id */, + AutomationURLRequest /* request */) + +// Read data from a URL request to be fetched via automation +IPC_MESSAGE_ROUTED2(AutomationMsg_RequestRead, + int /* request_id */, + int /* bytes_to_read */) + +// Response to a AutomationMsg_RequestStart message +IPC_MESSAGE_ROUTED2(AutomationMsg_RequestStarted, + int /* request_id */, + AutomationURLResponse /* response */) + +// Data read via automation +IPC_MESSAGE_ROUTED2(AutomationMsg_RequestData, + int /* request_id */, + std::string /* data */) + +IPC_MESSAGE_ROUTED2(AutomationMsg_RequestEnd, + int /* request_id */, + URLRequestStatus /* status */) + +IPC_MESSAGE_CONTROL1(AutomationMsg_PrintAsync, + int /* tab_handle */) + +IPC_MESSAGE_ROUTED2(AutomationMsg_SetCookieAsync, + GURL /* url */, + std::string /* cookie */) + +IPC_MESSAGE_CONTROL1(AutomationMsg_SelectAll, + int /* tab handle */) + +IPC_MESSAGE_CONTROL1(AutomationMsg_Cut, + int /* tab handle */) + +IPC_MESSAGE_CONTROL1(AutomationMsg_Copy, + int /* tab handle */) + +IPC_MESSAGE_CONTROL1(AutomationMsg_Paste, + int /* tab handle */) + +IPC_MESSAGE_CONTROL1(AutomationMsg_ReloadAsync, + int /* tab handle */) + +IPC_MESSAGE_CONTROL1(AutomationMsg_StopAsync, + int /* tab handle */) + +// Returns the number of times a filter was used to service an URL request. +// See AutomationMsg_SetFilteredInet. +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetFilteredInetHitCount, + int /* hit_count */) + +// Is the browser in fullscreen mode? +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_IsFullscreen, + int /* browser_handle */, + bool /* is_fullscreen */) + +// Is the fullscreen bubble visible? +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_IsFullscreenBubbleVisible, + int /* browser_handle */, + bool /* is_visible */) + +// This message notifies the AutomationProvider to navigate to a specified +// url in the tab with given handle. The first parameter is the handle to +// the tab resource. The second parameter is the target url. The third +// parameter is the number of navigations that are required for a successful +// return value. See AutomationMsg_NavigationResponseValues for the return +// value. +IPC_SYNC_MESSAGE_CONTROL3_1( + AutomationMsg_NavigateToURLBlockUntilNavigationsComplete, + int, + GURL, + int, + AutomationMsg_NavigationResponseValues) + +// This message notifies the AutomationProvider to navigate to a specified +// navigation entry index in the external tab with given handle. The first +// parameter is the handle to the tab resource. The second parameter is the +// index of navigation entry. +// The return value contains a status code which is nonnegative on success. +// see AutomationMsg_NavigationResponseValues for the navigation response. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_NavigateExternalTabAtIndex, + int, + int, + AutomationMsg_NavigationResponseValues) + +// This message requests the provider to wait until the window count +// reached the specified value. +// Request: +// - int: target browser window count +// Response: +// - bool: whether the operation was successful. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForBrowserWindowCountToBecome, + int, + bool) + +// This message requests the provider to wait until an application modal +// dialog is shown. +// Response: +// - bool: whether the operation was successful +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_WaitForAppModalDialogToBeShown, + bool) + +// This message notifies the AutomationProvider to navigate back in session +// history in the tab with given handle. The first parameter is the handle +// to the tab resource. The second parameter is the number of navigations the +// provider will wait for. +// See AutomationMsg_NavigationResponseValues for the navigation response +// values. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_GoBackBlockUntilNavigationsComplete, + int, + int, + AutomationMsg_NavigationResponseValues) + +// This message notifies the AutomationProvider to navigate forward in session +// history in the tab with given handle. The first parameter is the handle +// to the tab resource. The second parameter is the number of navigations +// the provider will wait for. +// See AutomationMsg_NavigationResponseValues for the navigation response +// values. +IPC_SYNC_MESSAGE_CONTROL2_1( + AutomationMsg_GoForwardBlockUntilNavigationsComplete, + int, + int, + AutomationMsg_NavigationResponseValues) + +// This message is used by automation clients to upload histogram data to the +// browser process. +IPC_MESSAGE_CONTROL1(AutomationMsg_RecordHistograms, + std::vector<std::string> /* histogram_list */) + +IPC_MESSAGE_ROUTED1(AutomationMsg_AttachExternalTab, + AttachExternalTabParams) + +// Sent when the automation client connects to an existing tab. +IPC_SYNC_MESSAGE_CONTROL3_4(AutomationMsg_ConnectExternalTab, + uint64 /* cookie */, + bool /* allow/block tab*/, + gfx::NativeWindow /* parent window */, + gfx::NativeWindow /* Tab container window */, + gfx::NativeWindow /* Tab window */, + int /* Handle to the new tab */, + int /* Session Id of the new tab */) + +// This message gets the bounds of the window. +// Request: +// int - the handle of the window to query +// Response: +// gfx::Rect - the bounds of the window +// bool - true if the query was successful +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_GetWindowBounds, + int, + gfx::Rect, + bool) + +// Simulate an end of session. Normally this happens when the user +// shuts down the machine or logs off. +// Request: +// int - the handle of the browser +// Response: +// bool - true if succesful +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TerminateSession, + int, + bool) + +// Returns whether the window is maximized. +// Request: +// int - the handle of the window +// Response: +// bool - true if the window is maximized +// bool - true if query is successful +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_IsWindowMaximized, + int, + bool, + bool) + +IPC_MESSAGE_CONTROL2(AutomationMsg_SetPageFontSize, + int /* tab_handle */, + int /* The font size */) + +// Returns a metric event duration that was last recorded. Returns -1 if the +// event hasn't occurred yet. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetMetricEventDuration, + std::string /* event_name */, + int /* duration ms */) + +// Sent by automation provider - go to history entry via automation. +IPC_MESSAGE_ROUTED1(AutomationMsg_RequestGoToHistoryEntryOffset, + int) // numbers of entries (negative or positive) + +// Silently install the extension in the given crx file. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_InstallExtension, + FilePath /* full path to crx file */, + AutomationMsg_ExtensionResponseValues) + +// Silently load the extension in the given directory. This expects an +// extension expanded into the directory, not a crx file. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_LoadExpandedExtension, + FilePath /* root directory of extension */, + AutomationMsg_ExtensionResponseValues) + +// Retrieves a list of the root directories of all enabled extensions +// that have been installed into Chrome by dropping a .crx file onto +// Chrome or an equivalent action (including loaded extensions). +// Other types of extensions are not included on the list (e.g. "component", +// "app" or "external" extensions) since since CEEE does not yet support them +// (and it actually only support a single extension in its profile for now). +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetEnabledExtensions, + std::vector<FilePath>) + +// This message requests the type of the window with the given handle. The +// return value contains the type (Browser::Type), or -1 if the request +// failed. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_Type, + int, + int) + +// Opens a new browser window of a specific type. +IPC_SYNC_MESSAGE_CONTROL2_0(AutomationMsg_OpenNewBrowserWindowOfType, + int /* Type (Browser::Type) */, + bool /* show */ ) + +// This message requests that the mouse be moved to this location, in +// window coordinate space. +// Request: +// int - the handle of the window that's the context for this click +// gfx::Point - the location to move to +IPC_MESSAGE_CONTROL2(AutomationMsg_WindowMouseMove, + int, + gfx::Point) + +// Called when requests should be downloaded using a host browser's +// download mechanism when chrome is being embedded. +IPC_MESSAGE_ROUTED1(AutomationMsg_DownloadRequestInHost, + int /* request_id */) + +// Shuts down the session service for the browser identified by +// |browser_handle|. On success |result| is set to true. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ShutdownSessionService, + int /* browser_handle */, + bool /* result */) + +IPC_MESSAGE_CONTROL1(AutomationMsg_SaveAsAsync, + int /* tab handle */) #if defined(OS_WIN) - // An incoming message from an automation host to Chrome. Signals that - // the browser containing |tab_handle| has moved. - IPC_MESSAGE_ROUTED1(AutomationMsg_BrowserMove, - int /* tab handle */) +// An incoming message from an automation host to Chrome. Signals that +// the browser containing |tab_handle| has moved. +IPC_MESSAGE_CONTROL1(AutomationMsg_BrowserMove, + int /* tab handle */) #endif - // Used to get cookies for the given URL. - IPC_MESSAGE_ROUTED3(AutomationMsg_GetCookiesFromHost, - int /* tab_handle */, - GURL /* url */, - int /* opaque_cookie_id */) - - IPC_MESSAGE_ROUTED5(AutomationMsg_GetCookiesHostResponse, - int /* tab_handle */, - bool /* success */, - GURL /* url */, - std::string /* cookies */, - int /* opaque_cookie_id */) - - // If the given host is empty, then the default content settings are - // modified. - IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_SetContentSetting, - int /* browser handle */, - std::string /* host */, - ContentSettingsType /* content type */, - ContentSetting /* setting */, - bool /* success */) +// Used to get cookies for the given URL. +IPC_MESSAGE_ROUTED2(AutomationMsg_GetCookiesFromHost, + GURL /* url */, + int /* opaque_cookie_id */) + +IPC_MESSAGE_CONTROL5(AutomationMsg_GetCookiesHostResponse, + int /* tab_handle */, + bool /* success */, + GURL /* url */, + std::string /* cookies */, + int /* opaque_cookie_id */) + +// If the given host is empty, then the default content settings are +// modified. +IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_SetContentSetting, + int /* browser handle */, + std::string /* host */, + ContentSettingsType /* content type */, + ContentSetting /* setting */, + bool /* success */) #if defined(OS_CHROMEOS) - // Logs in through the browser's login wizard if available. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_LoginWithUserAndPass, - std::string /* username*/, - std::string /* password*/, - bool /* Whether successful*/) +// Logs in through the browser's login wizard if available. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_LoginWithUserAndPass, + std::string /* username*/, + std::string /* password*/, + bool /* Whether successful*/) #endif - // Return the bookmarks encoded as a JSON string. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_GetBookmarksAsJSON, - int /* browser_handle */, - std::string /* bookmarks as a JSON string */, - bool /* success */) - - // Wait for the bookmark model to load. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_WaitForBookmarkModelToLoad, - int /* browser_handle */, - bool /* success */) - - // Bookmark addition, modification, and removal. - // Bookmarks are indexed by their id. - IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_AddBookmarkGroup, - int /* browser_handle */, - int64 /* parent_id */, - int /* index */, - std::wstring /* title */, - bool /* success */) - IPC_SYNC_MESSAGE_ROUTED5_1(AutomationMsg_AddBookmarkURL, - int /* browser_handle */, - int64 /* parent_id */, - int /* index */, - std::wstring /* title */, - GURL /* url */, - bool /* success */) - IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_ReparentBookmark, - int /* browser_handle */, - int64 /* id */, - int64 /* new_parent_id */, - int /* index */, - bool /* success */) - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetBookmarkTitle, - int /* browser_handle */, - int64 /* id */, - std::wstring /* title */, - bool /* success */) - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetBookmarkURL, - int /* browser_handle */, - int64 /* id */, - GURL /* url */, - bool /* success */) - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_RemoveBookmark, - int /* browser_handle */, - int64 /* id */, - bool /* success */) - - // This message informs the browser process to remove the history entries - // for the specified types across all time ranges. See - // browsing_data_remover.h for a list of REMOVE_* types supported in the - // remove_mask parameter. - IPC_MESSAGE_ROUTED1(AutomationMsg_RemoveBrowsingData, int) - - // Block until the focused view id changes to something other than - // |previous_view_id|. - IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_WaitForFocusedViewIDToChange, - int /* window handle */, - int /* previous_view_id */, - bool /* success */, - int /* new_view_id */) - - // To avoid race conditions, waiting until a popup menu opens is a - // three-step process: - // 1. Call StartTrackingPopupMenus. - // 2. Call an automation method that results in opening the popup menu. - // 3. Call WaitForPopupMenuToOpen and check for success. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_StartTrackingPopupMenus, - int /* browser handle */, - bool /* success */) - IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_WaitForPopupMenuToOpen, - bool /* success */) - - // Generic pyauto pattern to help avoid future addition of - // automation messages. - IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_SendJSONRequest, - int /* browser_handle */, - std::string /* JSON request */, - std::string /* JSON response */, - bool /* success */) - - // Installs an extension from the crx file and returns its id. - // On error, |extension handle| will be 0. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_InstallExtensionAndGetHandle, - FilePath /* full path to crx file */, - bool /* with UI */, - int /* extension handle */) - - // Waits for the next extension test result. Sets |test result| as the - // received result and |message| as any accompanying message with the - // result, which could be the empty string. - IPC_SYNC_MESSAGE_ROUTED0_2(AutomationMsg_WaitForExtensionTestResult, - bool /* test result */, - std::string /* message */) - - // Uninstalls an extension. On success |success| is true. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_UninstallExtension, - int /* extension handle */, - bool /* success */) - - // Enables an extension. On success |success| is true. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_EnableExtension, - int /* extension handle */, - bool /* success */) - - // Disables an extension. On success |success| is true. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_DisableExtension, - int /* extension handle */, - bool /* success */) - - // Executes the action associated with the given extension. This executes - // the extension's page or browser action in the given browser, but does - // not open popups. On success |success| is true. - IPC_SYNC_MESSAGE_ROUTED2_1( - AutomationMsg_ExecuteExtensionActionInActiveTabAsync, - int /* extension handle */, - int /* browser handle */, - bool /* success */) - - // Moves the browser action to the given index in the browser action toolbar. - // On success |success| is true. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_MoveExtensionBrowserAction, - int /* extension handle */, - int /* index */, - bool /* success */) - - // Gets an extension property |property type|. On success |success| is true, - // and |property value| is set. - IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_GetExtensionProperty, - int /* extension handle */, - AutomationMsg_ExtensionProperty /* property type */, - bool /* success */, - std::string /* property value */) - - // Resets to the default theme. - IPC_SYNC_MESSAGE_ROUTED0_0(AutomationMsg_ResetToDefaultTheme) - - // Navigates asynchronously to a URL with a certain disposition, - // like in a new tab. - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_NavigationAsyncWithDisposition, - int /* tab handle */, - GURL, - WindowOpenDisposition, - bool /* result */) - - - // This message requests the cookie be deleted for given url in the - // profile of the tab identified by the first parameter. The second - // parameter is the cookie name. - IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_DeleteCookie, GURL, std::string, - int /* tab handle */, - bool /* result */) - - // This message triggers the collected cookies dialog for a specific tab. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ShowCollectedCookiesDialog, - int /* tab handle */, - bool /* result */) - - // This message requests the external tab identified by the tab handle - // passed in be closed. - // Request: - // -int: Tab handle - // Response: - // None expected - IPC_MESSAGE_ROUTED1(AutomationMsg_CloseExternalTab, int) - - // This message requests that the external tab identified by the tab handle - // runs unload handlers if any on the current page. - // Request: - // -int: Tab handle - // -bool: result: true->unload, false->don't unload - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_RunUnloadHandlers, int, bool) - - // This message sets the current zoom level on the tab - // Request: - // -int: Tab handle - // -int: Zoom level. Values ZOOM_OUT = -1, RESET = 0, ZOOM_IN = 1 - // Response: - // None expected - IPC_MESSAGE_ROUTED2(AutomationMsg_SetZoomLevel, int, int) - - // Waits for tab count to reach target value. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WaitForTabCountToBecome, - int /* browser handle */, - int /* target tab count */, - bool /* success */) - - // Waits for the infobar count to reach given number. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WaitForInfoBarCount, - int /* tab handle */, - int /* target count */, - bool /* success */) - - // Waits for the autocomplete edit to receive focus. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_WaitForAutocompleteEditFocus, - int /* autocomplete edit handle */, - bool /* success */) - - // Loads all blocked plug-ins on the page. - IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_LoadBlockedPlugins, - int /* tab handle */, - bool /* success */) - - // Captures the entire page for the tab, including those portions not in - // view, and saves the image as a PNG in the given file location. - // Request: - // -int: Tab handle - // -FilePath: Path to save the captured image to - // Response: - // -bool: Whether the method succeeded - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_CaptureEntirePageAsPNG, int, - FilePath, bool) - -IPC_END_MESSAGES(Automation) +// Return the bookmarks encoded as a JSON string. +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_GetBookmarksAsJSON, + int /* browser_handle */, + std::string /* bookmarks as a JSON string */, + bool /* success */) + +// Wait for the bookmark model to load. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForBookmarkModelToLoad, + int /* browser_handle */, + bool /* success */) + +// Bookmark addition, modification, and removal. +// Bookmarks are indexed by their id. +IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_AddBookmarkGroup, + int /* browser_handle */, + int64 /* parent_id */, + int /* index */, + std::wstring /* title */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL5_1(AutomationMsg_AddBookmarkURL, + int /* browser_handle */, + int64 /* parent_id */, + int /* index */, + std::wstring /* title */, + GURL /* url */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_ReparentBookmark, + int /* browser_handle */, + int64 /* id */, + int64 /* new_parent_id */, + int /* index */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetBookmarkTitle, + int /* browser_handle */, + int64 /* id */, + std::wstring /* title */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetBookmarkURL, + int /* browser_handle */, + int64 /* id */, + GURL /* url */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_RemoveBookmark, + int /* browser_handle */, + int64 /* id */, + bool /* success */) + +// This message informs the browser process to remove the history entries +// for the specified types across all time ranges. See +// browsing_data_remover.h for a list of REMOVE_* types supported in the +// remove_mask parameter. +IPC_MESSAGE_CONTROL1(AutomationMsg_RemoveBrowsingData, + int) + +// Block until the focused view id changes to something other than +// |previous_view_id|. +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_WaitForFocusedViewIDToChange, + int /* window handle */, + int /* previous_view_id */, + bool /* success */, + int /* new_view_id */) + +// To avoid race conditions, waiting until a popup menu opens is a +// three-step process: +// 1. Call StartTrackingPopupMenus. +// 2. Call an automation method that results in opening the popup menu. +// 3. Call WaitForPopupMenuToOpen and check for success. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_StartTrackingPopupMenus, + int /* browser handle */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_WaitForPopupMenuToOpen, + bool /* success */) + +// Generic pyauto pattern to help avoid future addition of +// automation messages. +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_SendJSONRequest, + int /* browser_handle */, + std::string /* JSON request */, + std::string /* JSON response */, + bool /* success */) + +// Installs an extension from the crx file and returns its id. +// On error, |extension handle| will be 0. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_InstallExtensionAndGetHandle, + FilePath /* full path to crx file */, + bool /* with UI */, + int /* extension handle */) + +// Waits for the next extension test result. Sets |test result| as the +// received result and |message| as any accompanying message with the +// result, which could be the empty string. +IPC_SYNC_MESSAGE_CONTROL0_2(AutomationMsg_WaitForExtensionTestResult, + bool /* test result */, + std::string /* message */) + +// Uninstalls an extension. On success |success| is true. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_UninstallExtension, + int /* extension handle */, + bool /* success */) + +// Enables an extension. On success |success| is true. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_EnableExtension, + int /* extension handle */, + bool /* success */) + +// Disables an extension. On success |success| is true. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_DisableExtension, + int /* extension handle */, + bool /* success */) + +// Executes the action associated with the given extension. This executes +// the extension's page or browser action in the given browser, but does +// not open popups. On success |success| is true. +IPC_SYNC_MESSAGE_CONTROL2_1( + AutomationMsg_ExecuteExtensionActionInActiveTabAsync, + int /* extension handle */, + int /* browser handle */, + bool /* success */) + +// Moves the browser action to the given index in the browser action toolbar. +// On success |success| is true. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_MoveExtensionBrowserAction, + int /* extension handle */, + int /* index */, + bool /* success */) + +// Gets an extension property |property type|. On success |success| is true, +// and |property value| is set. +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_GetExtensionProperty, + int /* extension handle */, + AutomationMsg_ExtensionProperty /* property type */, + bool /* success */, + std::string /* property value */) + +// Resets to the default theme. +IPC_SYNC_MESSAGE_CONTROL0_0(AutomationMsg_ResetToDefaultTheme) + +// Navigates asynchronously to a URL with a certain disposition, +// like in a new tab. +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_NavigationAsyncWithDisposition, + int /* tab handle */, + GURL, + WindowOpenDisposition, + bool /* result */) + + +// This message requests the cookie be deleted for given url in the +// profile of the tab identified by the first parameter. The second +// parameter is the cookie name. +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_DeleteCookie, + GURL, + std::string, + int /* tab handle */, + bool /* result */) + +// This message triggers the collected cookies dialog for a specific tab. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ShowCollectedCookiesDialog, + int /* tab handle */, + bool /* result */) + +// This message requests the external tab identified by the tab handle +// passed in be closed. +// Request: +// Response: +// None expected +IPC_MESSAGE_ROUTED0(AutomationMsg_CloseExternalTab) + +// This message requests that the external tab identified by the tab handle +// runs unload handlers if any on the current page. +// Request: +// -int: Tab handle +// -bool: result: true->unload, false->don't unload +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_RunUnloadHandlers, + int, + bool) + +// This message sets the current zoom level on the tab +// Request: +// -int: Tab handle +// -int: Zoom level. Values ZOOM_OUT = -1, RESET = 0, ZOOM_IN = 1 +// Response: +// None expected +IPC_MESSAGE_CONTROL2(AutomationMsg_SetZoomLevel, + int, + int) + +// Waits for tab count to reach target value. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WaitForTabCountToBecome, + int /* browser handle */, + int /* target tab count */, + bool /* success */) + +// Waits for the infobar count to reach given number. +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WaitForInfoBarCount, + int /* tab handle */, + int /* target count */, + bool /* success */) + +// Waits for the autocomplete edit to receive focus. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForAutocompleteEditFocus, + int /* autocomplete edit handle */, + bool /* success */) + +// Loads all blocked plug-ins on the page. +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_LoadBlockedPlugins, + int /* tab handle */, + bool /* success */) + +// Captures the entire page for the tab, including those portions not in +// view, and saves the image as a PNG in the given file location. +// Request: +// -int: Tab handle +// -FilePath: Path to save the captured image to +// Response: +// -bool: Whether the method succeeded +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_CaptureEntirePageAsPNG, + int, + FilePath, + bool) diff --git a/chrome/common/child_process.cc b/chrome/common/child_process.cc index dd6fd40..af05a65 100644 --- a/chrome/common/child_process.cc +++ b/chrome/common/child_process.cc @@ -97,10 +97,10 @@ void ChildProcess::WaitForDebugger(const std::wstring& label) { // TODO(playmobil): In the long term, overriding this flag doesn't seem // right, either use our own flag or open a dialog we can use. // This is just to ease debugging in the interim. - LOG(WARNING) << label - << " (" - << getpid() - << ") paused waiting for debugger to attach @ pid"; + LOG(ERROR) << label + << " (" + << getpid() + << ") paused waiting for debugger to attach @ pid"; // Install a signal handler so that pause can be woken. struct sigaction sa; memset(&sa, 0, sizeof(sa)); diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc index b001eff..e03b3a6 100644 --- a/chrome/common/child_process_host.cc +++ b/chrome/common/child_process_host.cc @@ -13,7 +13,6 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/plugin_messages.h" #include "ipc/ipc_logging.h" -#include "ipc/ipc_message.h" #if defined(OS_LINUX) #include "base/linux_util.h" @@ -25,6 +24,17 @@ ChildProcessHost::ChildProcessHost() } ChildProcessHost::~ChildProcessHost() { + for (size_t i = 0; i < filters_.size(); ++i) { + filters_[i]->OnChannelClosing(); + filters_[i]->OnFilterRemoved(); + } +} + +void ChildProcessHost::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { + filters_.push_back(filter); + + if (channel_.get()) + filter->OnFilterAdded(channel_.get()); } // static @@ -109,13 +119,16 @@ bool ChildProcessHost::CreateChannel() { if (!channel_->Connect()) return false; + for (size_t i = 0; i < filters_.size(); ++i) + filters_[i]->OnFilterAdded(channel_.get()); + // Make sure these messages get sent first. #if defined(IPC_MESSAGE_LOG_ENABLED) - bool enabled = IPC::Logging::current()->Enabled(); - SendOnChannel(new PluginProcessMsg_SetIPCLoggingEnabled(enabled)); + bool enabled = IPC::Logging::GetInstance()->Enabled(); + Send(new PluginProcessMsg_SetIPCLoggingEnabled(enabled)); #endif - SendOnChannel(new PluginProcessMsg_AskBeforeShutdown()); + Send(new PluginProcessMsg_AskBeforeShutdown()); opening_channel_ = true; @@ -126,54 +139,57 @@ void ChildProcessHost::InstanceCreated() { Notify(NotificationType::CHILD_INSTANCE_CREATED); } -bool ChildProcessHost::SendOnChannel(IPC::Message* msg) { +bool ChildProcessHost::Send(IPC::Message* message) { if (!channel_.get()) { - delete msg; + delete message; return false; } - return channel_->Send(msg); + return channel_->Send(message); } void ChildProcessHost::OnChildDied() { delete this; } -bool ChildProcessHost::InterceptMessageFromChild(const IPC::Message& msg) { - return false; -} - ChildProcessHost::ListenerHook::ListenerHook(ChildProcessHost* host) : host_(host) { } -void ChildProcessHost::ListenerHook::OnMessageReceived( +bool ChildProcessHost::ListenerHook::OnMessageReceived( const IPC::Message& msg) { #ifdef IPC_MESSAGE_LOG_ENABLED - IPC::Logging* logger = IPC::Logging::current(); + IPC::Logging* logger = IPC::Logging::GetInstance(); if (msg.type() == IPC_LOGGING_ID) { logger->OnReceivedLoggingMessage(msg); - return; + return true; } if (logger->Enabled()) logger->OnPreDispatchMessage(msg); #endif - bool handled = host_->InterceptMessageFromChild(msg); - - if (!handled) { - if (msg.type() == PluginProcessHostMsg_ShutdownRequest::ID) { - if (host_->CanShutdown()) - host_->SendOnChannel(new PluginProcessMsg_Shutdown()); - } else { - host_->OnMessageReceived(msg); + bool handled = false; + for (size_t i = 0; i < host_->filters_.size(); ++i) { + if (host_->filters_[i]->OnMessageReceived(msg)) { + handled = true; + break; } } + if (!handled && msg.type() == PluginProcessHostMsg_ShutdownRequest::ID) { + if (host_->CanShutdown()) + host_->Send(new PluginProcessMsg_Shutdown()); + handled = true; + } + + if (!handled) + handled = host_->OnMessageReceived(msg); + #ifdef IPC_MESSAGE_LOG_ENABLED if (logger->Enabled()) logger->OnPostDispatchMessage(msg, host_->channel_id_); #endif + return handled; } void ChildProcessHost::ListenerHook::OnChannelConnected(int32 peer_pid) { @@ -181,16 +197,22 @@ void ChildProcessHost::ListenerHook::OnChannelConnected(int32 peer_pid) { host_->OnChannelConnected(peer_pid); // Notify in the main loop of the connection. host_->Notify(NotificationType::CHILD_PROCESS_HOST_CONNECTED); + + for (size_t i = 0; i < host_->filters_.size(); ++i) + host_->filters_[i]->OnChannelConnected(peer_pid); } void ChildProcessHost::ListenerHook::OnChannelError() { host_->opening_channel_ = false; host_->OnChannelError(); + for (size_t i = 0; i < host_->filters_.size(); ++i) + host_->filters_[i]->OnChannelError(); + // This will delete host_, which will also destroy this! host_->OnChildDied(); } void ChildProcessHost::ForceShutdown() { - SendOnChannel(new PluginProcessMsg_Shutdown()); + Send(new PluginProcessMsg_Shutdown()); } diff --git a/chrome/common/child_process_host.h b/chrome/common/child_process_host.h index 72438e8..c822346 100644 --- a/chrome/common/child_process_host.h +++ b/chrome/common/child_process_host.h @@ -7,6 +7,7 @@ #pragma once #include <string> +#include <vector> #include "build/build_config.h" @@ -17,7 +18,7 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "chrome/common/notification_type.h" -#include "ipc/ipc_channel.h" +#include "ipc/ipc_channel_proxy.h" class CommandLine; class FilePath; @@ -29,8 +30,8 @@ class Message; // Provides common functionality for hosting a child process and processing IPC // messages between the host and the child process. Subclasses are responsible // for the actual launching and terminating of the child processes. -// -class ChildProcessHost : public IPC::Channel::Listener { +class ChildProcessHost : public IPC::Channel::Listener, + public IPC::Message::Sender { public: virtual ~ChildProcessHost(); @@ -56,16 +57,14 @@ class ChildProcessHost : public IPC::Channel::Listener { static void PreCacheFont(LOGFONT font); #endif // defined(OS_WIN) + // IPC::Message::Sender implementation. + bool Send(IPC::Message* message); + protected: ChildProcessHost(); - // A helper method to send an IPC message to the child on the channel. - // It behavies just like IPC::Message::Sender::Send. The implementor takes - // ownership of the given Message regardless of whether or not this method - // succeeds. This class does not implement IPC::Message::Sender to prevent - // conflicts with subclasses which indirectly could inherit from - // IPC::Message::Sender. - bool SendOnChannel(IPC::Message* msg); + // Adds an IPC message filter. A reference will be kept to the filter. + void AddFilter(IPC::ChannelProxy::MessageFilter* filter); // Derived classes return true if it's ok to shut down the child process. virtual bool CanShutdown() = 0; @@ -81,7 +80,7 @@ class ChildProcessHost : public IPC::Channel::Listener { virtual void InstanceCreated(); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg) { } + virtual bool OnMessageReceived(const IPC::Message& msg) { return false; } virtual void OnChannelConnected(int32 peer_pid) { } virtual void OnChannelError() { } @@ -91,9 +90,8 @@ class ChildProcessHost : public IPC::Channel::Listener { // Called when the child process goes away. virtual void OnChildDied(); - // Allows the derived implementation to intercept a message before it is - // handed to the IPC::Channel::Listener::OnMessageReceived implementation. - virtual bool InterceptMessageFromChild(const IPC::Message& msg); + // Notifies the derived class that we told the child process to kill itself. + virtual void ShutdownStarted() { } // Subclasses can implement specific notification methods. virtual void Notify(NotificationType type) { } @@ -104,7 +102,7 @@ class ChildProcessHost : public IPC::Channel::Listener { class ListenerHook : public IPC::Channel::Listener { public: explicit ListenerHook(ChildProcessHost* host); - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); private: @@ -117,6 +115,11 @@ class ChildProcessHost : public IPC::Channel::Listener { scoped_ptr<IPC::Channel> channel_; std::string channel_id_; + // Holds all the IPC message filters. Since this object lives on the IO + // thread, we don't have a IPC::ChannelProxy and so we manage filters + // manually. + std::vector<scoped_refptr<IPC::ChannelProxy::MessageFilter> > filters_; + DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); }; diff --git a/chrome/common/child_thread.cc b/chrome/common/child_thread.cc index 8e6fbce..53823bc 100644 --- a/chrome/common/child_thread.cc +++ b/chrome/common/child_thread.cc @@ -43,11 +43,11 @@ void ChildThread::Init() { } channel_.reset(new IPC::SyncChannel(channel_name_, - IPC::Channel::MODE_CLIENT, this, NULL, + IPC::Channel::MODE_CLIENT, this, ChildProcess::current()->io_message_loop(), true, ChildProcess::current()->GetShutDownEvent())); #ifdef IPC_MESSAGE_LOG_ENABLED - IPC::Logging::current()->SetIPCSender(this); + IPC::Logging::GetInstance()->SetIPCSender(this); #endif resource_dispatcher_.reset(new ResourceDispatcher(this)); @@ -66,11 +66,16 @@ void ChildThread::Init() { ChildThread::~ChildThread() { #ifdef IPC_MESSAGE_LOG_ENABLED - IPC::Logging::current()->SetIPCSender(NULL); + IPC::Logging::GetInstance()->SetIPCSender(NULL); #endif channel_->RemoveFilter(sync_message_filter_.get()); + // Close this channel before resetting the message loop attached to it so + // the message loop can call ChannelProxy::Context::OnChannelClosed(), which + // releases the reference count to this channel. + channel_->Close(); + // The ChannelProxy object caches a pointer to the IPC thread, so need to // reset it as it's not guaranteed to outlive this object. // NOTE: this also has the side-effect of not closing the main IPC channel to @@ -134,14 +139,14 @@ MessageLoop* ChildThread::message_loop() { return message_loop_; } -void ChildThread::OnMessageReceived(const IPC::Message& msg) { +bool ChildThread::OnMessageReceived(const IPC::Message& msg) { // Resource responses are sent to the resource dispatcher. if (resource_dispatcher_->OnMessageReceived(msg)) - return; + return true; if (socket_stream_dispatcher_->OnMessageReceived(msg)) - return; + return true; if (file_system_dispatcher_->OnMessageReceived(msg)) - return; + return true; bool handled = true; IPC_BEGIN_MESSAGE_MAP(ChildThread, msg) @@ -155,13 +160,12 @@ void ChildThread::OnMessageReceived(const IPC::Message& msg) { IPC_END_MESSAGE_MAP() if (handled) - return; + return true; - if (msg.routing_id() == MSG_ROUTING_CONTROL) { - OnControlMessageReceived(msg); - } else { - router_.OnMessageReceived(msg); - } + if (msg.routing_id() == MSG_ROUTING_CONTROL) + return OnControlMessageReceived(msg); + + return router_.OnMessageReceived(msg); } void ChildThread::OnAskBeforeShutdown() { @@ -175,9 +179,9 @@ void ChildThread::OnShutdown() { #if defined(IPC_MESSAGE_LOG_ENABLED) void ChildThread::OnSetIPCLoggingEnabled(bool enable) { if (enable) - IPC::Logging::current()->Enable(); + IPC::Logging::GetInstance()->Enable(); else - IPC::Logging::current()->Disable(); + IPC::Logging::GetInstance()->Disable(); } #endif // IPC_MESSAGE_LOG_ENABLED diff --git a/chrome/common/child_thread.h b/chrome/common/child_thread.h index 337a7f8..dbe8677 100644 --- a/chrome/common/child_thread.h +++ b/chrome/common/child_thread.h @@ -74,7 +74,9 @@ class ChildThread : public IPC::Channel::Listener, // Called when the process refcount is 0. void OnProcessFinalRelease(); - virtual void OnControlMessageReceived(const IPC::Message& msg) { } + virtual bool OnControlMessageReceived(const IPC::Message& msg) { + return false; + } virtual void OnAskBeforeShutdown(); virtual void OnShutdown(); @@ -92,7 +94,7 @@ class ChildThread : public IPC::Channel::Listener, void Init(); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); std::string channel_name_; diff --git a/chrome/common/chrome_application_mac.h b/chrome/common/chrome_application_mac.h new file mode 100644 index 0000000..2ea557c --- /dev/null +++ b/chrome/common/chrome_application_mac.h @@ -0,0 +1,71 @@ +// 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. + +#ifndef CHROME_COMMON_CHROME_APPLICATION_MAC_H_ +#define CHROME_COMMON_CHROME_APPLICATION_MAC_H_ +#pragma once + +#if defined(__OBJC__) + +#import <AppKit/AppKit.h> + +#include "base/basictypes.h" +#include "base/message_pump_mac.h" +#include "base/scoped_nsobject.h" + +// Event hooks must implement this protocol. +@protocol CrApplicationEventHookProtocol +- (void)hookForEvent:(NSEvent*)theEvent; +@end + + +@interface CrApplication : NSApplication<CrAppProtocol> { + @private + BOOL handlingSendEvent_; + // Array of objects implementing the CrApplicationEventHookProtocol + scoped_nsobject<NSMutableArray> eventHooks_; +} +- (BOOL)isHandlingSendEvent; + +// Add or remove an event hook to be called for every sendEvent: +// that the application receives. These handlers are called before +// the normal [NSApplication sendEvent:] call is made. + +// This is not a good alternative to a nested event loop. It should +// be used only when normal event logic and notification breaks down +// (e.g. when clicking outside a canBecomeKey:NO window to "switch +// context" out of it). +- (void)addEventHook:(id<CrApplicationEventHookProtocol>)hook; +- (void)removeEventHook:(id<CrApplicationEventHookProtocol>)hook; + ++ (NSApplication*)sharedApplication; +@end + +namespace chrome_application_mac { + +// Controls the state of |handlingSendEvent_| in the event loop so that it is +// reset properly. +class ScopedSendingEvent { + public: + ScopedSendingEvent(); + ~ScopedSendingEvent(); + + private: + CrApplication* app_; + BOOL handling_; + DISALLOW_COPY_AND_ASSIGN(ScopedSendingEvent); +}; + +} // namespace chrome_application_mac + +#endif // defined(__OBJC__) + +namespace chrome_application_mac { + +// To be used to instantiate CrApplication from C++ code. +void RegisterCrApp(); + +} // namespace chrome_application_mac + +#endif // CHROME_COMMON_CHROME_APPLICATION_MAC_H_ diff --git a/chrome/common/chrome_application_mac.mm b/chrome/common/chrome_application_mac.mm new file mode 100644 index 0000000..3c1b013 --- /dev/null +++ b/chrome/common/chrome_application_mac.mm @@ -0,0 +1,76 @@ +// 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. + +#import "chrome/common/chrome_application_mac.h" + +#include "base/logging.h" + +@interface CrApplication () +- (void)setHandlingSendEvent:(BOOL)handlingSendEvent; +@end + +@implementation CrApplication +// Initialize NSApplication using the custom subclass. Check whether NSApp +// was already initialized using another class, because that would break +// some things. ++ (NSApplication*)sharedApplication { + NSApplication* app = [super sharedApplication]; + if (![NSApp isKindOfClass:self]) { + LOG(ERROR) << "NSApp should be of type " << [[self className] UTF8String] + << ", not " << [[NSApp className] UTF8String]; + DCHECK(false) << "NSApp is of wrong type"; + } + return app; +} + +- (id)init { + if ((self = [super init])) { + eventHooks_.reset([[NSMutableArray alloc] init]); + } + return self; +} + +- (BOOL)isHandlingSendEvent { + return handlingSendEvent_; +} + +- (void)setHandlingSendEvent:(BOOL)handlingSendEvent { + handlingSendEvent_ = handlingSendEvent; +} + +- (void)sendEvent:(NSEvent*)event { + chrome_application_mac::ScopedSendingEvent sendingEventScoper; + for (id<CrApplicationEventHookProtocol> handler in eventHooks_.get()) { + [handler hookForEvent:event]; + } + [super sendEvent:event]; +} + +- (void)addEventHook:(id<CrApplicationEventHookProtocol>)handler { + [eventHooks_ addObject:handler]; +} + +- (void)removeEventHook:(id<CrApplicationEventHookProtocol>)handler { + [eventHooks_ removeObject:handler]; +} + +@end + +namespace chrome_application_mac { + +ScopedSendingEvent::ScopedSendingEvent() + : app_(static_cast<CrApplication*>([CrApplication sharedApplication])), + handling_([app_ isHandlingSendEvent]) { + [app_ setHandlingSendEvent:YES]; +} + +ScopedSendingEvent::~ScopedSendingEvent() { + [app_ setHandlingSendEvent:handling_]; +} + +void RegisterCrApp() { + [CrApplication sharedApplication]; +} + +} // namespace chrome_application_mac diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc index e6a3246..97bb58e 100644 --- a/chrome/common/chrome_constants.cc +++ b/chrome/common/chrome_constants.cc @@ -11,10 +11,8 @@ #if defined(OS_MACOSX) #if defined(GOOGLE_CHROME_BUILD) #define PRODUCT_STRING "Google Chrome" -#define PRODUCT_STRING_W L"Google Chrome" #elif defined(CHROMIUM_BUILD) #define PRODUCT_STRING "Chromium" -#define PRODUCT_STRING_W L"Chromium" #else #error Unknown branding #endif @@ -22,29 +20,32 @@ namespace chrome { +const char kChromeVersionEnvVar[] = "CHROME_VERSION"; + // The following should not be used for UI strings; they are meant // for system strings only. UI changes should be made in the GRD. #if defined(OS_WIN) -const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe"; -const wchar_t kHelperProcessExecutableName[] = L"chrome.exe"; +const FilePath::CharType kBrowserProcessExecutableName[] = FPL("chrome.exe"); +const FilePath::CharType kHelperProcessExecutableName[] = FPL("chrome.exe"); #elif defined(OS_LINUX) -const wchar_t kBrowserProcessExecutableName[] = L"chrome"; +const FilePath::CharType kBrowserProcessExecutableName[] = FPL("chrome"); // Helper processes end up with a name of "exe" due to execing via // /proc/self/exe. See bug 22703. -const wchar_t kHelperProcessExecutableName[] = L"exe"; +const FilePath::CharType kHelperProcessExecutableName[] = FPL("exe"); #elif defined(OS_MACOSX) -const wchar_t kBrowserProcessExecutableName[] = PRODUCT_STRING_W; -const wchar_t kHelperProcessExecutableName[] = PRODUCT_STRING_W L" Helper"; +const FilePath::CharType kBrowserProcessExecutableName[] = FPL(PRODUCT_STRING); +const FilePath::CharType kHelperProcessExecutableName[] = + FPL(PRODUCT_STRING " Helper"); #endif // OS_* #if defined(OS_WIN) -const wchar_t kBrowserProcessExecutablePath[] = L"chrome.exe"; +const FilePath::CharType kBrowserProcessExecutablePath[] = FPL("chrome.exe"); const FilePath::CharType kHelperProcessExecutablePath[] = FPL("chrome.exe"); #elif defined(OS_LINUX) -const wchar_t kBrowserProcessExecutablePath[] = L"chrome"; +const FilePath::CharType kBrowserProcessExecutablePath[] = FPL("chrome"); const FilePath::CharType kHelperProcessExecutablePath[] = FPL("chrome"); #elif defined(OS_MACOSX) -const wchar_t kBrowserProcessExecutablePath[] = - PRODUCT_STRING_W L".app/Contents/MacOS/" PRODUCT_STRING_W; +const FilePath::CharType kBrowserProcessExecutablePath[] = + FPL(PRODUCT_STRING ".app/Contents/MacOS/" PRODUCT_STRING); const FilePath::CharType kHelperProcessExecutablePath[] = FPL(PRODUCT_STRING " Helper.app/Contents/MacOS/" PRODUCT_STRING " Helper"); #endif // OS_* @@ -89,7 +90,9 @@ const FilePath::CharType kFaviconsFilename[] = FPL("Favicons"); const FilePath::CharType kHistoryFilename[] = FPL("History"); const FilePath::CharType kLocalStateFilename[] = FPL("Local State"); const FilePath::CharType kPreferencesFilename[] = FPL("Preferences"); -const FilePath::CharType kSafeBrowsingFilename[] = FPL("Safe Browsing Bloom"); +const FilePath::CharType kSafeBrowsingBaseFilename[] = FPL("Safe Browsing"); +const FilePath::CharType kSafeBrowsingPhishingModelFilename[] = + FPL("Safe Browsing Phishing Model"); const FilePath::CharType kSingletonCookieFilename[] = FPL("SingletonCookie"); const FilePath::CharType kSingletonSocketFilename[] = FPL("SingletonSocket"); const FilePath::CharType kSingletonLockFilename[] = FPL("SingletonLock"); diff --git a/chrome/common/chrome_constants.h b/chrome/common/chrome_constants.h index bc4d4bf..56be2f8 100644 --- a/chrome/common/chrome_constants.h +++ b/chrome/common/chrome_constants.h @@ -14,9 +14,11 @@ namespace chrome { extern const char kChromeVersion[]; -extern const wchar_t kBrowserProcessExecutableName[]; -extern const wchar_t kHelperProcessExecutableName[]; -extern const wchar_t kBrowserProcessExecutablePath[]; +extern const char kChromeVersionEnvVar[]; + +extern const FilePath::CharType kBrowserProcessExecutableName[]; +extern const FilePath::CharType kHelperProcessExecutableName[]; +extern const FilePath::CharType kBrowserProcessExecutablePath[]; extern const FilePath::CharType kHelperProcessExecutablePath[]; #if defined(OS_MACOSX) extern const FilePath::CharType kFrameworkName[]; @@ -50,7 +52,8 @@ extern const FilePath::CharType kFaviconsFilename[]; extern const FilePath::CharType kHistoryFilename[]; extern const FilePath::CharType kLocalStateFilename[]; extern const FilePath::CharType kPreferencesFilename[]; -extern const FilePath::CharType kSafeBrowsingFilename[]; +extern const FilePath::CharType kSafeBrowsingBaseFilename[]; +extern const FilePath::CharType kSafeBrowsingPhishingModelFilename[]; extern const FilePath::CharType kSingletonCookieFilename[]; extern const FilePath::CharType kSingletonSocketFilename[]; extern const FilePath::CharType kSingletonLockFilename[]; diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 181cf0a..1b8e612 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -239,6 +239,18 @@ bool PathProvider(int key, FilePath* result) { cur = cur.Append(FILE_PATH_LITERAL("libpdf.so")); #endif break; + case chrome::FILE_NACL_PLUGIN: + if (!GetInternalPluginsDirectory(&cur)) + return false; +#if defined(OS_WIN) + cur = cur.Append(FILE_PATH_LITERAL("ppGoogleNaClPluginChrome.dll")); +#elif defined(OS_MACOSX) + // TODO(noelallen) Please verify this extention name is correct. + cur = cur.Append(FILE_PATH_LITERAL("ppGoogleNaClPluginChrome.plugin")); +#else // Linux and Chrome OS + cur = cur.Append(FILE_PATH_LITERAL("libppGoogleNaClPluginChrome.so")); +#endif + break; case chrome::FILE_RESOURCES_PACK: #if defined(OS_MACOSX) if (mac_util::AmIBundled()) { diff --git a/chrome/common/chrome_paths.h b/chrome/common/chrome_paths.h index 63037c6..21867bd 100644 --- a/chrome/common/chrome_paths.h +++ b/chrome/common/chrome_paths.h @@ -57,6 +57,7 @@ enum { FILE_GEARS_PLUGIN, // Full path to the gears.dll plugin file. FILE_FLASH_PLUGIN, // Full path to the internal Flash plugin file. FILE_PDF_PLUGIN, // Full path to the internal PDF plugin file. + FILE_NACL_PLUGIN, // Full path to the internal NaCl plugin file. FILE_LIBAVCODEC, // Full path to libavcodec media decoding // library. FILE_LIBAVFORMAT, // Full path to libavformat media parsing diff --git a/chrome/common/chrome_paths_win.cc b/chrome/common/chrome_paths_win.cc index 74a730d..8207db6 100644 --- a/chrome/common/chrome_paths_win.cc +++ b/chrome/common/chrome_paths_win.cc @@ -15,6 +15,7 @@ #include "base/path_service.h" #include "chrome/common/chrome_constants.h" #include "chrome/installer/util/browser_distribution.h" +#include "chrome/installer/util/master_preferences.h" namespace chrome { @@ -30,10 +31,10 @@ bool GetDefaultUserDataDirectory(FilePath* result) { bool GetChromeFrameUserDataDirectory(FilePath* result) { if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result)) return false; -#if defined(GOOGLE_CHROME_BUILD) - *result = result->Append(FILE_PATH_LITERAL("Google")); -#endif - *result = result->Append(L"Chrome Frame"); + BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( + BrowserDistribution::CHROME_FRAME, + installer::MasterPreferences::ForCurrentProcess()); + *result = result->Append(dist->GetInstallSubDir()); *result = result->Append(chrome::kUserDataDirname); return true; } diff --git a/chrome/common/chrome_plugin_lib.cc b/chrome/common/chrome_plugin_lib.cc index 3277f4a..1bd118b 100644 --- a/chrome/common/chrome_plugin_lib.cc +++ b/chrome/common/chrome_plugin_lib.cc @@ -19,7 +19,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/notification_service.h" #include "chrome/common/chrome_paths.h" -#include "webkit/glue/plugins/plugin_list.h" +#include "webkit/plugins/npapi/plugin_list.h" using base::TimeDelta; @@ -114,7 +114,7 @@ void ChromePluginLib::RegisterPluginsWithNPAPI() { FilePath path; // Register Gears, if available. if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &path)) - NPAPI::PluginList::Singleton()->AddExtraPluginPath(path); + webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(path); } static void LogPluginLoadTime(const TimeDelta &time) { diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 1d91c88..df8e12c 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -26,6 +26,9 @@ const char kAllowFileAccessFromFiles[] = "allow-file-access-from-files"; // directories. This switch re-enables file:// for testing. const char kAllowFileAccess[] = "allow-file-access"; +// Don't block outdated plugins. +const char kAllowOutdatedPlugins[] = "allow-outdated-plugins"; + // Disable checking of the renegotiation extension and any future checks over // and above what a "traditional" SSL stack might do. This has been requested // in order to support some web development tools that intercept SSL @@ -59,6 +62,7 @@ const char kAppsGalleryReturnTokens[] = "apps-gallery-return-tokens"; // The URL to use for the gallery link in the app launcher. const char kAppsGalleryURL[] = "apps-gallery-url"; +// The update url used by gallery/webstore extensions. const char kAppsGalleryUpdateURL[] = "apps-gallery-update-url"; // Disable throbber for extension apps. @@ -83,9 +87,6 @@ const char kAuthServerWhitelist[] = "auth-server-whitelist"; // automation-related messages on IPC channel with the given ID. const char kAutomationClientChannelID[] = "automation-channel"; -// Block non-sandboxed plugins. -const char kBlockNonSandboxedPlugins[] = "block-nonsandboxed-plugins"; - // Causes the browser process to throw an assertion on startup. const char kBrowserAssertTest[] = "assert-test"; @@ -203,6 +204,12 @@ const char kDisableDevTools[] = "disable-dev-tools"; // Disables device orientation events. const char kDisableDeviceOrientation[] = "disable-device-orientation"; +// By default, if the URL request throttler finds that a server is overloaded or +// encounters an error, it rejects requests to the server for a period of time, +// which is determined by an exponential back-off algorithm. This switch +// disables such behavior. +const char kDisableEnforcedThrottling[] = "disable-enforced-throttling"; + // Disable experimental WebGL support. const char kDisableExperimentalWebGL[] = "disable-webgl"; @@ -217,6 +224,9 @@ const char kDisableExtensionsFileAccessCheck[] = // Disable FileSystem API. const char kDisableFileSystem[] = "disable-file-system"; +// Disables the sandbox for the built-in flash player. +const char kDisableFlashSandbox[] = "disable-flash-sandbox"; + // Suppresses support for the Geolocation javascript API. const char kDisableGeolocation[] = "disable-geolocation"; @@ -238,6 +248,9 @@ const char kDisableHistoryQuickProvider[] = "disable-history-quick-provider"; // Disable the use of the HistoryURLProvider for autocomplete results. const char kDisableHistoryURLProvider[] = "disable-history-url-provider"; +// Disable the Indexed Database API. +const char kDisableIndexedDatabase[] = "disable-indexed-database"; + // Disable the internal Flash Player. const char kDisableInternalFlash[] = "disable-internal-flash"; @@ -267,9 +280,6 @@ const char kDisableLogging[] = "disable-logging"; // notification. const char kDisableNewTabFirstRun[] = "disable-new-tab-first-run"; -// Prevent outdated plugins from running. -const char kDisableOutdatedPlugins[] = "disable-outdated-plugins"; - // Prevent plugins from running. const char kDisablePlugins[] = "disable-plugins"; @@ -317,6 +327,9 @@ const char kDisableSyncApps[] = "disable-sync-apps"; // Disable syncing of autofill. const char kDisableSyncAutofill[] = "disable-sync-autofill"; +// Disable syncing of autofill Profile. +const char kDisableSyncAutofillProfile[] = "disable-sync-autofill-profile"; + // Disable syncing of bookmarks. const char kDisableSyncBookmarks[] = "disable-sync-bookmarks"; @@ -412,7 +425,10 @@ const char kEnableBenchmarking[] = "enable-benchmarking"; // blocked pop-ups only. const char kEnableBlockContentAnimation[] = "enable-blocked-content-animation"; -// Enable experimental client-side detection of phishing pages. +// In the browser process this switch is used to enable or disable the +// client-side phishing detection. In the renderer this switch is only enabled +// if this switch is enabled in the browser and the user has opted in to UMA +// stats and SafeBrowsing is enabled in the preferences. const char kEnableClientSidePhishingDetection[] = "enable-client-side-phishing-detection"; @@ -469,19 +485,12 @@ const char kEnableFastback[] = "enable-fastback"; // testing, for example page cycler and layout tests. See bug 1157243. const char kEnableFileCookies[] = "enable-file-cookies"; -// Enables the sandbox for the built-in flash player. -const char kEnableFlashSandbox[] = "enable-flash-sandbox"; - - // Enable IPv6 support, even if probes suggest that it may not be fully // supported. Some probes may require internet connections, and this flag will // allow support independent of application testing. // This flag overrides "disable-ipv6" which appears elswhere in this file. const char kEnableIPv6[] = "enable-ipv6"; -// Enable the Indexed Database API. -const char kEnableIndexedDatabase[] = "enable-indexed-database"; - // Enable the GPU plugin and Pepper 3D rendering. const char kEnableGPUPlugin[] = "enable-gpu-plugin"; @@ -507,9 +516,13 @@ const char kEnableNaClDebug[] = "enable-nacl-debug"; // Enable Native Web Worker support. const char kEnableNativeWebWorkers[] = "enable-native-web-workers"; -// Is the predictive varition of instant enabled? +// Is InstantController::PREDICTIVE_TYPE enabled? const char kEnablePredictiveInstant[] = "enable-predictive-instant"; +// Is InstantController::PREDICTIVE_NO_AUTO_COMPLETE_TYPE enabled? +const char kEnablePredictiveNoAutoCompleteInstant[] = + "enable-predictive-no-auto-complete-instant"; + // This applies only when the process type is "service". Enables the // Chromoting Host Process within the service process. const char kEnableRemoting[] = "enable-remoting"; @@ -706,9 +719,9 @@ const char kHomePage[] = "homepage"; // "MAP * baz, EXCLUDE www.google.com" --> Remaps everything to "baz", // except for "www.google.com". // -// These mappings apply to the endpoint host in a URLRequest (the TCP connect -// and host resolver in a direct connection, and the CONNECT in an http proxy -// connection, and the endpoint host in a SOCKS proxy connection). +// These mappings apply to the endpoint host in a net::URLRequest (the TCP +// connect and host resolver in a direct connection, and the CONNECT in an http +// proxy connection, and the endpoint host in a SOCKS proxy connection). const char kHostRules[] = "host-rules"; // The maximum number of concurrent host resolve requests (i.e. DNS) to allow. @@ -828,6 +841,9 @@ const char kNoExperiments[] = "no-experiments"; // you're for some reason tempted to pass them both. const char kNoFirstRun[] = "no-first-run"; +// Don't Sandbox the GPU process, does not affect other sandboxed processes. +const char kNoGpuSandbox[] = "no-gpu-sandbox"; + // Support a separate switch that enables the v8 playback extension. // The extension causes javascript calls to Date.now() and Math.random() // to return consistent values, such that subsequent loads of the same @@ -845,7 +861,7 @@ const char kNoProxyServer[] = "no-proxy-server"; // Don't send HTTP-Referer headers. const char kNoReferrers[] = "no-referrers"; -// Runs the renderer outside the sandbox. +// Disables the sandbox for all process types that are normally sandboxed. const char kNoSandbox[] = "no-sandbox"; // Does not automatically open a browser window on startup (used when launching @@ -1020,6 +1036,10 @@ const char kSbMacKeyURLPrefix[] = "safebrowsing-mackey-url-prefix"; // This is used for testing only. const char kSbDisableAutoUpdate[] = "safebrowsing-disable-auto-update"; +// If present, safebrowsing checks download url and download content's hash +// to make sure the content are not malicious. +const char kSbEnableDownloadProtection[] = "safebrowsing-download-protection"; + // Enable support for SDCH filtering (dictionary based expansion of content). // Optional argument is *the* only domain name that will have SDCH suppport. // Default is "-enable-sdch" to advertise SDCH on all domains. @@ -1309,13 +1329,6 @@ const char kEnableExposeForTabs[] = "enable-expose-for-tabs"; // Cause the OS X sandbox write to syslog every time an access to a resource // is denied by the sandbox. const char kEnableSandboxLogging[] = "enable-sandbox-logging"; - - -// Temporary flag to revert to the old WorkerPool implementation. -// This will be removed once we either fix the Mac WorkerPool -// implementation, or completely switch to the shared (with Linux) -// implementation. -const char kDisableLinuxWorkerPool[] = "disable-linux-worker-pool"; #else // Enable Kiosk mode. const char kKioskMode[] = "kiosk"; @@ -1343,25 +1356,19 @@ const char kTouchDevices[] = "touch-devices"; #endif -// USE_SECCOMP_SANDBOX controls whether the seccomp sandbox is opt-in or -out. +// SeccompSandboxEnabled() controls whether we are using Seccomp. +// It is currently off by default on all platforms. // TODO(evan): unify all of these once we turn the seccomp sandbox always // on. Also remove the #include of command_line.h above. -#if defined(USE_SECCOMP_SANDBOX) + // Disable the seccomp sandbox (Linux only) const char kDisableSeccompSandbox[] = "disable-seccomp-sandbox"; -#else // Enable the seccomp sandbox (Linux only) const char kEnableSeccompSandbox[] = "enable-seccomp-sandbox"; -#endif bool SeccompSandboxEnabled() { -#if defined(USE_SECCOMP_SANDBOX) - return !CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableSeccompSandbox); -#else return CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableSeccompSandbox); -#endif } // ----------------------------------------------------------------------------- diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index f8ac686..1270ac4 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -23,6 +23,7 @@ namespace switches { extern const char kActivateOnLaunch[]; extern const char kAllowFileAccessFromFiles[]; extern const char kAllowFileAccess[]; +extern const char kAllowOutdatedPlugins[]; extern const char kAllowSSLMITMProxies[]; extern const char kAllowSandboxDebugging[]; extern const char kAllowScriptingGallery[]; @@ -37,7 +38,6 @@ extern const char kAuthNegotiateDelegateWhitelist[]; extern const char kAuthSchemes[]; extern const char kAuthServerWhitelist[]; extern const char kAutomationClientChannelID[]; -extern const char kBlockNonSandboxedPlugins[]; extern const char kBrowserAssertTest[]; extern const char kBrowserCrashTest[]; extern const char kBrowserSubprocessPath[]; @@ -67,10 +67,12 @@ extern const char kDisableDatabases[]; extern const char kDisableDesktopNotifications[]; extern const char kDisableDevTools[]; extern const char kDisableDeviceOrientation[]; +extern const char kDisableEnforcedThrottling[]; extern const char kDisableExperimentalWebGL[]; extern const char kDisableExtensionsFileAccessCheck[]; extern const char kDisableExtensions[]; extern const char kDisableFileSystem[]; +extern const char kDisableFlashSandbox[]; extern const char kDisableGLSLTranslator[]; extern const char kDisableGeolocation[]; extern const char kDisableGpuWatchdog[]; @@ -78,13 +80,13 @@ extern const char kDisableHangMonitor[]; extern const char kDisableHistoryQuickProvider[]; extern const char kDisableHistoryURLProvider[]; extern const char kDisableInternalFlash[]; +extern const char kDisableIndexedDatabase[]; extern const char kDisableIPv6[]; extern const char kDisableJavaScript[]; extern const char kDisableJava[]; extern const char kDisableLocalStorage[]; extern const char kDisableLogging[]; extern const char kDisableNewTabFirstRun[]; -extern const char kDisableOutdatedPlugins[]; extern const char kDisablePlugins[]; extern const char kDisablePopupBlocking[]; extern const char kDisablePreconnect[]; @@ -100,6 +102,7 @@ extern const char kDisableSSLFalseStart[]; extern const char kDisableSync[]; extern const char kDisableSyncApps[]; extern const char kDisableSyncAutofill[]; +extern const char kDisableSyncAutofillProfile[]; extern const char kDisableSyncBookmarks[]; extern const char kDisableSyncExtensions[]; extern const char kDisableSyncPreferences[]; @@ -140,10 +143,8 @@ extern const char kEnableExperimentalExtensionApis[]; extern const char kEnableExtensionTimelineApi[]; extern const char kEnableFastback[]; extern const char kEnableFileCookies[]; -extern const char kEnableFlashSandbox[]; extern const char kEnableGPUPlugin[]; extern const char kEnableIPv6[]; -extern const char kEnableIndexedDatabase[]; extern const char kEnableLogging[]; extern const char kEnableMemoryInfo[]; extern const char kEnableMonitorProfile[]; @@ -154,6 +155,7 @@ extern const char kEnablePagePrerender[]; extern const char kEnableSyncNewAutofill[]; extern const char kEnablePreconnect[]; extern const char kEnablePredictiveInstant[]; +extern const char kEnablePredictiveNoAutoCompleteInstant[]; extern const char kEnablePreparsedJsCaching[]; extern const char kEnablePrintPreview[]; extern const char kEnableRemoting[]; @@ -194,6 +196,7 @@ extern const char kForceAppsPromoVisible[]; extern const char kForceFieldTestNameAndValue[]; extern const char kForceInternalPDFPlugin[]; extern const char kForceRendererAccessibility[]; +extern const char kForceStubLibcros[]; extern const char kGpuLauncher[]; extern const char kGpuProcess[]; extern const char kGpuStartupDialog[]; @@ -237,6 +240,7 @@ extern const char kNoDefaultBrowserCheck[]; extern const char kNoEvents[]; extern const char kNoExperiments[]; extern const char kNoFirstRun[]; +extern const char kNoGpuSandbox[]; extern const char kNoJsRandomness[]; extern const char kNoProxyServer[]; extern const char kNoReferrers[]; @@ -286,6 +290,7 @@ extern const char kSafePlugins[]; extern const char kSbInfoURLPrefix[]; extern const char kSbMacKeyURLPrefix[]; extern const char kSbDisableAutoUpdate[]; +extern const char kSbEnableDownloadProtection[]; extern const char kSdchFilter[]; extern const char kSearchInOmniboxHint[]; extern const char kServiceProcess[]; @@ -354,7 +359,6 @@ extern const char kGuestSession[]; extern const char kStubCros[]; extern const char kScreenSaverUrl[]; extern const char kCompressSystemFeedback[]; -extern const char kForceStubLibcros[]; extern const char kEnableDOMUIMenu[]; extern const char kEnableMediaPlayer[]; extern const char kEnableAdvancedFileSystem[]; @@ -380,7 +384,6 @@ extern const char kPasswordStore[]; extern const char kDisableHolePunching[]; extern const char kEnableExposeForTabs[]; extern const char kEnableSandboxLogging[]; -extern const char kDisableLinuxWorkerPool[]; #else extern const char kKioskMode[]; #endif @@ -400,11 +403,9 @@ extern const char kRendererCheckFalseTest[]; extern const char kTouchDevices[]; #endif -#if defined(USE_SECCOMP_SANDBOX) extern const char kDisableSeccompSandbox[]; -#else extern const char kEnableSeccompSandbox[]; -#endif + // Return true if the switches indicate the seccomp sandbox is enabled. bool SeccompSandboxEnabled(); diff --git a/chrome/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc index 5157c4a..7bca883 100644 --- a/chrome/common/chrome_version_info.cc +++ b/chrome/common/chrome_version_info.cc @@ -32,19 +32,19 @@ bool VersionInfo::is_valid() const { std::string VersionInfo::Name() const { if (!is_valid()) return std::string(); - return WideToASCII(version_info_->product_name()); + return UTF16ToASCII(version_info_->product_name()); } std::string VersionInfo::Version() const { if (!is_valid()) return std::string(); - return WideToASCII(version_info_->product_version()); + return UTF16ToASCII(version_info_->product_version()); } std::string VersionInfo::LastChange() const { if (!is_valid()) return std::string(); - return WideToASCII(version_info_->last_change()); + return UTF16ToASCII(version_info_->last_change()); } bool VersionInfo::IsOfficialBuild() const { diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc index 165224c..40417fc 100644 --- a/chrome/common/common_param_traits.cc +++ b/chrome/common/common_param_traits.cc @@ -13,6 +13,7 @@ #include "gfx/rect.h" #include "googleurl/src/gurl.h" #include "net/base/upload_data.h" +#include "printing/backend/print_backend.h" #include "printing/native_metafile.h" #include "printing/page_range.h" @@ -232,25 +233,36 @@ void ParamTraits<WebApplicationInfo>::Write(Message* m, WriteParam(m, p.title); WriteParam(m, p.description); WriteParam(m, p.app_url); + WriteParam(m, p.launch_container); WriteParam(m, p.icons.size()); + WriteParam(m, p.permissions.size()); + for (size_t i = 0; i < p.icons.size(); ++i) { WriteParam(m, p.icons[i].url); WriteParam(m, p.icons[i].width); WriteParam(m, p.icons[i].height); WriteParam(m, p.icons[i].data); } + + for (size_t i = 0; i < p.permissions.size(); ++i) + WriteParam(m, p.permissions[i]); } bool ParamTraits<WebApplicationInfo>::Read( const Message* m, void** iter, WebApplicationInfo* r) { - size_t icon_count; + size_t icon_count = 0; + size_t permissions_count = 0; + bool result = ReadParam(m, iter, &r->title) && ReadParam(m, iter, &r->description) && ReadParam(m, iter, &r->app_url) && - ReadParam(m, iter, &icon_count); + ReadParam(m, iter, &r->launch_container) && + ReadParam(m, iter, &icon_count) && + ReadParam(m, iter, &permissions_count); if (!result) return false; + for (size_t i = 0; i < icon_count; ++i) { param_type::IconInfo icon_info; result = @@ -262,6 +274,14 @@ bool ParamTraits<WebApplicationInfo>::Read( return false; r->icons.push_back(icon_info); } + + for (size_t i = 0; i < permissions_count; ++i) { + std::string permission; + if (!ReadParam(m, iter, &permission)) + return false; + r->permissions.push_back(permission); + } + return true; } @@ -627,4 +647,34 @@ void ParamTraits<base::PlatformFileInfo>::Log( l->append(")"); } +void ParamTraits<printing::PrinterCapsAndDefaults>::Write( + Message* m, const param_type& p) { + WriteParam(m, p.printer_capabilities); + WriteParam(m, p.caps_mime_type); + WriteParam(m, p.printer_defaults); + WriteParam(m, p.defaults_mime_type); +} + +bool ParamTraits<printing::PrinterCapsAndDefaults>::Read( + const Message* m, void** iter, param_type* p) { + return + ReadParam(m, iter, &p->printer_capabilities) && + ReadParam(m, iter, &p->caps_mime_type) && + ReadParam(m, iter, &p->printer_defaults) && + ReadParam(m, iter, &p->defaults_mime_type); +} + +void ParamTraits<printing::PrinterCapsAndDefaults>::Log( + const param_type& p, std::string* l) { + l->append("("); + LogParam(p.printer_capabilities, l); + l->append(","); + LogParam(p.caps_mime_type, l); + l->append(","); + LogParam(p.printer_defaults, l); + l->append(","); + LogParam(p.defaults_mime_type, l); + l->append(")"); +} + } // namespace IPC diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h index 6862482..3638443 100644 --- a/chrome/common/common_param_traits.h +++ b/chrome/common/common_param_traits.h @@ -14,6 +14,7 @@ #include "app/surface/transport_dib.h" #include "base/file_util.h" +#include "base/platform_file.h" #include "base/ref_counted.h" #include "chrome/common/content_settings.h" #include "chrome/common/page_zoom.h" @@ -55,6 +56,7 @@ class UploadData; namespace printing { struct PageRange; +struct PrinterCapsAndDefaults; } // namespace printing namespace webkit_glue { @@ -327,6 +329,20 @@ struct ParamTraits<base::PlatformFileInfo> { static void Log(const param_type& p, std::string* l); }; +// Traits for base::PlatformFileError +template <> +struct SimilarTypeTraits<base::PlatformFileError> { + typedef int Type; +}; + +template <> +struct ParamTraits<printing::PrinterCapsAndDefaults> { + typedef printing::PrinterCapsAndDefaults 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 // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ diff --git a/chrome/common/common_param_traits_unittest.cc b/chrome/common/common_param_traits_unittest.cc index 6086c12..8446158 100644 --- a/chrome/common/common_param_traits_unittest.cc +++ b/chrome/common/common_param_traits_unittest.cc @@ -13,6 +13,7 @@ #include "googleurl/src/gurl.h" #include "ipc/ipc_message.h" #include "ipc/ipc_message_utils.h" +#include "printing/backend/print_backend.h" #include "printing/native_metafile.h" #include "printing/page_range.h" #include "testing/gtest/include/gtest/gtest.h" @@ -264,3 +265,24 @@ TEST(IPCMessageTest, Metafile) { } #endif // defined(OS_WIN) +// Tests printing::PrinterCapsAndDefaults serialization +TEST(IPCMessageTest, PrinterCapsAndDefaults) { + printing::PrinterCapsAndDefaults input; + input.printer_capabilities = "Test Capabilities"; + input.caps_mime_type = "text/plain"; + input.printer_defaults = "Test Defaults"; + input.defaults_mime_type = "text/plain"; + + IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); + IPC::ParamTraits<printing::PrinterCapsAndDefaults>::Write(&msg, input); + + printing::PrinterCapsAndDefaults output; + void* iter = NULL; + EXPECT_TRUE(IPC::ParamTraits<printing::PrinterCapsAndDefaults>::Read( + &msg, &iter, &output)); + EXPECT_TRUE(input.printer_capabilities == output.printer_capabilities); + EXPECT_TRUE(input.caps_mime_type == output.caps_mime_type); + EXPECT_TRUE(input.printer_defaults == output.printer_defaults); + EXPECT_TRUE(input.defaults_mime_type == output.defaults_mime_type); +} + diff --git a/chrome/common/database_messages.cc b/chrome/common/database_messages.cc new file mode 100644 index 0000000..0b1b5d9 --- /dev/null +++ b/chrome/common/database_messages.cc @@ -0,0 +1,8 @@ +// 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 "chrome/common/common_param_traits.h" + +#define IPC_MESSAGE_IMPL +#include "chrome/common/database_messages.h" diff --git a/chrome/common/database_messages.h b/chrome/common/database_messages.h new file mode 100644 index 0000000..bb910b0 --- /dev/null +++ b/chrome/common/database_messages.h @@ -0,0 +1,79 @@ +// 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 CHROME_COMMON_DATABASE_MESSAGES_H_ +#define CHROME_COMMON_DATABASE_MESSAGES_H_ +#pragma once + +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" +#include "ipc/ipc_platform_file.h" + +#define IPC_MESSAGE_START DatabaseMsgStart + +// Database messages sent from the browser to the renderer. + +// Notifies the child process of the new database size +IPC_MESSAGE_CONTROL4(DatabaseMsg_UpdateSize, + string16 /* the origin */, + string16 /* the database name */, + int64 /* the new database size */, + int64 /* space available to origin */) + +// Asks the child process to close a database immediately +IPC_MESSAGE_CONTROL2(DatabaseMsg_CloseImmediately, + string16 /* the origin */, + string16 /* the database name */) + +// Database messages sent from the renderer to the browser. + +// Sent by the renderer process to check whether access to web databases is +// granted by content settings. This may block and trigger a cookie prompt. +IPC_SYNC_MESSAGE_ROUTED4_1(DatabaseHostMsg_Allow, + std::string /* origin_url */, + string16 /* database name */, + string16 /* database display name */, + unsigned long /* estimated size */, + bool /* result */) + +// Asks the browser process to open a DB file with the given name. +IPC_SYNC_MESSAGE_CONTROL2_1(DatabaseHostMsg_OpenFile, + string16 /* vfs file name */, + int /* desired flags */, + IPC::PlatformFileForTransit /* file_handle */) + +// Asks the browser process to delete a DB file +IPC_SYNC_MESSAGE_CONTROL2_1(DatabaseHostMsg_DeleteFile, + string16 /* vfs file name */, + bool /* whether or not to sync the directory */, + int /* SQLite error code */) + +// Asks the browser process to return the attributes of a DB file +IPC_SYNC_MESSAGE_CONTROL1_1(DatabaseHostMsg_GetFileAttributes, + string16 /* vfs file name */, + int32 /* the attributes for the given DB file */) + +// Asks the browser process to return the size of a DB file +IPC_SYNC_MESSAGE_CONTROL1_1(DatabaseHostMsg_GetFileSize, + string16 /* vfs file name */, + int64 /* the size of the given DB file */) + +// Notifies the browser process that a new database has been opened +IPC_MESSAGE_CONTROL4(DatabaseHostMsg_Opened, + string16 /* origin identifier */, + string16 /* database name */, + string16 /* database description */, + int64 /* estimated size */) + +// Notifies the browser process that a database might have been modified +IPC_MESSAGE_CONTROL2(DatabaseHostMsg_Modified, + string16 /* origin identifier */, + string16 /* database name */) + +// Notifies the browser process that a database is about to close +IPC_MESSAGE_CONTROL2(DatabaseHostMsg_Closed, + string16 /* origin identifier */, + string16 /* database name */) + +#endif // CHROME_COMMON_DATABASE_MESSAGES_H_ diff --git a/chrome/common/database_util.cc b/chrome/common/database_util.cc index ea4e2cc..36abdb8 100644 --- a/chrome/common/database_util.cc +++ b/chrome/common/database_util.cc @@ -5,7 +5,7 @@ #include "chrome/common/database_util.h" #include "chrome/common/child_thread.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/database_messages.h" #include "ipc/ipc_sync_message_filter.h" #include "third_party/sqlite/sqlite3.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" @@ -20,7 +20,7 @@ WebKitClient::FileHandle DatabaseUtil::databaseOpenFile( scoped_refptr<IPC::SyncMessageFilter> filter( ChildThread::current()->sync_message_filter()); - filter->Send(new ViewHostMsg_DatabaseOpenFile( + filter->Send(new DatabaseHostMsg_OpenFile( vfs_file_name, desired_flags, &file_handle)); return IPC::PlatformFileForTransitToPlatformFile(file_handle); @@ -31,7 +31,7 @@ int DatabaseUtil::databaseDeleteFile( int rv = SQLITE_IOERR_DELETE; scoped_refptr<IPC::SyncMessageFilter> filter( ChildThread::current()->sync_message_filter()); - filter->Send(new ViewHostMsg_DatabaseDeleteFile( + filter->Send(new DatabaseHostMsg_DeleteFile( vfs_file_name, sync_dir, &rv)); return rv; } @@ -40,7 +40,7 @@ long DatabaseUtil::databaseGetFileAttributes(const WebString& vfs_file_name) { int32 rv = -1; scoped_refptr<IPC::SyncMessageFilter> filter( ChildThread::current()->sync_message_filter()); - filter->Send(new ViewHostMsg_DatabaseGetFileAttributes(vfs_file_name, &rv)); + filter->Send(new DatabaseHostMsg_GetFileAttributes(vfs_file_name, &rv)); return rv; } @@ -48,6 +48,6 @@ long long DatabaseUtil::databaseGetFileSize(const WebString& vfs_file_name) { int64 rv = 0LL; scoped_refptr<IPC::SyncMessageFilter> filter( ChildThread::current()->sync_message_filter()); - filter->Send(new ViewHostMsg_DatabaseGetFileSize(vfs_file_name, &rv)); + filter->Send(new DatabaseHostMsg_GetFileSize(vfs_file_name, &rv)); return rv; } diff --git a/chrome/common/db_message_filter.cc b/chrome/common/db_message_filter.cc index 8e3bbc6..e10bb1d 100644 --- a/chrome/common/db_message_filter.cc +++ b/chrome/common/db_message_filter.cc @@ -4,8 +4,9 @@ #include "chrome/common/db_message_filter.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/database_messages.h" #include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h" +#include "third_party/WebKit/WebKit/chromium/public/WebString.h" DBMessageFilter::DBMessageFilter() { } @@ -13,8 +14,8 @@ DBMessageFilter::DBMessageFilter() { bool DBMessageFilter::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(DBMessageFilter, message) - IPC_MESSAGE_HANDLER(ViewMsg_DatabaseUpdateSize, OnDatabaseUpdateSize) - IPC_MESSAGE_HANDLER(ViewMsg_DatabaseCloseImmediately, + IPC_MESSAGE_HANDLER(DatabaseMsg_UpdateSize, OnDatabaseUpdateSize) + IPC_MESSAGE_HANDLER(DatabaseMsg_CloseImmediately, OnDatabaseCloseImmediately) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() diff --git a/chrome/common/default_plugin.cc b/chrome/common/default_plugin.cc index bba738b..3337c7c 100644 --- a/chrome/common/default_plugin.cc +++ b/chrome/common/default_plugin.cc @@ -5,13 +5,13 @@ #include "chrome/common/default_plugin.h" #include "chrome/default_plugin/plugin_main.h" -#include "webkit/glue/plugins/plugin_list.h" +#include "webkit/plugins/npapi/plugin_list.h" namespace chrome { void RegisterInternalDefaultPlugin() { - const NPAPI::PluginVersionInfo default_plugin = { - FilePath(kDefaultPluginLibraryName), + const webkit::npapi::PluginVersionInfo default_plugin = { + FilePath(webkit::npapi::kDefaultPluginLibraryName), L"Default Plug-in", L"Provides functionality for installing third-party plug-ins", L"1", @@ -27,7 +27,8 @@ void RegisterInternalDefaultPlugin() { } }; - NPAPI::PluginList::Singleton()->RegisterInternalPlugin(default_plugin); + webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( + default_plugin); } } // namespace chrome diff --git a/chrome/common/devtools_messages.cc b/chrome/common/devtools_messages.cc index 8ea923e..4efa63d 100644 --- a/chrome/common/devtools_messages.cc +++ b/chrome/common/devtools_messages.cc @@ -2,8 +2,5 @@ // 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 "chrome/common/devtools_messages.h" - -#define MESSAGES_INTERNAL_IMPL_FILE \ - "chrome/common/devtools_messages_internal.h" -#include "ipc/ipc_message_impl_macros.h" diff --git a/chrome/common/devtools_messages.h b/chrome/common/devtools_messages.h index 060c4d9..ab54b51 100644 --- a/chrome/common/devtools_messages.h +++ b/chrome/common/devtools_messages.h @@ -7,12 +7,10 @@ #pragma once #include <map> - -#include "ipc/ipc_message_utils.h" +#include <string> typedef std::map<std::string, std::string> DevToolsRuntimeProperties; -#define MESSAGES_INTERNAL_FILE "chrome/common/devtools_messages_internal.h" -#include "ipc/ipc_message_macros.h" +#include "chrome/common/devtools_messages_internal.h" #endif // CHROME_COMMON_DEVTOOLS_MESSAGES_H_ diff --git a/chrome/common/devtools_messages_internal.h b/chrome/common/devtools_messages_internal.h index ac8dbce..6019d60 100644 --- a/chrome/common/devtools_messages_internal.h +++ b/chrome/common/devtools_messages_internal.h @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This header is meant to be included in multiple passes, hence no traditional -// header guard. -// See ipc_message_macros.h for explanation of the macros and passes. - // Developer tools consist of the following parts: // // DevToolsAgent lives in the renderer of an inspected page and provides access @@ -44,57 +40,51 @@ #include "ipc/ipc_message_macros.h" +#define IPC_MESSAGE_START DevToolsMsgStart + // These are messages sent from DevToolsAgent to DevToolsClient through the // browser. -IPC_BEGIN_MESSAGES(DevToolsClient) - - // WebKit-level transport. - IPC_MESSAGE_CONTROL1(DevToolsClientMsg_DispatchOnInspectorFrontend, - std::string /* message */) +// WebKit-level transport. +IPC_MESSAGE_CONTROL1(DevToolsClientMsg_DispatchOnInspectorFrontend, + std::string /* message */) - // Legacy debugger output message. - IPC_MESSAGE_CONTROL1(DevToolsClientMsg_DebuggerOutput, - std::string /* message */) +// Legacy debugger output message. +IPC_MESSAGE_CONTROL1(DevToolsClientMsg_DebuggerOutput, + std::string /* message */) - // Legacy APU dispatch message. - IPC_MESSAGE_CONTROL1(DevToolsClientMsg_DispatchToAPU, - std::string /* message */) - -IPC_END_MESSAGES(DevToolsClient) +// Legacy APU dispatch message. +IPC_MESSAGE_CONTROL1(DevToolsClientMsg_DispatchToAPU, + std::string /* message */) //----------------------------------------------------------------------------- // These are messages sent from DevToolsClient to DevToolsAgent through the // browser. -IPC_BEGIN_MESSAGES(DevToolsAgent) - - // Tells agent that there is a client host connected to it. - IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_Attach, - DevToolsRuntimeProperties /* properties */) - - // Tells agent that there is no longer a client host connected to it. - IPC_MESSAGE_CONTROL0(DevToolsAgentMsg_Detach) - - // Tells agent that the front-end has been loaded - IPC_MESSAGE_CONTROL0(DevToolsAgentMsg_FrontendLoaded) - - // WebKit-level transport. - IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_DispatchOnInspectorBackend, - std::string /* message */) - - // Send debugger command to the debugger agent. Debugger commands should - // be handled on IO thread(while all other devtools messages are handled in - // the render thread) to allow executing the commands when v8 is on a - // breakpoint. - IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_DebuggerCommand, - std::string /* command */) - - // Inspect element with the given coordinates. - IPC_MESSAGE_CONTROL2(DevToolsAgentMsg_InspectElement, - int /* x */, - int /* y */) - - // Enables/disables the apu agent. - IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_SetApuAgentEnabled, bool /* enabled */) - -IPC_END_MESSAGES(DevToolsAgent) +// Tells agent that there is a client host connected to it. +IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_Attach, + DevToolsRuntimeProperties /* properties */) + +// Tells agent that there is no longer a client host connected to it. +IPC_MESSAGE_CONTROL0(DevToolsAgentMsg_Detach) + +// Tells agent that the front-end has been loaded +IPC_MESSAGE_CONTROL0(DevToolsAgentMsg_FrontendLoaded) + +// WebKit-level transport. +IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_DispatchOnInspectorBackend, + std::string /* message */) + +// Send debugger command to the debugger agent. Debugger commands should +// be handled on IO thread(while all other devtools messages are handled in +// the render thread) to allow executing the commands when v8 is on a +// breakpoint. +IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_DebuggerCommand, + std::string /* command */) + +// Inspect element with the given coordinates. +IPC_MESSAGE_CONTROL2(DevToolsAgentMsg_InspectElement, + int /* x */, + int /* y */) + +// Enables/disables the apu agent. +IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_SetApuAgentEnabled, bool /* enabled */) diff --git a/chrome/common/dom_storage_common.h b/chrome/common/dom_storage_common.h index 21ba19c..5946384 100644 --- a/chrome/common/dom_storage_common.h +++ b/chrome/common/dom_storage_common.h @@ -6,6 +6,10 @@ #define CHROME_COMMON_DOM_STORAGE_COMMON_H_ #pragma once +#include "build/build_config.h" + +#include "base/basictypes.h" + const int64 kLocalStorageNamespaceId = 0; const int64 kInvalidSessionStorageNamespaceId = kLocalStorageNamespaceId; diff --git a/chrome/common/dom_storage_messages.cc b/chrome/common/dom_storage_messages.cc new file mode 100644 index 0000000..9aee345 --- /dev/null +++ b/chrome/common/dom_storage_messages.cc @@ -0,0 +1,125 @@ +// 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 "chrome/common/common_param_traits.h" + +#define IPC_MESSAGE_IMPL +#include "chrome/common/dom_storage_messages.h" + +DOMStorageMsg_Event_Params::DOMStorageMsg_Event_Params() + : storage_type(DOM_STORAGE_LOCAL) { +} + +DOMStorageMsg_Event_Params::~DOMStorageMsg_Event_Params() { +} + +namespace IPC { + +void ParamTraits<DOMStorageMsg_Event_Params>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.key); + WriteParam(m, p.old_value); + WriteParam(m, p.new_value); + WriteParam(m, p.origin); + WriteParam(m, p.url); + WriteParam(m, p.storage_type); +} + +bool ParamTraits<DOMStorageMsg_Event_Params>::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->key) && + ReadParam(m, iter, &p->old_value) && + ReadParam(m, iter, &p->new_value) && + ReadParam(m, iter, &p->origin) && + ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->storage_type); +} + +void ParamTraits<DOMStorageMsg_Event_Params>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.key, l); + l->append(", "); + LogParam(p.old_value, l); + l->append(", "); + LogParam(p.new_value, l); + l->append(", "); + LogParam(p.origin, l); + l->append(", "); + LogParam(p.url, l); + l->append(", "); + LogParam(p.storage_type, l); + l->append(")"); +} + +void ParamTraits<DOMStorageType>::Write(Message* m, const param_type& p) { + m->WriteInt(p); +} + +bool ParamTraits<DOMStorageType>::Read(const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<param_type>(type); + return true; +} + +void ParamTraits<DOMStorageType>::Log(const param_type& p, std::string* l) { + std::string control; + switch (p) { + case DOM_STORAGE_LOCAL: + control = "DOM_STORAGE_LOCAL"; + break; + case DOM_STORAGE_SESSION: + control = "DOM_STORAGE_SESSION"; + break; + default: + NOTIMPLEMENTED(); + control = "UNKNOWN"; + break; + } + LogParam(control, l); +} + +void ParamTraits<WebKit::WebStorageArea::Result>::Write(Message* m, + const param_type& p) { + m->WriteInt(p); +} + +bool ParamTraits<WebKit::WebStorageArea::Result>::Read(const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<param_type>(type); + return true; +} + +void ParamTraits<WebKit::WebStorageArea::Result>::Log(const param_type& p, + std::string* l) { + std::string control; + switch (p) { + case WebKit::WebStorageArea::ResultOK: + control = "WebKit::WebStorageArea::ResultOK"; + break; + case WebKit::WebStorageArea::ResultBlockedByQuota: + control = "WebKit::WebStorageArea::ResultBlockedByQuota"; + break; + case WebKit::WebStorageArea::ResultBlockedByPolicy: + control = "WebKit::WebStorageArea::ResultBlockedByPolicy"; + break; + default: + NOTIMPLEMENTED(); + control = "UNKNOWN"; + break; + } + LogParam(control, l); +} + +} // namespace IPC diff --git a/chrome/common/dom_storage_messages.h b/chrome/common/dom_storage_messages.h new file mode 100644 index 0000000..e36f517 --- /dev/null +++ b/chrome/common/dom_storage_messages.h @@ -0,0 +1,125 @@ +// 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 CHROME_COMMON_DOM_STORAGE_MESSAGES_H_ +#define CHROME_COMMON_DOM_STORAGE_MESSAGES_H_ +#pragma once + +#include "chrome/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/WebKit/chromium/public/WebStorageArea.h" + +#define IPC_MESSAGE_START DOMStorageMsgStart + +// Signals a storage event. +struct DOMStorageMsg_Event_Params { + DOMStorageMsg_Event_Params(); + ~DOMStorageMsg_Event_Params(); + + // The key that generated the storage event. Null if clear() was called. + NullableString16 key; + + // The old value of this key. Null on clear() or if it didn't have a value. + NullableString16 old_value; + + // The new value of this key. Null on removeItem() or clear(). + NullableString16 new_value; + + // The origin this is associated with. + string16 origin; + + // The URL of the page that caused the storage event. + GURL url; + + // The storage type of this event. + DOMStorageType storage_type; +}; + +namespace IPC { + +template <> +struct ParamTraits<DOMStorageMsg_Event_Params> { + typedef DOMStorageMsg_Event_Params 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<DOMStorageType> { + typedef DOMStorageType 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::WebStorageArea::Result> { + typedef WebKit::WebStorageArea::Result 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 + +// 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 */) + +#endif // CHROME_COMMON_DOM_STORAGE_MESSAGES_H_ diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 1cb4a0e..8dac7c4 100644 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -517,10 +517,15 @@ "optional": true, "description": "If true, enqueues this utterance if TTS is already in progress. If false (the default), interrupts any current speech and flushes the speech queue before speaking this new utterance." }, - "languageName": { + "voiceName": { "type": "string", "optional": true, - "description": "The language name for synthesis specified in the form <language>-<locale>, e.g. en-US, en-GB, fr-CA, zh-CN, etc." + "description": "The name of the voice to use for synthesis." + }, + "locale": { + "type": "string", + "optional": true, + "description": "The language and region code that specify the language and dialect to be used for synthesis, in the form <language>-<region>, e.g. en-US, en-GB, fr-CA, zh-CN, etc." }, "gender": { "type": "string", @@ -584,6 +589,99 @@ ] } ] + }, + { + "name": "speakCompleted", + "nodoc": true, + "type": "function", + "description": "A callback passed to the onSpeak event.", + "parameters": [ + { + "type": "integer", + "name": "requestId" + }, + { + "type": "string", + "optional": "true", + "name": "errorMessage" + } + ] + } + ], + "events": [ + { + "name": "onSpeak", + "type": "function", + "description": "Called when the user makes a call to tts.speak and the options matches one of the tts_voices from this extension's manifest.", + "parameters": [ + { + "type": "string", + "name": "utterance", + "description": "The text to speak." + }, + { + "type": "object", + "name": "options", + "description": "The speak options.", + "properties": { + "voiceName": { + "type": "string", + "optional": true, + "description": "The name of the voice to use for synthesis." + }, + "locale": { + "type": "string", + "optional": true, + "description": "The language and region code that specify the language and dialect to be used for synthesis, in the form <language>-<region>, e.g. en-US, en-GB, fr-CA, zh-CN, etc." + }, + "gender": { + "type": "string", + "optional": true, + "description": "Gender of voice for synthesized speech.", + "enum": ["male", "female"] + }, + "rate": { + "type": "number", + "optional": true, + "minimum": 0, + "maximum": 1, + "description": "Speaking speed between 0 and 1 inclusive, with 0 being slowest and 1 being fastest." + }, + "pitch": { + "type": "number", + "optional": true, + "minimum": 0, + "maximum": 1, + "description": "Speaking pitch between 0 and 1 inclusive, with 0 being lowest and 1 being highest." + }, + "volume": { + "type": "number", + "optional": true, + "minimum": 0, + "maximum": 1, + "description": "Speaking volume between 0 and 1 inclusive, with 0 being lowest and 1 being highest." + } + } + }, + { + "type": "function", + "name": "callback", + "description": "You must call this function when speaking is finished.", + "parameters": [ + { + "type": "string", + "name": "error", + "optional": true, + "description": "Error message, which will be returned to the caller in chrome.extension.lastError." + } + ] + } + ] + }, + { + "name": "onStop", + "type": "function", + "description": "Fired when a call is made to tts.stop and this extension may be in the middle of speaking." } ] }, @@ -710,6 +808,7 @@ {"type": "array", "items": {"type": "string"}} ] }, + "tabId": {"type": "integer", "minimum": 0, "optional": true, "description": "The id of the tab for which you want to adopt to the new window."}, "left": {"type": "integer", "optional": true, "description": "The number of pixels to position the new window from the left edge of the screen. If not specified, the new window is offset naturally from the last focusd window."}, "top": {"type": "integer", "optional": true, "description": "The number of pixels to position the new window from the top edge of the screen. If not specified, the new window is offset naturally from the last focusd window."}, "width": {"type": "integer", "minimum": 0, "optional": true, "description": "The width in pixels of the new window. If not specified defaults to a natural width."}, @@ -3635,8 +3734,12 @@ "description": "An object encapsulating a complete proxy configuration.", "properties": { "rules": {"$ref": "ProxyRules", "optional": true, "description": "The proxy rules describing this configuration."}, - "autoDetect": {"type": "boolean", "optional": true, "description": "True if the proxy settings sbould be detected automatically."}, - "pacScript": {"$ref": "PacScript", "optional": true, "description": "The proxy auto-config (PAC) script for this configuration."} + "pacScript": {"$ref": "PacScript", "optional": true, "description": "The proxy auto-config (PAC) script for this configuration."}, + "mode": { + "type": "string", + "enum": ["direct", "auto_detect", "pac_script", "fixed_servers", "system"], + "description": "'direct' = Never use a proxy<br>'auto_detect' = Auto detect proxy settings<br>'pac_script' = Use specified PAC script<br>'fixed_servers' = Manually specify proxy servers<br>'system' = Use system proxy settings" + } } } ], @@ -3815,7 +3918,7 @@ "name": "state", "type": "string", "enum": ["hidden", "shown", "active"], - "description": "'hidden' indicates sidebar is not defined for the specified tab (show was never called or hide() was called). Nothing is displayed for this sidebar.</br>'shown' means sidebar is defined for the specified tab; mini tab is displayed for this sidebar. Sidebar UI is either collapsed or displaying a content of some other extension's sidebar.</br>'active' indicates that sidebar is defined for the specified tab; sidebar UI is expanded and displaying this sidebar's content." + "description": "'hidden' indicates sidebar is not defined for the specified tab (show was never called or hide() was called). Nothing is displayed for this sidebar.<br>'shown' means sidebar is defined for the specified tab; mini tab is displayed for this sidebar. Sidebar UI is either collapsed or displaying a content of some other extension's sidebar.<br>'active' indicates that sidebar is defined for the specified tab; sidebar UI is expanded and displaying this sidebar's content." } ] } @@ -4133,7 +4236,7 @@ }, { "name": "get", - "description": "Return information about the installed extension with the given ID.", + "description": "Return information about the installed extension or app that has the given ID.", "parameters": [ { "name": "id", diff --git a/chrome/common/extensions/docs/a11y.html b/chrome/common/extensions/docs/a11y.html index d18f6f7..721b93a 100644 --- a/chrome/common/extensions/docs/a11y.html +++ b/chrome/common/extensions/docs/a11y.html @@ -956,7 +956,7 @@ see <a href="samples.html">Samples</a>. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/api_index.html b/chrome/common/extensions/docs/api_index.html index af8e72b..5480998 100644 --- a/chrome/common/extensions/docs/api_index.html +++ b/chrome/common/extensions/docs/api_index.html @@ -523,7 +523,7 @@ For more information, see the video <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/api_other.html b/chrome/common/extensions/docs/api_other.html index 7a0077e..baa17f2 100644 --- a/chrome/common/extensions/docs/api_other.html +++ b/chrome/common/extensions/docs/api_other.html @@ -555,7 +555,7 @@ just as they do in other web pages. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/apps.html b/chrome/common/extensions/docs/apps.html index 0b50ed7..53634d6 100644 --- a/chrome/common/extensions/docs/apps.html +++ b/chrome/common/extensions/docs/apps.html @@ -378,7 +378,7 @@ extensions and packaged apps, and packaged apps and hosted apps: <ul> <li> <a href="http://code.google.com/chrome/apps/articles/thinking_in_web_apps.html">Thinking in Web Apps</a> </li> - <li> <a href="http://codesite-staging:29006/chrome/webstore/articles/apps_vs_extensions.html">Extensions, Packaged Apps, and Hosted Apps in the Chrome Web Store</a> </li> + <li> <a href="http://code.google.com/chrome/webstore/articles/apps_vs_extensions.html">Extensions, Packaged Apps, and Hosted Apps in the Chrome Web Store</a> </li> </ul> @@ -653,7 +653,7 @@ basic concepts about extensions. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/autoupdate.html b/chrome/common/extensions/docs/autoupdate.html index d3aaf51..b65e2a8 100644 --- a/chrome/common/extensions/docs/autoupdate.html +++ b/chrome/common/extensions/docs/autoupdate.html @@ -612,7 +612,7 @@ Another option is to use the --extensions-update-frequency command-line flag to <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/background_pages.html b/chrome/common/extensions/docs/background_pages.html index 85d9b99..68dfa2d 100644 --- a/chrome/common/extensions/docs/background_pages.html +++ b/chrome/common/extensions/docs/background_pages.html @@ -605,7 +605,7 @@ from a file named <code>image.html</code>. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/bookmarks.html b/chrome/common/extensions/docs/bookmarks.html index 33dd392..1f31c7b 100644 --- a/chrome/common/extensions/docs/bookmarks.html +++ b/chrome/common/extensions/docs/bookmarks.html @@ -5323,7 +5323,7 @@ For other examples and for help in viewing the source code, see <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/browserAction.html b/chrome/common/extensions/docs/browserAction.html index f8b505f..639fd88 100644 --- a/chrome/common/extensions/docs/browserAction.html +++ b/chrome/common/extensions/docs/browserAction.html @@ -1909,7 +1909,7 @@ For other examples and for help in viewing the source code, see <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/content_scripts.html b/chrome/common/extensions/docs/content_scripts.html index e64f704..3e529d2 100644 --- a/chrome/common/extensions/docs/content_scripts.html +++ b/chrome/common/extensions/docs/content_scripts.html @@ -961,7 +961,7 @@ sending a request to its parent extension. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/contextMenus.html b/chrome/common/extensions/docs/contextMenus.html index 981c17d..1265b34 100644 --- a/chrome/common/extensions/docs/contextMenus.html +++ b/chrome/common/extensions/docs/contextMenus.html @@ -2933,7 +2933,7 @@ You can find samples of this API on the <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/cookies.html b/chrome/common/extensions/docs/cookies.html index f45e8ef..582afa1 100644 --- a/chrome/common/extensions/docs/cookies.html +++ b/chrome/common/extensions/docs/cookies.html @@ -3611,7 +3611,7 @@ see <a href="samples.html">Samples</a>. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/crx.html b/chrome/common/extensions/docs/crx.html index 9a72d60..b1b2df7 100644 --- a/chrome/common/extensions/docs/crx.html +++ b/chrome/common/extensions/docs/crx.html @@ -638,7 +638,7 @@ echo "Wrote $crx" <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/css/samples.css b/chrome/common/extensions/docs/css/samples.css index de3bdb5..05701ea 100644 --- a/chrome/common/extensions/docs/css/samples.css +++ b/chrome/common/extensions/docs/css/samples.css @@ -75,7 +75,6 @@ img.icon { margin: 10px 0; background: #eee; padding: 10px; - -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; } @@ -99,4 +98,4 @@ img.icon { padding: 50px 0; font-size: 17px; font-weight: bold; -}
\ No newline at end of file +} diff --git a/chrome/common/extensions/docs/devguide.html b/chrome/common/extensions/docs/devguide.html index 8e489a6..a806b4b 100644 --- a/chrome/common/extensions/docs/devguide.html +++ b/chrome/common/extensions/docs/devguide.html @@ -607,7 +607,7 @@ applies to packaged apps, as well as extensions. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/docs.html b/chrome/common/extensions/docs/docs.html index baab851..aa629a7 100644 --- a/chrome/common/extensions/docs/docs.html +++ b/chrome/common/extensions/docs/docs.html @@ -610,7 +610,7 @@ The following table lists the doc locations and explains how they differ. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/events.html b/chrome/common/extensions/docs/events.html index 3136703..e6a3bb2 100644 --- a/chrome/common/extensions/docs/events.html +++ b/chrome/common/extensions/docs/events.html @@ -515,7 +515,7 @@ bool hasListener(function callback(...)) <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/examples/api/bookmarks/basic.zip b/chrome/common/extensions/docs/examples/api/bookmarks/basic.zip Binary files differindex 73a1258..02d772f 100644 --- a/chrome/common/extensions/docs/examples/api/bookmarks/basic.zip +++ b/chrome/common/extensions/docs/examples/api/bookmarks/basic.zip diff --git a/chrome/common/extensions/docs/examples/api/bookmarks/basic/icon.png b/chrome/common/extensions/docs/examples/api/bookmarks/basic/icon.png Binary files differnew file mode 100644 index 0000000..9a79a46 --- /dev/null +++ b/chrome/common/extensions/docs/examples/api/bookmarks/basic/icon.png diff --git a/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip b/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip Binary files differindex 17d22b2..2a5116d 100644 --- a/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip +++ b/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher.zip b/chrome/common/extensions/docs/examples/extensions/app_launcher.zip Binary files differnew file mode 100644 index 0000000..6f71c38 --- /dev/null +++ b/chrome/common/extensions/docs/examples/extensions/app_launcher.zip diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/browser_action_icon.png b/chrome/common/extensions/docs/examples/extensions/app_launcher/browser_action_icon.png Binary files differnew file mode 100644 index 0000000..046ee42 --- /dev/null +++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/browser_action_icon.png diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/icon.png b/chrome/common/extensions/docs/examples/extensions/app_launcher/icon.png Binary files differnew file mode 100644 index 0000000..4aa2994 --- /dev/null +++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/icon.png diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/manifest.json b/chrome/common/extensions/docs/examples/extensions/app_launcher/manifest.json new file mode 100644 index 0000000..86b0286 --- /dev/null +++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/manifest.json @@ -0,0 +1,13 @@ +{ + "name": "App Launcher", + "version": "0.7.3", + "permissions": ["management"], + "browser_action": { + "default_icon": "browser_action_icon.png", + "default_title": "App Launcher", + "default_popup": "popup.html" + }, + "icons": { + "48": "icon.png" + } +} diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.css b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.css new file mode 100644 index 0000000..aa6ce07 --- /dev/null +++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.css @@ -0,0 +1,49 @@ +// 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. + +html { + overflow-x: hidden; +} + +body { + font-family: Helvetica, Arial, sans-serif; +} + +#search_container { + text-align: center; +} + +#search { + width: 85%; +} + +.app { + width: 100%; + margin-top: 7px; + margin-bottom: 7px; + margin-left: 2px; + margin-right: 20px; + white-space: nowrap; +} + +.app img { + vertical-align: middle; + height: 38px; + width: 38px; +} + +.app_title { + vertical-align: middle; + margin-left: 5px; +} + +.app:hover { + background-color: rgb(250,250,250); + cursor:pointer; + outline: 1px dotted rgb(100,100,200); +} + +.app_selected,.app_selected:hover { + background-color: rgb(230,230,230); +} diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.html b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.html new file mode 100644 index 0000000..ca14080 --- /dev/null +++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.html @@ -0,0 +1,32 @@ +<!doctype html> +<!-- + * 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. +--> +<html> +<head> +<link rel="stylesheet" type="text/css" href="popup.css"> +<script src="popup.js"></script> +</head> +<body onload="onLoad()"> + +<div id="spacer_dummy"></div> +<div id="outer"> + +<div id="appstore_link" style="display:none"> +<p>No apps installed.</p><p> +<a href='javascript:chrome.tabs.create({"url":"https://chrome.google.com/webstore", "selected":true});window.close();'>Go get some</a></p> +</div> + +<div id="search_container"> +<input id="search" type="text" placeholder="type to search" + oninput="onSearchInput()" spellcheck="false"> +</div> + +<div id="apps"></div> + +</div> + +</body> +</html> diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.js b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.js new file mode 100644 index 0000000..8918c62 --- /dev/null +++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.js @@ -0,0 +1,198 @@ +// 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. + +function $(id) { + return document.getElementById(id); +} + +// Returns the largest size icon, or a default icon, for the given |app|. +function getIconURL(app) { + if (!app.icons || app.icons.length == 0) { + return chrome.extension.getURL("icon.png"); + } + var largest = {size:0}; + for (var i = 0; i < app.icons.length; i++) { + var icon = app.icons[i]; + if (icon.size > largest.size) { + largest = icon; + } + } + return largest.url; +} + +function launchApp(id) { + chrome.management.launchApp(id); + window.close(); // Only needed on OSX because of crbug.com/63594 +} + +// Adds DOM nodes for |app| into |appsDiv|. +function addApp(appsDiv, app, selected) { + var div = document.createElement("div"); + div.className = "app" + (selected ? " app_selected" : ""); + + div.onclick = function() { + launchApp(app.id); + }; + + var img = document.createElement("img"); + img.src = getIconURL(app); + div.appendChild(img); + + var title = document.createElement("span"); + title.className = "app_title"; + title.innerText = app.name; + div.appendChild(title); + + appsDiv.appendChild(div); +} + +// The list of all apps & extensions. +var completeList = []; + +// A filtered list of apps we actually want to show. +var appList = []; + +// The index of an app in |appList| that should be highlighted. +var selectedIndex = 0; + +function reloadAppDisplay() { + var appsDiv = $("apps"); + + // Empty the current content. + appsDiv.innerHTML = ""; + + for (var i = 0; i < appList.length; i++) { + var item = appList[i]; + addApp(appsDiv, item, i == selectedIndex); + } +} + +// Puts only enabled apps from completeList into appList. +function rebuildAppList(filter) { + selectedIndex = 0; + appList = []; + for (var i = 0; i < completeList.length; i++){ + var item = completeList[i]; + // Skip extensions and disabled apps. + if (!item.isApp || !item.enabled) { + continue; + } + if (filter && item.name.toLowerCase().search(filter) < 0) { + continue; + } + appList.push(item); + } +} + +// In order to keep the popup bubble from shrinking as your search narrows the +// list of apps shown, we set an explicit width on the outermost div. +var didSetExplicitWidth = false; + +function adjustWidthIfNeeded(filter) { + if (filter.length > 0 && !didSetExplicitWidth) { + // Set an explicit width, correcting for any scroll bar present. + var outer = $("outer"); + var correction = window.innerWidth - document.documentElement.clientWidth; + var width = outer.offsetWidth; + $("spacer_dummy").style.width = width + correction + "px"; + didSetExplicitWidth = true; + } +} + +// Shows the list of apps based on the search box contents. +function onSearchInput() { + var filter = $("search").value; + adjustWidthIfNeeded(filter); + rebuildAppList(filter); + reloadAppDisplay(); +} + +function compare(a, b) { + return (a > b) ? 1 : (a == b ? 0 : -1); +} + +function compareByName(app1, app2) { + return compare(app1.name.toLowerCase(), app2.name.toLowerCase()); +} + +function onLoad() { + chrome.management.getAll(function(info) { + var appCount = 0; + for (var i = 0; i < info.length; i++) { + if (info[i].isApp) { + appCount++; + } + } + if (appCount == 0) { + $("search").style.display = "none"; + $("appstore_link").style.display = ""; + return; + } + completeList = info.sort(compareByName); + onSearchInput(); + }); +} + +// Changes the selected app in the list. +function changeSelection(newIndex) { + if (newIndex >= 0 && newIndex <= appList.length - 1) { + selectedIndex = newIndex; + reloadAppDisplay(); + + var selected = document.getElementsByClassName("app_selected")[0]; + var rect = selected.getBoundingClientRect(); + if (newIndex == 0) { + window.scrollTo(0, 0); + } else if (newIndex == appList.length - 1) { + window.scrollTo(0, document.height); + } else if (rect.top < 0) { + window.scrollBy(0, rect.top); + } else if (rect.bottom > innerHeight) { + window.scrollBy(0, rect.bottom - innerHeight); + } + } +} + +var keys = { + ENTER : 13, + ESCAPE : 27, + END : 35, + HOME : 36, + LEFT : 37, + UP : 38, + RIGHT : 39, + DOWN : 40 +}; + +// Set up a key event handler that handles moving the selected app up/down, +// hitting enter to launch the selected app, as well as auto-focusing the +// search box as soon as you start typing. +window.onkeydown = function(event) { + switch (event.keyCode) { + case keys.DOWN: + changeSelection(selectedIndex + 1); + break; + case keys.UP: + changeSelection(selectedIndex - 1); + break; + case keys.HOME: + changeSelection(0); + break; + case keys.END: + changeSelection(appList.length - 1); + break; + case keys.ENTER: + var app = appList[selectedIndex]; + if (app) { + launchApp(app.id); + } + break; + default: + // Focus the search box and return true so you can just start typing even + // when the search box isn't focused. + $("search").focus(); + return true; + } + return false; +}; diff --git a/chrome/common/extensions/docs/examples/extensions/benchmark.zip b/chrome/common/extensions/docs/examples/extensions/benchmark.zip Binary files differindex a322ab3..3d799d2 100644 --- a/chrome/common/extensions/docs/examples/extensions/benchmark.zip +++ b/chrome/common/extensions/docs/examples/extensions/benchmark.zip diff --git a/chrome/common/extensions/docs/examples/extensions/benchmark/options.html b/chrome/common/extensions/docs/examples/extensions/benchmark/options.html index 24adc77..6db31d2 100644 --- a/chrome/common/extensions/docs/examples/extensions/benchmark/options.html +++ b/chrome/common/extensions/docs/examples/extensions/benchmark/options.html @@ -36,9 +36,9 @@ div#header { position: relative; overflow: hidden; background: #5296de; - -webkit-background-size: 100%; + background-size: 100%; border: 1px solid #3a75bd; - -webkit-border-radius: 6px; + border-radius: 6px; color: white; text-shadow: 0 0 2px black; } diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot.zip b/chrome/common/extensions/docs/examples/extensions/buildbot.zip Binary files differindex d7eb8c4..9e7ad86 100644 --- a/chrome/common/extensions/docs/examples/extensions/buildbot.zip +++ b/chrome/common/extensions/docs/examples/extensions/buildbot.zip diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/bg.html b/chrome/common/extensions/docs/examples/extensions/buildbot/bg.html index 39dd344..dda276e 100644 --- a/chrome/common/extensions/docs/examples/extensions/buildbot/bg.html +++ b/chrome/common/extensions/docs/examples/extensions/buildbot/bg.html @@ -49,9 +49,14 @@ function requestURL(url, callback) { try { xhr.onreadystatechange = function(state) { if (xhr.readyState == 4) { - var text = xhr.responseText; - //console.log(text); - callback(text); + if (xhr.status == 200) { + var text = xhr.responseText; + //console.log(text); + callback(text); + } else { + chrome.browserAction.setBadgeText({text:"?"}); + chrome.browserAction.setBadgeBackgroundColor({color:[0,0,255,255]}); + } } } diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json b/chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json index 1acb250..baeca6d 100644 --- a/chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json +++ b/chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json @@ -1,6 +1,6 @@ { "name": "Chromium Buildbot Monitor", - "version": "0.7.5", + "version": "0.7.6", "description": "Displays the status of the Chromium buildbot in the toolbar. Click to see more detailed status in a popup.", "icons": { "128": "icon.png" }, "background_page": "bg.html", diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html index 3a66636..f89511a 100644 --- a/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html +++ b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html @@ -17,7 +17,11 @@ function updateBotList(text) { } var data; try { - data = JSON.parse(results[1]); + // The build bot returns invalid JSON. Namely it uses single + // quotes and includes commas in some invalid locations. We have to + // run some regexps across the text to fix it up. + var jsonString = results[1].replace(/'/g, '"').replace(/},]/g,'}]'); + data = JSON.parse(jsonString); } catch (e) { console.dir(e); console.log(text); @@ -104,9 +108,13 @@ function requestURL(url, callback) { try { xhr.onreadystatechange = function(state) { if (xhr.readyState == 4) { - var text = xhr.responseText; - //console.log(text); - callback(text); + if (xhr.status == 200) { + var text = xhr.responseText; + //console.log(text); + callback(text); + } else { + bots.innerText = "Error."; + } } } @@ -147,7 +155,7 @@ body { #links { background-color: #efefef; border: 1px solid #cccccc; - -webkit-border-radius: 5px; + border-radius: 5px; margin-top: 1px; padding: 3px; white-space: nowrap; @@ -175,7 +183,7 @@ body.small .bot { .bot { cursor: pointer; - -webkit-border-radius: 5px; + border-radius: 5px; margin-top: 1px; padding: 3px; white-space: nowrap; diff --git a/chrome/common/extensions/docs/examples/extensions/chrome_search.zip b/chrome/common/extensions/docs/examples/extensions/chrome_search.zip Binary files differindex d0ad166..a38e561 100644 --- a/chrome/common/extensions/docs/examples/extensions/chrome_search.zip +++ b/chrome/common/extensions/docs/examples/extensions/chrome_search.zip diff --git a/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json b/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json index 54de17c..3254391 100644 --- a/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json +++ b/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json @@ -1,9 +1,9 @@ { "background_page": "background.html", "description": "Add support to the omnibox to search the Chromium source code.", + "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRx0y4f/CuomPPeGxcVMo7yfYZ1apxD+9e3ItNtPRBi8WMmzG0xhjnqvm03LTfTljbzA1L93s31HkjS5Bd12qM8SSZxOOizsZveK1tdpX0QelikSUaz1wwIyjatoC/jJy7vuuk0j5kPeLkNAhYGJTqN3H/Pqt0lFF1VFX4+fCEvQIDAQAB", "name": "Chromium Search", "omnibox": { "keyword" : "src" }, "permissions": [ "tabs", "http://www.google.com/" ], - "version": "5", - "minimum_chrome_version": "9" + "version": "4" } diff --git a/chrome/common/extensions/docs/examples/extensions/imageinfo.zip b/chrome/common/extensions/docs/examples/extensions/imageinfo.zip Binary files differindex 9ab6603..dbce95b 100644 --- a/chrome/common/extensions/docs/examples/extensions/imageinfo.zip +++ b/chrome/common/extensions/docs/examples/extensions/imageinfo.zip diff --git a/chrome/common/extensions/docs/examples/tutorials/getstarted.zip b/chrome/common/extensions/docs/examples/tutorials/getstarted.zip Binary files differindex 54083ae..268cc5d 100644 --- a/chrome/common/extensions/docs/examples/tutorials/getstarted.zip +++ b/chrome/common/extensions/docs/examples/tutorials/getstarted.zip diff --git a/chrome/common/extensions/docs/examples/tutorials/getstarted/getstarted.zip b/chrome/common/extensions/docs/examples/tutorials/getstarted/getstarted.zip Binary files differnew file mode 100644 index 0000000..37deb7f --- /dev/null +++ b/chrome/common/extensions/docs/examples/tutorials/getstarted/getstarted.zip diff --git a/chrome/common/extensions/docs/experimental.clipboard.html b/chrome/common/extensions/docs/experimental.clipboard.html index 24287e0..4852c75 100644 --- a/chrome/common/extensions/docs/experimental.clipboard.html +++ b/chrome/common/extensions/docs/experimental.clipboard.html @@ -966,7 +966,7 @@ generally indicates the tab is going away. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/experimental.contextMenus.html b/chrome/common/extensions/docs/experimental.contextMenus.html index aa7a362..5f246fd 100644 --- a/chrome/common/extensions/docs/experimental.contextMenus.html +++ b/chrome/common/extensions/docs/experimental.contextMenus.html @@ -480,7 +480,7 @@ You can read all about it at its new home: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/experimental.cookies.html b/chrome/common/extensions/docs/experimental.cookies.html index 5fdcdcc..b179e08 100644 --- a/chrome/common/extensions/docs/experimental.cookies.html +++ b/chrome/common/extensions/docs/experimental.cookies.html @@ -480,7 +480,7 @@ You can read all about it at its new home: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/experimental.history.html b/chrome/common/extensions/docs/experimental.history.html index 0e45ec7..b839162 100644 --- a/chrome/common/extensions/docs/experimental.history.html +++ b/chrome/common/extensions/docs/experimental.history.html @@ -480,7 +480,7 @@ You can read all about it at its new home: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/experimental.html b/chrome/common/extensions/docs/experimental.html index 1c9ebe1..fd600a2 100644 --- a/chrome/common/extensions/docs/experimental.html +++ b/chrome/common/extensions/docs/experimental.html @@ -547,7 +547,7 @@ For information on the standard APIs that extensions can use, see <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/experimental.idle.html b/chrome/common/extensions/docs/experimental.idle.html index 6d1ae19..6f709ae 100644 --- a/chrome/common/extensions/docs/experimental.idle.html +++ b/chrome/common/extensions/docs/experimental.idle.html @@ -480,7 +480,7 @@ You can read all about it at its new home: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/experimental.infobars.html b/chrome/common/extensions/docs/experimental.infobars.html index f542b7a..59e642d 100644 --- a/chrome/common/extensions/docs/experimental.infobars.html +++ b/chrome/common/extensions/docs/experimental.infobars.html @@ -800,7 +800,7 @@ For example: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/experimental.processes.html b/chrome/common/extensions/docs/experimental.processes.html index f2a289e..a41a1c6 100644 --- a/chrome/common/extensions/docs/experimental.processes.html +++ b/chrome/common/extensions/docs/experimental.processes.html @@ -1107,7 +1107,7 @@ http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_ <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/experimental.proxy.html b/chrome/common/extensions/docs/experimental.proxy.html index 07c2ed9..a13ce9e 100644 --- a/chrome/common/extensions/docs/experimental.proxy.html +++ b/chrome/common/extensions/docs/experimental.proxy.html @@ -1314,7 +1314,7 @@ </div><div> <div> <dt> - <var>autoDetect</var> + <var>pacScript</var> <em> <!-- TYPE --> @@ -1323,15 +1323,15 @@ <span class="optional">optional</span> <span class="enum" style="display: none; ">enumerated</span> <span id="typeTemplate"> - <span style="display: none; "> - <a> Type</a> - </span> <span> - <span style="display: none; "> + <a href="experimental.proxy.html#type-PacScript">PacScript</a> + </span> + <span style="display: none; "> + <span> array of <span><span></span></span> </span> - <span>boolean</span> - <span style="display: none; "></span> + <span>paramType</span> + <span></span> </span> </span> ) @@ -1342,7 +1342,7 @@ <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>True if the proxy settings sbould be detected automatically.</dd> + <dd>The proxy auto-config (PAC) script for this configuration.</dd> <dd style="display: none; "> This parameter was added in version <b><span></span></b>. @@ -1372,24 +1372,24 @@ </div><div> <div> <dt> - <var>pacScript</var> + <var>mode</var> <em> <!-- TYPE --> <div style="display:inline"> ( - <span class="optional">optional</span> - <span class="enum" style="display: none; ">enumerated</span> + <span class="optional" style="display: none; ">optional</span> + <span class="enum">enumerated</span> <span id="typeTemplate"> - <span> - <a href="experimental.proxy.html#type-PacScript">PacScript</a> - </span> <span style="display: none; "> - <span> + <a> Type</a> + </span> + <span> + <span style="display: none; "> array of <span><span></span></span> </span> - <span>paramType</span> - <span></span> + <span>string</span> + <span>["direct", "auto_detect", "pac_script", "fixed_servers", "system"]</span> </span> </span> ) @@ -1400,7 +1400,7 @@ <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>The proxy auto-config (PAC) script for this configuration.</dd> + <dd>'direct' = Never use a proxy<br>'auto_detect' = Auto detect proxy settings<br>'pac_script' = Use specified PAC script<br>'fixed_servers' = Manually specify proxy servers<br>'system' = Use system proxy settings</dd> <dd style="display: none; "> This parameter was added in version <b><span></span></b>. @@ -1455,7 +1455,7 @@ <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/experimental.sidebar.html b/chrome/common/extensions/docs/experimental.sidebar.html index 148de03..727bf89 100644 --- a/chrome/common/extensions/docs/experimental.sidebar.html +++ b/chrome/common/extensions/docs/experimental.sidebar.html @@ -2583,7 +2583,7 @@ <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/experimental.webNavigation.html b/chrome/common/extensions/docs/experimental.webNavigation.html index 52a04af..237ee23 100644 --- a/chrome/common/extensions/docs/experimental.webNavigation.html +++ b/chrome/common/extensions/docs/experimental.webNavigation.html @@ -2555,7 +2555,7 @@ <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/experimental.webRequest.html b/chrome/common/extensions/docs/experimental.webRequest.html index 71769af..14346ff 100644 --- a/chrome/common/extensions/docs/experimental.webRequest.html +++ b/chrome/common/extensions/docs/experimental.webRequest.html @@ -2493,7 +2493,7 @@ <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/extension.html b/chrome/common/extensions/docs/extension.html index a0e11fd..e7bb9e7 100644 --- a/chrome/common/extensions/docs/extension.html +++ b/chrome/common/extensions/docs/extension.html @@ -3556,7 +3556,7 @@ For details, see <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/external_extensions.html b/chrome/common/extensions/docs/external_extensions.html index 0ee2ed5..39c1540 100644 --- a/chrome/common/extensions/docs/external_extensions.html +++ b/chrome/common/extensions/docs/external_extensions.html @@ -768,7 +768,7 @@ through the UI, and then uninstalling it. </p> <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/faq.html b/chrome/common/extensions/docs/faq.html index 0e17982..66cc1b4 100644 --- a/chrome/common/extensions/docs/faq.html +++ b/chrome/common/extensions/docs/faq.html @@ -872,7 +872,7 @@ win,stable,#.#.###.#,#.#.###.#</pre> <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/getstarted.html b/chrome/common/extensions/docs/getstarted.html index 3dafe3c..d7e94c8 100644 --- a/chrome/common/extensions/docs/getstarted.html +++ b/chrome/common/extensions/docs/getstarted.html @@ -376,6 +376,7 @@ to the toolbar of Google Chrome. by clicking the wrench icon <img src="images/toolsmenu.gif" width="29" height="29" alt="" style="margin-top:0"> and choosing <b>Tools > Extensions</b>. + (On Mac, use <b>Window > Extensions</b>.) </li> <li> @@ -655,7 +656,7 @@ If you don't feel like reading, try these: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/history.html b/chrome/common/extensions/docs/history.html index e6be466..ce1c49e 100644 --- a/chrome/common/extensions/docs/history.html +++ b/chrome/common/extensions/docs/history.html @@ -3150,7 +3150,7 @@ For other examples and for help in viewing the source code, see <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/hosting.html b/chrome/common/extensions/docs/hosting.html index 0a688fb..e852619 100644 --- a/chrome/common/extensions/docs/hosting.html +++ b/chrome/common/extensions/docs/hosting.html @@ -560,7 +560,7 @@ or try hosting the <code>.crx</code> file at another server. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/i18n-messages.html b/chrome/common/extensions/docs/i18n-messages.html index 3c85b6b..cf07efd 100644 --- a/chrome/common/extensions/docs/i18n-messages.html +++ b/chrome/common/extensions/docs/i18n-messages.html @@ -814,7 +814,7 @@ because its value is obvious from the "content" field. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/i18n.html b/chrome/common/extensions/docs/i18n.html index d5e3bb9..39d0f83 100644 --- a/chrome/common/extensions/docs/i18n.html +++ b/chrome/common/extensions/docs/i18n.html @@ -1421,7 +1421,7 @@ For details on calling <code>getAcceptLanguages()</code>, see the <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/idle.html b/chrome/common/extensions/docs/idle.html index 1ab1b64..6b3aa54 100644 --- a/chrome/common/extensions/docs/idle.html +++ b/chrome/common/extensions/docs/idle.html @@ -713,7 +713,7 @@ For example: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/images/perms-hw1.png b/chrome/common/extensions/docs/images/perms-hw1.png Binary files differindex 224bd2d..eb6a79e 100644 --- a/chrome/common/extensions/docs/images/perms-hw1.png +++ b/chrome/common/extensions/docs/images/perms-hw1.png diff --git a/chrome/common/extensions/docs/images/perms-hw2.png b/chrome/common/extensions/docs/images/perms-hw2.png Binary files differindex 644a276..8fd5c47 100644 --- a/chrome/common/extensions/docs/images/perms-hw2.png +++ b/chrome/common/extensions/docs/images/perms-hw2.png diff --git a/chrome/common/extensions/docs/index.html b/chrome/common/extensions/docs/index.html index 54cd32f..7e89cfc 100644 --- a/chrome/common/extensions/docs/index.html +++ b/chrome/common/extensions/docs/index.html @@ -582,7 +582,7 @@ For more information, see the <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/management.html b/chrome/common/extensions/docs/management.html index 3bb1d52..7efee0e 100644 --- a/chrome/common/extensions/docs/management.html +++ b/chrome/common/extensions/docs/management.html @@ -384,7 +384,7 @@ For example:</p> <div class="description"> <p class="todo" style="display: none; ">Undocumented.</p> - <p>Return information about the installed extension with the given ID.</p> + <p>Return information about the installed extension or app that has the given ID.</p> <!-- PARAMETERS --> <h4>Parameters</h4> @@ -2661,7 +2661,7 @@ For example:</p> <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/manifest.html b/chrome/common/extensions/docs/manifest.html index 658290f..c043355 100644 --- a/chrome/common/extensions/docs/manifest.html +++ b/chrome/common/extensions/docs/manifest.html @@ -441,9 +441,8 @@ see <a href="i18n.html">Internationalization</a> for details. The URL of the homepage for this extension. The extensions management page (chrome://extensions) will contain a link to this URL. This field is particularly useful if you <a href="hosting.html">host the extension on your own site</a>. If you distribute your -extension using the <a href="https://chrome.google.com/extensions">Extensions Gallery</a>, -the homepage URL defaults to the extension's own gallery page. -<!-- PENDING: check whether the same is true of the store --> +extension using the <a href="https://chrome.google.com/extensions">Extensions Gallery</a> or <a href="https://chrome.google.com/webstore">Chrome Web Store</a>, +the homepage URL defaults to the extension's own page. </p> <h3 id="icons">icons</h3> @@ -950,7 +949,7 @@ For more information, see <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/match_patterns.html b/chrome/common/extensions/docs/match_patterns.html index ddbc56b..c9aa23c 100644 --- a/chrome/common/extensions/docs/match_patterns.html +++ b/chrome/common/extensions/docs/match_patterns.html @@ -702,7 +702,7 @@ Here are some examples of <em>invalid</em> pattern matches: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/messaging.html b/chrome/common/extensions/docs/messaging.html index 19e683d..4d7d884 100644 --- a/chrome/common/extensions/docs/messaging.html +++ b/chrome/common/extensions/docs/messaging.html @@ -768,7 +768,7 @@ For more examples and for help in viewing the source code, see <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/notifications.html b/chrome/common/extensions/docs/notifications.html index 82c5e07..3afbd73 100644 --- a/chrome/common/extensions/docs/notifications.html +++ b/chrome/common/extensions/docs/notifications.html @@ -609,7 +609,7 @@ see the <a href="http://dev.chromium.org/developers/design-documents/desktop-not <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/npapi.html b/chrome/common/extensions/docs/npapi.html index 8aad2ea..904bff2 100644 --- a/chrome/common/extensions/docs/npapi.html +++ b/chrome/common/extensions/docs/npapi.html @@ -567,7 +567,7 @@ avoid making your NPAPI plugin public whenever possible. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/omnibox.html b/chrome/common/extensions/docs/omnibox.html index 6f7afa7..24fad5e 100644 --- a/chrome/common/extensions/docs/omnibox.html +++ b/chrome/common/extensions/docs/omnibox.html @@ -1217,7 +1217,7 @@ You can find samples of this API on the <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/options.html b/chrome/common/extensions/docs/options.html index 982032f..701630a 100644 --- a/chrome/common/extensions/docs/options.html +++ b/chrome/common/extensions/docs/options.html @@ -558,7 +558,7 @@ Favorite Color: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/override.html b/chrome/common/extensions/docs/override.html index bfa7e7d..6d03561 100644 --- a/chrome/common/extensions/docs/override.html +++ b/chrome/common/extensions/docs/override.html @@ -663,7 +663,7 @@ For other examples and for help in viewing the source code, see <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/overview.html b/chrome/common/extensions/docs/overview.html index 49e7d8c..2d5760f 100644 --- a/chrome/common/extensions/docs/overview.html +++ b/chrome/common/extensions/docs/overview.html @@ -937,7 +937,7 @@ Here are some ideas for where to go next: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/packaging.html b/chrome/common/extensions/docs/packaging.html index ccfa542..4939c6c 100644 --- a/chrome/common/extensions/docs/packaging.html +++ b/chrome/common/extensions/docs/packaging.html @@ -649,7 +649,7 @@ to create <code>.crx</code> files, see <a href="crx.html">CRX package format</a> <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/pageAction.html b/chrome/common/extensions/docs/pageAction.html index 36d96af..b086ab8 100644 --- a/chrome/common/extensions/docs/pageAction.html +++ b/chrome/common/extensions/docs/pageAction.html @@ -427,6 +427,15 @@ follow these guidelines:</p> for features that make sense for most pages. Use <a href="browserAction.html">browser actions</a> instead. + </li><li><b>Do</b> use icons + that are slightly lighter weight + than <a href="browserAction.html#icon">browser action icons</a>. + Most icons that Chrome displays + in the location bar + are smaller than 19 pixels. + If the edge pixels are used, + they are usually only used + for a faint shadow. </li><li><b>Don't</b> constantly animate your icon. That's just annoying. </li></ul> @@ -1655,7 +1664,7 @@ For other examples and for help in viewing the source code, see <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/permission_warnings.html b/chrome/common/extensions/docs/permission_warnings.html index eb062e3..1c6ed92 100644 --- a/chrome/common/extensions/docs/permission_warnings.html +++ b/chrome/common/extensions/docs/permission_warnings.html @@ -326,21 +326,9 @@ <div id="static"><div id="pageData-name" class="pageData">Permission Warnings</div> <div id="pageData-showTOC" class="pageData">true</div> -<!-- -NOTE: When this doc is updated, the online help should also be updated: -http://www.google.com/support/chrome/bin/answer.py?hl=en&answer=186213 - -We should periodically look at -http://src.chromium.org/viewvc/chrome/trunk/src/chrome/app/generated_resources.grd?view=markup -to make sure that we're covering all messages. Search for -IDS_EXTENSION_PROMPT_WARNING -(e.g. IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY). ---> - <p> To use most chrome.* APIs and extension capabilities, -your extension must declare its intent in the -<a href="manifest.html">manifest</a>, +your extension must declare its intent in the manifest, often in the "permissions" field. Some of these declarations result in a warning when @@ -364,7 +352,7 @@ Here's a typical dialog that a user might see when installing an extension: </p> -<img src="images/perms-hw1.png" width="410" height="193" alt="Permission warning: 'It can access: Your data on api.flickr.com'"> +<img src="images/perms-hw1.png" width="387" height="162" alt="Permission warning: 'This extension can access: Your data on api.flickr.com'"> <p> The warning about access to data on api.flickr.com @@ -415,7 +403,7 @@ Clicking the Re-enable button brings up the following warning: </p> -<img src="images/perms-hw2.png" width="412" height="220" alt="Permission warning: 'It can access: Your data on api.flickr.com and flickr.com; Your browsing history'"> +<img src="images/perms-hw2.png" width="387" height="190" alt="Permission warning: 'This extension can access: Your data on api.flickr.com and flickr.com; Your browsing history'"> <h2 id="warnings"> Warnings and their triggers </h2> @@ -426,7 +414,8 @@ results in the seemingly unrelated warning that the extension can access your browsing history. The reason for the warning is that although the <code>chrome.tabs</code> API -might be used only to open new tabs, +might be used only to open new tabs +(<a href="tabs.html#method-create"><code>chrome.tabs.create()</code></a>), it can also be used to see the URL that's associated with every newly opened tab (using their <a href="tabs.html#type-Tab">Tab</a> objects). @@ -436,14 +425,13 @@ with every newly opened tab <b>Note:</b> As of Google Chrome 7, you no longer need to specify the "tabs" permission -just to call <code>chrome.tabs.create()</code> -or <code>chrome.tabs.update()</code>. +just to call <code>chrome.tabs.create()</code>. </p> <p> The following table lists the warning messages that users can see, -along with the manifest entries +along with the <a href="manifest.html">manifest</a> entries that trigger them. </p> @@ -455,7 +443,7 @@ that trigger them. <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_FULL_ACCESS --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_FULL_ACCESS --> All data on your computer and the websites you visit </td> <td> @@ -469,7 +457,7 @@ that trigger them. <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_BOOKMARKS --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_BOOKMARKS --> Your bookmarks </td> <td> @@ -483,7 +471,7 @@ that trigger them. <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_BROWSING_HISTORY --> Your browsing history </td> <td> @@ -510,7 +498,7 @@ that trigger them. <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_ALL_HOSTS --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_ALL_HOSTS --> Your data on all websites </td> <td> @@ -543,8 +531,8 @@ that trigger them. </tr> <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_?_HOST --> - <!-- IDS_EXTENSION_PROMPT_WARNING_4_OR_MORE_HOSTS --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_?_HOST --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_4_OR_MORE_HOSTS --> Your data on <em>{list of websites}</em> </td> <td> @@ -577,29 +565,7 @@ that trigger them. <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_MANAGEMENT --> - Your list of installed apps, extensions, and themes - <br> - <span style="font-weight:normal; font-style:italic">or</span> - <br> - Manage themes, extensions, and apps - - <!-- PENDING: remove "Manage...apps" alternative message - once the fix is out on stable channel --> - <!-- See http://crbug.com/67859 --> - </td> - <td> - "management" permission - </td> - <td> - The "management" permission is required by the - <a href="management.html"><code>chrome.management</code></a> module. - </td> -</tr> - -<tr> - <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_GEOLOCATION --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_GEOLOCATION --> Your physical location </td> <td> @@ -825,7 +791,7 @@ by clicking the <b>chrome://extensions</b> page's <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/samples.html b/chrome/common/extensions/docs/samples.html index f57fa01..85ae945 100644 --- a/chrome/common/extensions/docs/samples.html +++ b/chrome/common/extensions/docs/samples.html @@ -303,7 +303,7 @@ <!-- STATIC CONTENT PLACEHOLDER --> <div id="static"><link rel="stylesheet" href="css/samples.css"> -<script>var search_data = {"0262260daf0c8f7b28feff2ef23b05e7abf9d1e0":"A BROWSER ACTION WHICH CHANGES ITS ICON WHEN CLICKED. BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETICON","ea2894c41cb8e80a4433a3e6c5772dadce9be90d":"A BROWSER ACTION WITH A POPUP THAT CHANGES THE PAGE COLOR. BROWSER_ACTION POPUP TABS CHROME.TABS.EXECUTESCRIPT","ede3c47b7757245be42ec33fd5ca63df4b490066":"A BROWSER ACTION WITH NO ICON THAT MAKES THE PAGE RED BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.TABS.EXECUTESCRIPT","fbf0aa1a09a15ff8cc4fc7de4fd176d6c663d07a":"ACCEPTLANGUAGE RETURNS ACCEPT LANGUAGES OF THE BROWSER BROWSER_ACTION POPUP CHROME.I18N.GETACCEPTLANGUAGES CHROME.I18N.GETMESSAGE","9a6e4ec46997fb92b324974afa08a3d007e2537f":"ANIMATED PAGE ACTION THIS EXTENSION ADDS AN ANIMATED BROWSER ACTION TO THE TOOLBAR. BACKGROUND_PAGE PAGE_ACTION TABS CHROME.PAGEACTION.HIDE CHROME.PAGEACTION.ONCLICKED CHROME.PAGEACTION.SETICON CHROME.PAGEACTION.SETTITLE CHROME.PAGEACTION.SHOW CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONSELECTIONCHANGED","9747e3d6a3eab39bc7c17f11a80573c62d44c7e5":"BLANK NEW TAB PAGE CHROME_URL_OVERRIDES","903e7277139e1e6caec123d3319cab295d8d1b3a":"CHROME SOUNDS ENJOY A MORE MAGICAL AND IMMERSIVE EXPERIENCE WHEN BROWSING THE WEB USING THE POWER OF SOUND. BACKGROUND_PAGE BOOKMARKS OPTIONS_PAGE TABS CHROME.BOOKMARKS.ONCREATED CHROME.BOOKMARKS.ONMOVED CHROME.BOOKMARKS.ONREMOVED CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.ONREQUEST CHROME.EXTENSION.SENDREQUEST CHROME.TABS.GET CHROME.TABS.ONATTACHED CHROME.TABS.ONCREATED CHROME.TABS.ONDETACHED CHROME.TABS.ONMOVED CHROME.TABS.ONREMOVED CHROME.TABS.ONSELECTIONCHANGED CHROME.TABS.ONUPDATED CHROME.WINDOWS.ONCREATED CHROME.WINDOWS.ONFOCUSCHANGED CHROME.WINDOWS.ONREMOVED","0e790e035a4a00b6f1def5ef9a7d7be1bce95ab5":"CHROMIUM BUILDBOT MONITOR DISPLAYS THE STATUS OF THE CHROMIUM BUILDBOT IN THE TOOLBAR. CLICK TO SEE MORE DETAILED STATUS IN A POPUP. BACKGROUND_PAGE BROWSER_ACTION NOTIFICATIONS OPTIONS_PAGE POPUP CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.BROWSERACTION.SETTITLE CHROME.EXTENSION.GETURL","ac31228200b41a87982e386cc90d3a6eee4ad885":"CHROMIUM SEARCH ADD SUPPORT TO THE OMNIBOX TO SEARCH THE CHROMIUM SOURCE CODE. BACKGROUND_PAGE TABS CHROME.OMNIBOX.ONINPUTCANCELLED CHROME.OMNIBOX.ONINPUTCHANGED CHROME.OMNIBOX.ONINPUTENTERED CHROME.OMNIBOX.ONINPUTSTARTED CHROME.OMNIBOX.SETDEFAULTSUGGESTION CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.UPDATE","7d5d6cf195bc25480256618e360aa38c6e6fba82":"CLD DISPLAYS THE LANGUAGE OF A TAB BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.SETBADGETEXT CHROME.TABS.DETECTLANGUAGE CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONSELECTIONCHANGED CHROME.TABS.ONUPDATED","5d81304a17cf7ac2887484f730fbd2b01e51e166":"CONTEXT MENUS SAMPLE SHOWS SOME OF THE FEATURES OF THE CONTEXT MENUS API BACKGROUND_PAGE CONTEXTMENUS CHROME.CONTEXTMENUS.CREATE","4daa6becd0899a54776d9cf7f09613ed1a9f4d77":"COOKIE API TEST EXTENSION TESTING COOKIE API BACKGROUND_PAGE BROWSER_ACTION COOKIES TABS CHROME.BROWSERACTION.ONCLICKED CHROME.COOKIES.GET CHROME.COOKIES.GETALL CHROME.COOKIES.ONCHANGED CHROME.COOKIES.REMOVE CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.UPDATE CHROME.WINDOWS.GET CHROME.WINDOWS.GETALL","6871d09f4a96bf9d4b6cc724d00e909cee0f3902":"CROSS-DOMAIN XMLHTTPREQUEST FROM A CONTENT SCRIPT DEMONSTRATES A METHOD TO MAKE A CROSS-DOMAIN XMLHTTPREQUEST FETCH FROM A CONTENT SCRIPT. THIS EXTENSION FETCHES THE CURRENT TRENDING TOPICS FROM TWITTER AND INSERTS THEM IN AN OVERLAY AT THE TOP OF GOOGLE NEWS. VISIT HTTP://NEWS.GOOGLE.COM TO TEST THIS EXTENSION. BACKGROUND_PAGE CHROME.EXTENSION.ONREQUEST CHROME.EXTENSION.SENDREQUEST","028eb5364924344029bcbe1d527f132fc72b34e5":"EMAIL THIS PAGE (BY GOOGLE) THIS EXTENSION ADDS AN EMAIL BUTTON TO THE TOOLBAR WHICH ALLOWS YOU TO EMAIL THE PAGE LINK USING YOUR DEFAULT MAIL CLIENT OR GMAIL. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE TABS CHROME.BROWSERACTION.ONCLICKED CHROME.EXTENSION.CONNECT CHROME.EXTENSION.ONCONNECT CHROME.TABS.CREATE CHROME.TABS.EXECUTESCRIPT CHROME.TABS.UPDATE","763a08e9b06595d785568a8d392b95a2f3700258":"EVENT TRACKING WITH GOOGLE ANALYTICS A SAMPLE EXTENSION WHICH USES GOOGLE ANALYTICS TO TRACK USAGE. BACKGROUND_PAGE BROWSER_ACTION POPUP","e3df888a89e35bdeb9c8bc8d03be5e1851b97c68":"EXTENSION DOCS SEARCH SEARCH THE CHROME EXTENSIONS DOCUMENTATION. TO USE, TYPE CRDOC PLUS A SEARCH TERM INTO THE OMNIBOX. BACKGROUND_PAGE TABS CHROME.OMNIBOX.ONINPUTCHANGED CHROME.OMNIBOX.ONINPUTENTERED CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.ONREMOVED CHROME.TABS.UPDATE","8b0dd31216235941bdd8eb33fda915ef5cf79a82":"GOOGLE CALENDAR CHECKER (BY GOOGLE) QUICKLY SEE THE TIME UNTIL YOUR NEXT MEETING FROM ANY OF YOUR CALENDARS. CLICK ON THE BUTTON TO BE TAKEN TO YOUR CALENDAR. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.BROWSERACTION.SETICON CHROME.BROWSERACTION.SETTITLE CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.ONREQUEST CHROME.EXTENSION.SENDREQUEST CHROME.I18N.GETMESSAGE CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETALLINWINDOW CHROME.TABS.ONUPDATED CHROME.TABS.UPDATE","4e35caa9742fb82dbd628892d23a781614f6eff6":"GOOGLE DOCUMENT LIST VIEWER DEMONSTRATES HOW TO USE OAUTH TO CONNECT THE GOOGLE DOCUMENTS LIST DATA API. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE POPUP TABS CHROME.BROWSERACTION.SETBADGETEXT CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONUPDATED CHROME.TABS.REMOVE","bb57f7a0132cbeb36ad7e7bb0ab75c21704234ca":"GOOGLE MAIL CHECKER DISPLAYS THE NUMBER OF UNREAD MESSAGES IN YOUR GOOGLE MAIL INBOX. YOU CAN ALSO CLICK THE BUTTON TO OPEN YOUR INBOX. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.BROWSERACTION.SETICON CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.I18N.GETMESSAGE CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETALLINWINDOW CHROME.TABS.ONUPDATED CHROME.TABS.UPDATE","1682e05ea9a1bde985123b04f6f8ac50a8a64033":"GOOGLE WAVE NOTIFIER FIND OUT WHEN YOU HAVE NEW WAVES AND PREVIEW THEM FAST. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE POPUP TABS CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONUPDATED CHROME.TABS.REMOVE","14b9651fda4e57b2a5914ba73a779812201b750a":"HELLO WORLD THE FIRST EXTENSION THAT I MADE. BROWSER_ACTION POPUP","2020d72f2577f53caf8e94e3dbac0fb849ceaa4d":"IDLE - SIMPLE EXAMPLE DEMONSTRATES THE IDLE API BACKGROUND_PAGE BROWSER_ACTION IDLE CHROME.BROWSERACTION.ONCLICKED CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.IDLE.ONSTATECHANGED CHROME.IDLE.QUERYSTATE","0ea1588bd07b20338fc21f725de1542a5fdf9726":"IGOOGLE NEW TAB PAGE CHROME_URL_OVERRIDES","646325c25f572a1d15edc73d057f821d847a4fbe":"IMAGEINFO GET IMAGE INFO FOR IMAGES, INCLUDING EXIF DATA BACKGROUND_PAGE CONTEXTMENUS TABS CHROME.CONTEXTMENUS.CREATE CHROME.TABS.GET CHROME.TABS.GETCURRENT CHROME.WINDOWS.CREATE CHROME.WINDOWS.UPDATE","ec97ec20ca2f095d081e39f1565fc12af09ef067":"MAPPY FINDS ADDRESSES IN THE WEB PAGE YOURE ON AND POPS UP A MAP WINDOW. BACKGROUND_PAGE PAGE_ACTION POPUP TABS CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.ONREQUEST CHROME.PAGEACTION.HIDE CHROME.PAGEACTION.SETTITLE CHROME.PAGEACTION.SHOW CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONSELECTIONCHANGED CHROME.TABS.ONUPDATED CHROME.TABS.SENDREQUEST","b2f5f8a790e16f091a7e4e0a39b2d0a6d32e3a6d":"MERGE WINDOWS MERGES ALL OF THE BROWSERS WINDOWS INTO THE CURRENT WINDOW BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.TABS.GET CHROME.TABS.GETALLINWINDOW CHROME.TABS.MOVE CHROME.WINDOWS.GET CHROME.WINDOWS.GETALL CHROME.WINDOWS.GETCURRENT","51a83d2ba3a32e3ff1bdb624d4e18ccec4c4038e":"MESSAGE TIMER TIMES HOW LONG IT TAKES TO SEND A MESSAGE TO A CONTENT SCRIPT AND BACK. BROWSER_ACTION POPUP TABS CHROME.EXTENSION.ONCONNECT CHROME.EXTENSION.ONREQUEST CHROME.TABS.CONNECT CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.SENDREQUEST","4f6785ec4f937add6728615682dd37c9a42d9548":"MY BOOKMARKS A BROWSER ACTION WITH A POPUP DUMP OF ALL BOOKMARKS, INCLUDING SEARCH, ADD, EDIT AND DELETE. BOOKMARKS BROWSER_ACTION POPUP TABS CHROME.BOOKMARKS.CREATE CHROME.BOOKMARKS.GET CHROME.BOOKMARKS.GETTREE CHROME.BOOKMARKS.REMOVE CHROME.BOOKMARKS.UPDATE CHROME.TABS.CREATE","597015d3bcce3da693b02314afd607bec4f55291":"NEWS READER DISPLAYS THE FIRST 5 ITEMS FROM THE GOOGLE NEWS - TOP NEWS RSS FEED IN A POPUP. BROWSER_ACTION POPUP TABS CHROME.TABS.CREATE","6444e5c8ae112a6a433909c5e770669cd16e2e5f":"NEWS READER DISPLAYS THE FIRST 5 ITEMS FROM THE GOOGLE NEWS - TOP NEWS RSS FEED IN A POPUP. BROWSER_ACTION POPUP TABS CHROME.I18N.GETMESSAGE CHROME.TABS.CREATE","3aea027164cb9b732ba4a8c51cb93708891726ef":"NEWS READER (BY GOOGLE) DISPLAYS THE LATEST STORIES FROM GOOGLE NEWS IN A POPUP. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE POPUP TABS CHROME.EXTENSION.GETURL CHROME.I18N.GETMESSAGE CHROME.TABS.CREATE","f799e26ceef2367cf836f24bcb47df4398b0df58":"NOTIFICATION DEMO SHOWS OFF DESKTOP NOTIFICATIONS, WHICH ARE TOAST WINDOWS THAT POP UP ON THE DESKTOP. BACKGROUND_PAGE NOTIFICATIONS OPTIONS_PAGE TABS CHROME.TABS.CREATE","e787b322bddbc6289bb31b7d7550b1bf6456a80b":"OMNIBOX EXAMPLE TO USE, TYPE OMNIX PLUS A SEARCH TERM INTO THE OMNIBOX. BACKGROUND_PAGE CHROME.OMNIBOX.ONINPUTCHANGED CHROME.OMNIBOX.ONINPUTENTERED","8d0a50b57c26bb498be592e871001ffed91541b4":"PAGE ACTION BY CONTENT SHOWS A PAGE ACTION FOR HTML PAGES CONTAINING THE WORD SANDWICH BACKGROUND_PAGE PAGE_ACTION CHROME.EXTENSION.ONREQUEST CHROME.EXTENSION.SENDREQUEST CHROME.PAGEACTION.SHOW","80b86ccc6e8520660fa591caa565826f0ed1b12c":"PAGE ACTION BY URL SHOWS A PAGE ACTION FOR URLS WHICH HAVE THE LETTER G IN THEM. BACKGROUND_PAGE PAGE_ACTION TABS CHROME.PAGEACTION.SHOW CHROME.TABS.ONUPDATED","d74c3c18a1c1dd18b035149105a306f837c8823e":"PAGE BENCHMARKER CHROMIUM PAGE BENCHMARKER. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.BROWSERACTION.SETTITLE CHROME.EXTENSION.CONNECT CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.GETEXTENSIONTABS CHROME.EXTENSION.GETURL CHROME.EXTENSION.ONCONNECT CHROME.TABS.CREATE CHROME.TABS.EXECUTESCRIPT CHROME.TABS.GET CHROME.TABS.GETALLINWINDOW CHROME.TABS.GETSELECTED CHROME.TABS.REMOVE CHROME.TABS.UPDATE CHROME.WINDOWS.GET CHROME.WINDOWS.GETCURRENT","e6ae17ab4ccfd7e059c8c01f25760ca5d894c7fd":"PRINT THIS PAGE ADDS A PRINT BUTTON TO THE BROWSER. BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.TABS.UPDATE","beff6ecd9677dea0a7c648c5042165b48bb66f09":"PROCESS MONITOR ADDS A BROWSER ACTION THAT MONITORS RESOURCE USAGE OF ALL BROWSER PROCESSES. BROWSER_ACTION EXPERIMENTAL POPUP TABS CHROME.EXPERIMENTAL.PROCESSES.ONUPDATED","56a8d2ac24ca7bba78fd88ad57f43fc13c784497":"SAMPLE - OAUTH CONTACTS USES OAUTH TO CONNECT TO GOOGLES CONTACTS SERVICE AND DISPLAY A LIST OF YOUR CONTACTS. BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETICON CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONUPDATED CHROME.TABS.REMOVE","38f6e1e17756ede38b1364c7114a738ca717dcbb":"SANDWICHBAR SHOWS AN INFOBAR ON PAGES WHICH CONTAIN THE WORD SANDWICH BACKGROUND_PAGE EXPERIMENTAL CHROME.EXPERIMENTAL.INFOBARS.SHOW CHROME.EXTENSION.ONREQUEST CHROME.EXTENSION.SENDREQUEST","fc89b35755483af30b66cd72cefa34a43a3e8312":"SHOW TABS IN PROCESS ADDS A BROWSER ACTION SHOWING WHICH TABS SHARE THE CURRENT TABS PROCESS. BROWSER_ACTION EXPERIMENTAL POPUP TABS CHROME.EXPERIMENTAL.PROCESSES.GETPROCESSIDFORTAB CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.UPDATE CHROME.WINDOWS.GET CHROME.WINDOWS.GETALL CHROME.WINDOWS.GETCURRENT CHROME.WINDOWS.UPDATE","230463f2d5c3d4d0ca13c230e1f00f2aae0a8a64":"TAB INSPECTOR UTILITY FOR WORKING WITH THE EXTENSION TABS API BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETALLINWINDOW CHROME.TABS.GETSELECTED CHROME.TABS.MOVE CHROME.TABS.ONATTACHED CHROME.TABS.ONCREATED CHROME.TABS.ONDETACHED CHROME.TABS.ONMOVED CHROME.TABS.ONREMOVED CHROME.TABS.ONSELECTIONCHANGED CHROME.TABS.ONUPDATED CHROME.TABS.REMOVE CHROME.TABS.UPDATE CHROME.WINDOWS.CREATE CHROME.WINDOWS.GET CHROME.WINDOWS.GETALL CHROME.WINDOWS.GETCURRENT CHROME.WINDOWS.GETLASTFOCUSED CHROME.WINDOWS.ONCREATED CHROME.WINDOWS.ONFOCUSCHANGED CHROME.WINDOWS.ONREMOVED CHROME.WINDOWS.REMOVE CHROME.WINDOWS.UPDATE","e1697cacebad05218798bf3e8a0f724517f0e8c3":"TEST SCREENSHOT EXTENSION DEMONSTRATE SCREENSHOT FUNCTIONALITY IN THE CHROME.TABS API. BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.EXTENSION.GETURL CHROME.EXTENSION.GETVIEWS CHROME.TABS.CAPTUREVISIBLETAB CHROME.TABS.CREATE CHROME.TABS.ONUPDATED","b3de91ab04b7d7a2670ca7ee9d740eb42cead0b6":"TYPED URL HISTORY READS YOUR HISTORY, AND SHOWS THE TOP TEN PAGES YOU GO TO BY TYPING THE URL. BROWSER_ACTION HISTORY TABS CHROME.HISTORY.GETVISITS CHROME.HISTORY.SEARCH CHROME.TABS.CREATE"}</script> +<script>var search_data = {"0262260daf0c8f7b28feff2ef23b05e7abf9d1e0":"A BROWSER ACTION WHICH CHANGES ITS ICON WHEN CLICKED. BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETICON","ea2894c41cb8e80a4433a3e6c5772dadce9be90d":"A BROWSER ACTION WITH A POPUP THAT CHANGES THE PAGE COLOR. BROWSER_ACTION POPUP TABS CHROME.TABS.EXECUTESCRIPT","ede3c47b7757245be42ec33fd5ca63df4b490066":"A BROWSER ACTION WITH NO ICON THAT MAKES THE PAGE RED BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.TABS.EXECUTESCRIPT","fbf0aa1a09a15ff8cc4fc7de4fd176d6c663d07a":"ACCEPTLANGUAGE RETURNS ACCEPT LANGUAGES OF THE BROWSER BROWSER_ACTION POPUP CHROME.I18N.GETACCEPTLANGUAGES CHROME.I18N.GETMESSAGE","9a6e4ec46997fb92b324974afa08a3d007e2537f":"ANIMATED PAGE ACTION THIS EXTENSION ADDS AN ANIMATED BROWSER ACTION TO THE TOOLBAR. BACKGROUND_PAGE PAGE_ACTION TABS CHROME.PAGEACTION.HIDE CHROME.PAGEACTION.ONCLICKED CHROME.PAGEACTION.SETICON CHROME.PAGEACTION.SETTITLE CHROME.PAGEACTION.SHOW CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONSELECTIONCHANGED","a1f7cf79dd555b04fa8d603247a040e644996293":"APP LAUNCHER BROWSER_ACTION MANAGEMENT CHROME.EXTENSION.GETURL CHROME.MANAGEMENT.GET CHROME.MANAGEMENT.GETALL CHROME.MANAGEMENT.LAUNCHAPP CHROME.TABS.CREATE","9747e3d6a3eab39bc7c17f11a80573c62d44c7e5":"BLANK NEW TAB PAGE CHROME_URL_OVERRIDES","903e7277139e1e6caec123d3319cab295d8d1b3a":"CHROME SOUNDS ENJOY A MORE MAGICAL AND IMMERSIVE EXPERIENCE WHEN BROWSING THE WEB USING THE POWER OF SOUND. BACKGROUND_PAGE BOOKMARKS OPTIONS_PAGE TABS CHROME.BOOKMARKS.ONCREATED CHROME.BOOKMARKS.ONMOVED CHROME.BOOKMARKS.ONREMOVED CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.ONREQUEST CHROME.EXTENSION.SENDREQUEST CHROME.TABS.GET CHROME.TABS.ONATTACHED CHROME.TABS.ONCREATED CHROME.TABS.ONDETACHED CHROME.TABS.ONMOVED CHROME.TABS.ONREMOVED CHROME.TABS.ONSELECTIONCHANGED CHROME.TABS.ONUPDATED CHROME.WINDOWS.ONCREATED CHROME.WINDOWS.ONFOCUSCHANGED CHROME.WINDOWS.ONREMOVED","0e790e035a4a00b6f1def5ef9a7d7be1bce95ab5":"CHROMIUM BUILDBOT MONITOR DISPLAYS THE STATUS OF THE CHROMIUM BUILDBOT IN THE TOOLBAR. CLICK TO SEE MORE DETAILED STATUS IN A POPUP. BACKGROUND_PAGE BROWSER_ACTION NOTIFICATIONS OPTIONS_PAGE POPUP CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.BROWSERACTION.SETTITLE CHROME.EXTENSION.GETURL","ac31228200b41a87982e386cc90d3a6eee4ad885":"CHROMIUM SEARCH ADD SUPPORT TO THE OMNIBOX TO SEARCH THE CHROMIUM SOURCE CODE. BACKGROUND_PAGE TABS CHROME.OMNIBOX.ONINPUTCANCELLED CHROME.OMNIBOX.ONINPUTCHANGED CHROME.OMNIBOX.ONINPUTENTERED CHROME.OMNIBOX.ONINPUTSTARTED CHROME.OMNIBOX.SETDEFAULTSUGGESTION CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.UPDATE","7d5d6cf195bc25480256618e360aa38c6e6fba82":"CLD DISPLAYS THE LANGUAGE OF A TAB BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.SETBADGETEXT CHROME.TABS.DETECTLANGUAGE CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONSELECTIONCHANGED CHROME.TABS.ONUPDATED","5d81304a17cf7ac2887484f730fbd2b01e51e166":"CONTEXT MENUS SAMPLE SHOWS SOME OF THE FEATURES OF THE CONTEXT MENUS API BACKGROUND_PAGE CONTEXTMENUS CHROME.CONTEXTMENUS.CREATE","4daa6becd0899a54776d9cf7f09613ed1a9f4d77":"COOKIE API TEST EXTENSION TESTING COOKIE API BACKGROUND_PAGE BROWSER_ACTION COOKIES TABS CHROME.BROWSERACTION.ONCLICKED CHROME.COOKIES.GET CHROME.COOKIES.GETALL CHROME.COOKIES.ONCHANGED CHROME.COOKIES.REMOVE CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.UPDATE CHROME.WINDOWS.GET CHROME.WINDOWS.GETALL","6871d09f4a96bf9d4b6cc724d00e909cee0f3902":"CROSS-DOMAIN XMLHTTPREQUEST FROM A CONTENT SCRIPT DEMONSTRATES A METHOD TO MAKE A CROSS-DOMAIN XMLHTTPREQUEST FETCH FROM A CONTENT SCRIPT. THIS EXTENSION FETCHES THE CURRENT TRENDING TOPICS FROM TWITTER AND INSERTS THEM IN AN OVERLAY AT THE TOP OF GOOGLE NEWS. VISIT HTTP://NEWS.GOOGLE.COM TO TEST THIS EXTENSION. BACKGROUND_PAGE CHROME.EXTENSION.ONREQUEST CHROME.EXTENSION.SENDREQUEST","028eb5364924344029bcbe1d527f132fc72b34e5":"EMAIL THIS PAGE (BY GOOGLE) THIS EXTENSION ADDS AN EMAIL BUTTON TO THE TOOLBAR WHICH ALLOWS YOU TO EMAIL THE PAGE LINK USING YOUR DEFAULT MAIL CLIENT OR GMAIL. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE TABS CHROME.BROWSERACTION.ONCLICKED CHROME.EXTENSION.CONNECT CHROME.EXTENSION.ONCONNECT CHROME.TABS.CREATE CHROME.TABS.EXECUTESCRIPT CHROME.TABS.UPDATE","763a08e9b06595d785568a8d392b95a2f3700258":"EVENT TRACKING WITH GOOGLE ANALYTICS A SAMPLE EXTENSION WHICH USES GOOGLE ANALYTICS TO TRACK USAGE. BACKGROUND_PAGE BROWSER_ACTION POPUP","e3df888a89e35bdeb9c8bc8d03be5e1851b97c68":"EXTENSION DOCS SEARCH SEARCH THE CHROME EXTENSIONS DOCUMENTATION. TO USE, TYPE CRDOC PLUS A SEARCH TERM INTO THE OMNIBOX. BACKGROUND_PAGE TABS CHROME.OMNIBOX.ONINPUTCHANGED CHROME.OMNIBOX.ONINPUTENTERED CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.ONREMOVED CHROME.TABS.UPDATE","8b0dd31216235941bdd8eb33fda915ef5cf79a82":"GOOGLE CALENDAR CHECKER (BY GOOGLE) QUICKLY SEE THE TIME UNTIL YOUR NEXT MEETING FROM ANY OF YOUR CALENDARS. CLICK ON THE BUTTON TO BE TAKEN TO YOUR CALENDAR. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.BROWSERACTION.SETICON CHROME.BROWSERACTION.SETTITLE CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.ONREQUEST CHROME.EXTENSION.SENDREQUEST CHROME.I18N.GETMESSAGE CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETALLINWINDOW CHROME.TABS.ONUPDATED CHROME.TABS.UPDATE","4e35caa9742fb82dbd628892d23a781614f6eff6":"GOOGLE DOCUMENT LIST VIEWER DEMONSTRATES HOW TO USE OAUTH TO CONNECT THE GOOGLE DOCUMENTS LIST DATA API. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE POPUP TABS CHROME.BROWSERACTION.SETBADGETEXT CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONUPDATED CHROME.TABS.REMOVE","bb57f7a0132cbeb36ad7e7bb0ab75c21704234ca":"GOOGLE MAIL CHECKER DISPLAYS THE NUMBER OF UNREAD MESSAGES IN YOUR GOOGLE MAIL INBOX. YOU CAN ALSO CLICK THE BUTTON TO OPEN YOUR INBOX. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.BROWSERACTION.SETICON CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.I18N.GETMESSAGE CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETALLINWINDOW CHROME.TABS.ONUPDATED CHROME.TABS.UPDATE","1682e05ea9a1bde985123b04f6f8ac50a8a64033":"GOOGLE WAVE NOTIFIER FIND OUT WHEN YOU HAVE NEW WAVES AND PREVIEW THEM FAST. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE POPUP TABS CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONUPDATED CHROME.TABS.REMOVE","14b9651fda4e57b2a5914ba73a779812201b750a":"HELLO WORLD THE FIRST EXTENSION THAT I MADE. BROWSER_ACTION POPUP","2020d72f2577f53caf8e94e3dbac0fb849ceaa4d":"IDLE - SIMPLE EXAMPLE DEMONSTRATES THE IDLE API BACKGROUND_PAGE BROWSER_ACTION IDLE CHROME.BROWSERACTION.ONCLICKED CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.IDLE.ONSTATECHANGED CHROME.IDLE.QUERYSTATE","0ea1588bd07b20338fc21f725de1542a5fdf9726":"IGOOGLE NEW TAB PAGE CHROME_URL_OVERRIDES","646325c25f572a1d15edc73d057f821d847a4fbe":"IMAGEINFO GET IMAGE INFO FOR IMAGES, INCLUDING EXIF DATA BACKGROUND_PAGE CONTEXTMENUS TABS CHROME.CONTEXTMENUS.CREATE CHROME.TABS.GET CHROME.TABS.GETCURRENT CHROME.WINDOWS.CREATE CHROME.WINDOWS.UPDATE","ec97ec20ca2f095d081e39f1565fc12af09ef067":"MAPPY FINDS ADDRESSES IN THE WEB PAGE YOURE ON AND POPS UP A MAP WINDOW. BACKGROUND_PAGE PAGE_ACTION POPUP TABS CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.ONREQUEST CHROME.PAGEACTION.HIDE CHROME.PAGEACTION.SETTITLE CHROME.PAGEACTION.SHOW CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONSELECTIONCHANGED CHROME.TABS.ONUPDATED CHROME.TABS.SENDREQUEST","b2f5f8a790e16f091a7e4e0a39b2d0a6d32e3a6d":"MERGE WINDOWS MERGES ALL OF THE BROWSERS WINDOWS INTO THE CURRENT WINDOW BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.TABS.GET CHROME.TABS.GETALLINWINDOW CHROME.TABS.MOVE CHROME.WINDOWS.GET CHROME.WINDOWS.GETALL CHROME.WINDOWS.GETCURRENT","51a83d2ba3a32e3ff1bdb624d4e18ccec4c4038e":"MESSAGE TIMER TIMES HOW LONG IT TAKES TO SEND A MESSAGE TO A CONTENT SCRIPT AND BACK. BROWSER_ACTION POPUP TABS CHROME.EXTENSION.ONCONNECT CHROME.EXTENSION.ONREQUEST CHROME.TABS.CONNECT CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.SENDREQUEST","4f6785ec4f937add6728615682dd37c9a42d9548":"MY BOOKMARKS A BROWSER ACTION WITH A POPUP DUMP OF ALL BOOKMARKS, INCLUDING SEARCH, ADD, EDIT AND DELETE. BOOKMARKS BROWSER_ACTION POPUP TABS CHROME.BOOKMARKS.CREATE CHROME.BOOKMARKS.GET CHROME.BOOKMARKS.GETTREE CHROME.BOOKMARKS.REMOVE CHROME.BOOKMARKS.UPDATE CHROME.TABS.CREATE","597015d3bcce3da693b02314afd607bec4f55291":"NEWS READER DISPLAYS THE FIRST 5 ITEMS FROM THE GOOGLE NEWS - TOP NEWS RSS FEED IN A POPUP. BROWSER_ACTION POPUP TABS CHROME.TABS.CREATE","6444e5c8ae112a6a433909c5e770669cd16e2e5f":"NEWS READER DISPLAYS THE FIRST 5 ITEMS FROM THE GOOGLE NEWS - TOP NEWS RSS FEED IN A POPUP. BROWSER_ACTION POPUP TABS CHROME.I18N.GETMESSAGE CHROME.TABS.CREATE","3aea027164cb9b732ba4a8c51cb93708891726ef":"NEWS READER (BY GOOGLE) DISPLAYS THE LATEST STORIES FROM GOOGLE NEWS IN A POPUP. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE POPUP TABS CHROME.EXTENSION.GETURL CHROME.I18N.GETMESSAGE CHROME.TABS.CREATE","f799e26ceef2367cf836f24bcb47df4398b0df58":"NOTIFICATION DEMO SHOWS OFF DESKTOP NOTIFICATIONS, WHICH ARE TOAST WINDOWS THAT POP UP ON THE DESKTOP. BACKGROUND_PAGE NOTIFICATIONS OPTIONS_PAGE TABS CHROME.TABS.CREATE","e787b322bddbc6289bb31b7d7550b1bf6456a80b":"OMNIBOX EXAMPLE TO USE, TYPE OMNIX PLUS A SEARCH TERM INTO THE OMNIBOX. BACKGROUND_PAGE CHROME.OMNIBOX.ONINPUTCHANGED CHROME.OMNIBOX.ONINPUTENTERED","8d0a50b57c26bb498be592e871001ffed91541b4":"PAGE ACTION BY CONTENT SHOWS A PAGE ACTION FOR HTML PAGES CONTAINING THE WORD SANDWICH BACKGROUND_PAGE PAGE_ACTION CHROME.EXTENSION.ONREQUEST CHROME.EXTENSION.SENDREQUEST CHROME.PAGEACTION.SHOW","80b86ccc6e8520660fa591caa565826f0ed1b12c":"PAGE ACTION BY URL SHOWS A PAGE ACTION FOR URLS WHICH HAVE THE LETTER G IN THEM. BACKGROUND_PAGE PAGE_ACTION TABS CHROME.PAGEACTION.SHOW CHROME.TABS.ONUPDATED","d74c3c18a1c1dd18b035149105a306f837c8823e":"PAGE BENCHMARKER CHROMIUM PAGE BENCHMARKER. BACKGROUND_PAGE BROWSER_ACTION OPTIONS_PAGE TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.BROWSERACTION.SETTITLE CHROME.EXTENSION.CONNECT CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.GETEXTENSIONTABS CHROME.EXTENSION.GETURL CHROME.EXTENSION.ONCONNECT CHROME.TABS.CREATE CHROME.TABS.EXECUTESCRIPT CHROME.TABS.GET CHROME.TABS.GETALLINWINDOW CHROME.TABS.GETSELECTED CHROME.TABS.REMOVE CHROME.TABS.UPDATE CHROME.WINDOWS.GET CHROME.WINDOWS.GETCURRENT","e6ae17ab4ccfd7e059c8c01f25760ca5d894c7fd":"PRINT THIS PAGE ADDS A PRINT BUTTON TO THE BROWSER. BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.TABS.UPDATE","beff6ecd9677dea0a7c648c5042165b48bb66f09":"PROCESS MONITOR ADDS A BROWSER ACTION THAT MONITORS RESOURCE USAGE OF ALL BROWSER PROCESSES. BROWSER_ACTION EXPERIMENTAL POPUP TABS CHROME.EXPERIMENTAL.PROCESSES.ONUPDATED","56a8d2ac24ca7bba78fd88ad57f43fc13c784497":"SAMPLE - OAUTH CONTACTS USES OAUTH TO CONNECT TO GOOGLES CONTACTS SERVICE AND DISPLAY A LIST OF YOUR CONTACTS. BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETICON CHROME.EXTENSION.GETBACKGROUNDPAGE CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONUPDATED CHROME.TABS.REMOVE","38f6e1e17756ede38b1364c7114a738ca717dcbb":"SANDWICHBAR SHOWS AN INFOBAR ON PAGES WHICH CONTAIN THE WORD SANDWICH BACKGROUND_PAGE EXPERIMENTAL CHROME.EXPERIMENTAL.INFOBARS.SHOW CHROME.EXTENSION.ONREQUEST CHROME.EXTENSION.SENDREQUEST","fc89b35755483af30b66cd72cefa34a43a3e8312":"SHOW TABS IN PROCESS ADDS A BROWSER ACTION SHOWING WHICH TABS SHARE THE CURRENT TABS PROCESS. BROWSER_ACTION EXPERIMENTAL POPUP TABS CHROME.EXPERIMENTAL.PROCESSES.GETPROCESSIDFORTAB CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.UPDATE CHROME.WINDOWS.GET CHROME.WINDOWS.GETALL CHROME.WINDOWS.GETCURRENT CHROME.WINDOWS.UPDATE","230463f2d5c3d4d0ca13c230e1f00f2aae0a8a64":"TAB INSPECTOR UTILITY FOR WORKING WITH THE EXTENSION TABS API BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.EXTENSION.GETURL CHROME.TABS.CREATE CHROME.TABS.GET CHROME.TABS.GETALLINWINDOW CHROME.TABS.GETSELECTED CHROME.TABS.MOVE CHROME.TABS.ONATTACHED CHROME.TABS.ONCREATED CHROME.TABS.ONDETACHED CHROME.TABS.ONMOVED CHROME.TABS.ONREMOVED CHROME.TABS.ONSELECTIONCHANGED CHROME.TABS.ONUPDATED CHROME.TABS.REMOVE CHROME.TABS.UPDATE CHROME.WINDOWS.CREATE CHROME.WINDOWS.GET CHROME.WINDOWS.GETALL CHROME.WINDOWS.GETCURRENT CHROME.WINDOWS.GETLASTFOCUSED CHROME.WINDOWS.ONCREATED CHROME.WINDOWS.ONFOCUSCHANGED CHROME.WINDOWS.ONREMOVED CHROME.WINDOWS.REMOVE CHROME.WINDOWS.UPDATE","e1697cacebad05218798bf3e8a0f724517f0e8c3":"TEST SCREENSHOT EXTENSION DEMONSTRATE SCREENSHOT FUNCTIONALITY IN THE CHROME.TABS API. BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.ONCLICKED CHROME.EXTENSION.GETURL CHROME.EXTENSION.GETVIEWS CHROME.TABS.CAPTUREVISIBLETAB CHROME.TABS.CREATE CHROME.TABS.ONUPDATED","b3de91ab04b7d7a2670ca7ee9d740eb42cead0b6":"TYPED URL HISTORY READS YOUR HISTORY, AND SHOWS THE TOP TEN PAGES YOU GO TO BY TYPING THE URL. BROWSER_ACTION HISTORY TABS CHROME.HISTORY.GETVISITS CHROME.HISTORY.SEARCH CHROME.TABS.CREATE"}</script> <script src="js/sample_search.js"></script> @@ -558,6 +558,51 @@ </ul> </div> <div><a href="examples/api/pageAction/set_icon.zip">Download .zip</a></div> +</div><div class="sample" id="a1f7cf79dd555b04fa8d603247a040e644996293"> + <img class="icon" style="display: none; "> + <img class="icon" src="images/sample-default-icon.png"> + <h2 class="name"> + <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/app_launcher/">App Launcher</a> + </h2> + <p class="metadata features">Uses + <span> + <strong>browser_action</strong><span style="display: none; ">, </span> + <span> and</span> + </span><span> + <strong>management</strong><span style="display: none; ">, </span> + <span style="display: none; "> and</span> + </span> + </p> + <p></p> + <div class="apicalls"><strong>Calls:</strong> + <ul> + <li> + <code><a href="extension.html#method-getURL">chrome.extension.getURL</a></code> + </li><li> + <code><a href="management.html#method-get">chrome.management.get</a></code> + </li><li> + <code><a href="management.html#method-getAll">chrome.management.getAll</a></code> + </li><li> + <code><a href="management.html#method-launchApp">chrome.management.launchApp</a></code> + </li><li> + <code><a href="tabs.html#method-create">chrome.tabs.create</a></code> + </li> + </ul> + </div> + <div class="sourcefiles"><strong>Source files:</strong> + <ul> + <li> + <code><a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/app_launcher/manifest.json?content-type=text/plain">manifest.json</a></code> + </li><li> + <code><a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.css?content-type=text/plain">popup.css</a></code> + </li><li> + <code><a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.html?content-type=text/plain">popup.html</a></code> + </li><li> + <code><a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.js?content-type=text/plain">popup.js</a></code> + </li> + </ul> + </div> + <div><a href="examples/extensions/app_launcher.zip">Download .zip</a></div> </div><div class="sample" id="9747e3d6a3eab39bc7c17f11a80573c62d44c7e5"> <img class="icon" style="display: none; "> <img class="icon" src="images/sample-default-icon.png"> @@ -2777,7 +2822,7 @@ <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/samples.json b/chrome/common/extensions/docs/samples.json index 89ffe2e..9e70b0c 100644 --- a/chrome/common/extensions/docs/samples.json +++ b/chrome/common/extensions/docs/samples.json @@ -279,6 +279,34 @@ "zip_path": "examples/api/pageAction/set_icon.zip" }, { + "api_calls": [ + "chrome.extension.getURL", + "chrome.management.get", + "chrome.management.getAll", + "chrome.management.launchApp", + "chrome.tabs.create" + ], + "description": "", + "features": [ + "browser_action", + "management" + ], + "icon": null, + "id": "a1f7cf79dd555b04fa8d603247a040e644996293", + "name": "App Launcher", + "path": "examples/extensions/app_launcher/", + "protocols": [], + "search_string": "APP LAUNCHER BROWSER_ACTION MANAGEMENT CHROME.EXTENSION.GETURL CHROME.MANAGEMENT.GET CHROME.MANAGEMENT.GETALL CHROME.MANAGEMENT.LAUNCHAPP CHROME.TABS.CREATE", + "source_files": [ + "manifest.json", + "popup.css", + "popup.html", + "popup.js" + ], + "source_hash": "4cb1348cfca9c990117d52290f93eb5fc5081bc2", + "zip_path": "examples/extensions/app_launcher.zip" + }, + { "api_calls": [], "description": "", "features": [ @@ -373,7 +401,7 @@ "options.html", "popup.html" ], - "source_hash": "bbd36a3d1d5580b477929d081f5a3a467ad32c63", + "source_hash": "a6ad5cd2a77ef54c0d96b4c5da014cfac34487db", "zip_path": "examples/extensions/buildbot.zip" }, { @@ -404,7 +432,7 @@ "background.html", "manifest.json" ], - "source_hash": "37dd43080094bbe459b0429f1a2b995c33bab7c3", + "source_hash": "027409688a677867e3f2fcbc530ceac904ccedea", "zip_path": "examples/extensions/chrome_search.zip" }, { @@ -913,7 +941,7 @@ "info.html", "manifest.json" ], - "source_hash": "672f49ed8edbe0829c7ba5a1d890b4440b157991", + "source_hash": "c746d9114348f4b414c1ec05e988e2807feb963a", "zip_path": "examples/extensions/imageinfo.zip" }, { @@ -1286,7 +1314,7 @@ "util/sorttable.js", "util/table2CSV.js" ], - "source_hash": "7b6fde63c8dd0e626d176e8ce34ad43649746436", + "source_hash": "7e592dbd3446353f7d98d1760f7cd773035aaaad", "zip_path": "examples/extensions/benchmark.zip" }, { diff --git a/chrome/common/extensions/docs/server/chromeextensionsdocs.py b/chrome/common/extensions/docs/server/chromeextensionsdocs.py index 9edf5cd..a3778f4 100644 --- a/chrome/common/extensions/docs/server/chromeextensionsdocs.py +++ b/chrome/common/extensions/docs/server/chromeextensionsdocs.py @@ -6,6 +6,7 @@ import cgi import logging import re +import os from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app @@ -43,10 +44,10 @@ DEFAULT_CACHE_TIME = 300 class MainPage(webapp.RequestHandler): # get page from memcache, or else fetch it from src def get(self): - path = self.request.path + path = os.path.realpath(os.path.join('/', self.request.path)) # special path to invoke the unit tests # TODO(nickbaum): is there a less ghetto way to invoke the unit test? - if path == "/test/": + if path == "/test": self.unitTest() return # if root, redirect to index.html diff --git a/chrome/common/extensions/docs/static/apps.html b/chrome/common/extensions/docs/static/apps.html index b4696bb..2cf3944 100644 --- a/chrome/common/extensions/docs/static/apps.html +++ b/chrome/common/extensions/docs/static/apps.html @@ -60,7 +60,7 @@ extensions and packaged apps, and packaged apps and hosted apps: <ul> <li> <a href="http://code.google.com/chrome/apps/articles/thinking_in_web_apps.html">Thinking in Web Apps</a> </li> - <li> <a href="http://codesite-staging:29006/chrome/webstore/articles/apps_vs_extensions.html">Extensions, Packaged Apps, and Hosted Apps in the Chrome Web Store</a> </li> + <li> <a href="http://code.google.com/chrome/webstore/articles/apps_vs_extensions.html">Extensions, Packaged Apps, and Hosted Apps in the Chrome Web Store</a> </li> </ul> diff --git a/chrome/common/extensions/docs/static/getstarted.html b/chrome/common/extensions/docs/static/getstarted.html index f1ec273..1121b58 100644 --- a/chrome/common/extensions/docs/static/getstarted.html +++ b/chrome/common/extensions/docs/static/getstarted.html @@ -65,6 +65,7 @@ to the toolbar of Google Chrome. <img src="images/toolsmenu.gif" width="29" height="29" alt="" style="margin-top:0" /> and choosing <b>Tools > Extensions</b>. + (On Mac, use <b>Window > Extensions</b>.) </li> <li> diff --git a/chrome/common/extensions/docs/static/manifest.html b/chrome/common/extensions/docs/static/manifest.html index 3f2f34e..aed4953 100644 --- a/chrome/common/extensions/docs/static/manifest.html +++ b/chrome/common/extensions/docs/static/manifest.html @@ -111,9 +111,8 @@ see <a href="i18n.html">Internationalization</a> for details. The URL of the homepage for this extension. The extensions management page (chrome://extensions) will contain a link to this URL. This field is particularly useful if you <a href="hosting.html">host the extension on your own site</a>. If you distribute your -extension using the <a href="https://chrome.google.com/extensions">Extensions Gallery</a>, -the homepage URL defaults to the extension's own gallery page. -<!-- PENDING: check whether the same is true of the store --> +extension using the <a href="https://chrome.google.com/extensions">Extensions Gallery</a> or <a href="https://chrome.google.com/webstore">Chrome Web Store</a>, +the homepage URL defaults to the extension's own page. </p> <h3 id="icons">icons</h3> diff --git a/chrome/common/extensions/docs/static/pageAction.html b/chrome/common/extensions/docs/static/pageAction.html index 60933ff..3def87e 100644 --- a/chrome/common/extensions/docs/static/pageAction.html +++ b/chrome/common/extensions/docs/static/pageAction.html @@ -95,6 +95,15 @@ follow these guidelines:</p> for features that make sense for most pages. Use <a href="browserAction.html">browser actions</a> instead. + <li><b>Do</b> use icons + that are slightly lighter weight + than <a href="browserAction.html#icon">browser action icons</a>. + Most icons that Chrome displays + in the location bar + are smaller than 19 pixels. + If the edge pixels are used, + they are usually only used + for a faint shadow. <li><b>Don't</b> constantly animate your icon. That's just annoying. </ul> diff --git a/chrome/common/extensions/docs/static/permission_warnings.html b/chrome/common/extensions/docs/static/permission_warnings.html index 4671f58..eea6558 100644 --- a/chrome/common/extensions/docs/static/permission_warnings.html +++ b/chrome/common/extensions/docs/static/permission_warnings.html @@ -1,21 +1,9 @@ <div id="pageData-name" class="pageData">Permission Warnings</div> <div id="pageData-showTOC" class="pageData">true</div> -<!-- -NOTE: When this doc is updated, the online help should also be updated: -http://www.google.com/support/chrome/bin/answer.py?hl=en&answer=186213 - -We should periodically look at -http://src.chromium.org/viewvc/chrome/trunk/src/chrome/app/generated_resources.grd?view=markup -to make sure that we're covering all messages. Search for -IDS_EXTENSION_PROMPT_WARNING -(e.g. IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY). ---> - <p> To use most chrome.* APIs and extension capabilities, -your extension must declare its intent in the -<a href="manifest.html">manifest</a>, +your extension must declare its intent in the manifest, often in the "permissions" field. Some of these declarations result in a warning when @@ -40,8 +28,8 @@ that a user might see when installing an extension: </p> <img src="images/perms-hw1.png" - width="410" height="193" - alt="Permission warning: 'It can access: Your data on api.flickr.com'" + width="387" height="162" + alt="Permission warning: 'This extension can access: Your data on api.flickr.com'" /> <p> @@ -99,8 +87,8 @@ brings up the following warning: </p> <img src="images/perms-hw2.png" - width="412" height="220" - alt="Permission warning: 'It can access: Your data on api.flickr.com and flickr.com; Your browsing history'" + width="387" height="190" + alt="Permission warning: 'This extension can access: Your data on api.flickr.com and flickr.com; Your browsing history'" /> @@ -112,7 +100,8 @@ results in the seemingly unrelated warning that the extension can access your browsing history. The reason for the warning is that although the <code>chrome.tabs</code> API -might be used only to open new tabs, +might be used only to open new tabs +(<a href="tabs.html#method-create"><code>chrome.tabs.create()</code></a>), it can also be used to see the URL that's associated with every newly opened tab (using their <a href="tabs.html#type-Tab">Tab</a> objects). @@ -122,14 +111,13 @@ with every newly opened tab <b>Note:</b> As of Google Chrome 7, you no longer need to specify the "tabs" permission -just to call <code>chrome.tabs.create()</code> -or <code>chrome.tabs.update()</code>. +just to call <code>chrome.tabs.create()</code>. </p> <p> The following table lists the warning messages that users can see, -along with the manifest entries +along with the <a href="manifest.html">manifest</a> entries that trigger them. </p> @@ -141,7 +129,7 @@ that trigger them. <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_FULL_ACCESS --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_FULL_ACCESS --> All data on your computer and the websites you visit </td> <td> @@ -155,7 +143,7 @@ that trigger them. <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_BOOKMARKS --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_BOOKMARKS --> Your bookmarks </td> <td> @@ -169,7 +157,7 @@ that trigger them. <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_BROWSING_HISTORY --> Your browsing history </td> <td> @@ -196,7 +184,7 @@ that trigger them. <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_ALL_HOSTS --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_ALL_HOSTS --> Your data on all websites </td> <td> @@ -229,8 +217,8 @@ that trigger them. </tr> <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_?_HOST --> - <!-- IDS_EXTENSION_PROMPT_WARNING_4_OR_MORE_HOSTS --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_?_HOST --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_4_OR_MORE_HOSTS --> Your data on <em>{list of websites}</em> </td> <td> @@ -263,29 +251,7 @@ that trigger them. <tr> <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_MANAGEMENT --> - Your list of installed apps, extensions, and themes - <br /> - <span style="font-weight:normal; font-style:italic">or</span> - <br /> - Manage themes, extensions, and apps - - <!-- PENDING: remove "Manage...apps" alternative message - once the fix is out on stable channel --> - <!-- See http://crbug.com/67859 --> - </td> - <td> - "management" permission - </td> - <td> - The "management" permission is required by the - <a href="management.html"><code>chrome.management</code></a> module. - </td> -</tr> - -<tr> - <td style="font-weight:bold"> - <!-- IDS_EXTENSION_PROMPT_WARNING_GEOLOCATION --> + <!-- IDS_EXTENSION_PROMPT2_WARNING_GEOLOCATION --> Your physical location </td> <td> diff --git a/chrome/common/extensions/docs/static/themes.html b/chrome/common/extensions/docs/static/themes.html index 651a74d..0d04779 100644 --- a/chrome/common/extensions/docs/static/themes.html +++ b/chrome/common/extensions/docs/static/themes.html @@ -66,7 +66,7 @@ file for a theme: Colors are in RGB format. To find the strings you can use within the "colors" field, look for kColor* strings in -<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/themes/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. +<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. </p> <h3 id="images">images</h3> @@ -75,7 +75,7 @@ look for kColor* strings in Image resources use paths relative to the root of the extension. You can override any of the images that are specified by <code>kThemeableImages</code> in -<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/themes/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. +<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. Just remove the "IDR_" and convert the remaining characters to lowercase. For example, <code>IDR_THEME_NTP_BACKGROUND</code> @@ -92,7 +92,7 @@ properties such as background alignment, background repeat, and an alternate logo. To see the properties and the values they can have, see -<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/themes/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. +<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. <!-- [PENDING: We should flesh this out.] --> </p> @@ -106,7 +106,7 @@ because images don't work across platforms and are brittle in the case of adding new buttons. To find the strings you can use within the "tints" field, look for kTint* strings in -<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/themes/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. +<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. </p> <p> diff --git a/chrome/common/extensions/docs/static/tut_debugging.html b/chrome/common/extensions/docs/static/tut_debugging.html index 7713e90..20d46c5 100644 --- a/chrome/common/extensions/docs/static/tut_debugging.html +++ b/chrome/common/extensions/docs/static/tut_debugging.html @@ -38,7 +38,7 @@ in the Extensions page. find the extension files and load them. If you don't have a handy copy of the files, extract them from this - <a href="examples/tutorials/getstarted.zip">ZIP file</a>. + <a href="examples/tutorials/getstarted/getstarted.zip">ZIP file</a>. See Getting Started if you need <a href="getstarted.html#load-ext">instructions for loading the extension</a>. diff --git a/chrome/common/extensions/docs/tabs.html b/chrome/common/extensions/docs/tabs.html index 27b26be..cf7d2f6 100644 --- a/chrome/common/extensions/docs/tabs.html +++ b/chrome/common/extensions/docs/tabs.html @@ -7373,7 +7373,7 @@ For other examples and for help in viewing the source code, see <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/template/api_template.html b/chrome/common/extensions/docs/template/api_template.html index 1b47011..b495e8d 100644 --- a/chrome/common/extensions/docs/template/api_template.html +++ b/chrome/common/extensions/docs/template/api_template.html @@ -471,7 +471,7 @@ <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/themes.html b/chrome/common/extensions/docs/themes.html index 57c8063..b488a9d 100644 --- a/chrome/common/extensions/docs/themes.html +++ b/chrome/common/extensions/docs/themes.html @@ -379,7 +379,7 @@ file for a theme: Colors are in RGB format. To find the strings you can use within the "colors" field, look for kColor* strings in -<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/themes/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. +<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. </p> <h3 id="images">images</h3> @@ -388,7 +388,7 @@ look for kColor* strings in Image resources use paths relative to the root of the extension. You can override any of the images that are specified by <code>kThemeableImages</code> in -<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/themes/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. +<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. Just remove the "IDR_" and convert the remaining characters to lowercase. For example, <code>IDR_THEME_NTP_BACKGROUND</code> @@ -405,7 +405,7 @@ properties such as background alignment, background repeat, and an alternate logo. To see the properties and the values they can have, see -<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/themes/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. +<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. <!-- [PENDING: We should flesh this out.] --> </p> @@ -419,7 +419,7 @@ because images don't work across platforms and are brittle in the case of adding new buttons. To find the strings you can use within the "tints" field, look for kTint* strings in -<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/themes/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. +<a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/browser_theme_provider.cc"><code>browser_theme_provider.cc</code></a>. </p> <p> @@ -627,7 +627,7 @@ Community-written documentation to help you write themes is here: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/tut_analytics.html b/chrome/common/extensions/docs/tut_analytics.html index 4c695ff..d6a070f 100644 --- a/chrome/common/extensions/docs/tut_analytics.html +++ b/chrome/common/extensions/docs/tut_analytics.html @@ -695,7 +695,7 @@ extension.</p> <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/tut_debugging.html b/chrome/common/extensions/docs/tut_debugging.html index 821c8e9..64a4ae1 100644 --- a/chrome/common/extensions/docs/tut_debugging.html +++ b/chrome/common/extensions/docs/tut_debugging.html @@ -368,7 +368,7 @@ in the Extensions page. find the extension files and load them. If you don't have a handy copy of the files, extract them from this - <a href="examples/tutorials/getstarted.zip">ZIP file</a>. + <a href="examples/tutorials/getstarted/getstarted.zip">ZIP file</a>. See Getting Started if you need <a href="getstarted.html#load-ext">instructions for loading the extension</a>. @@ -743,7 +743,7 @@ of Getting Started. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/tut_oauth.html b/chrome/common/extensions/docs/tut_oauth.html index 1d21c96..1783eda 100644 --- a/chrome/common/extensions/docs/tut_oauth.html +++ b/chrome/common/extensions/docs/tut_oauth.html @@ -685,7 +685,7 @@ Sample extensions that use these techniques are available in the Chromium source <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/tutorials.html b/chrome/common/extensions/docs/tutorials.html index 8657aed..b88a9cf 100644 --- a/chrome/common/extensions/docs/tutorials.html +++ b/chrome/common/extensions/docs/tutorials.html @@ -498,7 +498,7 @@ more specialized topics: <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/whats_new.html b/chrome/common/extensions/docs/whats_new.html index 9e2b8ed..79d6835 100644 --- a/chrome/common/extensions/docs/whats_new.html +++ b/chrome/common/extensions/docs/whats_new.html @@ -610,7 +610,7 @@ No API or manifest changes worth noting. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/windows.html b/chrome/common/extensions/docs/windows.html index ad163a2..1332caf 100644 --- a/chrome/common/extensions/docs/windows.html +++ b/chrome/common/extensions/docs/windows.html @@ -616,6 +616,64 @@ For other examples and for help in viewing the source code, see </div><div> <div> <dt> + <var>tabId</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional">optional</span> + <span class="enum" style="display: none; ">enumerated</span> + <span id="typeTemplate"> + <span style="display: none; "> + <a> Type</a> + </span> + <span> + <span style="display: none; "> + array of <span><span></span></span> + </span> + <span>integer</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The id of the tab for which you want to adopt to the new window.</dd> + <dd style="display: none; "> + This parameter was added in version + <b><span></span></b>. + You must omit this parameter in earlier versions, + and you may omit it in any version. If you require this + parameter, the manifest key + <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> + can ensure that your extension won't be run in an earlier browser version. + </dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + + <!-- FUNCTION PARAMETERS --> + <dd style="display: none; "> + <div></div> + </dd> + + </div> + </div><div> + <div> + <dt> <var>left</var> <em> @@ -3668,7 +3726,7 @@ For other examples and for help in viewing the source code, see <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/docs/xhr.html b/chrome/common/extensions/docs/xhr.html index 4710c3e..b76acc5 100644 --- a/chrome/common/extensions/docs/xhr.html +++ b/chrome/common/extensions/docs/xhr.html @@ -628,7 +628,7 @@ prefer HTTPS whenever possible. <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. </p> <p> - ©2011 Google + ©2010 Google </p> <!-- begin analytics --> diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index c49399a..bdbb33a 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -31,7 +31,6 @@ #include "chrome/common/extensions/extension_l10n_util.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/user_script.h" -#include "chrome/common/notification_service.h" #include "chrome/common/url_constants.h" #include "googleurl/src/url_util.h" #include "grit/chromium_strings.h" @@ -133,7 +132,7 @@ const size_t kNumNonPermissionFunctionNames = // A singleton object containing global data needed by the extension objects. class ExtensionConfig { public: - static ExtensionConfig* GetSingleton() { + static ExtensionConfig* GetInstance() { return Singleton<ExtensionConfig>::get(); } @@ -288,7 +287,7 @@ GURL Extension::GalleryUpdateUrl(bool secure) { // static int Extension::GetPermissionMessageId(const std::string& permission) { - return ExtensionConfig::GetSingleton()->GetPermissionMessageId(permission); + return ExtensionConfig::GetInstance()->GetPermissionMessageId(permission); } std::vector<string16> Extension::GetPermissionMessages() const { @@ -470,7 +469,7 @@ std::string Extension::GenerateIdForPath(const FilePath& path) { return id; } -Extension::HistogramType Extension::GetHistogramType() const { +Extension::Type Extension::GetType() const { if (is_theme()) return TYPE_THEME; if (converted_from_user_script()) @@ -1267,8 +1266,7 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, *error = errors::kInvalidVersion; return false; } - version_.reset( - Version::GetVersionFromString(version_str)); + version_.reset(Version::GetVersionFromString(version_str)); if (!version_.get() || version_->components().size() > 4) { *error = errors::kInvalidVersion; @@ -1742,6 +1740,15 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, if (web_extent().is_empty() || location() == Extension::COMPONENT) { // Check if it's a module permission. If so, enable that permission. if (IsAPIPermission(permission_str)) { + // Only allow the experimental API permission if the command line + // flag is present, or if the extension is a component of Chrome. + if (permission_str == Extension::kExperimentalPermission && + !CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableExperimentalExtensionApis) && + location() != Extension::COMPONENT) { + *error = errors::kExperimentalFlagRequired; + return false; + } api_permissions_.insert(permission_str); continue; } @@ -1781,9 +1788,8 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, } if (source.HasKey(keys::kDefaultLocale)) { - if (!source.GetString(keys::kDefaultLocale, - &default_locale_) || - default_locale_.empty()) { + if (!source.GetString(keys::kDefaultLocale, &default_locale_) || + !l10n_util::IsValidLocaleSyntax(default_locale_)) { *error = errors::kInvalidDefaultLocale; return false; } @@ -1846,6 +1852,59 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, devtools_url_ = GetResourceURL(devtools_str); } + // Initialize text-to-speech voices (optional). + if (source.HasKey(keys::kTts)) { + DictionaryValue* tts_dict; + if (!source.GetDictionary(keys::kTts, &tts_dict)) { + *error = errors::kInvalidTts; + return false; + } + + if (tts_dict->HasKey(keys::kTtsVoices)) { + ListValue* tts_voices; + if (!tts_dict->GetList(keys::kTtsVoices, &tts_voices)) { + *error = errors::kInvalidTtsVoices; + return false; + } + + for (size_t i = 0; i < tts_voices->GetSize(); i++) { + DictionaryValue* one_tts_voice; + if (!tts_voices->GetDictionary(i, &one_tts_voice)) { + *error = errors::kInvalidTtsVoices; + return false; + } + + TtsVoice voice_data; + if (one_tts_voice->HasKey(keys::kTtsVoicesVoiceName)) { + if (!one_tts_voice->GetString( + keys::kTtsVoicesVoiceName, &voice_data.voice_name)) { + *error = errors::kInvalidTtsVoicesVoiceName; + return false; + } + } + if (one_tts_voice->HasKey(keys::kTtsVoicesLocale)) { + if (!one_tts_voice->GetString( + keys::kTtsVoicesLocale, &voice_data.locale) || + !l10n_util::IsValidLocaleSyntax(voice_data.locale)) { + *error = errors::kInvalidTtsVoicesLocale; + return false; + } + } + if (one_tts_voice->HasKey(keys::kTtsVoicesGender)) { + if (!one_tts_voice->GetString( + keys::kTtsVoicesGender, &voice_data.gender) || + (voice_data.gender != keys::kTtsGenderMale && + voice_data.gender != keys::kTtsGenderFemale)) { + *error = errors::kInvalidTtsVoicesGender; + return false; + } + } + + tts_voices_.push_back(voice_data); + } + } + } + // Initialize incognito behavior. Apps default to split mode, extensions // default to spanning. incognito_split_mode_ = is_app(); @@ -1966,7 +2025,7 @@ static std::string SizeToString(const gfx::Size& max_size) { void Extension::SetScriptingWhitelist( const std::vector<std::string>& whitelist) { ScriptingWhitelist* current_whitelist = - ExtensionConfig::GetSingleton()->whitelist(); + ExtensionConfig::GetInstance()->whitelist(); current_whitelist->clear(); for (ScriptingWhitelist::const_iterator it = whitelist.begin(); it != whitelist.end(); ++it) { @@ -2201,20 +2260,7 @@ bool Extension::HasFullPermissions() const { bool Extension::IsAPIPermission(const std::string& str) const { for (size_t i = 0; i < Extension::kNumPermissions; ++i) { if (str == Extension::kPermissions[i].name) { - // Only allow the experimental API permission if the command line - // flag is present, or if the extension is a component of Chrome. - if (str == Extension::kExperimentalPermission) { - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableExperimentalExtensionApis)) { - return true; - } else if (location() == Extension::COMPONENT) { - return true; - } else { - return false; - } - } else { - return true; - } + return true; } } return false; @@ -2225,7 +2271,7 @@ bool Extension::CanExecuteScriptEverywhere() const { return true; ScriptingWhitelist* whitelist = - ExtensionConfig::GetSingleton()->whitelist(); + ExtensionConfig::GetInstance()->whitelist(); for (ScriptingWhitelist::const_iterator it = whitelist->begin(); it != whitelist->end(); ++it) { @@ -2260,9 +2306,15 @@ UninstalledExtensionInfo::UninstalledExtensionInfo( const Extension& extension) : extension_id(extension.id()), extension_api_permissions(extension.api_permissions()), - is_theme(extension.is_theme()), - is_app(extension.is_app()), - converted_from_user_script(extension.converted_from_user_script()), + extension_type(extension.GetType()), update_url(extension.update_url()) {} UninstalledExtensionInfo::~UninstalledExtensionInfo() {} + + +UnloadedExtensionInfo::UnloadedExtensionInfo( + const Extension* extension, + Reason reason) + : reason(reason), + already_disabled(false), + extension(extension) {} diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index 0d171d8..4c82fd6 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -83,9 +83,9 @@ class Extension : public base::RefCountedThreadSafe<Extension> { EXTENSION_ICON_BITTY = 16, }; - // Type used for UMA_HISTOGRAM_ENUMERATION about extensions. - // Do not change the order of entries or remove entries in this list. - enum HistogramType { + // Do not change the order of entries or remove entries in this list + // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions. + enum Type { TYPE_UNKNOWN = 0, TYPE_EXTENSION, TYPE_THEME, @@ -100,6 +100,12 @@ class Extension : public base::RefCountedThreadSafe<Extension> { bool is_public; // False if only this extension can load this plugin. }; + struct TtsVoice { + std::string voice_name; + std::string locale; + std::string gender; + }; + // A permission is defined by its |name| (what is used in the manifest), // and the |message_id| that's used by install/update UI. struct Permission { @@ -227,8 +233,8 @@ class Extension : public base::RefCountedThreadSafe<Extension> { IsExternalLocation(location); } - // See HistogramType definition above. - HistogramType GetHistogramType() const; + // See Type definition above. + Type GetType() const; // Returns an absolute url to a resource inside of an extension. The // |extension_url| argument should be the url() from an Extension object. The @@ -296,8 +302,8 @@ class Extension : public base::RefCountedThreadSafe<Extension> { // Returns the url prefix for the extension/apps gallery. Can be set via the // --apps-gallery-url switch. The URL returned will not contain a trailing // slash. Do not use this as a prefix/extent for the store. Instead see - // ExtensionsService::GetWebStoreApp or - // ExtensionsService::IsDownloadFromGallery + // ExtensionService::GetWebStoreApp or + // ExtensionService::IsDownloadFromGallery static std::string ChromeStoreLaunchURL(); // Helper function that consolidates the check for whether the script can @@ -428,6 +434,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> { } const std::string omnibox_keyword() const { return omnibox_keyword_; } bool incognito_split_mode() const { return incognito_split_mode_; } + const std::vector<TtsVoice>& tts_voices() const { return tts_voices_; } // App-related. bool is_app() const { return is_app_; } @@ -691,7 +698,10 @@ class Extension : public base::RefCountedThreadSafe<Extension> { // The Omnibox keyword for this extension, or empty if there is none. std::string omnibox_keyword_; - FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, + // List of text-to-speech voices that this extension provides, if any. + std::vector<TtsVoice> tts_voices_; + + FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, UpdateExtensionPreservesLocation); FRIEND_TEST_ALL_PREFIXES(ExtensionTest, LoadPageActionHelper); FRIEND_TEST_ALL_PREFIXES(ExtensionTest, InitFromValueInvalid); @@ -730,12 +740,26 @@ struct UninstalledExtensionInfo { std::string extension_id; std::set<std::string> extension_api_permissions; - // TODO(akalin): Once we have a unified ExtensionType, replace the - // below member variables with a member of that type. - bool is_theme; - bool is_app; - bool converted_from_user_script; + Extension::Type extension_type; GURL update_url; }; +struct UnloadedExtensionInfo { + enum Reason { + DISABLE, // The extension is being disabled. + UPDATE, // The extension is being updated to a newer version. + UNINSTALL, // The extension is being uninstalled. + }; + + Reason reason; + + // Was the extension already disabled? + bool already_disabled; + + // The extension being unloaded - this should always be non-NULL. + const Extension* extension; + + UnloadedExtensionInfo(const Extension* extension, Reason reason); +}; + #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc index 2e99e2b..dd15afa 100644 --- a/chrome/common/extensions/extension_constants.cc +++ b/chrome/common/extensions/extension_constants.cc @@ -60,6 +60,13 @@ const char* kThemeImages = "images"; const char* kThemeTints = "tints"; const char* kToolstripPath = "path"; const char* kToolstrips = "toolstrips"; +const char* kTts = "tts"; +const char* kTtsGenderFemale = "female"; +const char* kTtsGenderMale = "male"; +const char* kTtsVoices = "voices"; +const char* kTtsVoicesGender = "gender"; +const char* kTtsVoicesLocale = "locale"; +const char* kTtsVoicesVoiceName = "voiceName"; const char* kType = "type"; const char* kUpdateURL = "update_url"; const char* kVersion = "version"; @@ -98,6 +105,9 @@ const char* kDisabledByPolicy = const char* kDevToolsExperimental = "You must request the 'experimental' permission in order to use the" " DevTools API."; +const char* kExperimentalFlagRequired = + "Loading extensions with 'experimental' permission requires" + " --enable-experimental-extension-apis command line flag."; const char* kHostedAppsCannotIncludeExtensionFeatures = "Hosted apps cannot use extension features."; const char* kInvalidAllFrames = @@ -231,6 +241,16 @@ const char* kInvalidToolstrip = "Invalid value for 'toolstrips[*]'"; const char* kInvalidToolstrips = "Invalid value for 'toolstrips'."; +const char* kInvalidTts = + "Invalid value for 'tts'."; +const char* kInvalidTtsVoices = + "Invalid value for 'tts.voices'."; +const char* kInvalidTtsVoicesGender = + "Invalid value for 'tts.voices[*].gender'."; +const char* kInvalidTtsVoicesLocale = + "Invalid value for 'tts.voices[*].locale'."; +const char* kInvalidTtsVoicesVoiceName = + "Invalid value for 'tts.voices[*].voiceName'."; const char* kInvalidUpdateURL = "Invalid value for update url: '[*]'."; const char* kInvalidVersion = diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h index cf09515..7f09630 100644 --- a/chrome/common/extensions/extension_constants.h +++ b/chrome/common/extensions/extension_constants.h @@ -65,6 +65,13 @@ namespace extension_manifest_keys { extern const char* kThemeTints; extern const char* kToolstripPath; extern const char* kToolstrips; + extern const char* kTts; + extern const char* kTtsGenderFemale; + extern const char* kTtsGenderMale; + extern const char* kTtsVoices; + extern const char* kTtsVoicesGender; + extern const char* kTtsVoicesLocale; + extern const char* kTtsVoicesVoiceName; extern const char* kType; extern const char* kUpdateURL; extern const char* kVersion; @@ -92,6 +99,8 @@ namespace extension_manifest_errors { extern const char* kCannotScriptGallery; extern const char* kChromeVersionTooLow; extern const char* kDevToolsExperimental; + extern const char* kDisabledByPolicy; + extern const char* kExperimentalFlagRequired; extern const char* kHostedAppsCannotIncludeExtensionFeatures; extern const char* kInvalidAllFrames; extern const char* kInvalidBackground; @@ -105,7 +114,6 @@ namespace extension_manifest_errors { extern const char* kInvalidCssList; extern const char* kInvalidDefaultLocale; extern const char* kInvalidDescription; - extern const char* kDisabledByPolicy; extern const char* kInvalidDevToolsPage; extern const char* kInvalidGlob; extern const char* kInvalidGlobList; @@ -160,6 +168,11 @@ namespace extension_manifest_errors { extern const char* kInvalidThemeTints; extern const char* kInvalidToolstrip; extern const char* kInvalidToolstrips; + extern const char* kInvalidTts; + extern const char* kInvalidTtsVoices; + extern const char* kInvalidTtsVoicesGender; + extern const char* kInvalidTtsVoicesLocale; + extern const char* kInvalidTtsVoicesVoiceName; extern const char* kInvalidUpdateURL; extern const char* kInvalidVersion; extern const char* kInvalidWebURL; @@ -243,8 +256,7 @@ namespace extension_misc { PROMO_LAUNCH_WEB_STORE, PROMO_CLOSE, PROMO_EXPIRE, - PROMO_SEEN, - PROMO_BUCKET_BOUNDARY + PROMO_BUCKET_BOUNDARY = PROMO_EXPIRE + 1 }; } // extension_misc diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc index f2350cc..e8636be 100644 --- a/chrome/common/extensions/extension_file_util.cc +++ b/chrome/common/extensions/extension_file_util.cc @@ -77,7 +77,7 @@ void UninstallExtension(const FilePath& extensions_dir, const std::string& id) { // We don't care about the return value. If this fails (and it can, due to // plugins that aren't unloaded yet, it will get cleaned up by - // ExtensionsService::GarbageCollectExtensions). + // ExtensionService::GarbageCollectExtensions). file_util::Delete(extensions_dir.AppendASCII(id), true); // recursive. } diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc index 230712d..3f59da6 100644 --- a/chrome/common/extensions/extension_file_util_unittest.cc +++ b/chrome/common/extensions/extension_file_util_unittest.cc @@ -239,5 +239,5 @@ TEST(ExtensionFileUtil, ExtensionURLToRelativeFilePath) { } // TODO(aa): More tests as motivation allows. Maybe steal some from -// ExtensionsService? Many of them could probably be tested here without the +// ExtensionService? Many of them could probably be tested here without the // MessageLoop shenanigans. diff --git a/chrome/common/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc index 34762fd..994ab83 100644 --- a/chrome/common/extensions/extension_l10n_util.cc +++ b/chrome/common/extensions/extension_l10n_util.cc @@ -167,37 +167,14 @@ bool AddLocale(const std::set<std::string>& chrome_locales, return true; } -std::string NormalizeLocale(const std::string& locale) { - std::string normalized_locale(locale); - std::replace(normalized_locale.begin(), normalized_locale.end(), '-', '_'); - - return normalized_locale; -} - std::string CurrentLocaleOrDefault() { - std::string current_locale = NormalizeLocale(*GetProcessLocale()); + std::string current_locale = l10n_util::NormalizeLocale(*GetProcessLocale()); if (current_locale.empty()) current_locale = "en"; return current_locale; } -void GetParentLocales(const std::string& current_locale, - std::vector<std::string>* parent_locales) { - std::string locale(NormalizeLocale(current_locale)); - - const int kNameCapacity = 256; - char parent[kNameCapacity]; - base::strlcpy(parent, locale.c_str(), kNameCapacity); - parent_locales->push_back(parent); - UErrorCode err = U_ZERO_ERROR; - while (uloc_getParent(parent, parent, kNameCapacity, &err) > 0) { - if (U_FAILURE(err)) - break; - parent_locales->push_back(parent); - } -} - void GetAllLocales(std::set<std::string>* all_locales) { const std::vector<std::string>& available_locales = l10n_util::GetAvailableLocales(); @@ -205,7 +182,7 @@ void GetAllLocales(std::set<std::string>* all_locales) { // I.e. for sr_Cyrl_RS we add sr_Cyrl_RS, sr_Cyrl and sr. for (size_t i = 0; i < available_locales.size(); ++i) { std::vector<std::string> result; - GetParentLocales(available_locales[i], &result); + l10n_util::GetParentLocales(available_locales[i], &result); all_locales->insert(result.begin(), result.end()); } } @@ -240,6 +217,7 @@ bool GetValidLocales(const FilePath& locale_path, return true; } + // Loads contents of the messages file for given locale. If file is not found, // or there was parsing error we return NULL and set |error|. // Caller owns the returned object. @@ -270,7 +248,7 @@ ExtensionMessageBundle* LoadMessageCatalogs( // Order locales to load as current_locale, first_parent, ..., default_locale. std::vector<std::string> all_fallback_locales; if (!application_locale.empty() && application_locale != default_locale) - GetParentLocales(application_locale, &all_fallback_locales); + l10n_util::GetParentLocales(application_locale, &all_fallback_locales); all_fallback_locales.push_back(default_locale); std::vector<linked_ptr<DictionaryValue> > catalogs; diff --git a/chrome/common/extensions/extension_l10n_util.h b/chrome/common/extensions/extension_l10n_util.h index e1fdfa0..57aa68f 100644 --- a/chrome/common/extensions/extension_l10n_util.h +++ b/chrome/common/extensions/extension_l10n_util.h @@ -59,18 +59,9 @@ bool AddLocale(const std::set<std::string>& chrome_locales, std::set<std::string>* valid_locales, std::string* error); -// Converts all - into _, to be consistent with ICU and file system names. -std::string NormalizeLocale(const std::string& locale); - // Returns normalized current locale, or default locale - en_US. std::string CurrentLocaleOrDefault(); -// Produce a vector of parent locales for given locale. -// It includes the current locale in the result. -// sr_Cyrl_RS generates sr_Cyrl_RS, sr_Cyrl and sr. -void GetParentLocales(const std::string& current_locale, - std::vector<std::string>* parent_locales); - // Extends list of Chrome locales to them and their parents, so we can do // proper fallback. void GetAllLocales(std::set<std::string>* all_locales); diff --git a/chrome/common/extensions/extension_l10n_util_unittest.cc b/chrome/common/extensions/extension_l10n_util_unittest.cc index 1487452..0ec7e97 100644 --- a/chrome/common/extensions/extension_l10n_util_unittest.cc +++ b/chrome/common/extensions/extension_l10n_util_unittest.cc @@ -214,17 +214,6 @@ TEST(ExtensionL10nUtil, LoadMessageCatalogsDuplicateKeys) { EXPECT_TRUE(error.empty()); } -TEST(ExtensionL10nUtil, GetParentLocales) { - std::vector<std::string> locales; - const std::string top_locale("sr_Cyrl_RS"); - extension_l10n_util::GetParentLocales(top_locale, &locales); - - ASSERT_EQ(3U, locales.size()); - EXPECT_EQ("sr_Cyrl_RS", locales[0]); - EXPECT_EQ("sr_Cyrl", locales[1]); - EXPECT_EQ("sr", locales[2]); -} - // Caller owns the returned object. ExtensionMessageBundle* CreateManifestBundle() { linked_ptr<DictionaryValue> catalog(new DictionaryValue); diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc index 2132b6c..f7c8f27 100644 --- a/chrome/common/extensions/extension_manifests_unittest.cc +++ b/chrome/common/extensions/extension_manifests_unittest.cc @@ -245,6 +245,15 @@ TEST_F(ExtensionManifestTest, ChromeURLContentScriptInvalid) { errors::kInvalidMatch); } +TEST_F(ExtensionManifestTest, ExperimentalPermission) { + LoadAndExpectError("experimental.json", errors::kExperimentalFlagRequired); + CommandLine old_command_line = *CommandLine::ForCurrentProcess(); + CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kEnableExperimentalExtensionApis); + LoadAndExpectSuccess("experimental.json"); + *CommandLine::ForCurrentProcess() = old_command_line; +} + TEST_F(ExtensionManifestTest, DevToolsExtensions) { LoadAndExpectError("devtools_extension_no_permissions.json", errors::kDevToolsExperimental); @@ -365,3 +374,37 @@ TEST_F(ExtensionManifestTest, DefaultPathForExtent) { EXPECT_TRUE(extension->web_extent().ContainsURL( GURL("http://www.google.com/monkey"))); } + +TEST_F(ExtensionManifestTest, DefaultLocale) { + LoadAndExpectError("default_locale_invalid.json", + extension_manifest_errors::kInvalidDefaultLocale); + + scoped_refptr<Extension> extension( + LoadAndExpectSuccess("default_locale_valid.json")); + EXPECT_EQ("de-AT", extension->default_locale()); +} + +TEST_F(ExtensionManifestTest, TtsProvider) { + LoadAndExpectError("tts_provider_invalid_1.json", + extension_manifest_errors::kInvalidTts); + LoadAndExpectError("tts_provider_invalid_2.json", + extension_manifest_errors::kInvalidTtsVoices); + LoadAndExpectError("tts_provider_invalid_3.json", + extension_manifest_errors::kInvalidTtsVoices); + LoadAndExpectError("tts_provider_invalid_4.json", + extension_manifest_errors::kInvalidTtsVoicesVoiceName); + LoadAndExpectError("tts_provider_invalid_5.json", + extension_manifest_errors::kInvalidTtsVoicesLocale); + LoadAndExpectError("tts_provider_invalid_6.json", + extension_manifest_errors::kInvalidTtsVoicesLocale); + LoadAndExpectError("tts_provider_invalid_7.json", + extension_manifest_errors::kInvalidTtsVoicesGender); + + scoped_refptr<Extension> extension( + LoadAndExpectSuccess("tts_provider_valid.json")); + + ASSERT_EQ(1u, extension->tts_voices().size()); + EXPECT_EQ("name", extension->tts_voices()[0].voice_name); + EXPECT_EQ("en-US", extension->tts_voices()[0].locale); + EXPECT_EQ("female", extension->tts_voices()[0].gender); +} diff --git a/chrome/common/extensions/extension_message_bundle.cc b/chrome/common/extensions/extension_message_bundle.cc index 3f7c152..ea28c83 100644 --- a/chrome/common/extensions/extension_message_bundle.cc +++ b/chrome/common/extensions/extension_message_bundle.cc @@ -10,9 +10,9 @@ #include "app/l10n_util.h" #include "base/hash_tables.h" #include "base/i18n/rtl.h" +#include "base/lazy_instance.h" #include "base/linked_ptr.h" #include "base/scoped_ptr.h" -#include "base/singleton.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -316,18 +316,30 @@ std::string ExtensionMessageBundle::GetL10nMessage( // /////////////////////////////////////////////////////////////////////////////// +// Unique class for Singleton. +struct ExtensionToMessagesMap { + ExtensionToMessagesMap(); + ~ExtensionToMessagesMap(); + + // Maps extension ID to message map. + ExtensionToL10nMessagesMap messages_map; +}; + +static base::LazyInstance<ExtensionToMessagesMap> g_extension_to_messages_map( + base::LINKER_INITIALIZED); + ExtensionToMessagesMap::ExtensionToMessagesMap() {} ExtensionToMessagesMap::~ExtensionToMessagesMap() {} ExtensionToL10nMessagesMap* GetExtensionToL10nMessagesMap() { - return &Singleton<ExtensionToMessagesMap>()->messages_map; + return &g_extension_to_messages_map.Get().messages_map; } L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id) { ExtensionToL10nMessagesMap::iterator it = - Singleton<ExtensionToMessagesMap>()->messages_map.find(extension_id); - if (it != Singleton<ExtensionToMessagesMap>()->messages_map.end()) + g_extension_to_messages_map.Get().messages_map.find(extension_id); + if (it != g_extension_to_messages_map.Get().messages_map.end()) return &(it->second); return NULL; diff --git a/chrome/common/extensions/extension_message_bundle.h b/chrome/common/extensions/extension_message_bundle.h index 6370559..df3bf35 100644 --- a/chrome/common/extensions/extension_message_bundle.h +++ b/chrome/common/extensions/extension_message_bundle.h @@ -155,15 +155,6 @@ typedef std::map<std::string, std::string> L10nMessagesMap; // A map of extension ID to l10n message map. typedef std::map<std::string, L10nMessagesMap > ExtensionToL10nMessagesMap; -// Unique class for Singleton. -struct ExtensionToMessagesMap { - ExtensionToMessagesMap(); - ~ExtensionToMessagesMap(); - - // Maps extension ID to message map. - ExtensionToL10nMessagesMap messages_map; -}; - // Returns the extension_id to messages map. ExtensionToL10nMessagesMap* GetExtensionToL10nMessagesMap(); diff --git a/chrome/common/extensions/extension_resource_unittest.cc b/chrome/common/extensions/extension_resource_unittest.cc index 1590225..e7b3ef0 100644 --- a/chrome/common/extensions/extension_resource_unittest.cc +++ b/chrome/common/extensions/extension_resource_unittest.cc @@ -58,8 +58,7 @@ TEST(ExtensionResourceTest, CreateWithAllResourcesOnDisk) { ASSERT_TRUE(file_util::CreateDirectory(l10n_path)); std::vector<std::string> locales; - extension_l10n_util::GetParentLocales(l10n_util::GetApplicationLocale(""), - &locales); + l10n_util::GetParentLocales(l10n_util::GetApplicationLocale(""), &locales); ASSERT_FALSE(locales.empty()); for (size_t i = 0; i < locales.size(); i++) { FilePath make_path; diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/extension_unpacker.cc index e270870..1ff4342 100644 --- a/chrome/common/extensions/extension_unpacker.cc +++ b/chrome/common/extensions/extension_unpacker.cc @@ -4,6 +4,8 @@ #include "chrome/common/extensions/extension_unpacker.h" +#include <set> + #include "base/file_util.h" #include "base/scoped_handle.h" #include "base/scoped_temp_dir.h" @@ -18,7 +20,6 @@ #include "chrome/common/extensions/extension_file_util.h" #include "chrome/common/extensions/extension_l10n_util.h" #include "chrome/common/json_value_serializer.h" -#include "chrome/common/notification_service.h" #include "chrome/common/url_constants.h" #include "chrome/common/zip.h" #include "ipc/ipc_message_utils.h" @@ -150,7 +151,6 @@ bool ExtensionUnpacker::Run() { extension_path_.DirName().AppendASCII(filenames::kTempExtensionName); if (!file_util::CreateDirectory(temp_install_dir_)) { - #if defined(OS_WIN) std::string dir_string = WideToUTF8(temp_install_dir_.value()); #else diff --git a/chrome/common/extensions/update_manifest.cc b/chrome/common/extensions/update_manifest.cc index 3329456..c75aa01 100644 --- a/chrome/common/extensions/update_manifest.cc +++ b/chrome/common/extensions/update_manifest.cc @@ -10,6 +10,7 @@ #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/string_number_conversions.h" +#include "base/stringprintf.h" #include "base/version.h" #include "chrome/common/libxml_utils.h" #include "libxml/tree.h" @@ -35,7 +36,7 @@ void UpdateManifest::ParseError(const char* details, ...) { // TODO(asargent) make a platform abstracted newline? errors_ += "\r\n"; } - StringAppendV(&errors_, details, args); + base::StringAppendV(&errors_, details, args); va_end(args); } @@ -81,7 +82,7 @@ static void XmlErrorFunc(void *context, const char *message, ...) { va_list args; va_start(args, message); std::string* error = static_cast<std::string*>(context); - StringAppendV(error, message, args); + base::StringAppendV(error, message, args); va_end(args); } diff --git a/chrome/common/extensions/url_pattern.h b/chrome/common/extensions/url_pattern.h index 72810ba..c0f17af 100644 --- a/chrome/common/extensions/url_pattern.h +++ b/chrome/common/extensions/url_pattern.h @@ -203,19 +203,10 @@ class URLPattern { private: friend class std::vector<URLPattern>; -// See clang bug: http://llvm.org/bugs/show_bug.cgi?id=8479 -#if defined(__clang__) - public: -#endif - // Note: don't use this directly. This exists so URLPattern can be used // with STL containers. URLPattern(); -#if defined(__clang__) - private: -#endif - // A bitmask containing the schemes which are considered valid for this // pattern. Parse() uses this to decide whether a pattern contains a valid // scheme. MatchesScheme uses this to decide whether a wildcard scheme_ diff --git a/chrome/common/file_system/file_system_dispatcher.h b/chrome/common/file_system/file_system_dispatcher.h index b8ffb2c..21bc792 100644 --- a/chrome/common/file_system/file_system_dispatcher.h +++ b/chrome/common/file_system/file_system_dispatcher.h @@ -25,11 +25,12 @@ class GURL; // Dispatches and sends file system related messages sent to/from a child // process from/to the main browser process. There is one instance // per child process. Messages are dispatched on the main child thread. -class FileSystemDispatcher { +class FileSystemDispatcher : public IPC::Channel::Listener { public: FileSystemDispatcher(); ~FileSystemDispatcher(); + // IPC::Channel::Listener implementation. bool OnMessageReceived(const IPC::Message& msg); bool OpenFileSystem(const GURL& origin_url, diff --git a/chrome/common/file_utilities_messages.cc b/chrome/common/file_utilities_messages.cc new file mode 100644 index 0000000..b1236ae --- /dev/null +++ b/chrome/common/file_utilities_messages.cc @@ -0,0 +1,8 @@ +// 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 "chrome/common/common_param_traits.h" + +#define IPC_MESSAGE_IMPL +#include "chrome/common/file_utilities_messages.h" diff --git a/chrome/common/file_utilities_messages.h b/chrome/common/file_utilities_messages.h new file mode 100644 index 0000000..6b8157d --- /dev/null +++ b/chrome/common/file_utilities_messages.h @@ -0,0 +1,35 @@ +// 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 CHROME_COMMON_FILE_UTILITIES_MESSAGES_H_ +#define CHROME_COMMON_FILE_UTILITIES_MESSAGES_H_ +#pragma once + +#include "base/time.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" +#include "ipc/ipc_platform_file.h" + +#define IPC_MESSAGE_START FileUtilitiesMsgStart + +// File utilities messages sent from the renderer to the browser. + +// Get file size in bytes. Set result to -1 if failed to get the file size. +IPC_SYNC_MESSAGE_CONTROL1_1(FileUtilitiesMsg_GetFileSize, + FilePath /* path */, + int64 /* result */) + +// Get file modification time in seconds. Set result to 0 if failed to get the +// file modification time. +IPC_SYNC_MESSAGE_CONTROL1_1(FileUtilitiesMsg_GetFileModificationTime, + FilePath /* path */, + base::Time /* result */) + +// Open the file. +IPC_SYNC_MESSAGE_CONTROL2_1(FileUtilitiesMsg_OpenFile, + FilePath /* path */, + int /* mode */, + IPC::PlatformFileForTransit /* result */) + +#endif // CHROME_COMMON_FILE_UTILITIES_MESSAGES_H_ diff --git a/chrome/common/font_config_ipc_linux.cc b/chrome/common/font_config_ipc_linux.cc new file mode 100644 index 0000000..a2e86a9 --- /dev/null +++ b/chrome/common/font_config_ipc_linux.cc @@ -0,0 +1,110 @@ +// 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 "chrome/common/font_config_ipc_linux.h" + +#include <errno.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/socket.h> +#include <sys/uio.h> + +#include "base/pickle.h" +#include "chrome/common/unix_domain_socket_posix.h" + +FontConfigIPC::FontConfigIPC(int fd) + : fd_(fd) { +} + +FontConfigIPC::~FontConfigIPC() { + close(fd_); +} + +bool FontConfigIPC::Match(std::string* result_family, + unsigned* result_filefaceid, + bool filefaceid_valid, unsigned filefaceid, + const std::string& family, + const void* characters, size_t characters_bytes, + bool* is_bold, bool* is_italic) { + if (family.length() > kMaxFontFamilyLength) + return false; + + Pickle request; + request.WriteInt(METHOD_MATCH); + request.WriteBool(filefaceid_valid); + if (filefaceid_valid) + request.WriteUInt32(filefaceid); + + request.WriteBool(is_bold && *is_bold); + request.WriteBool(is_bold && *is_italic); + + request.WriteUInt32(characters_bytes); + if (characters_bytes) + request.WriteBytes(characters, characters_bytes); + + request.WriteString(family); + + uint8_t reply_buf[512]; + const ssize_t r = UnixDomainSocket::SendRecvMsg(fd_, reply_buf, + sizeof(reply_buf), NULL, + request); + if (r == -1) + return false; + + Pickle reply(reinterpret_cast<char*>(reply_buf), r); + void* iter = NULL; + bool result; + if (!reply.ReadBool(&iter, &result)) + return false; + if (!result) + return false; + + uint32_t reply_filefaceid; + std::string reply_family; + bool resulting_bold, resulting_italic; + if (!reply.ReadUInt32(&iter, &reply_filefaceid) || + !reply.ReadString(&iter, &reply_family) || + !reply.ReadBool(&iter, &resulting_bold) || + !reply.ReadBool(&iter, &resulting_italic)) { + return false; + } + + *result_filefaceid = reply_filefaceid; + if (result_family) + *result_family = reply_family; + + if (is_bold) + *is_bold = resulting_bold; + if (is_italic) + *is_italic = resulting_italic; + + return true; +} + +int FontConfigIPC::Open(unsigned filefaceid) { + Pickle request; + request.WriteInt(METHOD_OPEN); + request.WriteUInt32(filefaceid); + + int result_fd = -1; + uint8_t reply_buf[256]; + const ssize_t r = UnixDomainSocket::SendRecvMsg(fd_, reply_buf, + sizeof(reply_buf), + &result_fd, request); + + if (r == -1) + return -1; + + Pickle reply(reinterpret_cast<char*>(reply_buf), r); + bool result; + void* iter = NULL; + if (!reply.ReadBool(&iter, &result) || + !result) { + if (result_fd) + close(result_fd); + return -1; + } + + return result_fd; +} diff --git a/chrome/common/font_config_ipc_linux.h b/chrome/common/font_config_ipc_linux.h new file mode 100644 index 0000000..e478f6a --- /dev/null +++ b/chrome/common/font_config_ipc_linux.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 CHROME_COMMON_FONT_CONFIG_IPC_LINUX_H_ +#define CHROME_COMMON_FONT_CONFIG_IPC_LINUX_H_ +#pragma once + +#include "skia/ext/SkFontHost_fontconfig_impl.h" + +#include <string> + +// FontConfig implementation for Skia that proxies out of process to get out +// of the sandbox. See http://code.google.com/p/chromium/wiki/LinuxSandboxIPC +class FontConfigIPC : public FontConfigInterface { + public: + explicit FontConfigIPC(int fd); + ~FontConfigIPC(); + + // FontConfigInterface implementation. + virtual bool Match(std::string* result_family, + unsigned* result_filefaceid, + bool filefaceid_valid, + unsigned filefaceid, + const std::string& family, + const void* characters, + size_t characters_bytes, + bool* is_bold, bool* is_italic); + virtual int Open(unsigned filefaceid); + + enum Method { + METHOD_MATCH = 0, + METHOD_OPEN = 1, + }; + + private: + const int fd_; +}; + +#endif // CHROME_COMMON_FONT_CONFIG_IPC_LINUX_H_ diff --git a/chrome/common/gpu_messages.cc b/chrome/common/gpu_messages.cc index bd850a1..9d5c32e 100644 --- a/chrome/common/gpu_messages.cc +++ b/chrome/common/gpu_messages.cc @@ -2,19 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/gpu_messages.h" - #include "chrome/common/gpu_create_command_buffer_config.h" #include "chrome/common/gpu_info.h" #include "chrome/common/dx_diag_node.h" #include "gfx/rect.h" #include "gfx/size.h" #include "ipc/ipc_channel_handle.h" -#include "ipc/ipc_message_utils.h" -#define MESSAGES_INTERNAL_IMPL_FILE \ - "chrome/common/gpu_messages_internal.h" -#include "ipc/ipc_message_impl_macros.h" +#define IPC_MESSAGE_IMPL +#include "chrome/common/gpu_messages.h" #if defined(OS_MACOSX) diff --git a/chrome/common/gpu_messages.h b/chrome/common/gpu_messages.h index f932c99..387d2b1 100644 --- a/chrome/common/gpu_messages.h +++ b/chrome/common/gpu_messages.h @@ -13,8 +13,6 @@ #include "gfx/native_widget_types.h" #include "gpu/command_buffer/common/command_buffer.h" -#define MESSAGES_INTERNAL_FILE \ - "chrome/common/gpu_messages_internal.h" -#include "ipc/ipc_message_macros.h" +#include "chrome/common/gpu_messages_internal.h" #endif // CHROME_COMMON_GPU_MESSAGES_H_ diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h index 1872992..22f2f9d 100644 --- a/chrome/common/gpu_messages_internal.h +++ b/chrome/common/gpu_messages_internal.h @@ -2,13 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This header is meant to be included in multiple passes, hence no traditional -// header guard. It is included by backing_store_messages_internal.h -// See ipc_message_macros.h for explanation of the macros and passes. - -// This file needs to be included again, even though we're actually included -// from it via utility_messages.h. - #include <vector> #include <string> @@ -16,6 +9,8 @@ #include "chrome/common/gpu_video_common.h" #include "ipc/ipc_message_macros.h" +#define IPC_MESSAGE_START GpuMsgStart + namespace gfx { class Size; } @@ -30,42 +25,40 @@ class GPUInfo; //------------------------------------------------------------------------------ // GPU Messages // These are messages from the browser to the GPU process. -IPC_BEGIN_MESSAGES(Gpu) - - // Tells the GPU process to create a new channel for communication with a - // given renderer. The channel name is returned in a - // GpuHostMsg_ChannelEstablished message. The renderer ID is passed so that - // the GPU process reuses an existing channel to that process if it exists. - // This ID is a unique opaque identifier generated by the browser process. - IPC_MESSAGE_CONTROL1(GpuMsg_EstablishChannel, - int /* renderer_id */) - - // Tells the GPU process to close the channel identified by IPC channel - // handle. If no channel can be identified, do nothing. - IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel, - IPC::ChannelHandle /* channel_handle */) - - // Provides a synchronization point to guarantee that the processing of - // previous asynchronous messages (i.e., GpuMsg_EstablishChannel) has - // completed. (This message can't be synchronous because the - // GpuProcessHost uses an IPC::ChannelProxy, which sends all messages - // asynchronously.) Results in a GpuHostMsg_SynchronizeReply. - IPC_MESSAGE_CONTROL0(GpuMsg_Synchronize) - - // Tells the GPU process to create a context for collecting graphics card - // information. - IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo) +// Tells the GPU process to create a new channel for communication with a +// given renderer. The channel name is returned in a +// GpuHostMsg_ChannelEstablished message. The renderer ID is passed so that +// the GPU process reuses an existing channel to that process if it exists. +// This ID is a unique opaque identifier generated by the browser process. +IPC_MESSAGE_CONTROL1(GpuMsg_EstablishChannel, + int /* renderer_id */) + +// Tells the GPU process to close the channel identified by IPC channel +// handle. If no channel can be identified, do nothing. +IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel, + IPC::ChannelHandle /* channel_handle */) + +// Provides a synchronization point to guarantee that the processing of +// previous asynchronous messages (i.e., GpuMsg_EstablishChannel) has +// completed. (This message can't be synchronous because the +// GpuProcessHost uses an IPC::ChannelProxy, which sends all messages +// asynchronously.) Results in a GpuHostMsg_SynchronizeReply. +IPC_MESSAGE_CONTROL0(GpuMsg_Synchronize) + +// Tells the GPU process to create a context for collecting graphics card +// information. +IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo) #if defined(OS_MACOSX) - // Tells the GPU process that the browser process handled the swap - // buffers request with the given number. Note that it is possible - // for the browser process to coalesce frames; it is not guaranteed - // that every GpuHostMsg_AcceleratedSurfaceBuffersSwapped message - // will result in a buffer swap on the browser side. - IPC_MESSAGE_CONTROL3(GpuMsg_AcceleratedSurfaceBuffersSwappedACK, - int /* renderer_id */, - int32 /* route_id */, - uint64 /* swap_buffers_count */) +// Tells the GPU process that the browser process handled the swap +// buffers request with the given number. Note that it is possible +// for the browser process to coalesce frames; it is not guaranteed +// that every GpuHostMsg_AcceleratedSurfaceBuffersSwapped message +// will result in a buffer swap on the browser side. +IPC_MESSAGE_CONTROL3(GpuMsg_AcceleratedSurfaceBuffersSwappedACK, + int /* renderer_id */, + int32 /* route_id */, + uint64 /* swap_buffers_count */) // Tells the GPU process that the IOSurface of the buffer belonging to // |renderer_route_id| a given id was destroyed, either by the user closing the @@ -75,289 +68,270 @@ IPC_MESSAGE_CONTROL2(GpuMsg_DidDestroyAcceleratedSurface, int32 /* renderer_route_id */) #endif - // Tells the GPU process to crash. - IPC_MESSAGE_CONTROL0(GpuMsg_Crash) - - // Tells the GPU process to hang. - IPC_MESSAGE_CONTROL0(GpuMsg_Hang) +// Tells the GPU process to crash. +IPC_MESSAGE_CONTROL0(GpuMsg_Crash) -IPC_END_MESSAGES(Gpu) +// Tells the GPU process to hang. +IPC_MESSAGE_CONTROL0(GpuMsg_Hang) //------------------------------------------------------------------------------ // GPU Host Messages // These are messages from the GPU process to the browser. -IPC_BEGIN_MESSAGES(GpuHost) +// Response to a GpuHostMsg_EstablishChannel message. +IPC_MESSAGE_CONTROL2(GpuHostMsg_ChannelEstablished, + IPC::ChannelHandle, /* channel_handle */ + GPUInfo /* GPU logging stats */) - // Response to a GpuHostMsg_EstablishChannel message. - IPC_MESSAGE_CONTROL2(GpuHostMsg_ChannelEstablished, - IPC::ChannelHandle, /* channel_handle */ - GPUInfo /* GPU logging stats */) +// Response to a GpuMsg_Synchronize message. +IPC_MESSAGE_CONTROL0(GpuHostMsg_SynchronizeReply) - // Response to a GpuMsg_Synchronize message. - IPC_MESSAGE_CONTROL0(GpuHostMsg_SynchronizeReply) - - // Response to a GpuMsg_CollectGraphicsInfo. - IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected, - GPUInfo /* GPU logging stats */) +// Response to a GpuMsg_CollectGraphicsInfo. +IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected, + GPUInfo /* GPU logging stats */) #if defined(OS_LINUX) - // Get the XID for a view ID. - IPC_SYNC_MESSAGE_CONTROL1_1(GpuHostMsg_GetViewXID, - gfx::NativeViewId, /* view */ - unsigned long /* xid */) +// Get the XID for a view ID. +IPC_SYNC_MESSAGE_CONTROL1_1(GpuHostMsg_GetViewXID, + gfx::NativeViewId, /* view */ + unsigned long /* xid */) - // Release the lock on the window. - // If the associated view has been destroyed, destroy the window. - IPC_MESSAGE_CONTROL1(GpuHostMsg_ReleaseXID, - unsigned long /* xid */) +// Release the lock on the window. +// If the associated view has been destroyed, destroy the window. +IPC_MESSAGE_CONTROL1(GpuHostMsg_ReleaseXID, + unsigned long /* xid */) - IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_ResizeXID, - unsigned long, /* xid */ - gfx::Size, /* size */ - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_ResizeXID, + unsigned long, /* xid */ + gfx::Size, /* size */ + bool /* success */) #elif defined(OS_MACOSX) - // This message, used on Mac OS X 10.6 and later (where IOSurface is - // supported), is sent from the GPU process to the browser to indicate that a - // new backing store was allocated for the given "window" (fake - // PluginWindowHandle). The renderer ID and render view ID are needed in - // order to uniquely identify the RenderWidgetHostView on the browser side. - IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceSetIOSurface, - GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params) - - // This message notifies the browser process that the renderer - // swapped the buffers associated with the given "window", which - // should cause the browser to redraw the compositor's contents. - IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, - GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) +// This message, used on Mac OS X 10.6 and later (where IOSurface is +// supported), is sent from the GPU process to the browser to indicate that a +// new backing store was allocated for the given "window" (fake +// PluginWindowHandle). The renderer ID and render view ID are needed in +// order to uniquely identify the RenderWidgetHostView on the browser side. +IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceSetIOSurface, + GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params) + +// This message notifies the browser process that the renderer +// swapped the buffers associated with the given "window", which +// should cause the browser to redraw the compositor's contents. +IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, + GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) #elif defined(OS_WIN) - // Get the HWND for the compositor window and if necessary, create it - IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_GetCompositorHostWindow, - int32, /* renderer_id */ - int32, /* render_view_id */ - gfx::PluginWindowHandle /* compositor_host_id */) - - IPC_MESSAGE_CONTROL2(GpuHostMsg_ScheduleComposite, - int32, /* renderer_id */ - int32 /* render_view_id */) +// Get the HWND for the compositor window and if necessary, create it +IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_GetCompositorHostWindow, + int32, /* renderer_id */ + int32, /* render_view_id */ + gfx::PluginWindowHandle /* compositor_host_id */) + +IPC_MESSAGE_CONTROL2(GpuHostMsg_ScheduleComposite, + int32, /* renderer_id */ + int32 /* render_view_id */) #endif -IPC_END_MESSAGES(GpuHost) - //------------------------------------------------------------------------------ // GPU Channel Messages // These are messages from a renderer process to the GPU process. -IPC_BEGIN_MESSAGES(GpuChannel) - - // Tells the GPU process to create a new command buffer that renders directly - // to a native view. The |render_view_id| is currently needed only on Mac OS - // X in order to identify the window on the browser side into which the - // rendering results go. A corresponding GpuCommandBufferStub is created. - IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateViewCommandBuffer, - gfx::NativeViewId, /* view */ - int32, /* render_view_id */ - GPUCreateCommandBufferConfig, /* init_params */ - int32 /* route_id */) - - // Tells the GPU process to create a new command buffer that renders to an - // offscreen frame buffer. If parent_route_id is not zero, the texture backing - // the frame buffer is mapped into the corresponding parent command buffer's - // namespace, with the name of parent_texture_id. This ID is in the parent's - // namespace. - IPC_SYNC_MESSAGE_CONTROL4_1(GpuChannelMsg_CreateOffscreenCommandBuffer, - int32, /* parent_route_id */ - gfx::Size, /* size */ - GPUCreateCommandBufferConfig, /* init_params */ - uint32, /* parent_texture_id */ - int32 /* route_id */) - - // The CommandBufferProxy sends this to the GpuCommandBufferStub in its - // destructor, so that the stub deletes the actual CommandBufferService - // object that it's hosting. - // TODO(apatrick): Implement this. - IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer, - int32 /* instance_id */) - - // Create hardware video decoder && associate it with the output |decoder_id|; - // We need this to be control message because we had to map the GpuChannel and - // |decoder_id|. - IPC_MESSAGE_CONTROL2(GpuChannelMsg_CreateVideoDecoder, - int32, /* context_route_id */ - int32) /* decoder_id */ - - // Release all resource of the hardware video decoder which was assocaited - // with the input |decoder_id|. - // TODO(hclam): This message needs to be asynchronous. - IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyVideoDecoder, - int32 /* decoder_id */) - -IPC_END_MESSAGES(GpuChannel) +// Tells the GPU process to create a new command buffer that renders directly +// to a native view. The |render_view_id| is currently needed only on Mac OS +// X in order to identify the window on the browser side into which the +// rendering results go. A corresponding GpuCommandBufferStub is created. +IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateViewCommandBuffer, + gfx::NativeViewId, /* view */ + int32, /* render_view_id */ + GPUCreateCommandBufferConfig, /* init_params */ + int32 /* route_id */) + +// Tells the GPU process to create a new command buffer that renders to an +// offscreen frame buffer. If parent_route_id is not zero, the texture backing +// the frame buffer is mapped into the corresponding parent command buffer's +// namespace, with the name of parent_texture_id. This ID is in the parent's +// namespace. +IPC_SYNC_MESSAGE_CONTROL4_1(GpuChannelMsg_CreateOffscreenCommandBuffer, + int32, /* parent_route_id */ + gfx::Size, /* size */ + GPUCreateCommandBufferConfig, /* init_params */ + uint32, /* parent_texture_id */ + int32 /* route_id */) + +// The CommandBufferProxy sends this to the GpuCommandBufferStub in its +// destructor, so that the stub deletes the actual CommandBufferService +// object that it's hosting. +// TODO(apatrick): Implement this. +IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer, + int32 /* instance_id */) + +// Create hardware video decoder && associate it with the output |decoder_id|; +// We need this to be control message because we had to map the GpuChannel and +// |decoder_id|. +IPC_MESSAGE_CONTROL2(GpuChannelMsg_CreateVideoDecoder, + int32, /* context_route_id */ + int32) /* decoder_id */ + +// Release all resource of the hardware video decoder which was assocaited +// with the input |decoder_id|. +// TODO(hclam): This message needs to be asynchronous. +IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyVideoDecoder, + int32 /* decoder_id */) //------------------------------------------------------------------------------ // GPU Command Buffer Messages // These are messages between a renderer process to the GPU process relating to // a single OpenGL context. -IPC_BEGIN_MESSAGES(GpuCommandBuffer) - // Initialize a command buffer with the given number of command entries. - // Returns the shared memory handle for the command buffer mapped to the - // calling process. - IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_Initialize, - int32 /* size */, - base::SharedMemoryHandle /* ring_buffer */) - - // Get the current state of the command buffer. - IPC_SYNC_MESSAGE_ROUTED0_1(GpuCommandBufferMsg_GetState, - gpu::CommandBuffer::State /* state */) - - // Get the current state of the command buffer asynchronously. State is - // returned via UpdateState message. - IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_AsyncGetState) - - // Synchronize the put and get offsets of both processes. Caller passes its - // current put offset. Current state (including get offset) is returned. - IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_Flush, - int32 /* put_offset */, - gpu::CommandBuffer::State /* state */) - - // Asynchronously synchronize the put and get offsets of both processes. - // Caller passes its current put offset. Current state (including get offset) - // is returned via an UpdateState message. - IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_AsyncFlush, - int32 /* put_offset */) - - // Return the current state of the command buffer following a request via - // an AsyncGetState or AsyncFlush message. (This message is sent from the - // GPU process to the renderer process.) - IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_UpdateState, - gpu::CommandBuffer::State /* state */) - - // Indicates that a SwapBuffers call has been issued. - IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_SwapBuffers) - - // Create a shared memory transfer buffer. Returns an id that can be used to - // identify the transfer buffer from a comment. - IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_CreateTransferBuffer, - int32 /* size */, - int32 /* id */) - - // Destroy a previously created transfer buffer. - IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_DestroyTransferBuffer, - int32 /* id */) - - // Get the shared memory handle for a transfer buffer mapped to the callers - // process. - IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_GetTransferBuffer, - int32 /* id */, - base::SharedMemoryHandle /* transfer_buffer */, - uint32 /* size */) - - // Send from command buffer stub to proxy when window is invalid and must be - // repainted. - IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_NotifyRepaint) - - // Tells the GPU process to resize an offscreen frame buffer. - IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ResizeOffscreenFrameBuffer, - gfx::Size /* size */) +// Initialize a command buffer with the given number of command entries. +// Returns the shared memory handle for the command buffer mapped to the +// calling process. +IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_Initialize, + int32 /* size */, + base::SharedMemoryHandle /* ring_buffer */) + +// Get the current state of the command buffer. +IPC_SYNC_MESSAGE_ROUTED0_1(GpuCommandBufferMsg_GetState, + gpu::CommandBuffer::State /* state */) + +// Get the current state of the command buffer asynchronously. State is +// returned via UpdateState message. +IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_AsyncGetState) + +// Synchronize the put and get offsets of both processes. Caller passes its +// current put offset. Current state (including get offset) is returned. +IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_Flush, + int32 /* put_offset */, + gpu::CommandBuffer::State /* state */) + +// Asynchronously synchronize the put and get offsets of both processes. +// Caller passes its current put offset. Current state (including get offset) +// is returned via an UpdateState message. +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_AsyncFlush, + int32 /* put_offset */) + +// Return the current state of the command buffer following a request via +// an AsyncGetState or AsyncFlush message. (This message is sent from the +// GPU process to the renderer process.) +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_UpdateState, + gpu::CommandBuffer::State /* state */) + +// Indicates that a SwapBuffers call has been issued. +IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_SwapBuffers) + +// Create a shared memory transfer buffer. Returns an id that can be used to +// identify the transfer buffer from a comment. +IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_CreateTransferBuffer, + int32 /* size */, + int32 /* id */) + +// Destroy a previously created transfer buffer. +IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_DestroyTransferBuffer, + int32 /* id */) + +// Get the shared memory handle for a transfer buffer mapped to the callers +// process. +IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_GetTransferBuffer, + int32 /* id */, + base::SharedMemoryHandle /* transfer_buffer */, + uint32 /* size */) + +// Send from command buffer stub to proxy when window is invalid and must be +// repainted. +IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_NotifyRepaint) + +// Tells the GPU process to resize an offscreen frame buffer. +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ResizeOffscreenFrameBuffer, + gfx::Size /* size */) #if defined(OS_MACOSX) - // On Mac OS X the GPU plugin must be offscreen, because there is no - // true cross-process window hierarchy. For this reason we must send - // resize events explicitly to the command buffer stub so it can - // reallocate its backing store and send the new one back to the - // browser. This message is currently used only on 10.6 and later. - IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetWindowSize, - gfx::Size /* size */) +// On Mac OS X the GPU plugin must be offscreen, because there is no +// true cross-process window hierarchy. For this reason we must send +// resize events explicitly to the command buffer stub so it can +// reallocate its backing store and send the new one back to the +// browser. This message is currently used only on 10.6 and later. +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetWindowSize, + gfx::Size /* size */) #endif -IPC_END_MESSAGES(GpuCommandBuffer) - //------------------------------------------------------------------------------ // GPU Video Decoder Messages // These messages are sent from Renderer process to GPU process. -IPC_BEGIN_MESSAGES(GpuVideoDecoder) - // Initialize and configure GpuVideoDecoder asynchronously. - IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_Initialize, - GpuVideoDecoderInitParam) - - // Destroy and release GpuVideoDecoder asynchronously. - IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Destroy) +// Initialize and configure GpuVideoDecoder asynchronously. +IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_Initialize, + GpuVideoDecoderInitParam) - // Start decoder flushing operation. - IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Flush) +// Destroy and release GpuVideoDecoder asynchronously. +IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Destroy) - // Tell the decoder to start prerolling. - IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Preroll) +// Start decoder flushing operation. +IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Flush) - // Send input buffer to GpuVideoDecoder. - IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_EmptyThisBuffer, - GpuVideoDecoderInputBufferParam) +// Tell the decoder to start prerolling. +IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Preroll) - // Ask the GPU process to produce a video frame with the ID. - IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_ProduceVideoFrame, - int32) /* Video Frame ID */ +// Send input buffer to GpuVideoDecoder. +IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_EmptyThisBuffer, + GpuVideoDecoderInputBufferParam) - // Sent from Renderer process to the GPU process to notify that textures are - // generated for a video frame. - IPC_MESSAGE_ROUTED2(GpuVideoDecoderMsg_VideoFrameAllocated, - int32, /* Video Frame ID */ - std::vector<uint32>) /* Textures for video frame */ +// Ask the GPU process to produce a video frame with the ID. +IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_ProduceVideoFrame, + int32) /* Video Frame ID */ -IPC_END_MESSAGES(GpuVideoDecoder) +// Sent from Renderer process to the GPU process to notify that textures are +// generated for a video frame. +IPC_MESSAGE_ROUTED2(GpuVideoDecoderMsg_VideoFrameAllocated, + int32, /* Video Frame ID */ + std::vector<uint32>) /* Textures for video frame */ //------------------------------------------------------------------------------ // GPU Video Decoder Host Messages // These messages are sent from GPU process to Renderer process. -IPC_BEGIN_MESSAGES(GpuVideoDecoderHost) - // Inform GpuVideoDecoderHost that a GpuVideoDecoder is created. - IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_CreateVideoDecoderDone, - int32) /* decoder_id */ - - // Confirm GpuVideoDecoder had been initialized or failed to initialize. - // TODO(hclam): Change this to Done instead of ACK. - IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_InitializeACK, - GpuVideoDecoderInitDoneParam) - - // Confrim GpuVideoDecoder had been destroyed properly. - // TODO(hclam): Change this to Done instead of ACK. - IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_DestroyACK) - - // Confirm decoder had been flushed. - // TODO(hclam): Change this to Done instead of ACK. - IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_FlushACK) - - // Confirm preroll operation is done. - IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_PrerollDone) - - // GpuVideoDecoder has consumed input buffer from transfer buffer. - // TODO(hclam): Change this to Done instead of ACK. - IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_EmptyThisBufferACK) - - // GpuVideoDecoder require new input buffer. - IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_EmptyThisBufferDone) - - // GpuVideoDecoder reports that a video frame is ready to be consumed. - IPC_MESSAGE_ROUTED4(GpuVideoDecoderHostMsg_ConsumeVideoFrame, - int32, /* Video Frame ID */ - int64, /* Timestamp in microseconds */ - int64, /* Duration in microseconds */ - int32) /* Flags */ - - // Allocate video frames for output of the hardware video decoder. - IPC_MESSAGE_ROUTED4(GpuVideoDecoderHostMsg_AllocateVideoFrames, - int32, /* Number of video frames to generate */ - uint32, /* Width of the video frame */ - uint32, /* Height of the video frame */ - int32 /* Format of the video frame */) - - // Release all video frames allocated for a hardware video decoder. - IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_ReleaseAllVideoFrames) - - // GpuVideoDecoder report output format change. - IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_MediaFormatChange, - GpuVideoDecoderFormatChangeParam) - - // GpuVideoDecoder report error. - IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_ErrorNotification, - GpuVideoDecoderErrorInfoParam) - -IPC_END_MESSAGES(GpuVideoDecoderHost) +// Inform GpuVideoDecoderHost that a GpuVideoDecoder is created. +IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_CreateVideoDecoderDone, + int32) /* decoder_id */ + +// Confirm GpuVideoDecoder had been initialized or failed to initialize. +// TODO(hclam): Change this to Done instead of ACK. +IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_InitializeACK, + GpuVideoDecoderInitDoneParam) + +// Confrim GpuVideoDecoder had been destroyed properly. +// TODO(hclam): Change this to Done instead of ACK. +IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_DestroyACK) + +// Confirm decoder had been flushed. +// TODO(hclam): Change this to Done instead of ACK. +IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_FlushACK) + +// Confirm preroll operation is done. +IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_PrerollDone) + +// GpuVideoDecoder has consumed input buffer from transfer buffer. +// TODO(hclam): Change this to Done instead of ACK. +IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_EmptyThisBufferACK) + +// GpuVideoDecoder require new input buffer. +IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_EmptyThisBufferDone) + +// GpuVideoDecoder reports that a video frame is ready to be consumed. +IPC_MESSAGE_ROUTED4(GpuVideoDecoderHostMsg_ConsumeVideoFrame, + int32, /* Video Frame ID */ + int64, /* Timestamp in microseconds */ + int64, /* Duration in microseconds */ + int32) /* Flags */ + +// Allocate video frames for output of the hardware video decoder. +IPC_MESSAGE_ROUTED4(GpuVideoDecoderHostMsg_AllocateVideoFrames, + int32, /* Number of video frames to generate */ + uint32, /* Width of the video frame */ + uint32, /* Height of the video frame */ + int32 /* Format of the video frame */) + +// Release all video frames allocated for a hardware video decoder. +IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_ReleaseAllVideoFrames) + +// GpuVideoDecoder report output format change. +IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_MediaFormatChange, + GpuVideoDecoderFormatChangeParam) + +// GpuVideoDecoder report error. +IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_ErrorNotification, + GpuVideoDecoderErrorInfoParam) diff --git a/chrome/common/gpu_plugin.cc b/chrome/common/gpu_plugin.cc index 84ab339..4600638 100644 --- a/chrome/common/gpu_plugin.cc +++ b/chrome/common/gpu_plugin.cc @@ -9,18 +9,15 @@ #include "base/utf_string_conversions.h" #include "chrome/common/chrome_switches.h" #include "gpu/gpu_plugin/gpu_plugin.h" -#include "webkit/glue/plugins/plugin_list.h" - -#if defined(ENABLE_GPU) -#include "webkit/glue/plugins/plugin_constants_win.h" -#endif +#include "webkit/plugins/npapi/plugin_list.h" namespace chrome { void RegisterInternalGPUPlugin() { #if defined(ENABLE_GPU) - static const std::wstring kWideMimeType = ASCIIToWide(kGPUPluginMimeType); - static const NPAPI::PluginVersionInfo kGPUPluginInfo = { + static const std::wstring kWideMimeType = ASCIIToWide( + "application/vnd.google.chrome.gpu-plugin"); + static const webkit::npapi::PluginVersionInfo kGPUPluginInfo = { FilePath(FILE_PATH_LITERAL("gpu-plugin")), L"GPU Plug-in", L"GPU Rendering Plug-in", @@ -38,7 +35,8 @@ void RegisterInternalGPUPlugin() { }; if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableGPUPlugin)) - NPAPI::PluginList::Singleton()->RegisterInternalPlugin(kGPUPluginInfo); + webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( + kGPUPluginInfo); #endif // ENABLE_GPU } diff --git a/chrome/common/guid.cc b/chrome/common/guid.cc new file mode 100644 index 0000000..a6b4b09 --- /dev/null +++ b/chrome/common/guid.cc @@ -0,0 +1,32 @@ +// 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 "chrome/common/guid.h" + +#include "base/rand_util.h" +#include "base/stringprintf.h" + +namespace guid { + +bool IsValidGUID(const std::string& guid) { + const size_t kGUIDLength = 36U; + if (guid.length() != kGUIDLength) + return false; + + std::string hexchars = "0123456789ABCDEF"; + for (uint32 i = 0; i < guid.length(); ++i) { + char current = guid[i]; + if (i == 8 || i == 13 || i == 18 || i == 23) { + if (current != '-') + return false; + } else { + if (hexchars.find(current) == std::string::npos) + return false; + } + } + + return true; +} + +} // namespace guid diff --git a/chrome/common/guid.h b/chrome/common/guid.h new file mode 100644 index 0000000..9121c9e --- /dev/null +++ b/chrome/common/guid.h @@ -0,0 +1,32 @@ +// 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 CHROME_COMMON_GUID_H_ +#define CHROME_COMMON_GUID_H_ +#pragma once + +#include <string> + +#include "base/basictypes.h" +#include "build/build_config.h" + +namespace guid { + +// Generate a 128-bit random GUID of the form: "%08X-%04X-%04X-%04X-%012llX". +// If GUID generation fails an empty string is returned. +// The POSIX implementation uses psuedo random number generation to create +// the GUID. The Windows implementation uses system services. +std::string GenerateGUID(); + +// Returns true if the input string conforms to the GUID format. +bool IsValidGUID(const std::string& guid); + +#if defined(OS_POSIX) +// For unit testing purposes only. Do not use outside of tests. +std::string RandomDataToGUIDString(const uint64 bytes[2]); +#endif + +} // namespace guid + +#endif // CHROME_COMMON_GUID_H_ diff --git a/chrome/common/guid_posix.cc b/chrome/common/guid_posix.cc new file mode 100644 index 0000000..f21788b --- /dev/null +++ b/chrome/common/guid_posix.cc @@ -0,0 +1,28 @@ +// Copyright (c) 2008 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 "chrome/common/guid.h" + +#include "base/rand_util.h" +#include "base/stringprintf.h" + +namespace guid { + +std::string GenerateGUID() { + uint64 sixteen_bytes[2] = { base::RandUint64(), base::RandUint64() }; + return RandomDataToGUIDString(sixteen_bytes); +} + +// TODO(cmasone): Once we're comfortable this works, migrate Windows code to +// use this as well. +std::string RandomDataToGUIDString(const uint64 bytes[2]) { + return StringPrintf("%08X-%04X-%04X-%04X-%012llX", + static_cast<unsigned int>(bytes[0] >> 32), + static_cast<unsigned int>((bytes[0] >> 16) & 0x0000ffff), + static_cast<unsigned int>(bytes[0] & 0x0000ffff), + static_cast<unsigned int>(bytes[1] >> 48), + bytes[1] & 0x0000ffffffffffffULL); +} + +} // namespace guid diff --git a/chrome/common/guid_unittest.cc b/chrome/common/guid_unittest.cc new file mode 100644 index 0000000..628bafc --- /dev/null +++ b/chrome/common/guid_unittest.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 "chrome/common/guid.h" + +#include <limits> + +#include "testing/gtest/include/gtest/gtest.h" + +#if defined(OS_POSIX) +TEST(GUIDTest, GUIDGeneratesAllZeroes) { + uint64 bytes[] = { 0, 0 }; + std::string clientid = guid::RandomDataToGUIDString(bytes); + EXPECT_EQ("00000000-0000-0000-0000-000000000000", clientid); +} + +TEST(GUIDTest, GUIDGeneratesCorrectly) { + uint64 bytes[] = { 0x0123456789ABCDEFULL, 0xFEDCBA9876543210ULL }; + std::string clientid = guid::RandomDataToGUIDString(bytes); + EXPECT_EQ("01234567-89AB-CDEF-FEDC-BA9876543210", clientid); +} +#endif + +TEST(GUIDTest, GUIDCorrectlyFormatted) { + const int kIterations = 10; + for (int it = 0; it < kIterations; ++it) { + std::string guid = guid::GenerateGUID(); + EXPECT_TRUE(guid::IsValidGUID(guid)); + } +} + +TEST(GUIDTest, GUIDBasicUniqueness) { + const int kIterations = 10; + for (int it = 0; it < kIterations; ++it) { + std::string guid1 = guid::GenerateGUID(); + std::string guid2 = guid::GenerateGUID(); + EXPECT_EQ(36U, guid1.length()); + EXPECT_EQ(36U, guid2.length()); + EXPECT_NE(guid1, guid2); + } +} diff --git a/chrome/common/guid_win.cc b/chrome/common/guid_win.cc new file mode 100644 index 0000000..0d95cd6 --- /dev/null +++ b/chrome/common/guid_win.cc @@ -0,0 +1,38 @@ +// Copyright (c) 2008 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 "chrome/common/guid.h" + +#include <stdlib.h> + +#include <objbase.h> +#include <windows.h> + +#include "base/basictypes.h" +#include "base/logging.h" +#include "base/string_util.h" +#include "base/utf_string_conversions.h" + +namespace guid { + +std::string GenerateGUID() { + const int kGUIDSize = 39; + + GUID guid; + HRESULT guid_result = CoCreateGuid(&guid); + DCHECK(SUCCEEDED(guid_result)); + if (!SUCCEEDED(guid_result)) + return std::string(); + + std::wstring guid_string; + int result = StringFromGUID2(guid, + WriteInto(&guid_string, kGUIDSize), kGUIDSize); + DCHECK(result == kGUIDSize); + if (result != kGUIDSize) + return std::string(); + + return WideToUTF8(guid_string.substr(1, guid_string.length() - 2)); +} + +} // namespace guid diff --git a/chrome/common/indexed_db_key.cc b/chrome/common/indexed_db_key.cc index 4488673..0379c30 100644 --- a/chrome/common/indexed_db_key.cc +++ b/chrome/common/indexed_db_key.cc @@ -29,12 +29,17 @@ void IndexedDBKey::SetInvalid() { type_ = WebIDBKey::InvalidType; } -void IndexedDBKey::Set(const string16& string) { +void IndexedDBKey::SetString(const string16& string) { type_ = WebIDBKey::StringType; string_ = string; } -void IndexedDBKey::Set(double number) { +void IndexedDBKey::SetDate(double date) { + type_ = WebIDBKey::DateType; + date_ = date; +} + +void IndexedDBKey::SetNumber(double number) { type_ = WebIDBKey::NumberType; number_ = number; } @@ -44,6 +49,7 @@ void IndexedDBKey::Set(const WebIDBKey& key) { 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 { @@ -51,9 +57,11 @@ IndexedDBKey::operator WebIDBKey() const { case WebIDBKey::NullType: return WebIDBKey::createNull(); case WebIDBKey::StringType: - return WebIDBKey(string_); + return WebIDBKey::createString(string_); + case WebIDBKey::DateType: + return WebIDBKey::createDate(date_); case WebIDBKey::NumberType: - return WebIDBKey(number_); + return WebIDBKey::createNumber(number_); case WebIDBKey::InvalidType: return WebIDBKey::createInvalid(); } diff --git a/chrome/common/indexed_db_key.h b/chrome/common/indexed_db_key.h index 60b4529..b740c10 100644 --- a/chrome/common/indexed_db_key.h +++ b/chrome/common/indexed_db_key.h @@ -18,12 +18,14 @@ class IndexedDBKey { void SetNull(); void SetInvalid(); - void Set(const string16& string); - void Set(double number); + 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; @@ -31,6 +33,7 @@ class IndexedDBKey { private: WebKit::WebIDBKey::Type type_; string16 string_; + double date_; double number_; }; diff --git a/chrome/common/indexed_db_messages.cc b/chrome/common/indexed_db_messages.cc new file mode 100644 index 0000000..c7c0e22 --- /dev/null +++ b/chrome/common/indexed_db_messages.cc @@ -0,0 +1,339 @@ +// 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 "chrome/common/common_param_traits.h" + +#define IPC_MESSAGE_IMPL +#include "chrome/common/indexed_db_messages.h" + +IndexedDBHostMsg_FactoryOpen_Params::IndexedDBHostMsg_FactoryOpen_Params() + : routing_id(0), + response_id(0), + maximum_size(0) { +} + +IndexedDBHostMsg_FactoryOpen_Params::~IndexedDBHostMsg_FactoryOpen_Params() { +} + +IndexedDBHostMsg_DatabaseCreateObjectStore_Params:: + IndexedDBHostMsg_DatabaseCreateObjectStore_Params() + : auto_increment(false), + transaction_id(0), + idb_database_id(0) { +} + +IndexedDBHostMsg_DatabaseCreateObjectStore_Params:: + ~IndexedDBHostMsg_DatabaseCreateObjectStore_Params() { +} + +IndexedDBHostMsg_IndexOpenCursor_Params:: + IndexedDBHostMsg_IndexOpenCursor_Params() + : response_id(0), + lower_open(false), + upper_open(false), + direction(0), + idb_index_id(0), + transaction_id(0) { +} + +IndexedDBHostMsg_IndexOpenCursor_Params:: + ~IndexedDBHostMsg_IndexOpenCursor_Params() { +} + + +IndexedDBHostMsg_ObjectStorePut_Params:: + IndexedDBHostMsg_ObjectStorePut_Params() + : idb_object_store_id(0), + response_id(0), + add_only(false), + transaction_id(0) { +} + +IndexedDBHostMsg_ObjectStorePut_Params:: +~IndexedDBHostMsg_ObjectStorePut_Params() { +} + +IndexedDBHostMsg_ObjectStoreCreateIndex_Params:: + IndexedDBHostMsg_ObjectStoreCreateIndex_Params() + : unique(false), + transaction_id(0), + idb_object_store_id(0) { +} + +IndexedDBHostMsg_ObjectStoreCreateIndex_Params:: + ~IndexedDBHostMsg_ObjectStoreCreateIndex_Params() { +} + + +IndexedDBHostMsg_ObjectStoreOpenCursor_Params:: + IndexedDBHostMsg_ObjectStoreOpenCursor_Params() + : response_id(0), + lower_open(false), + upper_open(false), + direction(0), + idb_object_store_id(0), + transaction_id(0) { +} + +IndexedDBHostMsg_ObjectStoreOpenCursor_Params:: + ~IndexedDBHostMsg_ObjectStoreOpenCursor_Params() { +} + +namespace IPC { + +void ParamTraits<IndexedDBHostMsg_FactoryOpen_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.routing_id); + WriteParam(m, p.response_id); + WriteParam(m, p.origin); + WriteParam(m, p.name); + WriteParam(m, p.maximum_size); +} + +bool ParamTraits<IndexedDBHostMsg_FactoryOpen_Params>::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->routing_id) && + ReadParam(m, iter, &p->response_id) && + ReadParam(m, iter, &p->origin) && + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->maximum_size); +} + +void ParamTraits<IndexedDBHostMsg_FactoryOpen_Params>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.routing_id, l); + l->append(", "); + LogParam(p.response_id, l); + l->append(", "); + LogParam(p.origin, l); + l->append(", "); + LogParam(p.name, l); + l->append(", "); + LogParam(p.maximum_size, l); + l->append(")"); +} + +void ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.key_path); + WriteParam(m, p.auto_increment); + WriteParam(m, p.transaction_id); + WriteParam(m, p.idb_database_id); +} + +bool ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->key_path) && + ReadParam(m, iter, &p->auto_increment) && + ReadParam(m, iter, &p->transaction_id) && + ReadParam(m, iter, &p->idb_database_id); +} + +void ParamTraits<IndexedDBHostMsg_DatabaseCreateObjectStore_Params>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.name, l); + l->append(", "); + LogParam(p.key_path, l); + l->append(", "); + LogParam(p.auto_increment, l); + l->append(", "); + LogParam(p.transaction_id, l); + l->append(", "); + LogParam(p.idb_database_id, l); + l->append(")"); +} + +void ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.response_id); + WriteParam(m, p.lower_key); + WriteParam(m, p.upper_key); + WriteParam(m, p.lower_open); + WriteParam(m, p.upper_open); + WriteParam(m, p.direction); + WriteParam(m, p.idb_index_id); + WriteParam(m, p.transaction_id); +} + +bool ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->response_id) && + ReadParam(m, iter, &p->lower_key) && + ReadParam(m, iter, &p->upper_key) && + ReadParam(m, iter, &p->lower_open) && + ReadParam(m, iter, &p->upper_open) && + ReadParam(m, iter, &p->direction) && + ReadParam(m, iter, &p->idb_index_id) && + ReadParam(m, iter, &p->transaction_id); +} + +void ParamTraits<IndexedDBHostMsg_IndexOpenCursor_Params>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.response_id, l); + l->append(", "); + LogParam(p.lower_key, l); + l->append(", "); + LogParam(p.upper_key, l); + l->append(", "); + LogParam(p.lower_open, l); + l->append(", "); + LogParam(p.upper_open, l); + l->append(", "); + LogParam(p.direction, l); + l->append(", "); + LogParam(p.idb_index_id, l); + l->append(","); + LogParam(p.transaction_id, l); + l->append(")"); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.idb_object_store_id); + WriteParam(m, p.response_id); + WriteParam(m, p.serialized_value); + WriteParam(m, p.key); + WriteParam(m, p.add_only); + WriteParam(m, p.transaction_id); +} + +bool ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->idb_object_store_id) && + ReadParam(m, iter, &p->response_id) && + ReadParam(m, iter, &p->serialized_value) && + ReadParam(m, iter, &p->key) && + ReadParam(m, iter, &p->add_only) && + ReadParam(m, iter, &p->transaction_id); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStorePut_Params>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.idb_object_store_id, l); + l->append(", "); + LogParam(p.response_id, l); + l->append(", "); + LogParam(p.serialized_value, l); + l->append(", "); + LogParam(p.key, l); + l->append(", "); + LogParam(p.add_only, l); + l->append(", "); + LogParam(p.transaction_id, l); + l->append(")"); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.key_path); + WriteParam(m, p.unique); + WriteParam(m, p.transaction_id); + WriteParam(m, p.idb_object_store_id); +} + +bool ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->key_path) && + ReadParam(m, iter, &p->unique) && + ReadParam(m, iter, &p->transaction_id) && + ReadParam(m, iter, &p->idb_object_store_id); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStoreCreateIndex_Params>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.name, l); + l->append(", "); + LogParam(p.key_path, l); + l->append(", "); + LogParam(p.unique, l); + l->append(", "); + LogParam(p.transaction_id, l); + l->append(", "); + LogParam(p.idb_object_store_id, l); + l->append(")"); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.response_id); + WriteParam(m, p.lower_key); + WriteParam(m, p.upper_key); + WriteParam(m, p.lower_open); + WriteParam(m, p.upper_open); + WriteParam(m, p.direction); + WriteParam(m, p.idb_object_store_id); + WriteParam(m, p.transaction_id); +} + +bool ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->response_id) && + ReadParam(m, iter, &p->lower_key) && + ReadParam(m, iter, &p->upper_key) && + ReadParam(m, iter, &p->lower_open) && + ReadParam(m, iter, &p->upper_open) && + ReadParam(m, iter, &p->direction) && + ReadParam(m, iter, &p->idb_object_store_id) && + ReadParam(m, iter, &p->transaction_id); +} + +void ParamTraits<IndexedDBHostMsg_ObjectStoreOpenCursor_Params>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.response_id, l); + l->append(", "); + LogParam(p.lower_key, l); + l->append(", "); + LogParam(p.upper_key, l); + l->append(", "); + LogParam(p.lower_open, l); + l->append(", "); + LogParam(p.upper_open, l); + l->append(", "); + LogParam(p.direction, l); + l->append(", "); + LogParam(p.idb_object_store_id, l); + l->append(","); + LogParam(p.transaction_id, l); + l->append(")"); +} + +} // namespace IPC diff --git a/chrome/common/indexed_db_messages.h b/chrome/common/indexed_db_messages.h new file mode 100644 index 0000000..8eb77eb --- /dev/null +++ b/chrome/common/indexed_db_messages.h @@ -0,0 +1,493 @@ +// 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 CHROME_COMMON_INDEXED_DB_MESSAGES_H_ +#define CHROME_COMMON_INDEXED_DB_MESSAGES_H_ +#pragma once + +#include "chrome/common/indexed_db_key.h" +#include "chrome/common/indexed_db_param_traits.h" +#include "chrome/common/serialized_script_value.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" +#include "third_party/WebKit/WebKit/chromium/public/WebExceptionCode.h" + +#define IPC_MESSAGE_START IndexedDBMsgStart + +// Used to open an indexed database. +struct IndexedDBHostMsg_FactoryOpen_Params { + IndexedDBHostMsg_FactoryOpen_Params(); + ~IndexedDBHostMsg_FactoryOpen_Params(); + + // The routing ID of the view initiating the open. + int32 routing_id; + + // The response should have this id. + int32 response_id; + + // The origin doing the initiating. + string16 origin; + + // The name of the database. + string16 name; + + // The maximum size of the database. + uint64 maximum_size; +}; + +// Used to create an object store. +struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params { + IndexedDBHostMsg_DatabaseCreateObjectStore_Params(); + ~IndexedDBHostMsg_DatabaseCreateObjectStore_Params(); + + // The name of the object store. + string16 name; + + // The keyPath of the object store. + NullableString16 key_path; + + // Whether the object store created should have a key generator. + bool auto_increment; + + // The transaction this is associated with. + int32 transaction_id; + + // The database the object store belongs to. + int32 idb_database_id; +}; + +// Used to open both cursors and object cursors in IndexedDB. +struct IndexedDBHostMsg_IndexOpenCursor_Params { + IndexedDBHostMsg_IndexOpenCursor_Params(); + ~IndexedDBHostMsg_IndexOpenCursor_Params(); + + // The response should have this id. + int32 response_id; + + // The serialized lower key. + IndexedDBKey lower_key; + + // The serialized upper key. + IndexedDBKey upper_key; + + // Is the lower bound open? + bool lower_open; + + // Is the upper bound open? + bool upper_open; + + // The direction of this cursor. + int32 direction; + + // The index the index belongs to. + int32 idb_index_id; + + // The transaction this request belongs to. + int transaction_id; +}; + +// Used to set a value in an object store. +struct IndexedDBHostMsg_ObjectStorePut_Params { + IndexedDBHostMsg_ObjectStorePut_Params(); + ~IndexedDBHostMsg_ObjectStorePut_Params(); + + // The object store's id. + int32 idb_object_store_id; + + // The id any response should contain. + int32 response_id; + + // The value to set. + SerializedScriptValue serialized_value; + + // The key to set it on (may not be "valid"/set in some cases). + IndexedDBKey key; + + // If it already exists, don't update (just return an error). + bool add_only; + + // The transaction it's associated with. + int transaction_id; +}; + +// Used to create an index. +struct IndexedDBHostMsg_ObjectStoreCreateIndex_Params { + IndexedDBHostMsg_ObjectStoreCreateIndex_Params(); + ~IndexedDBHostMsg_ObjectStoreCreateIndex_Params(); + + // The name of the index. + string16 name; + + // The keyPath of the index. + NullableString16 key_path; + + // Whether the index created has unique keys. + bool unique; + + // The transaction this is associated with. + int32 transaction_id; + + // The object store the index belongs to. + int32 idb_object_store_id; +}; + +// Used to open an IndexedDB cursor. +struct IndexedDBHostMsg_ObjectStoreOpenCursor_Params { + IndexedDBHostMsg_ObjectStoreOpenCursor_Params(); + ~IndexedDBHostMsg_ObjectStoreOpenCursor_Params(); + + // The response should have this id. + int32 response_id; + + // The serialized lower key. + IndexedDBKey lower_key; + + // The serialized upper key. + IndexedDBKey upper_key; + + // Is the lower bound open? + bool lower_open; + + // Is the upper bound open? + bool upper_open; + + // The direction of this cursor. + int32 direction; + + // The object store the cursor belongs to. + int32 idb_object_store_id; + + // The transaction this request belongs to. + int transaction_id; +}; + +namespace IPC { +template <> +struct ParamTraits<IndexedDBHostMsg_FactoryOpen_Params> { + typedef IndexedDBHostMsg_FactoryOpen_Params 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<IndexedDBHostMsg_DatabaseCreateObjectStore_Params> { + typedef IndexedDBHostMsg_DatabaseCreateObjectStore_Params 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<IndexedDBHostMsg_IndexOpenCursor_Params> { + typedef IndexedDBHostMsg_IndexOpenCursor_Params 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<IndexedDBHostMsg_ObjectStorePut_Params> { + typedef IndexedDBHostMsg_ObjectStorePut_Params 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<IndexedDBHostMsg_ObjectStoreCreateIndex_Params> { + typedef IndexedDBHostMsg_ObjectStoreCreateIndex_Params 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<IndexedDBHostMsg_ObjectStoreOpenCursor_Params> { + typedef IndexedDBHostMsg_ObjectStoreOpenCursor_Params 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 + +// Indexed DB messages sent from the browser to the renderer. + +// IDBCallback message handlers. +IPC_MESSAGE_CONTROL1(IndexedDBMsg_CallbacksSuccessNull, + int32 /* response_id */) +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_CallbacksSuccessIDBObjectStore, + int32 /* response_id */, + int32 /* idb_object_store_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 */) + +// 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 */) + + +// 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::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) + +// 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::~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::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 */) + +#endif // CHROME_COMMON_INDEXED_DB_MESSAGES_H_ diff --git a/chrome/common/indexed_db_param_traits.cc b/chrome/common/indexed_db_param_traits.cc index 3bab96e..70c10ff 100644 --- a/chrome/common/indexed_db_param_traits.cc +++ b/chrome/common/indexed_db_param_traits.cc @@ -50,6 +50,7 @@ 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()); } @@ -58,11 +59,14 @@ bool ParamTraits<IndexedDBKey>::Read(const Message* m, 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) { @@ -70,10 +74,13 @@ bool ParamTraits<IndexedDBKey>::Read(const Message* m, r->SetNull(); return true; case WebKit::WebIDBKey::StringType: - r->Set(string); + r->SetString(string); + return true; + case WebKit::WebIDBKey::DateType: + r->SetDate(date); return true; case WebKit::WebIDBKey::NumberType: - r->Set(number); + r->SetNumber(number); return true; case WebKit::WebIDBKey::InvalidType: r->SetInvalid(); @@ -89,6 +96,8 @@ void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) { l->append(", "); LogParam(p.string(), l); l->append(", "); + LogParam(p.date(), l); + l->append(", "); LogParam(p.number(), l); l->append(")"); } diff --git a/chrome/common/json_pref_store.cc b/chrome/common/json_pref_store.cc index d68307f..f5ff728 100644 --- a/chrome/common/json_pref_store.cc +++ b/chrome/common/json_pref_store.cc @@ -30,7 +30,50 @@ JsonPrefStore::~JsonPrefStore() { writer_.DoScheduledWrite(); } -PrefStore::PrefReadError JsonPrefStore::ReadPrefs() { +PrefStore::ReadResult JsonPrefStore::GetValue(const std::string& key, + Value** result) const { + return prefs_->Get(key, result) ? READ_OK : READ_NO_VALUE; +} + +void JsonPrefStore::AddObserver(PrefStore::Observer* observer) { + observers_.AddObserver(observer); +} + +void JsonPrefStore::RemoveObserver(PrefStore::Observer* observer) { + observers_.RemoveObserver(observer); +} + +void JsonPrefStore::SetValue(const std::string& key, Value* value) { + DCHECK(value); + scoped_ptr<Value> new_value(value); + Value* old_value = NULL; + prefs_->Get(key, &old_value); + if (!old_value || !value->Equals(old_value)) { + prefs_->Set(key, new_value.release()); + FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); + } +} + +void JsonPrefStore::SetValueSilently(const std::string& key, Value* value) { + DCHECK(value); + scoped_ptr<Value> new_value(value); + Value* old_value = NULL; + prefs_->Get(key, &old_value); + if (!old_value || !value->Equals(old_value)) + prefs_->Set(key, new_value.release()); +} + +void JsonPrefStore::RemoveValue(const std::string& key) { + if (prefs_->Remove(key, NULL)) { + FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); + } +} + +bool JsonPrefStore::ReadOnly() const { + return read_only_; +} + +PersistentPrefStore::PrefReadError JsonPrefStore::ReadPrefs() { if (path_.empty()) { read_only_ = true; return PREF_READ_ERROR_FILE_NOT_SPECIFIED; diff --git a/chrome/common/json_pref_store.h b/chrome/common/json_pref_store.h index 0407d1e..a587ba0 100644 --- a/chrome/common/json_pref_store.h +++ b/chrome/common/json_pref_store.h @@ -8,9 +8,12 @@ #include <string> +#include "base/basictypes.h" +#include "base/file_path.h" +#include "base/observer_list.h" #include "base/scoped_ptr.h" -#include "chrome/common/pref_store.h" #include "chrome/common/important_file_writer.h" +#include "chrome/common/persistent_pref_store.h" namespace base { class MessageLoopProxy; @@ -18,8 +21,10 @@ class MessageLoopProxy; class DictionaryValue; class FilePath; +class Value; -class JsonPrefStore : public PrefStore, +// A writable PrefStore implementation that is used for user preferences. +class JsonPrefStore : public PersistentPrefStore, public ImportantFileWriter::DataSerializer { public: // |file_message_loop_proxy| is the MessageLoopProxy for a thread on which @@ -28,21 +33,24 @@ class JsonPrefStore : public PrefStore, base::MessageLoopProxy* file_message_loop_proxy); virtual ~JsonPrefStore(); - // PrefStore methods: - virtual bool ReadOnly() { return read_only_; } - - virtual DictionaryValue* prefs() const { return prefs_.get(); } + // PrefStore overrides: + virtual ReadResult GetValue(const std::string& key, Value** result) const; + virtual void AddObserver(PrefStore::Observer* observer); + virtual void RemoveObserver(PrefStore::Observer* observer); + // PersistentPrefStore overrides: + virtual void SetValue(const std::string& key, Value* value); + virtual void SetValueSilently(const std::string& key, Value* value); + virtual void RemoveValue(const std::string& key); + virtual bool ReadOnly() const; virtual PrefReadError ReadPrefs(); - virtual bool WritePrefs(); - virtual void ScheduleWritePrefs(); - // ImportantFileWriter::DataSerializer methods: - virtual bool SerializeData(std::string* data); - private: + // ImportantFileWriter::DataSerializer overrides: + virtual bool SerializeData(std::string* output); + FilePath path_; scoped_ptr<DictionaryValue> prefs_; @@ -51,6 +59,10 @@ class JsonPrefStore : public PrefStore, // Helper for safely writing pref data. ImportantFileWriter writer_; + + ObserverList<PrefStore::Observer, true> observers_; + + DISALLOW_COPY_AND_ASSIGN(JsonPrefStore); }; #endif // CHROME_COMMON_JSON_PREF_STORE_H_ diff --git a/chrome/common/json_pref_store_unittest.cc b/chrome/common/json_pref_store_unittest.cc index e38aba2..326e32d 100644 --- a/chrome/common/json_pref_store_unittest.cc +++ b/chrome/common/json_pref_store_unittest.cc @@ -54,9 +54,9 @@ TEST_F(JsonPrefStoreTest, NonExistentFile) { FilePath bogus_input_file = data_dir_.AppendASCII("read.txt"); ASSERT_FALSE(file_util::PathExists(bogus_input_file)); JsonPrefStore pref_store(bogus_input_file, message_loop_proxy_.get()); - EXPECT_EQ(PrefStore::PREF_READ_ERROR_NO_FILE, pref_store.ReadPrefs()); + EXPECT_EQ(PersistentPrefStore::PREF_READ_ERROR_NO_FILE, + pref_store.ReadPrefs()); EXPECT_FALSE(pref_store.ReadOnly()); - EXPECT_TRUE(pref_store.prefs()->empty()); } // Test fallback behavior for an invalid file. @@ -65,9 +65,9 @@ TEST_F(JsonPrefStoreTest, InvalidFile) { FilePath invalid_file = test_dir_.AppendASCII("invalid.json"); ASSERT_TRUE(file_util::CopyFile(invalid_file_original, invalid_file)); JsonPrefStore pref_store(invalid_file, message_loop_proxy_.get()); - EXPECT_EQ(PrefStore::PREF_READ_ERROR_JSON_PARSE, pref_store.ReadPrefs()); + EXPECT_EQ(PersistentPrefStore::PREF_READ_ERROR_JSON_PARSE, + pref_store.ReadPrefs()); EXPECT_FALSE(pref_store.ReadOnly()); - EXPECT_TRUE(pref_store.prefs()->empty()); // The file should have been moved aside. EXPECT_FALSE(file_util::PathExists(invalid_file)); @@ -85,9 +85,8 @@ TEST_F(JsonPrefStoreTest, Basic) { FilePath input_file = test_dir_.AppendASCII("write.json"); ASSERT_TRUE(file_util::PathExists(input_file)); JsonPrefStore pref_store(input_file, message_loop_proxy_.get()); - ASSERT_EQ(PrefStore::PREF_READ_ERROR_NONE, pref_store.ReadPrefs()); + ASSERT_EQ(PersistentPrefStore::PREF_READ_ERROR_NONE, pref_store.ReadPrefs()); ASSERT_FALSE(pref_store.ReadOnly()); - DictionaryValue* prefs = pref_store.prefs(); // The JSON file looks like this: // { @@ -105,38 +104,55 @@ TEST_F(JsonPrefStoreTest, Basic) { std::string cnn("http://www.cnn.com"); + Value* actual; + EXPECT_EQ(PrefStore::READ_OK, + pref_store.GetValue(prefs::kHomePage, &actual)); std::string string_value; - EXPECT_TRUE(prefs->GetString(prefs::kHomePage, &string_value)); + EXPECT_TRUE(actual->GetAsString(&string_value)); EXPECT_EQ(cnn, string_value); const char kSomeDirectory[] = "some_directory"; + EXPECT_EQ(PrefStore::READ_OK, pref_store.GetValue(kSomeDirectory, &actual)); FilePath::StringType path; - EXPECT_TRUE(prefs->GetString(kSomeDirectory, &path)); + EXPECT_TRUE(actual->GetAsString(&path)); EXPECT_EQ(FilePath::StringType(FILE_PATH_LITERAL("/usr/local/")), path); FilePath some_path(FILE_PATH_LITERAL("/usr/sbin/")); - prefs->SetString(kSomeDirectory, some_path.value()); - EXPECT_TRUE(prefs->GetString(kSomeDirectory, &path)); + + pref_store.SetValue(kSomeDirectory, + Value::CreateStringValue(some_path.value())); + EXPECT_EQ(PrefStore::READ_OK, pref_store.GetValue(kSomeDirectory, &actual)); + EXPECT_TRUE(actual->GetAsString(&path)); EXPECT_EQ(some_path.value(), path); // Test reading some other data types from sub-dictionaries. - bool boolean; - EXPECT_TRUE(prefs->GetBoolean(kNewWindowsInTabs, &boolean)); + EXPECT_EQ(PrefStore::READ_OK, + pref_store.GetValue(kNewWindowsInTabs, &actual)); + bool boolean = false; + EXPECT_TRUE(actual->GetAsBoolean(&boolean)); EXPECT_TRUE(boolean); - prefs->SetBoolean(kNewWindowsInTabs, false); - EXPECT_TRUE(prefs->GetBoolean(kNewWindowsInTabs, &boolean)); + pref_store.SetValue(kNewWindowsInTabs, + Value::CreateBooleanValue(false)); + EXPECT_EQ(PrefStore::READ_OK, + pref_store.GetValue(kNewWindowsInTabs, &actual)); + EXPECT_TRUE(actual->GetAsBoolean(&boolean)); EXPECT_FALSE(boolean); - int integer; - EXPECT_TRUE(prefs->GetInteger(kMaxTabs, &integer)); + EXPECT_EQ(PrefStore::READ_OK, pref_store.GetValue(kMaxTabs, &actual)); + int integer = 0; + EXPECT_TRUE(actual->GetAsInteger(&integer)); EXPECT_EQ(20, integer); - prefs->SetInteger(kMaxTabs, 10); - EXPECT_TRUE(prefs->GetInteger(kMaxTabs, &integer)); + pref_store.SetValue(kMaxTabs, Value::CreateIntegerValue(10)); + EXPECT_EQ(PrefStore::READ_OK, pref_store.GetValue(kMaxTabs, &actual)); + EXPECT_TRUE(actual->GetAsInteger(&integer)); EXPECT_EQ(10, integer); - prefs->SetString(kLongIntPref, base::Int64ToString(214748364842LL)); - EXPECT_TRUE(prefs->GetString(kLongIntPref, &string_value)); + pref_store.SetValue(kLongIntPref, + Value::CreateStringValue( + base::Int64ToString(214748364842LL))); + EXPECT_EQ(PrefStore::READ_OK, pref_store.GetValue(kLongIntPref, &actual)); + EXPECT_TRUE(actual->GetAsString(&string_value)); int64 value; base::StringToInt64(string_value, &value); EXPECT_EQ(214748364842LL, value); diff --git a/chrome/common/json_schema_validator.cc b/chrome/common/json_schema_validator.cc index ee28a89..a76b2d9 100644 --- a/chrome/common/json_schema_validator.cc +++ b/chrome/common/json_schema_validator.cc @@ -159,6 +159,7 @@ JSONSchemaValidator::JSONSchemaValidator(DictionaryValue* schema, } } +JSONSchemaValidator::~JSONSchemaValidator() {} bool JSONSchemaValidator::Validate(Value* instance) { errors_.clear(); diff --git a/chrome/common/json_schema_validator.h b/chrome/common/json_schema_validator.h index 9af31fb..68030f8 100644 --- a/chrome/common/json_schema_validator.h +++ b/chrome/common/json_schema_validator.h @@ -113,6 +113,8 @@ class JSONSchemaValidator { // not be used with untrusted schemas. JSONSchemaValidator(DictionaryValue* schema, ListValue* types); + ~JSONSchemaValidator(); + // Whether the validator allows additional items for objects and lists, beyond // those defined by their schema, by default. // diff --git a/chrome/common/json_value_serializer.h b/chrome/common/json_value_serializer.h index 11b7b7a..e0c9569 100644 --- a/chrome/common/json_value_serializer.h +++ b/chrome/common/json_value_serializer.h @@ -33,12 +33,12 @@ class JSONStringValueSerializer : public ValueSerializer { allow_trailing_comma_(false) { } - ~JSONStringValueSerializer(); + virtual ~JSONStringValueSerializer(); // Attempt to serialize the data structure represented by Value into // JSON. If the return value is true, the result will have been written // into the string passed into the constructor. - bool Serialize(const Value& root); + virtual bool Serialize(const Value& root); // Attempt to deserialize the data structure encoded in the string passed // in to the constructor into a structure of Value objects. If the return @@ -47,7 +47,7 @@ class JSONStringValueSerializer : public ValueSerializer { // If |error_message| is non-null, it will be filled in with a formatted // error message including the location of the error if appropriate. // The caller takes ownership of the returned value. - Value* Deserialize(int* error_code, std::string* error_message); + virtual Value* Deserialize(int* error_code, std::string* error_message); void set_pretty_print(bool new_value) { pretty_print_ = new_value; } bool pretty_print() { return pretty_print_; } @@ -75,7 +75,7 @@ class JSONFileValueSerializer : public ValueSerializer { explicit JSONFileValueSerializer(const FilePath& json_file_path) : json_file_path_(json_file_path) {} - ~JSONFileValueSerializer() {} + virtual ~JSONFileValueSerializer() {} // DO NOT USE except in unit tests to verify the file was written properly. // We should never serialize directly to a file since this will block the @@ -85,7 +85,7 @@ class JSONFileValueSerializer : public ValueSerializer { // Attempt to serialize the data structure represented by Value into // JSON. If the return value is true, the result will have been written // into the file whose name was passed into the constructor. - bool Serialize(const Value& root); + virtual bool Serialize(const Value& root); // Attempt to deserialize the data structure encoded in the file passed // in to the constructor into a structure of Value objects. If the return @@ -94,7 +94,7 @@ class JSONFileValueSerializer : public ValueSerializer { // If |error_message| is non-null, it will be filled in with a formatted // error message including the location of the error if appropriate. // The caller takes ownership of the returned value. - Value* Deserialize(int* error_code, std::string* error_message); + virtual Value* Deserialize(int* error_code, std::string* error_message); // This enum is designed to safely overlap with JSONReader::JsonParseError. enum JsonFileError { diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc index 196c581..c607f21 100644 --- a/chrome/common/logging_chrome.cc +++ b/chrome/common/logging_chrome.cc @@ -164,23 +164,17 @@ FilePath SetUpSymlinkIfNeeded(const FilePath& symlink_path, bool new_log) { target_path = GenerateTimestampedName(symlink_path, base::Time::Now()); // We don't care if the unlink fails; we're going to continue anyway. - if (unlink(symlink_path.value().c_str()) == -1) { + if (::unlink(symlink_path.value().c_str()) == -1) { if (symlink_exists) // only warn if we might expect it to succeed. PLOG(WARNING) << "Unable to unlink " << symlink_path.value(); } - if (symlink(target_path.value().c_str(), - symlink_path.value().c_str()) == -1) { + if (!file_util::CreateSymbolicLink(target_path, symlink_path)) { PLOG(ERROR) << "Unable to create symlink " << symlink_path.value() << " pointing at " << target_path.value(); } } else { - char buf[PATH_MAX]; - ssize_t count = readlink(symlink_path.value().c_str(), buf, arraysize(buf)); - if (count > 0) { - target_path = FilePath(FilePath::StringType(buf, count)); - } else { + if (!file_util::ReadSymbolicLink(symlink_path, &target_path)) PLOG(ERROR) << "Unable to read symlink " << symlink_path.value(); - } } return target_path; } @@ -244,7 +238,7 @@ void InitChromeLogging(const CommandLine& command_line, "Attempted to initialize logging when it was already initialized."; #if defined(OS_POSIX) && defined(IPC_MESSAGE_LOG_ENABLED) - IPC::Logging::SetLoggerFunctions(g_log_function_mapping); + IPC::Logging::set_log_function_map(&g_log_function_mapping); #endif FilePath log_path = GetLogFileName(); diff --git a/chrome/common/message_router.cc b/chrome/common/message_router.cc index 6bd6e95..b3ea596 100644 --- a/chrome/common/message_router.cc +++ b/chrome/common/message_router.cc @@ -10,9 +10,10 @@ MessageRouter::MessageRouter() { MessageRouter::~MessageRouter() { } -void MessageRouter::OnControlMessageReceived(const IPC::Message& msg) { +bool MessageRouter::OnControlMessageReceived(const IPC::Message& msg) { NOTREACHED() << "should override in subclass if you care about control messages"; + return false; } bool MessageRouter::Send(IPC::Message* msg) { @@ -30,12 +31,11 @@ void MessageRouter::RemoveRoute(int32 routing_id) { routes_.Remove(routing_id); } -void MessageRouter::OnMessageReceived(const IPC::Message& msg) { - if (msg.routing_id() == MSG_ROUTING_CONTROL) { - OnControlMessageReceived(msg); - } else { - RouteMessage(msg); - } +bool MessageRouter::OnMessageReceived(const IPC::Message& msg) { + if (msg.routing_id() == MSG_ROUTING_CONTROL) + return OnControlMessageReceived(msg); + + return RouteMessage(msg); } bool MessageRouter::RouteMessage(const IPC::Message& msg) { diff --git a/chrome/common/message_router.h b/chrome/common/message_router.h index 6a61091..e6709be 100644 --- a/chrome/common/message_router.h +++ b/chrome/common/message_router.h @@ -34,10 +34,10 @@ class MessageRouter : public IPC::Channel::Listener, virtual ~MessageRouter(); // Implemented by subclasses to handle control messages - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); // Like OnMessageReceived, except it only handles routed messages. Returns // true if the message was dispatched, or false if there was no listener for diff --git a/chrome/common/metrics_helpers.cc b/chrome/common/metrics_helpers.cc index 6462383..c452937 100644 --- a/chrome/common/metrics_helpers.cc +++ b/chrome/common/metrics_helpers.cc @@ -377,6 +377,10 @@ int64 MetricsLogBase::GetBuildTime() { return integral_build_time; } +MetricsLog* MetricsLogBase::AsMetricsLog() { + return NULL; +} + // TODO(JAR): A The following should really be part of the histogram class. // Internal state is being needlessly exposed, and it would be hard to reuse // this code. If we moved this into the Histogram class, then we could use @@ -499,6 +503,10 @@ void MetricsServiceBase::SnapshotProblemResolved(int amount) { std::abs(amount)); } +HistogramSender::HistogramSender() {} + +HistogramSender::~HistogramSender() {} + void HistogramSender::TransmitAllHistograms(Histogram::Flags flag_to_set, bool send_only_uma) { StatisticsRecorder::Histograms histograms; diff --git a/chrome/common/metrics_helpers.h b/chrome/common/metrics_helpers.h index b261488..3de3fbd 100644 --- a/chrome/common/metrics_helpers.h +++ b/chrome/common/metrics_helpers.h @@ -99,9 +99,7 @@ class MetricsLogBase { version_extension_ = extension; } - virtual MetricsLog* AsMetricsLog() { - return NULL; - } + virtual MetricsLog* AsMetricsLog(); protected: class XmlWrapper; @@ -185,8 +183,8 @@ class MetricsLogBase { // onward. class HistogramSender { protected: - HistogramSender() {} - virtual ~HistogramSender() {} + HistogramSender(); + virtual ~HistogramSender(); // Snapshot all histograms, and transmit the delta. // The arguments allow a derived class to select only a subset for diff --git a/chrome/common/mime_registry_messages.cc b/chrome/common/mime_registry_messages.cc new file mode 100644 index 0000000..e8c2b9b --- /dev/null +++ b/chrome/common/mime_registry_messages.cc @@ -0,0 +1,8 @@ +// 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 "chrome/common/common_param_traits.h" + +#define IPC_MESSAGE_IMPL +#include "chrome/common/mime_registry_messages.h" diff --git a/chrome/common/mime_registry_messages.h b/chrome/common/mime_registry_messages.h new file mode 100644 index 0000000..636009f --- /dev/null +++ b/chrome/common/mime_registry_messages.h @@ -0,0 +1,28 @@ +// 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 CHROME_COMMON_MIME_REGISTRY_MESSAGES_H_ +#define CHROME_COMMON_MIME_REGISTRY_MESSAGES_H_ +#pragma once + +#include "base/file_path.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" + +#define IPC_MESSAGE_START MimeRegistryMsgStart + +// Mime registry messages sent from the renderer to the browser. + +// Sent to query MIME information. +IPC_SYNC_MESSAGE_CONTROL1_1(MimeRegistryMsg_GetMimeTypeFromExtension, + FilePath::StringType /* extension */, + std::string /* mime_type */) +IPC_SYNC_MESSAGE_CONTROL1_1(MimeRegistryMsg_GetMimeTypeFromFile, + FilePath /* file_path */, + std::string /* mime_type */) +IPC_SYNC_MESSAGE_CONTROL1_1(MimeRegistryMsg_GetPreferredExtensionForMimeType, + std::string /* mime_type */, + FilePath::StringType /* extension */) + +#endif // CHROME_COMMON_MIME_REGISTRY_MESSAGES_H_ diff --git a/chrome/common/nacl_messages.cc b/chrome/common/nacl_messages.cc index 291ed5a..1b2aff9 100644 --- a/chrome/common/nacl_messages.cc +++ b/chrome/common/nacl_messages.cc @@ -2,8 +2,5 @@ // 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 "chrome/common/nacl_messages.h" - -#define MESSAGES_INTERNAL_IMPL_FILE \ - "chrome/common/nacl_messages_internal.h" -#include "ipc/ipc_message_impl_macros.h" diff --git a/chrome/common/nacl_messages.h b/chrome/common/nacl_messages.h index 11abf19..6c7c771 100644 --- a/chrome/common/nacl_messages.h +++ b/chrome/common/nacl_messages.h @@ -8,11 +8,6 @@ #define CHROME_COMMON_NACL_MESSAGES_H_ #pragma once -#include "base/basictypes.h" -#include "ipc/ipc_message_utils.h" - -#define MESSAGES_INTERNAL_FILE "chrome/common/nacl_messages_internal.h" -#include "ipc/ipc_message_macros.h" +#include "chrome/common/nacl_messages_internal.h" #endif // CHROME_COMMON_NACL_MESSAGES_H_ - diff --git a/chrome/common/nacl_messages_internal.h b/chrome/common/nacl_messages_internal.h index e302118..ea96a03 100644 --- a/chrome/common/nacl_messages_internal.h +++ b/chrome/common/nacl_messages_internal.h @@ -6,25 +6,24 @@ #include "chrome/common/nacl_types.h" #include "ipc/ipc_message_macros.h" +#define IPC_MESSAGE_START NaClMsgStart + //----------------------------------------------------------------------------- // NaClProcess messages // These are messages sent from the browser to the NaCl process. -IPC_BEGIN_MESSAGES(NaClProcess) - // Tells the NaCl process to start. - IPC_MESSAGE_CONTROL1(NaClProcessMsg_Start, - std::vector<nacl::FileDescriptor> /* sockets */) - - // Tells the NaCl broker to launch a NaCl loader process. - IPC_MESSAGE_CONTROL1(NaClProcessMsg_LaunchLoaderThroughBroker, - std::wstring /* channel ID for the loader */) +// Tells the NaCl process to start. +IPC_MESSAGE_CONTROL1(NaClProcessMsg_Start, + std::vector<nacl::FileDescriptor> /* sockets */) - // Notify the browser process that the loader was launched successfully. - IPC_MESSAGE_CONTROL2(NaClProcessMsg_LoaderLaunched, - std::wstring, /* channel ID for the loader */ - base::ProcessHandle /* loader process handle */) +// Tells the NaCl broker to launch a NaCl loader process. +IPC_MESSAGE_CONTROL1(NaClProcessMsg_LaunchLoaderThroughBroker, + std::wstring /* channel ID for the loader */) - // Notify the broker that all loader processes have been terminated and it - // should shutdown. - IPC_MESSAGE_CONTROL0(NaClProcessMsg_StopBroker) -IPC_END_MESSAGES(NaClProcess) +// Notify the browser process that the loader was launched successfully. +IPC_MESSAGE_CONTROL2(NaClProcessMsg_LoaderLaunched, + std::wstring, /* channel ID for the loader */ + base::ProcessHandle /* loader process handle */) +// Notify the broker that all loader processes have been terminated and it +// should shutdown. +IPC_MESSAGE_CONTROL0(NaClProcessMsg_StopBroker) diff --git a/chrome/common/native_web_keyboard_event.h b/chrome/common/native_web_keyboard_event.h index 4f6548d..1ed0cb1 100644 --- a/chrome/common/native_web_keyboard_event.h +++ b/chrome/common/native_web_keyboard_event.h @@ -59,6 +59,13 @@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent { // it is hit in ime mode. // Currently, it's only used by Linux and Mac ports. bool skip_in_browser; + +#if defined(OS_LINUX) + // True if the key event matches an edit command. In order to ensure the edit + // command always work in web page, the browser should not pre-handle this key + // event as a reserved accelerator. See http://crbug.com/54573 + bool match_edit_command; +#endif }; #endif // CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_ diff --git a/chrome/common/native_web_keyboard_event_linux.cc b/chrome/common/native_web_keyboard_event_linux.cc index 571550e..7165c98 100644 --- a/chrome/common/native_web_keyboard_event_linux.cc +++ b/chrome/common/native_web_keyboard_event_linux.cc @@ -33,12 +33,14 @@ void FreeEvent(GdkEventKey* event) { NativeWebKeyboardEvent::NativeWebKeyboardEvent() : os_event(NULL), - skip_in_browser(false) { + skip_in_browser(false), + match_edit_command(false) { } NativeWebKeyboardEvent::NativeWebKeyboardEvent(const GdkEventKey* native_event) : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(native_event)), - skip_in_browser(false) { + skip_in_browser(false), + match_edit_command(false) { CopyEventTo(native_event, &os_event); } @@ -49,13 +51,15 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character, state, time_stamp_seconds)), os_event(NULL), - skip_in_browser(false) { + skip_in_browser(false), + match_edit_command(false) { } NativeWebKeyboardEvent::NativeWebKeyboardEvent( const NativeWebKeyboardEvent& other) : WebKeyboardEvent(other), - skip_in_browser(other.skip_in_browser) { + skip_in_browser(other.skip_in_browser), + match_edit_command(other.match_edit_command) { CopyEventTo(other.os_event, &os_event); } @@ -67,6 +71,7 @@ NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=( CopyEventTo(other.os_event, &os_event); skip_in_browser = other.skip_in_browser; + match_edit_command = other.match_edit_command; return *this; } diff --git a/chrome/common/navigation_gesture.h b/chrome/common/navigation_gesture.h index e27ea4c..729f4d2 100644 --- a/chrome/common/navigation_gesture.h +++ b/chrome/common/navigation_gesture.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// 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. @@ -7,17 +7,14 @@ #pragma once enum NavigationGesture { - NavigationGestureUser, // User initiated navigation/load. This is not - // currently used due to the untrustworthy nature - // of userGestureHint (wasRunByUserGesture). See - // bug 1051891. - NavigationGestureAuto, // Non-user initiated navigation / load. For example - // onload or setTimeout triggered document.location - // changes, and form.submits. See bug 1046841 for - // some cases that should be treated this way but - // aren't yet. - NavigationGestureUnknown, // What we assign when userGestureHint returns true - // because we can't trust it. + // User initiated navigation/load. + NavigationGestureUser, + // Non-user initiated navigation/load. For example, onload- or + // setTimeout-triggered document.location changes and form.submits. See + // http://b/1046841 for some cases that should be treated this way but aren't. + NavigationGestureAuto, + // Initial state. + NavigationGestureUnknown, }; #endif // CHROME_COMMON_NAVIGATION_GESTURE_H_ diff --git a/chrome/common/net/gaia/gaia_auth_fetcher.h b/chrome/common/net/gaia/gaia_auth_fetcher.h index e0fe76e..1a1602d 100644 --- a/chrome/common/net/gaia/gaia_auth_fetcher.h +++ b/chrome/common/net/gaia/gaia_auth_fetcher.h @@ -74,12 +74,12 @@ class GaiaAuthFetcher : public URLFetcher::Delegate { const std::string& info_key); // Implementation of URLFetcher::Delegate - void OnURLFetchComplete(const URLFetcher* source, - const GURL& url, - const URLRequestStatus& status, - int response_code, - const ResponseCookies& cookies, - const std::string& data); + virtual void OnURLFetchComplete(const URLFetcher* source, + const GURL& url, + const URLRequestStatus& status, + int response_code, + const ResponseCookies& cookies, + const std::string& data); // StartClientLogin been called && results not back yet? bool HasPendingFetch(); diff --git a/chrome/common/net/gaia/gaia_authenticator.cc b/chrome/common/net/gaia/gaia_authenticator.cc index 563ee3a..36d060e 100644 --- a/chrome/common/net/gaia/gaia_authenticator.cc +++ b/chrome/common/net/gaia/gaia_authenticator.cc @@ -196,6 +196,13 @@ bool GaiaAuthenticator::PerformGaiaRequest(const AuthParams& params, } } +bool GaiaAuthenticator::Post(const GURL& url, + const std::string& post_body, + unsigned long* response_code, + std::string* response_body) { + return false; +} + bool GaiaAuthenticator::LookupEmail(AuthResults* results) { DCHECK_EQ(MessageLoop::current(), message_loop_); // Use the provided Gaia server, but change the path to what V1 expects. @@ -238,6 +245,11 @@ bool GaiaAuthenticator::LookupEmail(AuthResults* results) { return false; } +int GaiaAuthenticator::GetBackoffDelaySeconds(int current_backoff_delay) { + NOTREACHED(); + return current_backoff_delay; +} + // We need to call this explicitly when we need to obtain a long-lived session // token. bool GaiaAuthenticator::IssueAuthToken(AuthResults* results, diff --git a/chrome/common/net/gaia/gaia_authenticator.h b/chrome/common/net/gaia/gaia_authenticator.h index 789863e..be1b2d9 100644 --- a/chrome/common/net/gaia/gaia_authenticator.h +++ b/chrome/common/net/gaia/gaia_authenticator.h @@ -180,9 +180,7 @@ class GaiaAuthenticator { virtual bool PerformGaiaRequest(const AuthParams& params, AuthResults* results); virtual bool Post(const GURL& url, const std::string& post_body, - unsigned long* response_code, std::string* response_body) { - return false; - } + unsigned long* response_code, std::string* response_body); // Caller should fill in results->LSID before calling. Result in // results->primary_email. @@ -193,10 +191,7 @@ class GaiaAuthenticator { // TODO(sanjeevr): This should be made pure virtual. But this class is // currently directly being used in sync/engine/authenticator.cc, which is // wrong. - virtual int GetBackoffDelaySeconds(int current_backoff_delay) { - NOTREACHED(); - return current_backoff_delay; - } + virtual int GetBackoffDelaySeconds(int current_backoff_delay); public: // Retrieve email. diff --git a/chrome/common/net/http_return.h b/chrome/common/net/http_return.h index 7cb7731..517a849 100644 --- a/chrome/common/net/http_return.h +++ b/chrome/common/net/http_return.h @@ -10,9 +10,10 @@ // contains a few HTTP return codes. Add more HTTP return codes. enum HTTPReturnCode { RC_REQUEST_OK = 200, + RC_BAD_REQUEST = 400, RC_UNAUTHORIZED = 401, RC_FORBIDDEN = 403, + RC_INTERNAL_SERVER_ERROR = 500, }; #endif // CHROME_COMMON_NET_HTTP_RETURN_H_ - diff --git a/chrome/common/net/url_fetcher.cc b/chrome/common/net/url_fetcher.cc index 64a12f8..81b47cf 100644 --- a/chrome/common/net/url_fetcher.cc +++ b/chrome/common/net/url_fetcher.cc @@ -35,7 +35,7 @@ bool URLFetcher::g_interception_enabled = false; class URLFetcher::Core : public base::RefCountedThreadSafe<URLFetcher::Core>, - public URLRequest::Delegate { + public net::URLRequest::Delegate { public: // For POST requests, set |content_type| to the MIME type of the content // and set |content| to the data to upload. |flags| are flags to apply to @@ -61,9 +61,9 @@ class URLFetcher::Core // Reports that the received content was malformed. void ReceivedContentWasMalformed(); - // URLRequest::Delegate implementation. - virtual void OnResponseStarted(URLRequest* request); - virtual void OnReadCompleted(URLRequest* request, int bytes_read); + // Overridden from net::URLRequest::Delegate: + virtual void OnResponseStarted(net::URLRequest* request); + virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); URLFetcher::Delegate* delegate() const { return delegate_; } @@ -117,7 +117,7 @@ class URLFetcher::Core scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; // The message loop proxy for the thread // on which the request IO happens. - scoped_ptr<URLRequest> request_; // The actual request this wraps + scoped_ptr<net::URLRequest> request_; // The actual request this wraps int load_flags_; // Flags for the load operation int response_code_; // HTTP status code for the request std::string data_; // Results of the request @@ -273,7 +273,7 @@ void URLFetcher::Core::CancelAll() { g_registry.Get().CancelAll(); } -void URLFetcher::Core::OnResponseStarted(URLRequest* request) { +void URLFetcher::Core::OnResponseStarted(net::URLRequest* request) { DCHECK_EQ(request, request_.get()); DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); if (request_->status().is_success()) { @@ -291,7 +291,8 @@ void URLFetcher::Core::OnResponseStarted(URLRequest* request) { OnReadCompleted(request_.get(), bytes_read); } -void URLFetcher::Core::OnReadCompleted(URLRequest* request, int bytes_read) { +void URLFetcher::Core::OnReadCompleted(net::URLRequest* request, + int bytes_read) { DCHECK(request == request_); DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); @@ -337,7 +338,7 @@ void URLFetcher::Core::StartURLRequest() { DCHECK(!request_.get()); g_registry.Get().AddURLFetcherCore(this); - request_.reset(new URLRequest(original_url_, this)); + request_.reset(new net::URLRequest(original_url_, this)); int flags = request_->load_flags() | load_flags_; if (!g_interception_enabled) { flags = flags | net::LOAD_DISABLE_INTERCEPT; diff --git a/chrome/common/net/url_fetcher.h b/chrome/common/net/url_fetcher.h index 78ad752..87eef4e 100644 --- a/chrome/common/net/url_fetcher.h +++ b/chrome/common/net/url_fetcher.h @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// This file contains URLFetcher, a wrapper around URLRequest that handles +// This file contains URLFetcher, a wrapper around net::URLRequest that handles // low-level details like thread safety, ref counting, and incremental buffer // reading. This is useful for callers who simply want to get the data from a // URL and don't care about all the nitty-gritty details. diff --git a/chrome/common/net/url_fetcher_unittest.cc b/chrome/common/net/url_fetcher_unittest.cc index c231dca..d1f7ef3 100644 --- a/chrome/common/net/url_fetcher_unittest.cc +++ b/chrome/common/net/url_fetcher_unittest.cc @@ -409,7 +409,7 @@ URLFetcherBadHTTPSTest::URLFetcherBadHTTPSTest() { // The "server certificate expired" error should result in automatic // cancellation of the request by -// URLRequest::Delegate::OnSSLCertificateError. +// net::URLRequest::Delegate::OnSSLCertificateError. void URLFetcherBadHTTPSTest::OnURLFetchComplete( const URLFetcher* source, const GURL& url, diff --git a/chrome/common/net/url_request_intercept_job.cc b/chrome/common/net/url_request_intercept_job.cc index 329eea6..641a8e8 100644 --- a/chrome/common/net/url_request_intercept_job.cc +++ b/chrome/common/net/url_request_intercept_job.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// 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. // @@ -8,10 +8,13 @@ #include "chrome/common/net/url_request_intercept_job.h" +#include <vector> + +#include "base/compiler_specific.h" #include "base/message_loop.h" #include "base/string_util.h" #include "chrome/common/chrome_plugin_lib.h" -#include "chrome/common/notification_service.h" +#include "chrome/common/notification_source.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/base/x509_certificate.h" @@ -25,13 +28,14 @@ using base::TimeDelta; // URLRequestInterceptJob // -URLRequestInterceptJob::URLRequestInterceptJob(URLRequest* request, +URLRequestInterceptJob::URLRequestInterceptJob(net::URLRequest* request, ChromePluginLib* plugin, ScopableCPRequest* cprequest) - : URLRequestJob(request), + : net::URLRequestJob(request), cprequest_(cprequest), plugin_(plugin), - read_buffer_(NULL) { + read_buffer_(NULL), + ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { cprequest_->data = this; // see FromCPRequest(). registrar_.Add(this, NotificationType::CHROME_PLUGIN_UNLOADED, @@ -53,8 +57,10 @@ void URLRequestInterceptJob::DetachPlugin() { void URLRequestInterceptJob::Start() { // Start reading asynchronously so that all error reporting and data // callbacks happen as they would for network requests. - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( - this, &URLRequestInterceptJob::StartAsync)); + MessageLoop::current()->PostTask( + FROM_HERE, + method_factory_.NewRunnableMethod( + &URLRequestInterceptJob::StartAsync)); } void URLRequestInterceptJob::Kill() { @@ -63,7 +69,8 @@ void URLRequestInterceptJob::Kill() { CPERR_CANCELLED); DetachPlugin(); } - URLRequestJob::Kill(); + net::URLRequestJob::Kill(); + method_factory_.RevokeAll(); } bool URLRequestInterceptJob::ReadRawData(net::IOBuffer* dest, int dest_size, diff --git a/chrome/common/net/url_request_intercept_job.h b/chrome/common/net/url_request_intercept_job.h index 6d47bfc..581b30a 100644 --- a/chrome/common/net/url_request_intercept_job.h +++ b/chrome/common/net/url_request_intercept_job.h @@ -9,6 +9,7 @@ #include <string> #include "base/scoped_ptr.h" +#include "base/task.h" #include "net/url_request/url_request_job.h" #include "chrome/common/chrome_plugin_api.h" #include "chrome/common/chrome_plugin_util.h" @@ -36,7 +37,7 @@ class URLRequestInterceptJob : public net::URLRequestJob, void OnStartCompleted(int result); void OnReadCompleted(int bytes_read); - // URLRequestJob + // net::URLRequestJob virtual void Start(); virtual void Kill(); virtual bool GetMimeType(std::string* mime_type) const; @@ -64,6 +65,7 @@ class URLRequestInterceptJob : public net::URLRequestJob, ChromePluginLib* plugin_; net::IOBuffer* read_buffer_; int read_buffer_size_; + ScopedRunnableMethodFactory<URLRequestInterceptJob> method_factory_; DISALLOW_COPY_AND_ASSIGN(URLRequestInterceptJob); }; diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index e2da69c..e7484aa 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -117,12 +117,12 @@ class NotificationType { // The DOM for a frame was fully constructed, but referenced resources // might not be fully loaded yet. The source is a // Source<NavigationController> corresponding to the tab in which the load - // occurred. Details are the long long frame ID. + // occurred. Details are the int64 frame ID. FRAME_DOM_CONTENT_LOADED, // The frame finished loading. The source is a Source<NavigationController> // corresponding to the tab in which the load occurred. Details are the - // long long frame ID. + // int64 frame ID. FRAME_DID_FINISH_LOAD, // Content was loaded from an in-memory cache. The source will be a @@ -183,16 +183,6 @@ class NotificationType { // change. There are no details. SSL_INTERNAL_STATE_CHANGED, - // Lets resource handlers and other interested observers know when the - // message filter is being deleted and can no longer be used. This will - // also get sent if the renderer crashes (and in that case, it'll be sent - // twice). - RESOURCE_MESSAGE_FILTER_SHUTDOWN, - - // Lets interested observers know when a WorkerProcessHost is being deleted - // and can no longer be used. - WORKER_PROCESS_HOST_SHUTDOWN, - // Views ------------------------------------------------------------------- // Notification that a view was removed from a view hierarchy. The source @@ -502,7 +492,8 @@ class NotificationType { WEB_CACHE_STATS_OBSERVED, // The focused element inside a page has changed. The source is the render - // view host for the page, there are no details. + // view host for the page. The details are a Details<const bool> that + // indicates whether or not an editable node was focused. FOCUS_CHANGED_IN_PAGE, // Notification posted from ExecuteJavascriptInWebFrameNotifyResult. The @@ -510,7 +501,7 @@ class NotificationType { // invoked on. The details are a std::pair<int, Value*> with the int giving // the id returned from ExecuteJavascriptInWebFrameNotifyResult and the // Value the results of the javascript expression. The Value is owned by - // RenderViewHost. + // RenderViewHost and may be a Null Value. EXECUTE_JAVASCRIPT_RESULT, // BackgroundContents ------------------------------------------------------ @@ -548,12 +539,20 @@ class NotificationType { // The details are in a Details<ChildProcessInfo>. CHILD_PROCESS_HOST_DISCONNECTED, - // This message is sent when a child process disappears unexpectedly. - // There is no usable source, since it is sent from an ephemeral task; - // register for AllSources() to receive this notification. The details are - // in a Details<ChildProcessInfo>. + // This message is sent when a child process disappears + // unexpectedly as a result of a crash. There is no usable + // source, since it is sent from an ephemeral task; register for + // AllSources() to receive this notification. The details are in + // a Details<ChildProcessInfo>. CHILD_PROCESS_CRASHED, + // This message is sent when a child process disappears + // unexpectedly as a result of a termination signal. There is no + // usable source, since it is sent from an ephemeral task; + // register for AllSources() to receive this notification. The + // details are in a Details<ChildProcessInfo>. + CHILD_PROCESS_WAS_KILLED, + // This message indicates that an instance of a particular child was // created in a page. (If one page contains several regions rendered by // the same child, this notification will occur once for each region @@ -736,6 +735,10 @@ class NotificationType { // PrefService and the details a std::string of the changed path. PREF_CHANGED, + // This is broadcast after the preference subsystem has completed + // asynchronous initalization of a PrefService. + PREF_INITIALIZATION_COMPLETED, + // Sent when a default request context has been created, so calling // Profile::GetDefaultRequestContext() will not return NULL. This is sent // on the thread where Profile::GetRequestContext() is first called, which @@ -851,16 +854,13 @@ class NotificationType { EXTENSION_UNINSTALLED, // Sent when an extension is unloaded. This happens when an extension is - // uninstalled or disabled. The details are an Extension, and the source is - // a Profile. + // uninstalled or disabled. The details are an UnloadedExtensionInfo, and + // the source is a Profile. // - // Note that when this notification is sent, ExtensionsService has already + // Note that when this notification is sent, ExtensionService has already // removed the extension from its internal state. EXTENSION_UNLOADED, - // Same as above, but for a disabled extension. - EXTENSION_UNLOADED_DISABLED, - // Sent when an extension has updated its user scripts. The details are an // Extension, and the source is a Profile. EXTENSION_USER_SCRIPTS_UPDATED, @@ -1103,6 +1103,11 @@ class NotificationType { // details are None. DESKTOP_NOTIFICATION_SETTINGS_CHANGED, + // Sent when the geolocation settings change. The source is the + // GeolocationContentSettingsMap object, the details are + // ContentSettingsNotificationsDetails. + GEOLOCATION_SETTINGS_CHANGED, + // Sync -------------------------------------------------------------------- // Sent when the sync backend has been paused. @@ -1247,6 +1252,9 @@ class NotificationType { // os device has failed. OWNER_KEY_FETCH_ATTEMPT_FAILED, + // Sent after device was successfully owned. + OWNERSHIP_TAKEN, + // This is sent to a ChromeOS settings observer when a system setting is // changed. The source is the CrosSettings and the details a std::string of // the changed setting. @@ -1286,19 +1294,6 @@ class NotificationType { // |webkit_glue::PasswordForm|s that were affected. LOGINS_CHANGED, - // Configuration Policy ---------------------------------------------------- - // This notification is sent whenever the administrator changes policy. - // The detail of this notification is not used. - POLICY_CHANGED, - - // This notification is sent whenever the device token becomes available - // that the policy subsystem uses to fetch policy from the cloud. - DEVICE_TOKEN_AVAILABLE, - - // This notification is sent whenever cloud policies are fetched and - // updated. The detail of this notification is not used. - CLOUD_POLICY_UPDATE, - // Count (must be last) ---------------------------------------------------- // Used to determine the number of notification types. Not valid as // a type parameter when registering for or posting notifications. diff --git a/chrome/common/pepper_file_messages.cc b/chrome/common/pepper_file_messages.cc new file mode 100644 index 0000000..30f6ad1 --- /dev/null +++ b/chrome/common/pepper_file_messages.cc @@ -0,0 +1,34 @@ +// 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 "chrome/common/common_param_traits.h" + +#define IPC_MESSAGE_IMPL +#include "chrome/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(")"); +} + +} // namespace IPC diff --git a/chrome/common/pepper_file_messages.h b/chrome/common/pepper_file_messages.h new file mode 100644 index 0000000..657b3e3 --- /dev/null +++ b/chrome/common/pepper_file_messages.h @@ -0,0 +1,68 @@ +// 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 CHROME_COMMON_PEPPER_FILE_MESSAGES_H_ +#define CHROME_COMMON_PEPPER_FILE_MESSAGES_H_ +#pragma once + +#include "chrome/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" + +#define IPC_MESSAGE_START PepperFileMsgStart + +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); +}; + +} // namespace IPC + +// Trusted Pepper Filesystem messages from the renderer to the browser. + +// Open the file. +IPC_SYNC_MESSAGE_CONTROL2_2(PepperFileMsg_OpenFile, + FilePath /* path */, + int /* flags */, + base::PlatformFileError /* error_code */, + IPC::PlatformFileForTransit /* result */) + +// Rename the file. +IPC_SYNC_MESSAGE_CONTROL2_1(PepperFileMsg_RenameFile, + FilePath /* path_from */, + FilePath /* path_to */, + base::PlatformFileError /* error_code */) + +// Delete the file. +IPC_SYNC_MESSAGE_CONTROL2_1(PepperFileMsg_DeleteFileOrDir, + FilePath /* path */, + bool /* recursive */, + base::PlatformFileError /* error_code */) + +// Create the directory. +IPC_SYNC_MESSAGE_CONTROL1_1(PepperFileMsg_CreateDir, + FilePath /* path */, + base::PlatformFileError /* error_code */) + +// Query the file's info. +IPC_SYNC_MESSAGE_CONTROL1_2(PepperFileMsg_QueryFile, + FilePath /* path */, + base::PlatformFileInfo, /* info */ + base::PlatformFileError /* error_code */) + +// Get the directory's contents. +IPC_SYNC_MESSAGE_CONTROL1_2(PepperFileMsg_GetDirContents, + FilePath /* path */, + webkit::ppapi::DirContents, /* contents */ + base::PlatformFileError /* error_code */) + +#endif // CHROME_COMMON_PEPPER_FILE_MESSAGES_H_ diff --git a/chrome/common/pepper_plugin_registry.cc b/chrome/common/pepper_plugin_registry.cc index f812afd..5223e55 100644 --- a/chrome/common/pepper_plugin_registry.cc +++ b/chrome/common/pepper_plugin_registry.cc @@ -21,6 +21,14 @@ const char* PepperPluginRegistry::kPDFPluginExtension = "pdf"; const char* PepperPluginRegistry::kPDFPluginDescription = "Portable Document Format"; +const char* PepperPluginRegistry::kNaClPluginName = "Chrome NaCl"; +const char* PepperPluginRegistry::kNaClPluginMimeType = + "application/x-ppapi-nacl-srpc"; +const char* PepperPluginRegistry::kNaClPluginExtension = "nexe"; +const char* PepperPluginRegistry::kNaClPluginDescription = + "Native Client Executable"; + + PepperPluginInfo::PepperPluginInfo() : is_internal(false), is_out_of_process(false) { @@ -30,8 +38,12 @@ PepperPluginInfo::~PepperPluginInfo() {} // static PepperPluginRegistry* PepperPluginRegistry::GetInstance() { - static PepperPluginRegistry registry; - return ®istry; + static PepperPluginRegistry* registry = NULL; + // This object leaks. It is a temporary hack to work around a crash. + // http://code.google.com/p/chromium/issues/detail?id=63234 + if (!registry) + registry = new PepperPluginRegistry; + return registry; } // static @@ -136,6 +148,27 @@ void PepperPluginRegistry::GetExtraPlugins( skip_pdf_file_check = true; } } + + // Verify that we enable nacl on the command line. The name of the + // switch varies between the browser and renderer process. + bool enable_nacl = + CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaCl) || + CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl); + + static bool skip_nacl_file_check = false; + if (enable_nacl && PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { + if (skip_nacl_file_check || file_util::PathExists(path)) { + PepperPluginInfo nacl; + nacl.path = path; + nacl.name = kNaClPluginName; + nacl.mime_types.push_back(kNaClPluginMimeType); + nacl.file_extensions = kNaClPluginExtension; + nacl.type_descriptions = kNaClPluginDescription; + plugins->push_back(nacl); + + skip_nacl_file_check = true; + } + } } PepperPluginRegistry::InternalPluginInfo::InternalPluginInfo() { @@ -187,7 +220,7 @@ bool PepperPluginRegistry::RunOutOfProcessForPlugin( return false; } -pepper::PluginModule* PepperPluginRegistry::GetModule( +webkit::ppapi::PluginModule* PepperPluginRegistry::GetModule( const FilePath& path) const { ModuleMap::const_iterator it = modules_.find(path); if (it == modules_.end()) @@ -207,9 +240,8 @@ PepperPluginRegistry::PepperPluginRegistry() { it != internal_plugin_info.end(); ++it) { const FilePath& path = it->path; - ModuleHandle module = - pepper::PluginModule::CreateInternalModule(it->entry_points); - if (!module) { + ModuleHandle module(new webkit::ppapi::PluginModule); + if (!module->InitAsInternalPlugin(it->entry_points)) { DLOG(ERROR) << "Failed to load pepper module: " << path.value(); continue; } @@ -227,8 +259,8 @@ PepperPluginRegistry::PepperPluginRegistry() { continue; // Only preload in-process plugins. const FilePath& path = plugins[i].path; - ModuleHandle module = pepper::PluginModule::CreateModule(path); - if (!module) { + ModuleHandle module(new webkit::ppapi::PluginModule); + if (!module->InitAsLibrary(path)) { DLOG(ERROR) << "Failed to load pepper module: " << path.value(); continue; } diff --git a/chrome/common/pepper_plugin_registry.h b/chrome/common/pepper_plugin_registry.h index 60762c5..424ed1a 100644 --- a/chrome/common/pepper_plugin_registry.h +++ b/chrome/common/pepper_plugin_registry.h @@ -11,7 +11,7 @@ #include <vector> #include "base/file_path.h" -#include "webkit/glue/plugins/pepper_plugin_module.h" +#include "webkit/plugins/ppapi/plugin_module.h" struct PepperPluginInfo { PepperPluginInfo(); @@ -40,6 +40,11 @@ class PepperPluginRegistry { static const char* kPDFPluginExtension; static const char* kPDFPluginDescription; + static const char* kNaClPluginName; + static const char* kNaClPluginMimeType; + static const char* kNaClPluginExtension; + static const char* kNaClPluginDescription; + static PepperPluginRegistry* GetInstance(); // Returns the list of known pepper plugins. This method is static so that @@ -59,7 +64,7 @@ class PepperPluginRegistry { // Returns a preloaded module for the given path. This only works for // non-out-of-process plugins since we preload them so they will run in the // sandbox. Returns NULL if the plugin hasn't been preloaded. - pepper::PluginModule* GetModule(const FilePath& path) const; + webkit::ppapi::PluginModule* GetModule(const FilePath& path) const; ~PepperPluginRegistry(); @@ -69,14 +74,14 @@ class PepperPluginRegistry { struct InternalPluginInfo : public PepperPluginInfo { InternalPluginInfo(); // Sets |is_internal|. - pepper::PluginModule::EntryPoints entry_points; + webkit::ppapi::PluginModule::EntryPoints entry_points; }; typedef std::vector<InternalPluginInfo> InternalPluginInfoList; static void GetInternalPluginInfo(InternalPluginInfoList* plugin_info); PepperPluginRegistry(); - typedef scoped_refptr<pepper::PluginModule> ModuleHandle; + typedef scoped_refptr<webkit::ppapi::PluginModule> ModuleHandle; typedef std::map<FilePath, ModuleHandle> ModuleMap; ModuleMap modules_; }; diff --git a/chrome/common/persistent_pref_store.h b/chrome/common/persistent_pref_store.h new file mode 100644 index 0000000..9e2fb0a --- /dev/null +++ b/chrome/common/persistent_pref_store.h @@ -0,0 +1,69 @@ +// 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 CHROME_COMMON_PERSISTENT_PREF_STORE_H_ +#define CHROME_COMMON_PERSISTENT_PREF_STORE_H_ +#pragma once + +#include <string> + +#include <chrome/common/pref_store.h> + +// This interface is complementary to the PrefStore interface, declaring +// additional functionatliy that adds support for setting values and persisting +// the data to some backing store. +class PersistentPrefStore : public PrefStore { + public: + virtual ~PersistentPrefStore() {} + + // Unique integer code for each type of error so we can report them + // distinctly in a histogram. + // NOTE: Don't change the order here as it will change the server's meaning + // of the histogram. + enum PrefReadError { + PREF_READ_ERROR_NONE = 0, + PREF_READ_ERROR_JSON_PARSE, + PREF_READ_ERROR_JSON_TYPE, + PREF_READ_ERROR_ACCESS_DENIED, + PREF_READ_ERROR_FILE_OTHER, + PREF_READ_ERROR_FILE_LOCKED, + PREF_READ_ERROR_NO_FILE, + PREF_READ_ERROR_JSON_REPEAT, + PREF_READ_ERROR_OTHER, + PREF_READ_ERROR_FILE_NOT_SPECIFIED + }; + + // Sets a |value| for |key| in the store. Assumes ownership of |value|, which + // must be non-NULL. + virtual void SetValue(const std::string& key, Value* value) = 0; + + // Same as SetValue, but doesn't generate notifications. This is used by + // GetMutableDictionary() and GetMutableList() in order to put empty entries + // into the user pref store. Using SetValue is not an option since existing + // tests rely on the number of notifications generated. + // + // TODO(mnissler, danno): Can we replace GetMutableDictionary() and + // GetMutableList() with something along the lines of ScopedPrefUpdate that + // updates the value in the end? + virtual void SetValueSilently(const std::string& key, Value* value) = 0; + + // Removes the value for |key|. + virtual void RemoveValue(const std::string& key) = 0; + + // Whether the store is in a pseudo-read-only mode where changes are not + // actually persisted to disk. This happens in some cases when there are + // read errors during startup. + virtual bool ReadOnly() const = 0; + + // Reads the preferences from disk. + virtual PrefReadError ReadPrefs() = 0; + + // Writes the preferences to disk immediately. + virtual bool WritePrefs() = 0; + + // Schedules an asynchronous write operation. + virtual void ScheduleWritePrefs() = 0; +}; + +#endif // CHROME_COMMON_PERSISTENT_PREF_STORE_H_ diff --git a/chrome/common/plugin_messages.cc b/chrome/common/plugin_messages.cc index 0434197..d9117ff 100644 --- a/chrome/common/plugin_messages.cc +++ b/chrome/common/plugin_messages.cc @@ -2,14 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/plugin_messages.h" - #include "base/utf_string_conversions.h" #include "ipc/ipc_channel_handle.h" -#define MESSAGES_INTERNAL_IMPL_FILE \ - "chrome/common/plugin_messages_internal.h" -#include "ipc/ipc_message_impl_macros.h" +#define IPC_MESSAGE_IMPL +#include "chrome/common/plugin_messages.h" PluginMsg_Init_Params::PluginMsg_Init_Params() : containing_window(0), diff --git a/chrome/common/plugin_messages.h b/chrome/common/plugin_messages.h index 3935fa8..4753c9d 100644 --- a/chrome/common/plugin_messages.h +++ b/chrome/common/plugin_messages.h @@ -236,8 +236,6 @@ struct ParamTraits<PluginMsg_UpdateGeometry_Param> { } // namespace IPC - -#define MESSAGES_INTERNAL_FILE "chrome/common/plugin_messages_internal.h" -#include "ipc/ipc_message_macros.h" +#include "chrome/common/plugin_messages_internal.h" #endif // CHROME_COMMON_PLUGIN_MESSAGES_H_ diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h index 7ebfd58..54ba2eb 100644 --- a/chrome/common/plugin_messages_internal.h +++ b/chrome/common/plugin_messages_internal.h @@ -12,523 +12,511 @@ #include "base/file_descriptor_posix.h" #endif +#define IPC_MESSAGE_START PluginMsgStart + //----------------------------------------------------------------------------- // PluginProcess messages // These are messages sent from the browser to the plugin process. -IPC_BEGIN_MESSAGES(PluginProcess) - // Tells the plugin process to create a new channel for communication with a - // given renderer. The channel name is returned in a - // PluginProcessHostMsg_ChannelCreated message. The renderer ID is passed so - // that the plugin process reuses an existing channel to that process if it - // exists. This ID is a unique opaque identifier generated by the browser - // process. - IPC_MESSAGE_CONTROL2(PluginProcessMsg_CreateChannel, - int /* renderer_id */, - bool /* off_the_record */) - - // Allows a chrome plugin loaded in the browser process to send arbitrary - // data to an instance of the same plugin loaded in a plugin process. - IPC_MESSAGE_CONTROL1(PluginProcessMsg_PluginMessage, - std::vector<uint8> /* opaque data */) - - // Tells the plugin process to notify every connected renderer of the pending - // shutdown, so we don't mistake it for a crash. - IPC_MESSAGE_CONTROL0(PluginProcessMsg_NotifyRenderersOfPendingShutdown) - - // The following messages are used by all child processes, even though they - // are listed under PluginProcess. It seems overkill to define ChildProcess. - // Tells the child process it should stop. - IPC_MESSAGE_CONTROL0(PluginProcessMsg_AskBeforeShutdown) - - // Sent in response to PluginProcessHostMsg_ShutdownRequest to tell the child - // process that it's safe to shutdown. - IPC_MESSAGE_CONTROL0(PluginProcessMsg_Shutdown) +// Tells the plugin process to create a new channel for communication with a +// given renderer. The channel name is returned in a +// PluginProcessHostMsg_ChannelCreated message. The renderer ID is passed so +// that the plugin process reuses an existing channel to that process if it +// exists. This ID is a unique opaque identifier generated by the browser +// process. +IPC_MESSAGE_CONTROL2(PluginProcessMsg_CreateChannel, + int /* renderer_id */, + bool /* off_the_record */) + +// Allows a chrome plugin loaded in the browser process to send arbitrary +// data to an instance of the same plugin loaded in a plugin process. +IPC_MESSAGE_CONTROL1(PluginProcessMsg_PluginMessage, + std::vector<uint8> /* opaque data */) + +// Tells the plugin process to notify every connected renderer of the pending +// shutdown, so we don't mistake it for a crash. +IPC_MESSAGE_CONTROL0(PluginProcessMsg_NotifyRenderersOfPendingShutdown) + +// The following messages are used by all child processes, even though they +// are listed under PluginProcess. It seems overkill to define ChildProcess. +// Tells the child process it should stop. +IPC_MESSAGE_CONTROL0(PluginProcessMsg_AskBeforeShutdown) + +// Sent in response to PluginProcessHostMsg_ShutdownRequest to tell the child +// process that it's safe to shutdown. +IPC_MESSAGE_CONTROL0(PluginProcessMsg_Shutdown) #if defined(IPC_MESSAGE_LOG_ENABLED) - // Tell the child process to begin or end IPC message logging. - // Like above, this is used by all ChildProcesses. - IPC_MESSAGE_CONTROL1(PluginProcessMsg_SetIPCLoggingEnabled, - bool /* on or off */) +// Tell the child process to begin or end IPC message logging. +// Like above, this is used by all ChildProcesses. +IPC_MESSAGE_CONTROL1(PluginProcessMsg_SetIPCLoggingEnabled, + bool /* on or off */) #endif -IPC_END_MESSAGES(PluginProcess) - //----------------------------------------------------------------------------- // PluginProcessHost messages // These are messages sent from the plugin process to the browser process. -IPC_BEGIN_MESSAGES(PluginProcessHost) - // Response to a PluginProcessMsg_CreateChannel message. - IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_ChannelCreated, - IPC::ChannelHandle /* channel_handle */) - - IPC_SYNC_MESSAGE_CONTROL0_1(PluginProcessHostMsg_GetPluginFinderUrl, - std::string /* plugin finder URL */) - - IPC_MESSAGE_CONTROL0(PluginProcessHostMsg_ShutdownRequest) - - // Allows a chrome plugin loaded in a plugin process to send arbitrary - // data to an instance of the same plugin loaded in the browser process. - IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_PluginMessage, - std::vector<uint8> /* opaque data */) - - // Allows a chrome plugin loaded in a plugin process to send arbitrary - // data to an instance of the same plugin loaded in the browser process. - IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_PluginSyncMessage, - std::vector<uint8> /* opaque data */, - std::vector<uint8> /* opaque data response */) - - // Used to get cookies for the given URL. The request_context is a - // CPBrowsingContext, but is passed as int32 to avoid compilation errors. - IPC_SYNC_MESSAGE_CONTROL2_1(PluginProcessHostMsg_GetCookies, - int32 /* request_context */, - GURL /* url */, - std::string /* cookies */) - - // Used by the plugin process to verify that its renderer |renderer_id| has - // permission to access the given |files|. - IPC_SYNC_MESSAGE_CONTROL2_1(PluginProcessHostMsg_AccessFiles, - int /* renderer_id */, - std::vector<std::string> /* files */, - bool /* allowed */) - - // Get the list of proxies to use for |url|, as a semicolon delimited list - // of "<TYPE> <HOST>:<PORT>" | "DIRECT". See also ViewHostMsg_ResolveProxy - // which does the same thing. - IPC_SYNC_MESSAGE_CONTROL1_2(PluginProcessHostMsg_ResolveProxy, - GURL /* url */, - int /* network error */, - std::string /* proxy list */) +// Response to a PluginProcessMsg_CreateChannel message. +IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_ChannelCreated, + IPC::ChannelHandle /* channel_handle */) + +IPC_SYNC_MESSAGE_CONTROL0_1(PluginProcessHostMsg_GetPluginFinderUrl, + std::string /* plugin finder URL */) + +IPC_MESSAGE_CONTROL0(PluginProcessHostMsg_ShutdownRequest) + +// Allows a chrome plugin loaded in a plugin process to send arbitrary +// data to an instance of the same plugin loaded in the browser process. +IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_PluginMessage, + std::vector<uint8> /* opaque data */) + +// Allows a chrome plugin loaded in a plugin process to send arbitrary +// data to an instance of the same plugin loaded in the browser process. +IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_PluginSyncMessage, + std::vector<uint8> /* opaque data */, + std::vector<uint8> /* opaque data response */) + +// Used to get cookies for the given URL. The request_context is a +// CPBrowsingContext, but is passed as int32 to avoid compilation errors. +IPC_SYNC_MESSAGE_CONTROL2_1(PluginProcessHostMsg_GetCookies, + int32 /* request_context */, + GURL /* url */, + std::string /* cookies */) + +// Used by the plugin process to verify that its renderer |renderer_id| has +// permission to access the given |files|. +IPC_SYNC_MESSAGE_CONTROL2_1(PluginProcessHostMsg_AccessFiles, + int /* renderer_id */, + std::vector<std::string> /* files */, + bool /* allowed */) + +// Get the list of proxies to use for |url|, as a semicolon delimited list +// of "<TYPE> <HOST>:<PORT>" | "DIRECT". See also ViewHostMsg_ResolveProxy +// which does the same thing. +IPC_SYNC_MESSAGE_CONTROL1_2(PluginProcessHostMsg_ResolveProxy, + GURL /* url */, + int /* network error */, + std::string /* proxy list */) #if defined(OS_WIN) - // Creates a child window of the given parent window on the UI thread. - IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_CreateWindow, - HWND /* parent */, - HWND /* child */) - - // Destroys the given window's parent on the UI thread. - IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginWindowDestroyed, - HWND /* window */, - HWND /* parent */) - - IPC_MESSAGE_ROUTED3(PluginProcessHostMsg_DownloadUrl, - std::string /* URL */, - int /* process id */, - HWND /* caller window */) +// Creates a child window of the given parent window on the UI thread. +IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_CreateWindow, + HWND /* parent */, + HWND /* child */) + +// Destroys the given window's parent on the UI thread. +IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginWindowDestroyed, + HWND /* window */, + HWND /* parent */) + +IPC_MESSAGE_ROUTED3(PluginProcessHostMsg_DownloadUrl, + std::string /* URL */, + int /* process id */, + HWND /* caller window */) #endif #if defined(USE_X11) - // On X11, the mapping between NativeViewId and X window ids - // is known only to the browser. This message lets the plugin process - // ask about a NativeViewId that was provided by the renderer. - // It will get 0 back if it's a bogus input. - IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_MapNativeViewId, - gfx::NativeViewId /* input: native view id */, - gfx::PluginWindowHandle /* output: X window id */) +// On X11, the mapping between NativeViewId and X window ids +// is known only to the browser. This message lets the plugin process +// ask about a NativeViewId that was provided by the renderer. +// It will get 0 back if it's a bogus input. +IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_MapNativeViewId, + gfx::NativeViewId /* input: native view id */, + gfx::PluginWindowHandle /* output: X window id */) #endif #if defined(OS_MACOSX) - // On Mac OS X, we need the browser to keep track of plugin windows so - // that it can add and remove them from stacking groups, hide and show the - // menu bar, etc. We pass the window rect for convenience so that the - // browser can easily tell if the window is fullscreen. - - // Notifies the browser that the plugin has selected a window (i.e., brought - // it to the front and wants it to have keyboard focus). - IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginSelectWindow, - uint32 /* window ID */, - gfx::Rect /* window rect */, - bool /* modal */) - - // Notifies the browser that the plugin has shown a window. - IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginShowWindow, - uint32 /* window ID */, - gfx::Rect /* window rect */, - bool /* modal */) - - // Notifies the browser that the plugin has hidden a window. - IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginHideWindow, - uint32 /* window ID */, - gfx::Rect /* window rect */) - - // Notifies the browser that a plugin instance has requested a cursor - // visibility change. - IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_PluginSetCursorVisibility, - bool /* cursor visibility */) +// On Mac OS X, we need the browser to keep track of plugin windows so +// that it can add and remove them from stacking groups, hide and show the +// menu bar, etc. We pass the window rect for convenience so that the +// browser can easily tell if the window is fullscreen. + +// Notifies the browser that the plugin has selected a window (i.e., brought +// it to the front and wants it to have keyboard focus). +IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginSelectWindow, + uint32 /* window ID */, + gfx::Rect /* window rect */, + bool /* modal */) + +// Notifies the browser that the plugin has shown a window. +IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginShowWindow, + uint32 /* window ID */, + gfx::Rect /* window rect */, + bool /* modal */) + +// Notifies the browser that the plugin has hidden a window. +IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginHideWindow, + uint32 /* window ID */, + gfx::Rect /* window rect */) + +// Notifies the browser that a plugin instance has requested a cursor +// visibility change. +IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_PluginSetCursorVisibility, + bool /* cursor visibility */) #endif -IPC_END_MESSAGES(PluginProcessHost) - //----------------------------------------------------------------------------- // Plugin messages // These are messages sent from the renderer process to the plugin process. -IPC_BEGIN_MESSAGES(Plugin) - // Tells the plugin process to create a new plugin instance with the given - // id. A corresponding WebPluginDelegateStub is created which hosts the - // WebPluginDelegateImpl. - IPC_SYNC_MESSAGE_CONTROL1_1(PluginMsg_CreateInstance, - std::string /* mime_type */, - int /* instance_id */) - - // The WebPluginDelegateProxy sends this to the WebPluginDelegateStub in its - // destructor, so that the stub deletes the actual WebPluginDelegateImpl - // object that it's hosting. - IPC_SYNC_MESSAGE_CONTROL1_0(PluginMsg_DestroyInstance, - int /* instance_id */) - - IPC_SYNC_MESSAGE_CONTROL0_1(PluginMsg_GenerateRouteID, - int /* id */) - - // The messages below all map to WebPluginDelegate methods. - IPC_SYNC_MESSAGE_ROUTED1_1(PluginMsg_Init, - PluginMsg_Init_Params, - bool /* result */) - - // Used to synchronously request a paint for windowless plugins. - IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_Paint, - gfx::Rect /* damaged_rect */) - - // Sent by the renderer after it paints from its backing store so that the - // plugin knows it can send more invalidates. - IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint) - - IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_Print, - base::SharedMemoryHandle /* shared_memory*/, - uint32 /* size */) - - IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_GetPluginScriptableObject, - int /* route_id */) - - IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason, - GURL /* url */, - int /* reason */, - int /* notify_id */) - - // Updates the plugin location. - IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry, - PluginMsg_UpdateGeometry_Param) - - // A synchronous version of above. - IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync, - PluginMsg_UpdateGeometry_Param) - - IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_SetFocus, - bool /* focused */) - - IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_HandleInputEvent, - IPC::WebInputEventPointer /* event */, - bool /* handled */, - WebCursor /* cursor type*/) - - IPC_MESSAGE_ROUTED1(PluginMsg_SetContentAreaFocus, - bool /* has_focus */) +// Tells the plugin process to create a new plugin instance with the given +// id. A corresponding WebPluginDelegateStub is created which hosts the +// WebPluginDelegateImpl. +IPC_SYNC_MESSAGE_CONTROL1_1(PluginMsg_CreateInstance, + std::string /* mime_type */, + int /* instance_id */) + +// The WebPluginDelegateProxy sends this to the WebPluginDelegateStub in its +// destructor, so that the stub deletes the actual WebPluginDelegateImpl +// object that it's hosting. +IPC_SYNC_MESSAGE_CONTROL1_0(PluginMsg_DestroyInstance, + int /* instance_id */) + +IPC_SYNC_MESSAGE_CONTROL0_1(PluginMsg_GenerateRouteID, + int /* id */) + +// The messages below all map to WebPluginDelegate methods. +IPC_SYNC_MESSAGE_ROUTED1_1(PluginMsg_Init, + PluginMsg_Init_Params, + bool /* result */) + +// Used to synchronously request a paint for windowless plugins. +IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_Paint, + gfx::Rect /* damaged_rect */) + +// Sent by the renderer after it paints from its backing store so that the +// plugin knows it can send more invalidates. +IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint) + +IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_Print, + base::SharedMemoryHandle /* shared_memory*/, + uint32 /* size */) + +IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_GetPluginScriptableObject, + int /* route_id */) + +IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason, + GURL /* url */, + int /* reason */, + int /* notify_id */) + +// Updates the plugin location. +IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry, + PluginMsg_UpdateGeometry_Param) + +// A synchronous version of above. +IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync, + PluginMsg_UpdateGeometry_Param) + +IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_SetFocus, + bool /* focused */) + +IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_HandleInputEvent, + IPC::WebInputEventPointer /* event */, + bool /* handled */, + WebCursor /* cursor type*/) + +IPC_MESSAGE_ROUTED1(PluginMsg_SetContentAreaFocus, + bool /* has_focus */) #if defined(OS_MACOSX) - IPC_MESSAGE_ROUTED1(PluginMsg_SetWindowFocus, - bool /* has_focus */) +IPC_MESSAGE_ROUTED1(PluginMsg_SetWindowFocus, + bool /* has_focus */) - IPC_MESSAGE_ROUTED0(PluginMsg_ContainerHidden) +IPC_MESSAGE_ROUTED0(PluginMsg_ContainerHidden) - IPC_MESSAGE_ROUTED3(PluginMsg_ContainerShown, - gfx::Rect /* window_frame */, - gfx::Rect /* view_frame */, - bool /* has_focus */) +IPC_MESSAGE_ROUTED3(PluginMsg_ContainerShown, + gfx::Rect /* window_frame */, + gfx::Rect /* view_frame */, + bool /* has_focus */) - IPC_MESSAGE_ROUTED2(PluginMsg_WindowFrameChanged, - gfx::Rect /* window_frame */, - gfx::Rect /* view_frame */) +IPC_MESSAGE_ROUTED2(PluginMsg_WindowFrameChanged, + gfx::Rect /* window_frame */, + gfx::Rect /* view_frame */) - IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionConfirmed, - string16 /* text */) +IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionConfirmed, + string16 /* text */) #endif - IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_WillSendRequest, - unsigned long /* id */, - GURL /* url */, - int /* http_status_code */) +IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_WillSendRequest, + unsigned long /* id */, + GURL /* url */, + int /* http_status_code */) - IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse, - PluginMsg_DidReceiveResponseParams) +IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse, + PluginMsg_DidReceiveResponseParams) - IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData, - unsigned long /* id */, - std::vector<char> /* buffer */, - int /* data_offset */) +IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData, + unsigned long /* id */, + std::vector<char> /* buffer */, + int /* data_offset */) - IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading, - unsigned long /* id */) +IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading, + unsigned long /* id */) - IPC_MESSAGE_ROUTED1(PluginMsg_DidFail, - unsigned long /* id */) +IPC_MESSAGE_ROUTED1(PluginMsg_DidFail, + unsigned long /* id */) - IPC_MESSAGE_ROUTED4(PluginMsg_SendJavaScriptStream, - GURL /* url */, - std::string /* result */, - bool /* success */, - int /* notify_id */) +IPC_MESSAGE_ROUTED4(PluginMsg_SendJavaScriptStream, + GURL /* url */, + std::string /* result */, + bool /* success */, + int /* notify_id */) - IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse, - GURL /* url */, - PluginMsg_DidReceiveResponseParams) +IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse, + GURL /* url */, + PluginMsg_DidReceiveResponseParams) - IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData, - std::vector<char> /* buffer */) +IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData, + std::vector<char> /* buffer */) - IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading) +IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading) - IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail) +IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail) - IPC_MESSAGE_ROUTED0(PluginMsg_InstallMissingPlugin) +IPC_MESSAGE_ROUTED0(PluginMsg_InstallMissingPlugin) - IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply, - unsigned long /* resource_id */, - GURL /* url */, - int /* notify_id */) +IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply, + unsigned long /* resource_id */, + GURL /* url */, + int /* notify_id */) - IPC_MESSAGE_ROUTED2(PluginMsg_HTTPRangeRequestReply, - unsigned long /* resource_id */, - int /* range_request_id */) +IPC_MESSAGE_ROUTED2(PluginMsg_HTTPRangeRequestReply, + unsigned long /* resource_id */, + int /* range_request_id */) - IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_CreateCommandBuffer, - int /* route_id */) +IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_CreateCommandBuffer, + int /* route_id */) - IPC_MESSAGE_ROUTED0(PluginMsg_DestroyCommandBuffer) +IPC_MESSAGE_ROUTED0(PluginMsg_DestroyCommandBuffer) - IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent, - gfx::NativeViewId /* containing_window */) +IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent, + gfx::NativeViewId /* containing_window */) - IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent, - gfx::NativeViewId /* containing_window */) +IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent, + gfx::NativeViewId /* containing_window */) #if defined(OS_MACOSX) - // This message, used only on 10.6 and later, transmits the "fake" - // window handle allocated by the browser on behalf of the renderer - // to the GPU plugin. - IPC_MESSAGE_ROUTED1(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, - gfx::PluginWindowHandle /* window */) +// This message, used only on 10.6 and later, transmits the "fake" +// window handle allocated by the browser on behalf of the renderer +// to the GPU plugin. +IPC_MESSAGE_ROUTED1(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, + gfx::PluginWindowHandle /* window */) #endif - IPC_MESSAGE_CONTROL3(PluginMsg_ClearSiteData, - uint64, /* flags */ - std::string, /* domain */ - base::Time /* begin_time */) - -IPC_END_MESSAGES(Plugin) +IPC_MESSAGE_CONTROL3(PluginMsg_ClearSiteData, + uint64, /* flags */ + std::string, /* domain */ + base::Time /* begin_time */) //----------------------------------------------------------------------------- // PluginHost messages // These are messages sent from the plugin process to the renderer process. // They all map to the corresponding WebPlugin methods. -IPC_BEGIN_MESSAGES(PluginHost) - // Sends the plugin window information to the renderer. - // The window parameter is a handle to the window if the plugin is a windowed - // plugin. It is NULL for windowless plugins. - IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow, - gfx::PluginWindowHandle /* window */) +// Sends the plugin window information to the renderer. +// The window parameter is a handle to the window if the plugin is a windowed +// plugin. It is NULL for windowless plugins. +IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow, + gfx::PluginWindowHandle /* window */) #if defined(OS_WIN) - // The modal_loop_pump_messages_event parameter is an event handle which is - // passed in for windowless plugins and is used to indicate if messages - // are to be pumped in sync calls to the plugin process. Currently used - // in HandleEvent calls. - IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindowlessPumpEvent, - HANDLE /* modal_loop_pump_messages_event */) +// The modal_loop_pump_messages_event parameter is an event handle which is +// passed in for windowless plugins and is used to indicate if messages +// are to be pumped in sync calls to the plugin process. Currently used +// in HandleEvent calls. +IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindowlessPumpEvent, + HANDLE /* modal_loop_pump_messages_event */) #endif - IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest, - PluginHostMsg_URLRequest_Params) +IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest, + PluginHostMsg_URLRequest_Params) - IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource, - int /* id */) +IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource, + int /* id */) - IPC_MESSAGE_ROUTED1(PluginHostMsg_InvalidateRect, - gfx::Rect /* rect */) +IPC_MESSAGE_ROUTED1(PluginHostMsg_InvalidateRect, + gfx::Rect /* rect */) - IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetWindowScriptNPObject, - int /* route id */, - bool /* success */) +IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetWindowScriptNPObject, + int /* route id */, + bool /* success */) - IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetPluginElement, - int /* route id */, - bool /* success */) +IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetPluginElement, + int /* route id */, + bool /* success */) - IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie, - GURL /* url */, - GURL /* first_party_for_cookies */, - std::string /* cookie */) +IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie, + GURL /* url */, + GURL /* first_party_for_cookies */, + std::string /* cookie */) - IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies, - GURL /* url */, - GURL /* first_party_for_cookies */, - std::string /* cookies */) +IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies, + GURL /* url */, + GURL /* first_party_for_cookies */, + std::string /* cookies */) - // Asks the browser to show a modal HTML dialog. The dialog is passed the - // given arguments as a JSON string, and returns its result as a JSON string - // through json_retval. - IPC_SYNC_MESSAGE_ROUTED4_1(PluginHostMsg_ShowModalHTMLDialog, - GURL /* url */, - int /* width */, - int /* height */, - std::string /* json_arguments */, - std::string /* json_retval */) +// Asks the browser to show a modal HTML dialog. The dialog is passed the +// given arguments as a JSON string, and returns its result as a JSON string +// through json_retval. +IPC_SYNC_MESSAGE_ROUTED4_1(PluginHostMsg_ShowModalHTMLDialog, + GURL /* url */, + int /* width */, + int /* height */, + std::string /* json_arguments */, + std::string /* json_retval */) - IPC_SYNC_MESSAGE_ROUTED2_2(PluginHostMsg_GetDragData, - NPVariant_Param /* event */, - bool /* add_data */, - std::vector<NPVariant_Param> /* result_values */, - bool /* result_success */) +IPC_SYNC_MESSAGE_ROUTED2_2(PluginHostMsg_GetDragData, + NPVariant_Param /* event */, + bool /* add_data */, + std::vector<NPVariant_Param> /* result_values */, + bool /* result_success */) - IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_SetDropEffect, - NPVariant_Param /* event */, - int /* effect */, - bool /* result_success */) +IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_SetDropEffect, + NPVariant_Param /* event */, + int /* effect */, + bool /* result_success */) - IPC_MESSAGE_ROUTED1(PluginHostMsg_MissingPluginStatus, - int /* status */) +IPC_MESSAGE_ROUTED1(PluginHostMsg_MissingPluginStatus, + int /* status */) - IPC_SYNC_MESSAGE_ROUTED0_1(PluginHostMsg_GetCPBrowsingContext, - uint32 /* context */) +IPC_SYNC_MESSAGE_ROUTED0_1(PluginHostMsg_GetCPBrowsingContext, + uint32 /* context */) - IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad) +IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad) - IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest, - std::string /* url */, - std::string /* range_info */, - int /* range_request_id */) +IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest, + std::string /* url */, + std::string /* range_info */, + int /* range_request_id */) - IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading, - unsigned long /* resource_id */, - bool /* defer */) +IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading, + unsigned long /* resource_id */, + bool /* defer */) - IPC_SYNC_MESSAGE_CONTROL1_0(PluginHostMsg_SetException, - std::string /* message */) +IPC_SYNC_MESSAGE_CONTROL1_0(PluginHostMsg_SetException, + std::string /* message */) - IPC_MESSAGE_CONTROL0(PluginHostMsg_PluginShuttingDown) +IPC_MESSAGE_CONTROL0(PluginHostMsg_PluginShuttingDown) #if defined(OS_MACOSX) - IPC_MESSAGE_ROUTED1(PluginHostMsg_UpdateGeometry_ACK, - int /* ack_key */) - - IPC_MESSAGE_ROUTED1(PluginHostMsg_SetImeEnabled, - bool /* enabled */) - - // This message, used in Mac OS X 10.5 and earlier, is sent from the plug-in - // process to the renderer process to indicate that the plug-in allocated a - // new TransportDIB that holds the GPU's rendered image. This information is - // then forwarded to the browser process via a similar message. - IPC_MESSAGE_ROUTED4(PluginHostMsg_AcceleratedSurfaceSetTransportDIB, - gfx::PluginWindowHandle /* window */, - int32 /* width */, - int32 /* height */, - TransportDIB::Handle /* handle to the TransportDIB */) - - // Synthesize a fake window handle for the plug-in to identify the instance - // to the browser, allowing mapping to a surface for hardware accelleration - // of plug-in content. The browser generates the handle which is then set on - // the plug-in. |opaque| indicates whether the content should be treated as - // opaque. - IPC_MESSAGE_ROUTED1(PluginHostMsg_BindFakePluginWindowHandle, - bool /* opaque */) - - // This message, used only on 10.6 and later, is sent from the plug-in process - // to the renderer process to indicate that the plugin allocated a new - // IOSurface object of the given width and height. This information is then - // forwarded on to the browser process. - // - // NOTE: the original intent was to pass a mach port as the IOSurface - // identifier but it looks like that will be a lot of work. For now we pass an - // ID from IOSurfaceGetID. - IPC_MESSAGE_ROUTED4(PluginHostMsg_AcceleratedSurfaceSetIOSurface, - gfx::PluginWindowHandle /* window */, - int32 /* width */, - int32 /* height */, - uint64 /* surface_id */) - - - // On the Mac, shared memory can't be allocated in the sandbox, so - // the TransportDIB used by the plug-in for rendering has to be allocated - // and managed by the browser. This is a synchronous message, use with care. - IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_AllocTransportDIB, - size_t /* requested memory size */, - TransportDIB::Handle /* output: DIB handle */) - - // Since the browser keeps handles to the allocated transport DIBs, this - // message is sent to tell the browser that it may release them when the - // renderer is finished with them. - IPC_MESSAGE_ROUTED1(PluginHostMsg_FreeTransportDIB, - TransportDIB::Id /* DIB id */) - - // This message notifies the renderer process (and from there the - // browser process) that the plug-in swapped the buffers associated - // with the given "window", which should cause the browser to redraw - // the various plug-ins' contents. - IPC_MESSAGE_ROUTED2(PluginHostMsg_AcceleratedSurfaceBuffersSwapped, - gfx::PluginWindowHandle /* window */, - uint64 /* surface_id */) +IPC_MESSAGE_ROUTED1(PluginHostMsg_UpdateGeometry_ACK, + int /* ack_key */) + +IPC_MESSAGE_ROUTED1(PluginHostMsg_SetImeEnabled, + bool /* enabled */) + +// This message, used in Mac OS X 10.5 and earlier, is sent from the plug-in +// process to the renderer process to indicate that the plug-in allocated a +// new TransportDIB that holds the GPU's rendered image. This information is +// then forwarded to the browser process via a similar message. +IPC_MESSAGE_ROUTED4(PluginHostMsg_AcceleratedSurfaceSetTransportDIB, + gfx::PluginWindowHandle /* window */, + int32 /* width */, + int32 /* height */, + TransportDIB::Handle /* handle to the TransportDIB */) + +// Synthesize a fake window handle for the plug-in to identify the instance +// to the browser, allowing mapping to a surface for hardware accelleration +// of plug-in content. The browser generates the handle which is then set on +// the plug-in. |opaque| indicates whether the content should be treated as +// opaque. +IPC_MESSAGE_ROUTED1(PluginHostMsg_BindFakePluginWindowHandle, + bool /* opaque */) + +// This message, used only on 10.6 and later, is sent from the plug-in process +// to the renderer process to indicate that the plugin allocated a new +// IOSurface object of the given width and height. This information is then +// forwarded on to the browser process. +// +// NOTE: the original intent was to pass a mach port as the IOSurface +// identifier but it looks like that will be a lot of work. For now we pass an +// ID from IOSurfaceGetID. +IPC_MESSAGE_ROUTED4(PluginHostMsg_AcceleratedSurfaceSetIOSurface, + gfx::PluginWindowHandle /* window */, + int32 /* width */, + int32 /* height */, + uint64 /* surface_id */) + + +// On the Mac, shared memory can't be allocated in the sandbox, so +// the TransportDIB used by the plug-in for rendering has to be allocated +// and managed by the browser. This is a synchronous message, use with care. +IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_AllocTransportDIB, + size_t /* requested memory size */, + TransportDIB::Handle /* output: DIB handle */) + +// Since the browser keeps handles to the allocated transport DIBs, this +// message is sent to tell the browser that it may release them when the +// renderer is finished with them. +IPC_MESSAGE_ROUTED1(PluginHostMsg_FreeTransportDIB, + TransportDIB::Id /* DIB id */) + +// This message notifies the renderer process (and from there the +// browser process) that the plug-in swapped the buffers associated +// with the given "window", which should cause the browser to redraw +// the various plug-ins' contents. +IPC_MESSAGE_ROUTED2(PluginHostMsg_AcceleratedSurfaceBuffersSwapped, + gfx::PluginWindowHandle /* window */, + uint64 /* surface_id */) #endif - IPC_MESSAGE_CONTROL1(PluginHostMsg_ClearSiteDataResult, - bool /* success */) +IPC_MESSAGE_CONTROL1(PluginHostMsg_ClearSiteDataResult, + bool /* success */) - IPC_MESSAGE_ROUTED2(PluginHostMsg_URLRedirectResponse, - bool /* allow */, - int /* resource_id */) +IPC_MESSAGE_ROUTED2(PluginHostMsg_URLRedirectResponse, + bool /* allow */, + int /* resource_id */) -IPC_END_MESSAGES(PluginHost) //----------------------------------------------------------------------------- // NPObject messages // These are messages used to marshall NPObjects. They are sent both from the // plugin to the renderer and from the renderer to the plugin. -IPC_BEGIN_MESSAGES(NPObject) - IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release) - - IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod, - NPIdentifier_Param /* name */, - bool /* result */) - - IPC_SYNC_MESSAGE_ROUTED3_2(NPObjectMsg_Invoke, - bool /* is_default */, - NPIdentifier_Param /* method */, - std::vector<NPVariant_Param> /* args */, - NPVariant_Param /* result_param */, - bool /* result */) - - IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasProperty, - NPIdentifier_Param /* name */, - bool /* result */) - - IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_GetProperty, - NPIdentifier_Param /* name */, - NPVariant_Param /* property */, - bool /* result */) - - IPC_SYNC_MESSAGE_ROUTED2_1(NPObjectMsg_SetProperty, - NPIdentifier_Param /* name */, - NPVariant_Param /* property */, - bool /* result */) - - IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_RemoveProperty, - NPIdentifier_Param /* name */, - bool /* result */) - - IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Invalidate) - - IPC_SYNC_MESSAGE_ROUTED0_2(NPObjectMsg_Enumeration, - std::vector<NPIdentifier_Param> /* value */, - bool /* result */) - - IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_Construct, - std::vector<NPVariant_Param> /* args */, - NPVariant_Param /* result_param */, - bool /* result */) - - IPC_SYNC_MESSAGE_ROUTED2_2(NPObjectMsg_Evaluate, - std::string /* script */, - bool /* popups_allowed */, - NPVariant_Param /* result_param */, - bool /* result */) - -IPC_END_MESSAGES(NPObject) +IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release) + +IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod, + NPIdentifier_Param /* name */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED3_2(NPObjectMsg_Invoke, + bool /* is_default */, + NPIdentifier_Param /* method */, + std::vector<NPVariant_Param> /* args */, + NPVariant_Param /* result_param */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasProperty, + NPIdentifier_Param /* name */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_GetProperty, + NPIdentifier_Param /* name */, + NPVariant_Param /* property */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED2_1(NPObjectMsg_SetProperty, + NPIdentifier_Param /* name */, + NPVariant_Param /* property */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_RemoveProperty, + NPIdentifier_Param /* name */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Invalidate) + +IPC_SYNC_MESSAGE_ROUTED0_2(NPObjectMsg_Enumeration, + std::vector<NPIdentifier_Param> /* value */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_Construct, + std::vector<NPVariant_Param> /* args */, + NPVariant_Param /* result_param */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED2_2(NPObjectMsg_Evaluate, + std::string /* script */, + bool /* popups_allowed */, + NPVariant_Param /* result_param */, + bool /* result */) diff --git a/chrome/common/policy_constants.cc b/chrome/common/policy_constants.cc index 42efba9..8ed8934 100644 --- a/chrome/common/policy_constants.cc +++ b/chrome/common/policy_constants.cc @@ -32,7 +32,10 @@ const char kDefaultSearchProviderIconURL[] = const char kDefaultSearchProviderEncodings[] = "DefaultSearchProviderEncodings"; const char kDisableSpdy[] = "DisableSpdy"; -const char kProxyServerMode[] = "ProxyServerMode"; +// We consider the name ProxyMode more apt than ProxyServerMode but could +// not change it after publishing that name for the win registry and policy +// config files. +const char kProxyMode[] = "ProxyServerMode"; const char kProxyServer[] = "ProxyServer"; const char kProxyPacUrl[] = "ProxyPacUrl"; const char kProxyBypassList[] = "ProxyBypassList"; @@ -62,6 +65,8 @@ const char kDefaultImagesSetting[] = "DefaultImagesSetting"; const char kDefaultJavaScriptSetting[] = "DefaultJavaScriptSetting"; const char kDefaultPluginsSetting[] = "DefaultPluginsSetting"; const char kDefaultPopupsSetting[] = "DefaultPopupsSetting"; +const char kDefaultNotificationSetting[] = "DefaultNotificationSetting"; +const char kDefaultGeolocationSetting[] = "DefaultGeolocationSetting"; const char kAuthSchemes[] = "AuthSchemes"; const char kDisableAuthNegotiateCnameLookup[] = "DisableAuthNegotiateCnameLookup"; diff --git a/chrome/common/policy_constants.h b/chrome/common/policy_constants.h index c5b8536..279197e 100644 --- a/chrome/common/policy_constants.h +++ b/chrome/common/policy_constants.h @@ -30,7 +30,7 @@ extern const char kDefaultSearchProviderSuggestURL[]; extern const char kDefaultSearchProviderIconURL[]; extern const char kDefaultSearchProviderEncodings[]; extern const char kDisableSpdy[]; -extern const char kProxyServerMode[]; +extern const char kProxyMode[]; extern const char kProxyServer[]; extern const char kProxyPacUrl[]; extern const char kProxyBypassList[]; @@ -59,6 +59,8 @@ extern const char kDefaultImagesSetting[]; extern const char kDefaultJavaScriptSetting[]; extern const char kDefaultPluginsSetting[]; extern const char kDefaultPopupsSetting[]; +extern const char kDefaultNotificationSetting[]; +extern const char kDefaultGeolocationSetting[]; extern const char kAuthSchemes[]; extern const char kDisableAuthNegotiateCnameLookup[]; extern const char kEnableAuthNegotiatePort[]; diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 8adb8fc..3da0b2c 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -41,7 +41,15 @@ const char kRestoreOnStartup[] = "session.restore_on_startup"; const char kURLsToRestoreOnStartup[] = "session.urls_to_restore_on_startup"; // The application locale. +// For OS_CHROMEOS we maintain kApplicationLocale property in both local state +// and user's profile. Global property determines locale of login screen, +// while user's profile determines his personal locale preference. const char kApplicationLocale[] = "intl.app_locale"; +#if defined(OS_CHROMEOS) +// Non-syncable item. Used for two-step initialization of locale in ChromeOS +// because synchronization of kApplicationLocale is not instant. +const char kApplicationLocaleBackup[] = "intl.app_locale_backup"; +#endif // The default character encoding to assume for a web page in the // absence of MIME charset specification @@ -194,18 +202,27 @@ const char kAlternateErrorPagesEnabled[] = "alternate_error_pages.enabled"; // A boolean pref set to true if DNS pre-fetching is being done in browser. const char kDnsPrefetchingEnabled[] = "dns_prefetching.enabled"; +// OBSOLETE: new pref now stored with user prefs instead of profile, as +// kDnsPrefetchingStartupList. +const char kDnsStartupPrefetchList[] = "StartupDNSPrefetchList"; + // An adaptively identified list of domain names to be pre-fetched during the // next startup, based on what was actually needed during this startup. -const char kDnsStartupPrefetchList[] = "StartupDNSPrefetchList"; +const char kDnsPrefetchingStartupList[] = "dns_prefetching.startup_list"; -// Disables the SPDY protocol. -const char kDisableSpdy[] = "spdy.disabled"; +// OBSOLETE: new pref now stored with user prefs instead of profile, as +// kDnsPrefetchingHostReferralList. +const char kDnsHostReferralList[] = "HostReferralList"; // A list of host names used to fetch web pages, and their commonly used // sub-resource hostnames (and expected latency benefits from pre-resolving, or // preconnecting to, such sub-resource hostnames). // This list is adaptively grown and pruned. -const char kDnsHostReferralList[] = "HostReferralList"; +const char kDnsPrefetchingHostReferralList[] = + "dns_prefetching.host_referral_list"; + +// Disables the SPDY protocol. +const char kDisableSpdy[] = "spdy.disabled"; // Is the cookie prompt expanded? const char kCookiePromptExpanded[] = "cookieprompt.expanded"; @@ -226,11 +243,18 @@ const char kInstantEnabledTime[] = "instant.enabled_time"; // that are used. const char kInstantPromo[] = "instant.promo"; +// Used to migrate preferences from local state to user preferences to +// enable multiple profiles. +// Holds possible values: +// 0: no preferences migrated yet. +// 1: dns prefetching preferences stored in user preferences. +const char kMultipleProfilePrefMigration[] = + "profile.multiple_profile_prefs_version"; + #if defined(USE_NSS) || defined(USE_OPENSSL) // Prefs for SSLConfigServicePref. Currently, these are only present on // and used by NSS/OpenSSL using OSes. const char kCertRevocationCheckingEnabled[] = "ssl.rev_checking.enabled"; -const char kSSL2Enabled[] = "ssl.ssl2.enabled"; const char kSSL3Enabled[] = "ssl.ssl3.enabled"; const char kTLS1Enabled[] = "ssl.tls1.enabled"; #endif @@ -443,8 +467,12 @@ const char kDeleteCache[] = "browser.clear_data.cache"; const char kDeleteCookies[] = "browser.clear_data.cookies"; const char kDeletePasswords[] = "browser.clear_data.passwords"; const char kDeleteFormData[] = "browser.clear_data.form_data"; +const char kDeleteLSOData[] = "browser.clear_data.lso_data"; const char kDeleteTimePeriod[] = "browser.clear_data.time_period"; +// Whether there is a Flash version installed that supports clearing LSO data. +const char kClearPluginLSODataEnabled[] = "browser.clear_lso_data_enabled"; + // Boolean pref to define the default values for using spellchecker. const char kEnableSpellCheck[] = "browser.enable_spellchecking"; @@ -555,6 +583,11 @@ const char kBlockNonsandboxedPlugins[] = "profile.block_nonsandboxed_plugins"; // storage, etc..) should be deleted on exit. const char kClearSiteDataOnExit[] = "profile.clear_site_data_on_exit"; +// Boolean that is true when plug-in locally stored data ("Flash cookies") +// should be deleted on exit. +const char kClearPluginLSODataOnExit[] = + "profile.clear_plugin_lso_data_on_exit"; + // Double that indicates the default zoom level. const char kDefaultZoomLevel[] = "profile.default_zoom_level"; @@ -763,11 +796,6 @@ const char kPreferencesWindowPlacement[] = "preferences.window_placement"; // renderer's in-memory cache of objects. const char kMemoryCacheSize[] = "renderer.memory_cache.size"; -// Boolean that records if chrome has set "launch on startup" property for -// itself earlier and is allowed to reset it later, reducing likelihood of -// overriding user choices. -const char kLaunchOnStartupResetAllowed[] = "launch_on_startup_reset_allowed"; - // String which specifies where to download files to by default. const char kDownloadDefaultDirectory[] = "download.default_directory"; @@ -1001,6 +1029,7 @@ const char kSyncPasswords[] = "sync.passwords"; const char kSyncPreferences[] = "sync.preferences"; const char kSyncApps[] = "sync.apps"; const char kSyncAutofill[] = "sync.autofill"; +const char kSyncAutofillProfile[] = "sync.autofill_profile"; const char kSyncThemes[] = "sync.themes"; const char kSyncTypedUrls[] = "sync.typed_urls"; const char kSyncExtensions[] = "sync.extensions"; @@ -1018,6 +1047,10 @@ const char kSyncSuppressStart[] = "sync.suppress_start"; // user settings DB to the token service. const char kSyncCredentialsMigrated[] = "sync.credentials_migrated"; +// Boolean to represent whether the legacy autofill profile data has been +// migrated to the new model. +const char kAutofillProfileMigrated[] = "sync.autofill_migrated"; + // A string that can be used to restore sync encryption infrastructure on // startup so that the user doesn't need to provide credentials on each start. const char kEncryptionBootstrapToken[] = "sync.encryption_bootstrap_token"; @@ -1102,11 +1135,10 @@ const char kCloudPrintPrintSystemSettings[] = // Used by the service process to determine if the remoting host is enabled. const char kRemotingHostEnabled[] = "remoting.host_enabled"; -// Boolean to disable proxy altogether. If true, other proxy -// preferences are ignored. -const char kNoProxyServer[] = "proxy.disabled"; -// Boolean specifying if proxy should be auto-detected. -const char kProxyAutoDetect[] = "proxy.auto_detect"; +// Integer to specify the type of proxy settings. +// See ProxyPrefs for possible values and interactions with the other proxy +// preferences. +const char kProxyMode[] = "proxy.mode"; // String specifying the proxy server. For a specification of the expected // syntax see net::ProxyConfig::ProxyRules::ParseFromString(). const char kProxyServer[] = "proxy.server"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index fae79ec..0450a21 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -25,6 +25,9 @@ extern const char kURLsToRestoreOnStartup[]; // and user's profile. Global property determines locale of login screen, // while user's profile determines his personal locale preference. extern const char kApplicationLocale[]; +#if defined(OS_CHROMEOS) +extern const char kApplicationLocaleBackup[]; +#endif extern const char kDefaultCharset[]; extern const char kAcceptLanguages[]; @@ -75,8 +78,10 @@ extern const char kSearchProviderOverridesVersion[]; extern const char kPromptForDownload[]; extern const char kAlternateErrorPagesEnabled[]; extern const char kDnsPrefetchingEnabled[]; -extern const char kDnsStartupPrefetchList[]; -extern const char kDnsHostReferralList[]; +extern const char kDnsStartupPrefetchList[]; // OBSOLETE +extern const char kDnsPrefetchingStartupList[]; +extern const char kDnsHostReferralList[]; // OBSOLETE +extern const char kDnsPrefetchingHostReferralList[]; extern const char kDisableSpdy[]; extern const char kCookiePromptExpanded[]; extern const char kInstantConfirmDialogShown[]; @@ -84,9 +89,9 @@ extern const char kInstantEnabled[]; extern const char kInstantEnabledOnce[]; extern const char kInstantEnabledTime[]; extern const char kInstantPromo[]; +extern const char kMultipleProfilePrefMigration[]; #if defined(USE_NSS) || defined(USE_OPENSSL) extern const char kCertRevocationCheckingEnabled[]; -extern const char kSSL2Enabled[]; extern const char kSSL3Enabled[]; extern const char kTLS1Enabled[]; #endif @@ -168,6 +173,8 @@ extern const char kDeleteCache[]; extern const char kDeleteCookies[]; extern const char kDeletePasswords[]; extern const char kDeleteFormData[]; +extern const char kDeleteLSOData[]; +extern const char kClearPluginLSODataEnabled[]; extern const char kEnableSpellCheck[]; extern const char kEnabledLabsExperiments[]; extern const char kEnableAutoSpellCorrect[]; @@ -211,6 +218,7 @@ extern const char kContentSettingsPatterns[]; extern const char kBlockThirdPartyCookies[]; extern const char kBlockNonsandboxedPlugins[]; extern const char kClearSiteDataOnExit[]; +extern const char kClearPluginLSODataOnExit[]; extern const char kDefaultZoomLevel[]; extern const char kPerHostZoomLevels[]; extern const char kAutoFillEnabled[]; @@ -275,8 +283,6 @@ extern const char kKeywordEditorWindowPlacement[]; extern const char kPreferencesWindowPlacement[]; extern const char kMemoryCacheSize[]; -extern const char kLaunchOnStartupResetAllowed[]; - extern const char kDownloadDefaultDirectory[]; extern const char kDownloadExtensionsToOpen[]; extern const char kDownloadDirUpgraded[]; @@ -370,6 +376,7 @@ extern const char kSyncPasswords[]; extern const char kSyncPreferences[]; extern const char kSyncApps[]; extern const char kSyncAutofill[]; +extern const char kSyncAutofillProfile[]; extern const char kSyncThemes[]; extern const char kSyncTypedUrls[]; extern const char kSyncExtensions[]; @@ -379,6 +386,7 @@ extern const char kGoogleServicesUsername[]; extern const char kSyncCredentialsMigrated[]; extern const char kSyncUsingSecondaryPassphrase[]; extern const char kEncryptionBootstrapToken[]; +extern const char kAutofillProfileMigrated[]; extern const char kWebAppCreateOnDesktop[]; extern const char kWebAppCreateInAppsMenu[]; @@ -403,8 +411,7 @@ extern const char kCloudPrintPrintSystemSettings[]; extern const char kRemotingHasSetupCompleted[]; extern const char kRemotingHostEnabled[]; -extern const char kNoProxyServer[]; -extern const char kProxyAutoDetect[]; +extern const char kProxyMode[]; extern const char kProxyServer[]; extern const char kProxyPacUrl[]; extern const char kProxyBypassList[]; diff --git a/chrome/common/pref_store.cc b/chrome/common/pref_store.cc index cf85417..47e7c38 100644 --- a/chrome/common/pref_store.cc +++ b/chrome/common/pref_store.cc @@ -3,12 +3,7 @@ // found in the LICENSE file. #include "chrome/common/pref_store.h" -#include "base/values.h" -Value* PrefStore::CreateUseDefaultSentinelValue() { - return Value::CreateNullValue(); -} - -bool PrefStore::IsUseDefaultSentinelValue(Value* value) { - return value->IsType(Value::TYPE_NULL); +bool PrefStore::IsInitializationComplete() const { + return true; } diff --git a/chrome/common/pref_store.h b/chrome/common/pref_store.h index 7011eba..35818a0 100644 --- a/chrome/common/pref_store.h +++ b/chrome/common/pref_store.h @@ -6,62 +6,58 @@ #define CHROME_COMMON_PREF_STORE_H_ #pragma once -class DictionaryValue; +#include <string> + +#include "base/basictypes.h" + class Value; // This is an abstract interface for reading and writing from/to a persistent -// preference store, used by |PrefService|. An implementation using a JSON file -// can be found in |JsonPrefStore|, while an implementation without any backing -// store (currently used for testing) can be found in |DummyPrefStore|. +// preference store, used by PrefService. An implementation using a JSON file +// can be found in JsonPrefStore, while an implementation without any backing +// store for testing can be found in TestingPrefStore. Furthermore, there is +// CommandLinePrefStore, which bridges command line options to preferences and +// ConfigurationPolicyPrefStore, which is used for hooking up configuration +// policy with the preference subsystem. class PrefStore { public: - // Unique integer code for each type of error so we can report them - // distinctly in a histogram. - // NOTE: Don't change the order here as it will change the server's meaning - // of the histogram. - enum PrefReadError { - PREF_READ_ERROR_NONE = 0, - PREF_READ_ERROR_JSON_PARSE, - PREF_READ_ERROR_JSON_TYPE, - PREF_READ_ERROR_ACCESS_DENIED, - PREF_READ_ERROR_FILE_OTHER, - PREF_READ_ERROR_FILE_LOCKED, - PREF_READ_ERROR_NO_FILE, - PREF_READ_ERROR_JSON_REPEAT, - PREF_READ_ERROR_OTHER, - PREF_READ_ERROR_FILE_NOT_SPECIFIED + // Observer interface for monitoring PrefStore. + class Observer { + public: + virtual ~Observer() {} + + // Called when the value for the given |key| in the store changes. + virtual void OnPrefValueChanged(const std::string& key) = 0; + // Notification about the PrefStore being fully initialized. + virtual void OnInitializationCompleted() = 0; }; - // To require that the default value be used for a preference, a - // PrefStore can set the value in its own prefs dictionary to the - // sentinel Value returned by this function. - // TODO(danno): Instead of having a sentinel value, pref stores - // should return a richer set of information from the property - // accessor methods to indicate that the default should be used. - static Value* CreateUseDefaultSentinelValue(); - - // Returns true if a value is the special sentinel value created by - // CreateUseDefaultSentinelValue. - static bool IsUseDefaultSentinelValue(Value* value); - - virtual ~PrefStore() { } + // Return values for GetValue(). + enum ReadResult { + // Value found and returned. + READ_OK, + // No value present, but skip other pref stores and use default. + READ_USE_DEFAULT, + // No value present. + READ_NO_VALUE, + }; - // Whether the store is in a pseudo-read-only mode where changes are not - // actually persisted to disk. This happens in some cases when there are - // read errors during startup. - virtual bool ReadOnly() { return true; } + PrefStore() {} + virtual ~PrefStore() {} - // TODO(danno): PrefValueStore shouldn't allow direct access to the - // DictionaryValue. Instead, it should have getters that return a - // richer set of information for a pref, including if the store - // wants to return the default value for a preference. - virtual DictionaryValue* prefs() const = 0; + // Add and remove observers. + virtual void AddObserver(Observer* observer) {} + virtual void RemoveObserver(Observer* observer) {} - virtual PrefReadError ReadPrefs() = 0; + // Whether the store has completed all asynchronous initialization. + virtual bool IsInitializationComplete() const; - virtual bool WritePrefs() { return true; } + // Get the value for a given preference |key| and stores it in |result|. + // |result| is only modified if the return value is READ_OK. Ownership of the + // |result| value remains with the PrefStore. + virtual ReadResult GetValue(const std::string& key, Value** result) const = 0; - virtual void ScheduleWritePrefs() { } + DISALLOW_COPY_AND_ASSIGN(PrefStore); }; #endif // CHROME_COMMON_PREF_STORE_H_ diff --git a/chrome/common/pref_store_observer_mock.h b/chrome/common/pref_store_observer_mock.h new file mode 100644 index 0000000..2a49284 --- /dev/null +++ b/chrome/common/pref_store_observer_mock.h @@ -0,0 +1,26 @@ +// 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 CHROME_COMMON_PREF_STORE_OBSERVER_MOCK_H_ +#define CHROME_COMMON_PREF_STORE_OBSERVER_MOCK_H_ +#pragma once + +#include "base/basictypes.h" +#include "chrome/common/pref_store.h" +#include "testing/gmock/include/gmock/gmock.h" + +// A gmock-ified implementation of PrefStore::Observer. +class PrefStoreObserverMock : public PrefStore::Observer { + public: + PrefStoreObserverMock() {} + virtual ~PrefStoreObserverMock() {} + + MOCK_METHOD1(OnPrefValueChanged, void(const std::string&)); + MOCK_METHOD0(OnInitializationCompleted, void()); + + private: + DISALLOW_COPY_AND_ASSIGN(PrefStoreObserverMock); +}; + +#endif // CHROME_COMMON_PREF_STORE_OBSERVER_MOCK_H_ diff --git a/chrome/common/remoting/chromoting_host_info.h b/chrome/common/remoting/chromoting_host_info.h new file mode 100644 index 0000000..e803eef --- /dev/null +++ b/chrome/common/remoting/chromoting_host_info.h @@ -0,0 +1,23 @@ +// 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 CHROME_COMMON_REMOTING_CHROMOTING_HOST_INFO_H_ +#define CHROME_COMMON_REMOTING_CHROMOTING_HOST_INFO_H_ + +#include <string> + +namespace remoting { + +// This struct is used for ServiceHostMsg_ChromotingHost_Info IPC message. +struct ChromotingHostInfo { + std::string host_id; + std::string hostname; + std::string public_key; + std::string login; + bool enabled; +}; + +} // namespace remoting + +#endif // CHROME_COMMON_REMOTING_CHROMOTING_HOST_INFO_H_ diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index be20600..c865a68 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -2,18 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/render_messages.h" - #include "base/values.h" #include "chrome/common/edit_command.h" #include "chrome/common/extensions/extension_extent.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/gpu_param_traits.h" -#include "chrome/common/indexed_db_key.h" -#include "chrome/common/indexed_db_param_traits.h" #include "chrome/common/render_messages_params.h" #include "chrome/common/resource_response.h" -#include "chrome/common/serialized_script_value.h" #include "chrome/common/speech_input_result.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/web_apps.h" @@ -23,33 +18,24 @@ #include "net/base/upload_data.h" #include "net/http/http_response_headers.h" #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" -#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" -#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" #include "third_party/skia/include/core/SkBitmap.h" #include "webkit/appcache/appcache_interfaces.h" #include "webkit/blob/blob_data.h" -#include "webkit/glue/context_menu.h" -#include "webkit/glue/form_data.h" #include "webkit/glue/form_field.h" #include "webkit/glue/password_form.h" -#include "webkit/glue/password_form_dom_manager.h" -#include "webkit/glue/plugins/webplugin.h" -#include "webkit/glue/plugins/webplugininfo.h" #include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/webaccessibility.h" #include "webkit/glue/webcookie.h" #include "webkit/glue/webcursor.h" -#include "webkit/glue/webdropdata.h" #include "webkit/glue/webmenuitem.h" +#include "webkit/plugins/npapi/webplugin.h" #if defined(OS_MACOSX) #include "chrome/common/font_descriptor_mac.h" #endif -#define MESSAGES_INTERNAL_IMPL_FILE \ - "chrome/common/render_messages_internal.h" -#include "ipc/ipc_message_impl_macros.h" +#define IPC_MESSAGE_IMPL +#include "chrome/common/render_messages.h" namespace IPC { @@ -210,8 +196,8 @@ void ParamTraits<ContextMenuParams>::Log(const param_type& p, l->append("<ContextMenuParams>"); } -void ParamTraits<webkit_glue::WebPluginGeometry>::Write(Message* m, - const param_type& p) { +void ParamTraits<webkit::npapi::WebPluginGeometry>::Write(Message* m, + const param_type& p) { WriteParam(m, p.window); WriteParam(m, p.window_rect); WriteParam(m, p.clip_rect); @@ -220,7 +206,7 @@ void ParamTraits<webkit_glue::WebPluginGeometry>::Write(Message* m, WriteParam(m, p.visible); } -bool ParamTraits<webkit_glue::WebPluginGeometry>::Read( +bool ParamTraits<webkit::npapi::WebPluginGeometry>::Read( const Message* m, void** iter, param_type* p) { return ReadParam(m, iter, &p->window) && @@ -231,8 +217,8 @@ bool ParamTraits<webkit_glue::WebPluginGeometry>::Read( ReadParam(m, iter, &p->visible); } -void ParamTraits<webkit_glue::WebPluginGeometry>::Log(const param_type& p, - std::string* l) { +void ParamTraits<webkit::npapi::WebPluginGeometry>::Log(const param_type& p, + std::string* l) { l->append("("); LogParam(p.window, l); l->append(", "); @@ -248,21 +234,24 @@ void ParamTraits<webkit_glue::WebPluginGeometry>::Log(const param_type& p, l->append(")"); } -void ParamTraits<WebPluginMimeType>::Write(Message* m, const param_type& p) { +void ParamTraits<webkit::npapi::WebPluginMimeType>::Write(Message* m, + const param_type& p) { WriteParam(m, p.mime_type); WriteParam(m, p.file_extensions); WriteParam(m, p.description); } -bool ParamTraits<WebPluginMimeType>::Read(const Message* m, void** iter, - param_type* r) { +bool ParamTraits<webkit::npapi::WebPluginMimeType>::Read(const Message* m, + void** iter, + param_type* r) { return ReadParam(m, iter, &r->mime_type) && ReadParam(m, iter, &r->file_extensions) && ReadParam(m, iter, &r->description); } -void ParamTraits<WebPluginMimeType>::Log(const param_type& p, std::string* l) { +void ParamTraits<webkit::npapi::WebPluginMimeType>::Log(const param_type& p, + std::string* l) { l->append("("); LogParam(p.mime_type, l); l->append(", "); @@ -272,7 +261,8 @@ void ParamTraits<WebPluginMimeType>::Log(const param_type& p, std::string* l) { l->append(")"); } -void ParamTraits<WebPluginInfo>::Write(Message* m, const param_type& p) { +void ParamTraits<webkit::npapi::WebPluginInfo>::Write(Message* m, + const param_type& p) { WriteParam(m, p.name); WriteParam(m, p.path); WriteParam(m, p.version); @@ -281,8 +271,9 @@ void ParamTraits<WebPluginInfo>::Write(Message* m, const param_type& p) { WriteParam(m, p.enabled); } -bool ParamTraits<WebPluginInfo>::Read(const Message* m, void** iter, - param_type* r) { +bool ParamTraits<webkit::npapi::WebPluginInfo>::Read(const Message* m, + void** iter, + param_type* r) { return ReadParam(m, iter, &r->name) && ReadParam(m, iter, &r->path) && @@ -292,7 +283,8 @@ bool ParamTraits<WebPluginInfo>::Read(const Message* m, void** iter, ReadParam(m, iter, &r->enabled); } -void ParamTraits<WebPluginInfo>::Log(const param_type& p, std::string* l) { +void ParamTraits<webkit::npapi::WebPluginInfo>::Log(const param_type& p, + std::string* l) { l->append("("); LogParam(p.name, l); l->append(", "); @@ -1222,26 +1214,6 @@ void ParamTraits<AudioBuffersState>::Log(const param_type& p, std::string* l) { l->append(")"); } -void ParamTraits<PepperDirEntry>::Write(Message* m, const param_type& p) { - WriteParam(m, p.name); - WriteParam(m, p.is_dir); -} - -bool ParamTraits<PepperDirEntry>::Read(const Message* m, - void** iter, - param_type* p) { - return ReadParam(m, iter, &p->name) && - ReadParam(m, iter, &p->is_dir); -} - -void ParamTraits<PepperDirEntry>::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<speech_input::SpeechInputResultItem>::Write( Message* m, const param_type& p) { WriteParam(m, p.utterance); diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index fb68afa..e06a667 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -17,18 +17,14 @@ #include "base/string16.h" #include "chrome/common/common_param_traits.h" #include "chrome/common/css_colors.h" -#include "chrome/common/dom_storage_common.h" -#include "chrome/common/indexed_db_param_traits.h" #include "chrome/common/page_transition_types.h" #include "chrome/common/translate_errors.h" #include "chrome/common/view_types.h" #include "chrome/common/webkit_param_traits.h" #include "ipc/ipc_message_utils.h" #include "ipc/ipc_platform_file.h" // ifdefed typedef. -#include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" #include "webkit/appcache/appcache_interfaces.h" // enum appcache::Status #include "webkit/fileapi/file_system_types.h" // enum fileapi::FileSystemType -#include "webkit/glue/plugins/pepper_dir_contents.h" #if defined(OS_MACOSX) struct FontDescriptor; @@ -65,10 +61,17 @@ struct ResourceLoadTimingInfo; struct ResourceResponseInfo; struct WebAccessibility; struct WebCookie; -struct WebPluginGeometry; struct WebAccessibility; } +namespace webkit { +namespace npapi { +struct WebPluginGeometry; +struct WebPluginInfo; +struct WebPluginMimeType; +} +} + struct AudioBuffersState; class ExtensionExtent; class GURL; @@ -81,8 +84,6 @@ struct SyncLoadResult; struct RendererPreferences; struct WebDropData; struct WebMenuItem; -struct WebPluginInfo; -struct WebPluginMimeType; struct WebPreferences; // Forward declarations of structures used to store data for when we have a lot @@ -99,17 +100,11 @@ struct ViewHostMsg_Resource_Request; struct ViewMsg_Print_Params; struct ViewMsg_PrintPage_Params; struct ViewMsg_PrintPages_Params; +struct ViewHostMsg_DidPreviewDocument_Params; struct ViewHostMsg_DidPrintPage_Params; struct ViewHostMsg_Audio_CreateStream_Params; struct ViewHostMsg_ShowPopup_Params; struct ViewHostMsg_ScriptedPrint_Params; -struct ViewMsg_DOMStorageEvent_Params; -struct ViewHostMsg_IDBFactoryOpen_Params; -struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params; -struct ViewHostMsg_IDBIndexOpenCursor_Params; -struct ViewHostMsg_IDBObjectStoreCreateIndex_Params; -struct ViewHostMsg_IDBObjectStoreOpenCursor_Params; -struct ViewHostMsg_IDBObjectStorePut_Params; struct ViewMsg_ExecuteCode_Params; struct ViewHostMsg_CreateWorker_Params; struct ViewHostMsg_ShowNotification_Params; @@ -162,8 +157,8 @@ struct ParamTraits<ContextMenuParams> { }; template <> -struct ParamTraits<webkit_glue::WebPluginGeometry> { - typedef webkit_glue::WebPluginGeometry param_type; +struct ParamTraits<webkit::npapi::WebPluginGeometry> { + typedef webkit::npapi::WebPluginGeometry 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); @@ -171,16 +166,16 @@ struct ParamTraits<webkit_glue::WebPluginGeometry> { // Traits for ViewMsg_GetPlugins_Reply structure to pack/unpack. template <> -struct ParamTraits<WebPluginMimeType> { - typedef WebPluginMimeType param_type; +struct ParamTraits<webkit::npapi::WebPluginMimeType> { + typedef webkit::npapi::WebPluginMimeType 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<WebPluginInfo> { - typedef WebPluginInfo param_type; +struct ParamTraits<webkit::npapi::WebPluginInfo> { + typedef webkit::npapi::WebPluginInfo 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); @@ -480,73 +475,6 @@ struct ParamTraits<EditCommand> { static void Log(const param_type& p, std::string* l); }; -// Traits for DOMStorageType enum. -template <> -struct ParamTraits<DOMStorageType> { - typedef DOMStorageType 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<param_type>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case DOM_STORAGE_LOCAL: - control = "DOM_STORAGE_LOCAL"; - break; - case DOM_STORAGE_SESSION: - control = "DOM_STORAGE_SESSION"; - break; - default: - NOTIMPLEMENTED(); - control = "UNKNOWN"; - break; - } - LogParam(control, l); - } -}; - -// Traits for WebKit::WebStorageArea::Result enum. -template <> -struct ParamTraits<WebKit::WebStorageArea::Result> { - typedef WebKit::WebStorageArea::Result 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<param_type>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case WebKit::WebStorageArea::ResultOK: - control = "WebKit::WebStorageArea::ResultOK"; - break; - case WebKit::WebStorageArea::ResultBlockedByQuota: - control = "WebKit::WebStorageArea::ResultBlockedByQuota"; - break; - case WebKit::WebStorageArea::ResultBlockedByPolicy: - control = "WebKit::WebStorageArea::ResultBlockedByPolicy"; - break; - default: - NOTIMPLEMENTED(); - control = "UNKNOWN"; - break; - } - LogParam(control, l); - } -}; - // Traits for WebCookie template <> struct ParamTraits<webkit_glue::WebCookie> { @@ -602,12 +530,6 @@ struct ParamTraits<scoped_refptr<webkit_blob::BlobData> > { static void Log(const param_type& p, std::string* l); }; -// Traits for base::PlatformFileError -template <> -struct SimilarTypeTraits<base::PlatformFileError> { - typedef int Type; -}; - template <> struct SimilarTypeTraits<fileapi::FileSystemType> { typedef int Type; @@ -623,14 +545,6 @@ struct ParamTraits<AudioBuffersState> { }; template <> -struct ParamTraits<PepperDirEntry> { - typedef PepperDirEntry 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<speech_input::SpeechInputResultItem> { typedef speech_input::SpeechInputResultItem param_type; static void Write(Message* m, const param_type& p); @@ -640,7 +554,6 @@ struct ParamTraits<speech_input::SpeechInputResultItem> { } // namespace IPC -#define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" -#include "ipc/ipc_message_macros.h" +#include "chrome/common/render_messages_internal.h" #endif // CHROME_COMMON_RENDER_MESSAGES_H_ diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 2dba9ae..f94f1ed 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -2,11 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This header is meant to be included in multiple passes, hence no traditional -// header guard. -// See ipc_message_macros.h for explanation of the macros and passes. - #include <map> +#include <set> #include <string> #include <vector> @@ -27,7 +24,14 @@ #include "chrome/common/window_container_type.h" #include "ipc/ipc_message_macros.h" #include "media/audio/audio_buffers_state.h" -#include "third_party/WebKit/WebKit/chromium/public/WebExceptionCode.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" +#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" +#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" +#include "webkit/glue/context_menu.h" +#include "webkit/glue/form_data.h" +#include "webkit/glue/password_form_dom_manager.h" +#include "webkit/glue/webdropdata.h" +#include "webkit/plugins/npapi/webplugininfo.h" #if defined(OS_POSIX) #include "base/file_descriptor_posix.h" @@ -45,8 +49,8 @@ // Substitution map for l10n messages. typedef std::map<std::string, std::string> SubstitutionMap; +class Value; class GPUInfo; -class SerializedScriptValue; class SkBitmap; struct ThumbnailScore; class WebCursor; @@ -68,3012 +72,2560 @@ namespace file_util { struct FileInfo; } +#define IPC_MESSAGE_START ViewMsgStart + //----------------------------------------------------------------------------- // RenderView messages // These are messages sent from the browser to the renderer process. -IPC_BEGIN_MESSAGES(View) - // Used typically when recovering from a crash. The new rendering process - // sets its global "next page id" counter to the given value. - IPC_MESSAGE_CONTROL1(ViewMsg_SetNextPageID, - int32 /* next_page_id */) - - // Sends System Colors corresponding to a set of CSS color keywords - // down the pipe. - // This message must be sent to the renderer immediately on launch - // before creating any new views. - // The message can also be sent during a renderer's lifetime if system colors - // are updated. - // TODO(jeremy): Possibly change IPC format once we have this all hooked up. - IPC_MESSAGE_ROUTED1(ViewMsg_SetCSSColors, - std::vector<CSSColors::CSSColorMapping>) - - // Tells the renderer to create a new view. - // This message is slightly different, the view it takes (via - // ViewMsg_New_Params) is the view to create, the message itself is sent as a - // non-view control message. - IPC_MESSAGE_CONTROL1(ViewMsg_New, - ViewMsg_New_Params) - - // Tells the renderer to set its maximum cache size to the supplied value. - IPC_MESSAGE_CONTROL3(ViewMsg_SetCacheCapacities, - size_t /* min_dead_capacity */, - size_t /* max_dead_capacity */, - size_t /* capacity */) - - // Tells the renderer to cleat the cache. - IPC_MESSAGE_CONTROL0(ViewMsg_ClearCache) - - // Reply in response to ViewHostMsg_ShowView or ViewHostMsg_ShowWidget. - // similar to the new command, but used when the renderer created a view - // first, and we need to update it. - IPC_MESSAGE_ROUTED1(ViewMsg_CreatingNew_ACK, - gfx::NativeViewId /* parent_hwnd */) - - // Sends updated preferences to the renderer. - IPC_MESSAGE_ROUTED1(ViewMsg_SetRendererPrefs, - RendererPreferences) - - // Tells the renderer to perform the given action on the media player - // located at the given point. - IPC_MESSAGE_ROUTED2(ViewMsg_MediaPlayerActionAt, - gfx::Point, /* location */ - WebKit::WebMediaPlayerAction) - - // Tells the render view to close. - IPC_MESSAGE_ROUTED0(ViewMsg_Close) - - // Tells the render view to change its size. A ViewHostMsg_PaintRect message - // is generated in response provided new_size is not empty and not equal to - // the view's current size. The generated ViewHostMsg_PaintRect message will - // have the IS_RESIZE_ACK flag set. It also receives the resizer rect so that - // we don't have to fetch it every time WebKit asks for it. - IPC_MESSAGE_ROUTED2(ViewMsg_Resize, - gfx::Size /* new_size */, - gfx::Rect /* resizer_rect */) - - // Sent to inform the view that it was hidden. This allows it to reduce its - // resource utilization. - IPC_MESSAGE_ROUTED0(ViewMsg_WasHidden) - - // Tells the render view that it is no longer hidden (see WasHidden), and the - // render view is expected to respond with a full repaint if needs_repainting - // is true. In that case, the generated ViewHostMsg_PaintRect message will - // have the IS_RESTORE_ACK flag set. If needs_repainting is false, then this - // message does not trigger a message in response. - IPC_MESSAGE_ROUTED1(ViewMsg_WasRestored, - bool /* needs_repainting */) - - // Tells the render view to capture a thumbnail image of the page. The - // render view responds with a ViewHostMsg_Thumbnail. - IPC_MESSAGE_ROUTED0(ViewMsg_CaptureThumbnail) - - // Tells the render view to capture a thumbnail image of the page. The - // render view responds with a ViewHostMsg_Snapshot. - IPC_MESSAGE_ROUTED0(ViewMsg_CaptureSnapshot) - - // Tells the render view to switch the CSS to print media type, renders every - // requested pages and switch back the CSS to display media type. - IPC_MESSAGE_ROUTED0(ViewMsg_PrintPages) - - // Tells the render view that printing is done so it can clean up. - IPC_MESSAGE_ROUTED2(ViewMsg_PrintingDone, - int /* document_cookie */, - bool /* success */) - - // Tells the render view to switch the CSS to print media type, renders every - // requested pages for print preview. - IPC_MESSAGE_ROUTED0(ViewMsg_PrintPreview) - - // Sends back to the browser the rendered "printed page" for preview that was - // requested by a ViewMsg_PrintPage message or from scripted printing. The - // memory handle in this message is already valid in the browser process. - IPC_MESSAGE_ROUTED2(ViewHostMsg_PagesReadyForPreview, - int /* document cookie */, - int /* fd in browser */) - - // Tells the renderer to dump as much memory as it can, perhaps because we - // have memory pressure or the renderer is (or will be) paged out. This - // should only result in purging objects we can recalculate, e.g. caches or - // JS garbage, not in purging irreplaceable objects. - IPC_MESSAGE_CONTROL0(ViewMsg_PurgeMemory) - - // Sent to render the view into the supplied transport DIB, resize - // the web widget to match the |page_size|, scale it by the - // appropriate scale to make it fit the |desired_size|, and return - // it. In response to this message, the host generates a - // ViewHostMsg_PaintAtSize_ACK message. Note that the DIB *must* be - // the right size to receive an RGBA image at the |desired_size|. - // |tag| is sent along with ViewHostMsg_PaintAtSize_ACK unmodified to - // identify the PaintAtSize message the ACK belongs to. - IPC_MESSAGE_ROUTED4(ViewMsg_PaintAtSize, - TransportDIB::Handle /* dib_handle */, - int /* tag */, - gfx::Size /* page_size */, - gfx::Size /* desired_size */) - - // Tells the render view that a ViewHostMsg_UpdateRect message was processed. - // This signals the render view that it can send another UpdateRect message. - IPC_MESSAGE_ROUTED0(ViewMsg_UpdateRect_ACK) - - // Message payload includes: - // 1. A blob that should be cast to WebInputEvent - // 2. An optional boolean value indicating if a RawKeyDown event is associated - // to a keyboard shortcut of the browser. - IPC_MESSAGE_ROUTED0(ViewMsg_HandleInputEvent) - - // This message notifies the renderer that the next key event is bound to one - // or more pre-defined edit commands. If the next key event is not handled - // by webkit, the specified edit commands shall be executed against current - // focused frame. - // Parameters - // * edit_commands (see chrome/common/edit_command_types.h) - // Contains one or more edit commands. - // See third_party/WebKit/WebCore/editing/EditorCommand.cpp for detailed - // definition of webkit edit commands. - // - // This message must be sent just before sending a key event. - IPC_MESSAGE_ROUTED1(ViewMsg_SetEditCommandsForNextKeyEvent, - std::vector<EditCommand> /* edit_commands */) - - // Message payload is the name/value of a WebCore edit command to execute. - IPC_MESSAGE_ROUTED2(ViewMsg_ExecuteEditCommand, - std::string, /* name */ - std::string /* value */) - - IPC_MESSAGE_ROUTED0(ViewMsg_MouseCaptureLost) - - // TODO(darin): figure out how this meshes with RestoreFocus - IPC_MESSAGE_ROUTED1(ViewMsg_SetFocus, bool /* enable */) - - // Tells the renderer to focus the first (last if reverse is true) focusable - // node. - IPC_MESSAGE_ROUTED1(ViewMsg_SetInitialFocus, bool /* reverse */) - - // Tells the renderer to scroll the currently focused node into view only if - // the currently focused node is a Text node (textfield, text area or content - // editable divs). - IPC_MESSAGE_ROUTED0(ViewMsg_ScrollFocusedEditableNodeIntoView) - - // Tells the renderer to perform the specified navigation, interrupting any - // existing navigation. - IPC_MESSAGE_ROUTED1(ViewMsg_Navigate, ViewMsg_Navigate_Params) - - IPC_MESSAGE_ROUTED0(ViewMsg_Stop) - - // Tells the renderer to reload the current focused frame - IPC_MESSAGE_ROUTED0(ViewMsg_ReloadFrame) - - // This message notifies the renderer that the user has closed the FindInPage - // window (and what action to take regarding the selection). - IPC_MESSAGE_ROUTED1(ViewMsg_StopFinding, - ViewMsg_StopFinding_Params /* action */) - - // These messages are typically generated from context menus and request the - // renderer to apply the specified operation to the current selection. - IPC_MESSAGE_ROUTED0(ViewMsg_Undo) - IPC_MESSAGE_ROUTED0(ViewMsg_Redo) - IPC_MESSAGE_ROUTED0(ViewMsg_Cut) - IPC_MESSAGE_ROUTED0(ViewMsg_Copy) +// Used typically when recovering from a crash. The new rendering process +// sets its global "next page id" counter to the given value. +IPC_MESSAGE_CONTROL1(ViewMsg_SetNextPageID, + int32 /* next_page_id */) + +// Sends System Colors corresponding to a set of CSS color keywords +// down the pipe. +// This message must be sent to the renderer immediately on launch +// before creating any new views. +// The message can also be sent during a renderer's lifetime if system colors +// are updated. +// TODO(jeremy): Possibly change IPC format once we have this all hooked up. +IPC_MESSAGE_ROUTED1(ViewMsg_SetCSSColors, + std::vector<CSSColors::CSSColorMapping>) + +// Tells the renderer to create a new view. +// This message is slightly different, the view it takes (via +// ViewMsg_New_Params) is the view to create, the message itself is sent as a +// non-view control message. +IPC_MESSAGE_CONTROL1(ViewMsg_New, + ViewMsg_New_Params) + +// Tells the renderer to set its maximum cache size to the supplied value. +IPC_MESSAGE_CONTROL3(ViewMsg_SetCacheCapacities, + size_t /* min_dead_capacity */, + size_t /* max_dead_capacity */, + size_t /* capacity */) + +// Tells the renderer to cleat the cache. +IPC_MESSAGE_CONTROL0(ViewMsg_ClearCache) + +// Reply in response to ViewHostMsg_ShowView or ViewHostMsg_ShowWidget. +// similar to the new command, but used when the renderer created a view +// first, and we need to update it. +IPC_MESSAGE_ROUTED1(ViewMsg_CreatingNew_ACK, + gfx::NativeViewId /* parent_hwnd */) + +// Sends updated preferences to the renderer. +IPC_MESSAGE_ROUTED1(ViewMsg_SetRendererPrefs, + RendererPreferences) + +// Tells the renderer to perform the given action on the media player +// located at the given point. +IPC_MESSAGE_ROUTED2(ViewMsg_MediaPlayerActionAt, + gfx::Point, /* location */ + WebKit::WebMediaPlayerAction) + +// Tells the render view to close. +IPC_MESSAGE_ROUTED0(ViewMsg_Close) + +// Tells the render view to change its size. A ViewHostMsg_PaintRect message +// is generated in response provided new_size is not empty and not equal to +// the view's current size. The generated ViewHostMsg_PaintRect message will +// have the IS_RESIZE_ACK flag set. It also receives the resizer rect so that +// we don't have to fetch it every time WebKit asks for it. +IPC_MESSAGE_ROUTED2(ViewMsg_Resize, + gfx::Size /* new_size */, + gfx::Rect /* resizer_rect */) + +// Sent to inform the view that it was hidden. This allows it to reduce its +// resource utilization. +IPC_MESSAGE_ROUTED0(ViewMsg_WasHidden) + +// Tells the render view that it is no longer hidden (see WasHidden), and the +// render view is expected to respond with a full repaint if needs_repainting +// is true. In that case, the generated ViewHostMsg_PaintRect message will +// have the IS_RESTORE_ACK flag set. If needs_repainting is false, then this +// message does not trigger a message in response. +IPC_MESSAGE_ROUTED1(ViewMsg_WasRestored, + bool /* needs_repainting */) + +// Tells the render view to capture a thumbnail image of the page. The +// render view responds with a ViewHostMsg_Thumbnail. +IPC_MESSAGE_ROUTED0(ViewMsg_CaptureThumbnail) + +// Tells the render view to capture a thumbnail image of the page. The +// render view responds with a ViewHostMsg_Snapshot. +IPC_MESSAGE_ROUTED0(ViewMsg_CaptureSnapshot) + +// Tells the render view to switch the CSS to print media type, renders every +// requested pages and switch back the CSS to display media type. +IPC_MESSAGE_ROUTED0(ViewMsg_PrintPages) + +// Tells the render view that printing is done so it can clean up. +IPC_MESSAGE_ROUTED2(ViewMsg_PrintingDone, + int /* document_cookie */, + bool /* success */) + +// Tells the render view to switch the CSS to print media type, renders every +// requested pages for print preview. +IPC_MESSAGE_ROUTED0(ViewMsg_PrintPreview) + +// Sends back to the browser the rendered "printed document" for preview that +// was requested by a ViewMsg_PrintPreview message. The memory handle in this +// message is already valid in the browser process. +IPC_MESSAGE_ROUTED1(ViewHostMsg_PagesReadyForPreview, + ViewHostMsg_DidPreviewDocument_Params /* params */) + +// Tells the renderer to dump as much memory as it can, perhaps because we +// have memory pressure or the renderer is (or will be) paged out. This +// should only result in purging objects we can recalculate, e.g. caches or +// JS garbage, not in purging irreplaceable objects. +IPC_MESSAGE_CONTROL0(ViewMsg_PurgeMemory) + +// Sent to render the view into the supplied transport DIB, resize +// the web widget to match the |page_size|, scale it by the +// appropriate scale to make it fit the |desired_size|, and return +// it. In response to this message, the host generates a +// ViewHostMsg_PaintAtSize_ACK message. Note that the DIB *must* be +// the right size to receive an RGBA image at the |desired_size|. +// |tag| is sent along with ViewHostMsg_PaintAtSize_ACK unmodified to +// identify the PaintAtSize message the ACK belongs to. +IPC_MESSAGE_ROUTED4(ViewMsg_PaintAtSize, + TransportDIB::Handle /* dib_handle */, + int /* tag */, + gfx::Size /* page_size */, + gfx::Size /* desired_size */) + +// Tells the render view that a ViewHostMsg_UpdateRect message was processed. +// This signals the render view that it can send another UpdateRect message. +IPC_MESSAGE_ROUTED0(ViewMsg_UpdateRect_ACK) + +// Message payload includes: +// 1. A blob that should be cast to WebInputEvent +// 2. An optional boolean value indicating if a RawKeyDown event is associated +// to a keyboard shortcut of the browser. +IPC_MESSAGE_ROUTED0(ViewMsg_HandleInputEvent) + +// This message notifies the renderer that the next key event is bound to one +// or more pre-defined edit commands. If the next key event is not handled +// by webkit, the specified edit commands shall be executed against current +// focused frame. +// Parameters +// * edit_commands (see chrome/common/edit_command_types.h) +// Contains one or more edit commands. +// See third_party/WebKit/WebCore/editing/EditorCommand.cpp for detailed +// definition of webkit edit commands. +// +// This message must be sent just before sending a key event. +IPC_MESSAGE_ROUTED1(ViewMsg_SetEditCommandsForNextKeyEvent, + std::vector<EditCommand> /* edit_commands */) + +// Message payload is the name/value of a WebCore edit command to execute. +IPC_MESSAGE_ROUTED2(ViewMsg_ExecuteEditCommand, + std::string, /* name */ + std::string /* value */) + +IPC_MESSAGE_ROUTED0(ViewMsg_MouseCaptureLost) + +// TODO(darin): figure out how this meshes with RestoreFocus +IPC_MESSAGE_ROUTED1(ViewMsg_SetFocus, bool /* enable */) + +// Tells the renderer to focus the first (last if reverse is true) focusable +// node. +IPC_MESSAGE_ROUTED1(ViewMsg_SetInitialFocus, bool /* reverse */) + +// Tells the renderer to scroll the currently focused node into view only if +// the currently focused node is a Text node (textfield, text area or content +// editable divs). +IPC_MESSAGE_ROUTED0(ViewMsg_ScrollFocusedEditableNodeIntoView) + +// Tells the renderer to perform the specified navigation, interrupting any +// existing navigation. +IPC_MESSAGE_ROUTED1(ViewMsg_Navigate, ViewMsg_Navigate_Params) + +IPC_MESSAGE_ROUTED0(ViewMsg_Stop) + +// Tells the renderer to reload the current focused frame +IPC_MESSAGE_ROUTED0(ViewMsg_ReloadFrame) + +// This message notifies the renderer that the user has closed the FindInPage +// window (and what action to take regarding the selection). +IPC_MESSAGE_ROUTED1(ViewMsg_StopFinding, + ViewMsg_StopFinding_Params /* action */) + +// These messages are typically generated from context menus and request the +// renderer to apply the specified operation to the current selection. +IPC_MESSAGE_ROUTED0(ViewMsg_Undo) +IPC_MESSAGE_ROUTED0(ViewMsg_Redo) +IPC_MESSAGE_ROUTED0(ViewMsg_Cut) +IPC_MESSAGE_ROUTED0(ViewMsg_Copy) #if defined(OS_MACOSX) - IPC_MESSAGE_ROUTED0(ViewMsg_CopyToFindPboard) +IPC_MESSAGE_ROUTED0(ViewMsg_CopyToFindPboard) #endif - IPC_MESSAGE_ROUTED0(ViewMsg_Paste) - // Replaces the selected region or a word around the cursor with the - // specified string. - IPC_MESSAGE_ROUTED1(ViewMsg_Replace, string16) - IPC_MESSAGE_ROUTED0(ViewMsg_ToggleSpellCheck) - IPC_MESSAGE_ROUTED0(ViewMsg_Delete) - IPC_MESSAGE_ROUTED0(ViewMsg_SelectAll) - IPC_MESSAGE_ROUTED1(ViewMsg_ToggleSpellPanel, bool) - - // This message tells the renderer to advance to the next misspelling. It is - // sent when the user clicks the "Find Next" button on the spelling panel. - IPC_MESSAGE_ROUTED0(ViewMsg_AdvanceToNextMisspelling) - - // Copies the image at location x, y to the clipboard (if there indeed is an - // image at that location). - IPC_MESSAGE_ROUTED2(ViewMsg_CopyImageAt, - int /* x */, - int /* y */) - - // History system notification that the visited link database has been - // replaced. It has one SharedMemoryHandle argument consisting of the table - // handle. This handle is valid in the context of the renderer - IPC_MESSAGE_CONTROL1(ViewMsg_VisitedLink_NewTable, base::SharedMemoryHandle) - - // History system notification that a link has been added and the link - // coloring state for the given hash must be re-calculated. - IPC_MESSAGE_CONTROL1(ViewMsg_VisitedLink_Add, std::vector<uint64>) - - // History system notification that one or more history items have been - // deleted, which at this point means that all link coloring state must be - // re-calculated. - IPC_MESSAGE_CONTROL0(ViewMsg_VisitedLink_Reset) - - // Notification that the user scripts have been updated. It has one - // SharedMemoryHandle argument consisting of the pickled script data. This - // handle is valid in the context of the renderer. - IPC_MESSAGE_CONTROL1(ViewMsg_UserScripts_UpdatedScripts, - base::SharedMemoryHandle) - - // Sent when the user wants to search for a word on the page (find in page). - IPC_MESSAGE_ROUTED3(ViewMsg_Find, - int /* request_id */, - string16 /* search_text */, - WebKit::WebFindOptions) - - // Send from the renderer to the browser to return the script running result. - IPC_MESSAGE_ROUTED2(ViewMsg_ExecuteCodeFinished, - int, /* request id */ - bool /* whether the script ran successfully */) - - // Sent when the headers are available for a resource request. - IPC_MESSAGE_ROUTED2(ViewMsg_Resource_ReceivedResponse, - int /* request_id */, - ResourceResponseHead) - - // Sent when cached metadata from a resource request is ready. - IPC_MESSAGE_ROUTED2(ViewMsg_Resource_ReceivedCachedMetadata, - int /* request_id */, - std::vector<char> /* data */) - - // Sent as upload progress is being made. - IPC_MESSAGE_ROUTED3(ViewMsg_Resource_UploadProgress, - int /* request_id */, - int64 /* position */, - int64 /* size */) - - // Sent when the request has been redirected. The receiver is expected to - // respond with either a FollowRedirect message (if the redirect is to be - // followed) or a CancelRequest message (if it should not be followed). - IPC_MESSAGE_ROUTED3(ViewMsg_Resource_ReceivedRedirect, - int /* request_id */, - GURL /* new_url */, - ResourceResponseHead) - - // Sent when some data from a resource request is ready. The handle should - // already be mapped into the process that receives this message. - IPC_MESSAGE_ROUTED3(ViewMsg_Resource_DataReceived, - int /* request_id */, - base::SharedMemoryHandle /* data */, - int /* data_len */) - - // Sent when some data from a resource request has been downloaded to - // file. This is only called in the 'download_to_file' case and replaces - // ViewMsg_Resource_DataReceived in the call sequence in that case. - IPC_MESSAGE_ROUTED2(ViewMsg_Resource_DataDownloaded, - int /* request_id */, - int /* data_len */) - - // Sent when the request has been completed. - IPC_MESSAGE_ROUTED4(ViewMsg_Resource_RequestComplete, - int /* request_id */, - URLRequestStatus /* status */, - std::string /* security info */, - base::Time /* completion_time */) - - // Sent when user prompting is required before a ViewHostMsg_GetCookies - // message can complete. This message indicates that the renderer should - // pump messages while waiting for cookies. - IPC_MESSAGE_CONTROL0(ViewMsg_SignalCookiePromptEvent) - - // Request for the renderer to evaluate an xpath to a frame and execute a - // javascript: url in that frame's context. The message is completely - // asynchronous and no corresponding response message is sent back. - // - // frame_xpath contains the modified xpath notation to identify an inner - // subframe (starting from the root frame). It is a concatenation of - // number of smaller xpaths delimited by '\n'. Each chunk in the string can - // be evaluated to a frame in its parent-frame's context. - // - // Example: /html/body/iframe/\n/html/body/div/iframe/\n/frameset/frame[0] - // can be broken into 3 xpaths - // /html/body/iframe evaluates to an iframe within the root frame - // /html/body/div/iframe evaluates to an iframe within the level-1 iframe - // /frameset/frame[0] evaluates to first frame within the level-2 iframe - // - // jscript_url is the string containing the javascript: url to be executed - // in the target frame's context. The string should start with "javascript:" - // and continue with a valid JS text. - // - // If the fourth parameter is true the result is sent back to the renderer - // using the message ViewHostMsg_ScriptEvalResponse. - // ViewHostMsg_ScriptEvalResponse is passed the ID parameter so that the - // client can uniquely identify the request. - IPC_MESSAGE_ROUTED4(ViewMsg_ScriptEvalRequest, - string16, /* frame_xpath */ - string16, /* jscript_url */ - int, /* ID */ - bool /* If true, result is sent back. */) - - // Request for the renderer to evaluate an xpath to a frame and insert css - // into that frame's document. See ViewMsg_ScriptEvalRequest for details on - // allowed xpath expressions. - IPC_MESSAGE_ROUTED3(ViewMsg_CSSInsertRequest, - std::wstring, /* frame_xpath */ - std::string, /* css string */ - std::string /* element id */) - - // Log a message to the console of the target frame - IPC_MESSAGE_ROUTED3(ViewMsg_AddMessageToConsole, - string16 /* frame_xpath */, - string16 /* message */, - WebKit::WebConsoleMessage::Level /* message_level */) - - // RenderViewHostDelegate::RenderViewCreated method sends this message to a - // new renderer to notify it that it will host developer tools UI and should - // set up all neccessary bindings and create DevToolsClient instance that - // will handle communication with inspected page DevToolsAgent. - IPC_MESSAGE_ROUTED0(ViewMsg_SetupDevToolsClient) - - // Change the zoom level for the current main frame. If the level actually - // changes, a ViewHostMsg_DidZoomURL message will be sent back to the browser - // telling it what url got zoomed and what its current zoom level is. - IPC_MESSAGE_ROUTED1(ViewMsg_Zoom, - PageZoom::Function /* function */) - - // Set the zoom level for the current main frame. If the level actually - // changes, a ViewHostMsg_DidZoomURL message will be sent back to the browser - // telling it what url got zoomed and what its current zoom level is. - IPC_MESSAGE_ROUTED1(ViewMsg_SetZoomLevel, - double /* zoom_level */) - - // Set the zoom level for a particular url that the renderer is in the - // process of loading. This will be stored, to be used if the load commits - // and ignored otherwise. - IPC_MESSAGE_ROUTED2(ViewMsg_SetZoomLevelForLoadingURL, - GURL /* url */, - double /* zoom_level */) - - // Set the zoom level for a particular url, so all render views - // displaying this url can update their zoom levels to match. - IPC_MESSAGE_CONTROL2(ViewMsg_SetZoomLevelForCurrentURL, - GURL /* url */, - double /* zoom_level */) - - // Set the content settings for a particular url that the renderer is in the - // process of loading. This will be stored, to be used if the load commits - // and ignored otherwise. - IPC_MESSAGE_ROUTED2(ViewMsg_SetContentSettingsForLoadingURL, - GURL /* url */, - ContentSettings /* content_settings */) - - // Set the content settings for a particular url, so all render views - // displaying this host url update their content settings to match. - IPC_MESSAGE_CONTROL2(ViewMsg_SetContentSettingsForCurrentURL, - GURL /* url */, - ContentSettings /* content_settings */) - - // Change encoding of page in the renderer. - IPC_MESSAGE_ROUTED1(ViewMsg_SetPageEncoding, - std::string /*new encoding name*/) - - // Reset encoding of page in the renderer back to default. - IPC_MESSAGE_ROUTED0(ViewMsg_ResetPageEncodingToDefault) - - // Requests the renderer to reserve a range of page ids. - IPC_MESSAGE_ROUTED1(ViewMsg_ReservePageIDRange, - int /* size_of_range */) - - // Fill a form with data and optionally submit it - IPC_MESSAGE_ROUTED1(ViewMsg_FormFill, - webkit_glue::FormData /* form */) - - // Fill a password form and prepare field autocomplete for multiple - // matching logins. - IPC_MESSAGE_ROUTED1(ViewMsg_FillPasswordForm, - webkit_glue::PasswordFormFillData) - - // D&d drop target messages. - IPC_MESSAGE_ROUTED4(ViewMsg_DragTargetDragEnter, - WebDropData /* drop_data */, - gfx::Point /* client_pt */, - gfx::Point /* screen_pt */, - WebKit::WebDragOperationsMask /* ops_allowed */) - IPC_MESSAGE_ROUTED3(ViewMsg_DragTargetDragOver, - gfx::Point /* client_pt */, - gfx::Point /* screen_pt */, - WebKit::WebDragOperationsMask /* ops_allowed */) - IPC_MESSAGE_ROUTED0(ViewMsg_DragTargetDragLeave) - IPC_MESSAGE_ROUTED2(ViewMsg_DragTargetDrop, - gfx::Point /* client_pt */, - gfx::Point /* screen_pt */) - - // Notifies the renderer of updates in mouse position of an in-progress - // drag. if |ended| is true, then the user has ended the drag operation. - IPC_MESSAGE_ROUTED4(ViewMsg_DragSourceEndedOrMoved, - gfx::Point /* client_pt */, - gfx::Point /* screen_pt */, - bool /* ended */, - WebKit::WebDragOperation /* drag_operation */) - - // Notifies the renderer that the system DoDragDrop call has ended. - IPC_MESSAGE_ROUTED0(ViewMsg_DragSourceSystemDragEnded) - - // Used to tell a render view whether it should expose various bindings - // that allow JS content extended privileges. See BindingsPolicy for valid - // flag values. - IPC_MESSAGE_ROUTED1(ViewMsg_AllowBindings, - int /* enabled_bindings_flags */) - - // Tell the renderer to add a property to the DOMUI binding object. This - // only works if we allowed DOMUI bindings. - IPC_MESSAGE_ROUTED2(ViewMsg_SetDOMUIProperty, - std::string /* property_name */, - std::string /* property_value_json */) - - // This message starts/stop monitoring the input method status of the focused - // edit control of a renderer process. - // Parameters - // * is_active (bool) - // Indicates if an input method is active in the browser process. - // The possible actions when a renderer process receives this message are - // listed below: - // Value Action - // true Start sending IPC message ViewHostMsg_ImeUpdateTextInputState - // to notify the input method status of the focused edit control. - // false Stop sending IPC message ViewHostMsg_ImeUpdateTextInputState. - IPC_MESSAGE_ROUTED1(ViewMsg_SetInputMethodActive, - bool /* is_active */) - - // This message sends a string being composed with an input method. - IPC_MESSAGE_ROUTED4( - ViewMsg_ImeSetComposition, - string16, /* text */ - std::vector<WebKit::WebCompositionUnderline>, /* underlines */ - int, /* selectiont_start */ - int /* selection_end */) - - // This message confirms an ongoing composition. - IPC_MESSAGE_ROUTED0(ViewMsg_ImeConfirmComposition) - - // This passes a set of webkit preferences down to the renderer. - IPC_MESSAGE_ROUTED1(ViewMsg_UpdateWebPreferences, WebPreferences) - - // Used to notify the render-view that the browser has received a reply for - // the Find operation and is interested in receiving the next one. This is - // used to prevent the renderer from spamming the browser process with - // results. - IPC_MESSAGE_ROUTED0(ViewMsg_FindReplyACK) - - // Used to notify the render-view that we have received a target URL. Used - // to prevent target URLs spamming the browser. - IPC_MESSAGE_ROUTED0(ViewMsg_UpdateTargetURL_ACK) - - // Sets the alternate error page URL (link doctor) for the renderer process. - IPC_MESSAGE_ROUTED1(ViewMsg_SetAltErrorPageURL, GURL) - - // Install the first missing pluign. - IPC_MESSAGE_ROUTED0(ViewMsg_InstallMissingPlugin) - - // Tells the renderer to empty its plugin list cache, optional reloading - // pages containing plugins. - IPC_MESSAGE_CONTROL1(ViewMsg_PurgePluginListCache, - bool /* reload_pages */) - - // Tells the render view to load all blocked plugins. - IPC_MESSAGE_ROUTED0(ViewMsg_LoadBlockedPlugins) - - IPC_MESSAGE_ROUTED1(ViewMsg_RunFileChooserResponse, - std::vector<FilePath> /* selected files */) - - // Used to instruct the RenderView to go into "view source" mode. - IPC_MESSAGE_ROUTED0(ViewMsg_EnableViewSourceMode) - - // Get all savable resource links from current webpage, include main - // frame and sub-frame. - IPC_MESSAGE_ROUTED1(ViewMsg_GetAllSavableResourceLinksForCurrentPage, - GURL /* url of page which is needed to save */) - - // Get html data by serializing all frames of current page with lists - // which contain all resource links that have local copy. - IPC_MESSAGE_ROUTED3(ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, - std::vector<GURL> /* urls that have local copy */, - std::vector<FilePath> /* paths of local copy */, - FilePath /* local directory path */) - - // Requests application info for the page. The renderer responds back with - // ViewHostMsg_DidGetApplicationInfo. - IPC_MESSAGE_ROUTED1(ViewMsg_GetApplicationInfo, int32 /*page_id*/) - - // Requests the renderer to download the specified favicon image encode it as - // PNG and send the PNG data back ala ViewHostMsg_DidDownloadFavIcon. - IPC_MESSAGE_ROUTED3(ViewMsg_DownloadFavIcon, - int /* identifier for the request */, - GURL /* URL of the image */, - int /* Size of the image. Normally 0, but set if you have - a preferred image size to request, such as when - downloading the favicon */) - - // When a renderer sends a ViewHostMsg_Focus to the browser process, - // the browser has the option of sending a ViewMsg_CantFocus back to - // the renderer. - IPC_MESSAGE_ROUTED0(ViewMsg_CantFocus) - - // Instructs the renderer to invoke the frame's shouldClose method, which - // runs the onbeforeunload event handler. Expects the result to be returned - // via ViewHostMsg_ShouldClose. - IPC_MESSAGE_ROUTED0(ViewMsg_ShouldClose) - - // Instructs the renderer to close the current page, including running the - // onunload event handler. See the struct in render_messages.h for more. - // - // Expects a ClosePage_ACK message when finished, where the parameters are - // echoed back. - IPC_MESSAGE_ROUTED1(ViewMsg_ClosePage, - ViewMsg_ClosePage_Params) - - // Asks the renderer to send back stats on the WebCore cache broken down by - // resource types. - IPC_MESSAGE_CONTROL0(ViewMsg_GetCacheResourceStats) - - // Asks the renderer to send back Histograms. - IPC_MESSAGE_CONTROL1(ViewMsg_GetRendererHistograms, - int /* sequence number of Renderer Histograms. */) +IPC_MESSAGE_ROUTED0(ViewMsg_Paste) +// Replaces the selected region or a word around the cursor with the +// specified string. +IPC_MESSAGE_ROUTED1(ViewMsg_Replace, string16) +IPC_MESSAGE_ROUTED0(ViewMsg_ToggleSpellCheck) +IPC_MESSAGE_ROUTED0(ViewMsg_Delete) +IPC_MESSAGE_ROUTED0(ViewMsg_SelectAll) +IPC_MESSAGE_ROUTED1(ViewMsg_ToggleSpellPanel, bool) + +// This message tells the renderer to advance to the next misspelling. It is +// sent when the user clicks the "Find Next" button on the spelling panel. +IPC_MESSAGE_ROUTED0(ViewMsg_AdvanceToNextMisspelling) + +// Copies the image at location x, y to the clipboard (if there indeed is an +// image at that location). +IPC_MESSAGE_ROUTED2(ViewMsg_CopyImageAt, + int /* x */, + int /* y */) + +// History system notification that the visited link database has been +// replaced. It has one SharedMemoryHandle argument consisting of the table +// handle. This handle is valid in the context of the renderer +IPC_MESSAGE_CONTROL1(ViewMsg_VisitedLink_NewTable, base::SharedMemoryHandle) + +// History system notification that a link has been added and the link +// coloring state for the given hash must be re-calculated. +IPC_MESSAGE_CONTROL1(ViewMsg_VisitedLink_Add, std::vector<uint64>) + +// History system notification that one or more history items have been +// deleted, which at this point means that all link coloring state must be +// re-calculated. +IPC_MESSAGE_CONTROL0(ViewMsg_VisitedLink_Reset) + +// Notification that the user scripts have been updated. It has one +// SharedMemoryHandle argument consisting of the pickled script data. This +// handle is valid in the context of the renderer. +IPC_MESSAGE_CONTROL1(ViewMsg_UserScripts_UpdatedScripts, + base::SharedMemoryHandle) + +// Sent when the user wants to search for a word on the page (find in page). +IPC_MESSAGE_ROUTED3(ViewMsg_Find, + int /* request_id */, + string16 /* search_text */, + WebKit::WebFindOptions) + +// Send from the renderer to the browser to return the script running result. +IPC_MESSAGE_ROUTED2(ViewMsg_ExecuteCodeFinished, + int, /* request id */ + bool /* whether the script ran successfully */) + +// Sent when the headers are available for a resource request. +IPC_MESSAGE_ROUTED2(ViewMsg_Resource_ReceivedResponse, + int /* request_id */, + ResourceResponseHead) + +// Sent when cached metadata from a resource request is ready. +IPC_MESSAGE_ROUTED2(ViewMsg_Resource_ReceivedCachedMetadata, + int /* request_id */, + std::vector<char> /* data */) + +// Sent as upload progress is being made. +IPC_MESSAGE_ROUTED3(ViewMsg_Resource_UploadProgress, + int /* request_id */, + int64 /* position */, + int64 /* size */) + +// Sent when the request has been redirected. The receiver is expected to +// respond with either a FollowRedirect message (if the redirect is to be +// followed) or a CancelRequest message (if it should not be followed). +IPC_MESSAGE_ROUTED3(ViewMsg_Resource_ReceivedRedirect, + int /* request_id */, + GURL /* new_url */, + ResourceResponseHead) + +// Sent when some data from a resource request is ready. The handle should +// already be mapped into the process that receives this message. +IPC_MESSAGE_ROUTED3(ViewMsg_Resource_DataReceived, + int /* request_id */, + base::SharedMemoryHandle /* data */, + int /* data_len */) + +// Sent when some data from a resource request has been downloaded to +// file. This is only called in the 'download_to_file' case and replaces +// ViewMsg_Resource_DataReceived in the call sequence in that case. +IPC_MESSAGE_ROUTED2(ViewMsg_Resource_DataDownloaded, + int /* request_id */, + int /* data_len */) + +// Sent when the request has been completed. +IPC_MESSAGE_ROUTED4(ViewMsg_Resource_RequestComplete, + int /* request_id */, + URLRequestStatus /* status */, + std::string /* security info */, + base::Time /* completion_time */) + +// Sent when user prompting is required before a ViewHostMsg_GetCookies +// message can complete. This message indicates that the renderer should +// pump messages while waiting for cookies. +IPC_MESSAGE_CONTROL0(ViewMsg_SignalCookiePromptEvent) + +// Request for the renderer to evaluate an xpath to a frame and execute a +// javascript: url in that frame's context. The message is completely +// asynchronous and no corresponding response message is sent back. +// +// frame_xpath contains the modified xpath notation to identify an inner +// subframe (starting from the root frame). It is a concatenation of +// number of smaller xpaths delimited by '\n'. Each chunk in the string can +// be evaluated to a frame in its parent-frame's context. +// +// Example: /html/body/iframe/\n/html/body/div/iframe/\n/frameset/frame[0] +// can be broken into 3 xpaths +// /html/body/iframe evaluates to an iframe within the root frame +// /html/body/div/iframe evaluates to an iframe within the level-1 iframe +// /frameset/frame[0] evaluates to first frame within the level-2 iframe +// +// jscript_url is the string containing the javascript: url to be executed +// in the target frame's context. The string should start with "javascript:" +// and continue with a valid JS text. +// +// If the fourth parameter is true the result is sent back to the renderer +// using the message ViewHostMsg_ScriptEvalResponse. +// ViewHostMsg_ScriptEvalResponse is passed the ID parameter so that the +// client can uniquely identify the request. +IPC_MESSAGE_ROUTED4(ViewMsg_ScriptEvalRequest, + string16, /* frame_xpath */ + string16, /* jscript_url */ + int, /* ID */ + bool /* If true, result is sent back. */) + +// Request for the renderer to evaluate an xpath to a frame and insert css +// into that frame's document. See ViewMsg_ScriptEvalRequest for details on +// allowed xpath expressions. +IPC_MESSAGE_ROUTED3(ViewMsg_CSSInsertRequest, + std::wstring, /* frame_xpath */ + std::string, /* css string */ + std::string /* element id */) + +// Log a message to the console of the target frame +IPC_MESSAGE_ROUTED3(ViewMsg_AddMessageToConsole, + string16 /* frame_xpath */, + string16 /* message */, + WebKit::WebConsoleMessage::Level /* message_level */) + +// RenderViewHostDelegate::RenderViewCreated method sends this message to a +// new renderer to notify it that it will host developer tools UI and should +// set up all neccessary bindings and create DevToolsClient instance that +// will handle communication with inspected page DevToolsAgent. +IPC_MESSAGE_ROUTED0(ViewMsg_SetupDevToolsClient) + +// Change the zoom level for the current main frame. If the level actually +// changes, a ViewHostMsg_DidZoomURL message will be sent back to the browser +// telling it what url got zoomed and what its current zoom level is. +IPC_MESSAGE_ROUTED1(ViewMsg_Zoom, + PageZoom::Function /* function */) + +// Set the zoom level for the current main frame. If the level actually +// changes, a ViewHostMsg_DidZoomURL message will be sent back to the browser +// telling it what url got zoomed and what its current zoom level is. +IPC_MESSAGE_ROUTED1(ViewMsg_SetZoomLevel, + double /* zoom_level */) + +// Set the zoom level for a particular url that the renderer is in the +// process of loading. This will be stored, to be used if the load commits +// and ignored otherwise. +IPC_MESSAGE_ROUTED2(ViewMsg_SetZoomLevelForLoadingURL, + GURL /* url */, + double /* zoom_level */) + +// Set the zoom level for a particular url, so all render views +// displaying this url can update their zoom levels to match. +IPC_MESSAGE_CONTROL2(ViewMsg_SetZoomLevelForCurrentURL, + GURL /* url */, + double /* zoom_level */) + +// Set the content settings for a particular url that the renderer is in the +// process of loading. This will be stored, to be used if the load commits +// and ignored otherwise. +IPC_MESSAGE_ROUTED2(ViewMsg_SetContentSettingsForLoadingURL, + GURL /* url */, + ContentSettings /* content_settings */) + +// Set the content settings for a particular url, so all render views +// displaying this host url update their content settings to match. +IPC_MESSAGE_CONTROL2(ViewMsg_SetContentSettingsForCurrentURL, + GURL /* url */, + ContentSettings /* content_settings */) + +// Change encoding of page in the renderer. +IPC_MESSAGE_ROUTED1(ViewMsg_SetPageEncoding, + std::string /*new encoding name*/) + +// Reset encoding of page in the renderer back to default. +IPC_MESSAGE_ROUTED0(ViewMsg_ResetPageEncodingToDefault) + +// Requests the renderer to reserve a range of page ids. +IPC_MESSAGE_ROUTED1(ViewMsg_ReservePageIDRange, + int /* size_of_range */) + +// Fill a form with data and optionally submit it +IPC_MESSAGE_ROUTED1(ViewMsg_FormFill, + webkit_glue::FormData /* form */) + +// Fill a password form and prepare field autocomplete for multiple +// matching logins. +IPC_MESSAGE_ROUTED1(ViewMsg_FillPasswordForm, + webkit_glue::PasswordFormFillData) + +// D&d drop target messages. +IPC_MESSAGE_ROUTED4(ViewMsg_DragTargetDragEnter, + WebDropData /* drop_data */, + gfx::Point /* client_pt */, + gfx::Point /* screen_pt */, + WebKit::WebDragOperationsMask /* ops_allowed */) +IPC_MESSAGE_ROUTED3(ViewMsg_DragTargetDragOver, + gfx::Point /* client_pt */, + gfx::Point /* screen_pt */, + WebKit::WebDragOperationsMask /* ops_allowed */) +IPC_MESSAGE_ROUTED0(ViewMsg_DragTargetDragLeave) +IPC_MESSAGE_ROUTED2(ViewMsg_DragTargetDrop, + gfx::Point /* client_pt */, + gfx::Point /* screen_pt */) + +// Notifies the renderer of updates in mouse position of an in-progress +// drag. if |ended| is true, then the user has ended the drag operation. +IPC_MESSAGE_ROUTED4(ViewMsg_DragSourceEndedOrMoved, + gfx::Point /* client_pt */, + gfx::Point /* screen_pt */, + bool /* ended */, + WebKit::WebDragOperation /* drag_operation */) + +// Notifies the renderer that the system DoDragDrop call has ended. +IPC_MESSAGE_ROUTED0(ViewMsg_DragSourceSystemDragEnded) + +// Used to tell a render view whether it should expose various bindings +// that allow JS content extended privileges. See BindingsPolicy for valid +// flag values. +IPC_MESSAGE_ROUTED1(ViewMsg_AllowBindings, + int /* enabled_bindings_flags */) + +// Tell the renderer to add a property to the DOMUI binding object. This +// only works if we allowed DOMUI bindings. +IPC_MESSAGE_ROUTED2(ViewMsg_SetDOMUIProperty, + std::string /* property_name */, + std::string /* property_value_json */) + +// This message starts/stop monitoring the input method status of the focused +// edit control of a renderer process. +// Parameters +// * is_active (bool) +// Indicates if an input method is active in the browser process. +// The possible actions when a renderer process receives this message are +// listed below: +// Value Action +// true Start sending IPC message ViewHostMsg_ImeUpdateTextInputState +// to notify the input method status of the focused edit control. +// false Stop sending IPC message ViewHostMsg_ImeUpdateTextInputState. +IPC_MESSAGE_ROUTED1(ViewMsg_SetInputMethodActive, + bool /* is_active */) + +// This message sends a string being composed with an input method. +IPC_MESSAGE_ROUTED4( + ViewMsg_ImeSetComposition, + string16, /* text */ + std::vector<WebKit::WebCompositionUnderline>, /* underlines */ + int, /* selectiont_start */ + int /* selection_end */) + +// This message confirms an ongoing composition. +IPC_MESSAGE_ROUTED0(ViewMsg_ImeConfirmComposition) + +// This passes a set of webkit preferences down to the renderer. +IPC_MESSAGE_ROUTED1(ViewMsg_UpdateWebPreferences, WebPreferences) + +// Used to notify the render-view that the browser has received a reply for +// the Find operation and is interested in receiving the next one. This is +// used to prevent the renderer from spamming the browser process with +// results. +IPC_MESSAGE_ROUTED0(ViewMsg_FindReplyACK) + +// Used to notify the render-view that we have received a target URL. Used +// to prevent target URLs spamming the browser. +IPC_MESSAGE_ROUTED0(ViewMsg_UpdateTargetURL_ACK) + +// Sets the alternate error page URL (link doctor) for the renderer process. +IPC_MESSAGE_ROUTED1(ViewMsg_SetAltErrorPageURL, GURL) + +// Install the first missing pluign. +IPC_MESSAGE_ROUTED0(ViewMsg_InstallMissingPlugin) + +// Tells the renderer to empty its plugin list cache, optional reloading +// pages containing plugins. +IPC_MESSAGE_CONTROL1(ViewMsg_PurgePluginListCache, + bool /* reload_pages */) + +// Tells the render view to load all blocked plugins. +IPC_MESSAGE_ROUTED0(ViewMsg_LoadBlockedPlugins) + +IPC_MESSAGE_ROUTED1(ViewMsg_RunFileChooserResponse, + std::vector<FilePath> /* selected files */) + +// Used to instruct the RenderView to go into "view source" mode. +IPC_MESSAGE_ROUTED0(ViewMsg_EnableViewSourceMode) + +// Get all savable resource links from current webpage, include main +// frame and sub-frame. +IPC_MESSAGE_ROUTED1(ViewMsg_GetAllSavableResourceLinksForCurrentPage, + GURL /* url of page which is needed to save */) + +// Get html data by serializing all frames of current page with lists +// which contain all resource links that have local copy. +IPC_MESSAGE_ROUTED3(ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, + std::vector<GURL> /* urls that have local copy */, + std::vector<FilePath> /* paths of local copy */, + FilePath /* local directory path */) + +// Requests application info for the page. The renderer responds back with +// ViewHostMsg_DidGetApplicationInfo. +IPC_MESSAGE_ROUTED1(ViewMsg_GetApplicationInfo, int32 /*page_id*/) + +// Requests the renderer to download the specified favicon image encode it as +// PNG and send the PNG data back ala ViewHostMsg_DidDownloadFavIcon. +IPC_MESSAGE_ROUTED3(ViewMsg_DownloadFavIcon, + int /* identifier for the request */, + GURL /* URL of the image */, + int /* Size of the image. Normally 0, but set if you have + a preferred image size to request, such as when + downloading the favicon */) + +// When a renderer sends a ViewHostMsg_Focus to the browser process, +// the browser has the option of sending a ViewMsg_CantFocus back to +// the renderer. +IPC_MESSAGE_ROUTED0(ViewMsg_CantFocus) + +// Instructs the renderer to invoke the frame's shouldClose method, which +// runs the onbeforeunload event handler. Expects the result to be returned +// via ViewHostMsg_ShouldClose. +IPC_MESSAGE_ROUTED0(ViewMsg_ShouldClose) + +// Instructs the renderer to close the current page, including running the +// onunload event handler. See the struct in render_messages.h for more. +// +// Expects a ClosePage_ACK message when finished, where the parameters are +// echoed back. +IPC_MESSAGE_ROUTED1(ViewMsg_ClosePage, + ViewMsg_ClosePage_Params) + +// Asks the renderer to send back stats on the WebCore cache broken down by +// resource types. +IPC_MESSAGE_CONTROL0(ViewMsg_GetCacheResourceStats) + +// Asks the renderer to send back Histograms. +IPC_MESSAGE_CONTROL1(ViewMsg_GetRendererHistograms, + int /* sequence number of Renderer Histograms. */) #if defined(USE_TCMALLOC) - // Asks the renderer to send back tcmalloc stats. - IPC_MESSAGE_CONTROL0(ViewMsg_GetRendererTcmalloc) +// Asks the renderer to send back tcmalloc stats. +IPC_MESSAGE_CONTROL0(ViewMsg_GetRendererTcmalloc) #endif - // Asks the renderer to send back V8 heap stats. - IPC_MESSAGE_CONTROL0(ViewMsg_GetV8HeapStats) - - // Notifies the renderer about ui theme changes - IPC_MESSAGE_ROUTED0(ViewMsg_ThemeChanged) - - // Notifies the renderer that a paint is to be generated for the rectangle - // passed in. - IPC_MESSAGE_ROUTED1(ViewMsg_Repaint, - gfx::Size /* The view size to be repainted */) - - // Posts a message to the renderer. - IPC_MESSAGE_ROUTED3(ViewMsg_HandleMessageFromExternalHost, - std::string /* The message */, - std::string /* The origin */, - std::string /* The target*/) - - // Sent to the renderer when a popup window should no longer count against - // the current popup count (either because it's not a popup or because it was - // a generated by a user action or because a constrained popup got turned - // into a full window). - IPC_MESSAGE_ROUTED0(ViewMsg_DisassociateFromPopupCount) - - // The browser sends this to a renderer process in response to a - // ViewHostMsg_EstablishGpuChannel message. - IPC_MESSAGE_CONTROL2(ViewMsg_GpuChannelEstablished, - IPC::ChannelHandle /* handle to channel */, - GPUInfo /* stats about GPU process*/) - - // Notifies the renderer of the appcache that has been selected for a - // a particular host. This is sent in reply to AppCacheMsg_SelectCache. - IPC_MESSAGE_CONTROL2(AppCacheMsg_CacheSelected, - int /* host_id */, - appcache::AppCacheInfo) - - // Notifies the renderer of an AppCache status change. - IPC_MESSAGE_CONTROL2(AppCacheMsg_StatusChanged, - std::vector<int> /* host_ids */, - appcache::Status) - - // Notifies the renderer of an AppCache event other than the - // progress event which has a seperate message. - IPC_MESSAGE_CONTROL2(AppCacheMsg_EventRaised, - std::vector<int> /* host_ids */, - appcache::EventID) - - // Notifies the renderer of an AppCache progress event. - IPC_MESSAGE_CONTROL4(AppCacheMsg_ProgressEventRaised, - std::vector<int> /* host_ids */, - GURL /* url being processed */, - int /* total */, - int /* complete */) - - // Notifies the renderer of an AppCache error event. - IPC_MESSAGE_CONTROL2(AppCacheMsg_ErrorEventRaised, - std::vector<int> /* host_ids */, - std::string /* error_message */) - - // Notifies the renderer of an AppCache logging message. - IPC_MESSAGE_CONTROL3(AppCacheMsg_LogMessage, - int /* host_id */, - int /* log_level */, - std::string /* message */) - - // Notifies the renderer of the fact that AppCache access was blocked. - IPC_MESSAGE_CONTROL2(AppCacheMsg_ContentBlocked, - int /* host_id */, - GURL /* manifest_url */) - - // Reply to the ViewHostMsg_QueryFormFieldAutoFill message with the - // AutoFill suggestions. - IPC_MESSAGE_ROUTED5(ViewMsg_AutoFillSuggestionsReturned, - int /* id of the request message */, - std::vector<string16> /* names */, - std::vector<string16> /* labels */, - std::vector<string16> /* icons */, - std::vector<int> /* unique_ids */) - - // Reply to the ViewHostMsg_FillAutoFillFormData message with the - // AutoFill form data. - IPC_MESSAGE_ROUTED2(ViewMsg_AutoFillFormDataFilled, - int /* id of the request message */, - webkit_glue::FormData /* form data */) - - // Sent by the Browser process to alert a window about whether a it should - // allow a scripted window.close(). The renderer assumes every new window is a - // blocked popup until notified otherwise. - IPC_MESSAGE_ROUTED1(ViewMsg_AllowScriptToClose, - bool /* script_can_close */) - - // Sent by AudioRendererHost to renderer to request an audio packet. - IPC_MESSAGE_ROUTED2(ViewMsg_RequestAudioPacket, - int /* stream id */, - AudioBuffersState) - - // Tell the renderer process that the audio stream has been created, renderer - // process would be given a ShareMemoryHandle that it should write to from - // then on. - IPC_MESSAGE_ROUTED3(ViewMsg_NotifyAudioStreamCreated, - int /* stream id */, - base::SharedMemoryHandle /* handle */, - uint32 /* length */) - - // Tell the renderer process that a low latency audio stream has been created, - // renderer process would be given a SyncSocket that it should write to from - // then on. +// Asks the renderer to send back V8 heap stats. +IPC_MESSAGE_CONTROL0(ViewMsg_GetV8HeapStats) + +// Notifies the renderer about ui theme changes +IPC_MESSAGE_ROUTED0(ViewMsg_ThemeChanged) + +// Notifies the renderer that a paint is to be generated for the rectangle +// passed in. +IPC_MESSAGE_ROUTED1(ViewMsg_Repaint, + gfx::Size /* The view size to be repainted */) + +// Posts a message to the renderer. +IPC_MESSAGE_ROUTED3(ViewMsg_HandleMessageFromExternalHost, + std::string /* The message */, + std::string /* The origin */, + std::string /* The target*/) + +// Sent to the renderer when a popup window should no longer count against +// the current popup count (either because it's not a popup or because it was +// a generated by a user action or because a constrained popup got turned +// into a full window). +IPC_MESSAGE_ROUTED0(ViewMsg_DisassociateFromPopupCount) + +// The browser sends this to a renderer process in response to a +// ViewHostMsg_EstablishGpuChannel message. +IPC_MESSAGE_CONTROL2(ViewMsg_GpuChannelEstablished, + IPC::ChannelHandle /* handle to channel */, + GPUInfo /* stats about GPU process*/) + +// Notifies the renderer of the appcache that has been selected for a +// a particular host. This is sent in reply to AppCacheMsg_SelectCache. +IPC_MESSAGE_CONTROL2(AppCacheMsg_CacheSelected, + int /* host_id */, + appcache::AppCacheInfo) + +// Notifies the renderer of an AppCache status change. +IPC_MESSAGE_CONTROL2(AppCacheMsg_StatusChanged, + std::vector<int> /* host_ids */, + appcache::Status) + +// Notifies the renderer of an AppCache event other than the +// progress event which has a seperate message. +IPC_MESSAGE_CONTROL2(AppCacheMsg_EventRaised, + std::vector<int> /* host_ids */, + appcache::EventID) + +// Notifies the renderer of an AppCache progress event. +IPC_MESSAGE_CONTROL4(AppCacheMsg_ProgressEventRaised, + std::vector<int> /* host_ids */, + GURL /* url being processed */, + int /* total */, + int /* complete */) + +// Notifies the renderer of an AppCache error event. +IPC_MESSAGE_CONTROL2(AppCacheMsg_ErrorEventRaised, + std::vector<int> /* host_ids */, + std::string /* error_message */) + +// Notifies the renderer of an AppCache logging message. +IPC_MESSAGE_CONTROL3(AppCacheMsg_LogMessage, + int /* host_id */, + int /* log_level */, + std::string /* message */) + +// Notifies the renderer of the fact that AppCache access was blocked. +IPC_MESSAGE_CONTROL2(AppCacheMsg_ContentBlocked, + int /* host_id */, + GURL /* manifest_url */) + +// Reply to the ViewHostMsg_QueryFormFieldAutoFill message with the +// AutoFill suggestions. +IPC_MESSAGE_ROUTED5(ViewMsg_AutoFillSuggestionsReturned, + int /* id of the request message */, + std::vector<string16> /* names */, + std::vector<string16> /* labels */, + std::vector<string16> /* icons */, + std::vector<int> /* unique_ids */) + +// Reply to the ViewHostMsg_FillAutoFillFormData message with the +// AutoFill form data. +IPC_MESSAGE_ROUTED2(ViewMsg_AutoFillFormDataFilled, + int /* id of the request message */, + webkit_glue::FormData /* form data */) + +// Sent by the Browser process to alert a window about whether a it should +// allow a scripted window.close(). The renderer assumes every new window is a +// blocked popup until notified otherwise. +IPC_MESSAGE_ROUTED1(ViewMsg_AllowScriptToClose, + bool /* script_can_close */) + +// Sent by AudioRendererHost to renderer to request an audio packet. +IPC_MESSAGE_ROUTED2(ViewMsg_RequestAudioPacket, + int /* stream id */, + AudioBuffersState) + +// Tell the renderer process that the audio stream has been created, renderer +// process would be given a ShareMemoryHandle that it should write to from +// then on. +IPC_MESSAGE_ROUTED3(ViewMsg_NotifyAudioStreamCreated, + int /* stream id */, + base::SharedMemoryHandle /* handle */, + uint32 /* length */) + +// Tell the renderer process that a low latency audio stream has been created, +// renderer process would be given a SyncSocket that it should write to from +// then on. #if defined(OS_WIN) - IPC_MESSAGE_ROUTED4(ViewMsg_NotifyLowLatencyAudioStreamCreated, - int /* stream id */, - base::SharedMemoryHandle /* handle */, - base::SyncSocket::Handle /* socket handle */, - uint32 /* length */) +IPC_MESSAGE_ROUTED4(ViewMsg_NotifyLowLatencyAudioStreamCreated, + int /* stream id */, + base::SharedMemoryHandle /* handle */, + base::SyncSocket::Handle /* socket handle */, + uint32 /* length */) #else - IPC_MESSAGE_ROUTED4(ViewMsg_NotifyLowLatencyAudioStreamCreated, - int /* stream id */, - base::SharedMemoryHandle /* handle */, - base::FileDescriptor /* socket handle */, - uint32 /* length */) +IPC_MESSAGE_ROUTED4(ViewMsg_NotifyLowLatencyAudioStreamCreated, + int /* stream id */, + base::SharedMemoryHandle /* handle */, + base::FileDescriptor /* socket handle */, + uint32 /* length */) #endif - // Notification message sent from AudioRendererHost to renderer for state - // update after the renderer has requested a Create/Start/Close. - IPC_MESSAGE_ROUTED2(ViewMsg_NotifyAudioStreamStateChanged, - int /* stream id */, - ViewMsg_AudioStreamState_Params /* new state */) - - IPC_MESSAGE_ROUTED2(ViewMsg_NotifyAudioStreamVolume, - int /* stream id */, - double /* volume */) - - // Notification that a move or resize renderer's containing window has - // started. - IPC_MESSAGE_ROUTED0(ViewMsg_MoveOrResizeStarted) - - // The browser sends this message in response to all extension api calls. - IPC_MESSAGE_ROUTED4(ViewMsg_ExtensionResponse, - int /* request_id */, - bool /* success */, - std::string /* response */, - std::string /* error */) - - // This message is optionally routed. If used as a control message, it - // will call a javascript function in every registered context in the - // target process. If routed, it will be restricted to the contexts that - // are part of the target RenderView. - // If |extension_id| is non-empty, the function will be invoked only in - // contexts owned by the extension. |args| is a list of primitive Value types - // that are passed to the function. - IPC_MESSAGE_ROUTED4(ViewMsg_ExtensionMessageInvoke, - std::string /* extension_id */, - std::string /* function_name */, - ListValue /* args */, - GURL /* event URL */) - - // Tell the renderer process all known extension function names. - IPC_MESSAGE_CONTROL1(ViewMsg_Extension_SetFunctionNames, - std::vector<std::string>) - - // Tell the renderer process which permissions the given extension has. See - // Extension::Permissions for which elements correspond to which permissions. - IPC_MESSAGE_CONTROL2(ViewMsg_Extension_SetAPIPermissions, - std::string /* extension_id */, - std::set<std::string> /* permissions */) - - // Tell the renderer process which host permissions the given extension has. - IPC_MESSAGE_CONTROL2( - ViewMsg_Extension_SetHostPermissions, - GURL /* source extension's origin */, - std::vector<URLPattern> /* URLPatterns the extension can access */) - - // Tell the renderer process all known page action ids for a particular - // extension. - IPC_MESSAGE_CONTROL2(ViewMsg_Extension_UpdatePageActions, - std::string /* extension_id */, - std::vector<std::string> /* page_action_ids */) - - // Changes the text direction of the currently selected input field (if any). - IPC_MESSAGE_ROUTED1(ViewMsg_SetTextDirection, - WebKit::WebTextDirection /* direction */) - - // Tells the renderer to clear the focused node (if any). - IPC_MESSAGE_ROUTED0(ViewMsg_ClearFocusedNode) - - // Make the RenderView transparent and render it onto a custom background. The - // background will be tiled in both directions if it is not large enough. - IPC_MESSAGE_ROUTED1(ViewMsg_SetBackground, - SkBitmap /* background */) - - // Reply to ViewHostMsg_RequestMove, ViewHostMsg_ShowView, and - // ViewHostMsg_ShowWidget to inform the renderer that the browser has - // processed the move. The browser may have ignored the move, but it finished - // processing. This is used because the renderer keeps a temporary cache of - // the widget position while these asynchronous operations are in progress. - IPC_MESSAGE_ROUTED0(ViewMsg_Move_ACK) - - // Used to instruct the RenderView to send back updates to the preferred size. - IPC_MESSAGE_ROUTED1(ViewMsg_EnablePreferredSizeChangedMode, int /*flags*/) - - IPC_MESSAGE_ROUTED4(ViewMsg_SearchBoxChange, - string16 /*value*/, - bool /*verbatim*/, - int /*selection_start*/, - int /*selection_end*/) - IPC_MESSAGE_ROUTED2(ViewMsg_SearchBoxSubmit, - string16 /*value*/, - bool /*verbatim*/) - IPC_MESSAGE_ROUTED0(ViewMsg_SearchBoxCancel) - IPC_MESSAGE_ROUTED1(ViewMsg_SearchBoxResize, - gfx::Rect /*search_box_bounds*/) - IPC_MESSAGE_ROUTED2(ViewMsg_DetermineIfPageSupportsInstant, - string16 /*value*/, - bool /* verbatim */) - - // Used to tell the renderer not to add scrollbars with height and - // width below a threshold. - IPC_MESSAGE_ROUTED1(ViewMsg_DisableScrollbarsForSmallWindows, - gfx::Size /* disable_scrollbar_size_limit */) - - // Used to inform the renderer that the browser has displayed its - // requested notification. - IPC_MESSAGE_ROUTED1(ViewMsg_PostDisplayToNotificationObject, - int /* notification_id */) - - // Used to inform the renderer that the browser has encountered an error - // trying to display a notification. - IPC_MESSAGE_ROUTED2(ViewMsg_PostErrorToNotificationObject, - int /* notification_id */, - string16 /* message */) - - // Informs the renderer that the one if its notifications has closed. - IPC_MESSAGE_ROUTED2(ViewMsg_PostCloseToNotificationObject, - int /* notification_id */, - bool /* by_user */) - - // Informs the renderer that one of its notifications was clicked on. - IPC_MESSAGE_ROUTED1(ViewMsg_PostClickToNotificationObject, - int /* notification_id */) - - // Informs the renderer that the one if its notifications has closed. - IPC_MESSAGE_ROUTED1(ViewMsg_PermissionRequestDone, - int /* request_id */) - - // Activate/deactivate the RenderView (i.e., set its controls' tint - // accordingly, etc.). - IPC_MESSAGE_ROUTED1(ViewMsg_SetActive, - bool /* active */) +// Notification message sent from AudioRendererHost to renderer for state +// update after the renderer has requested a Create/Start/Close. +IPC_MESSAGE_ROUTED2(ViewMsg_NotifyAudioStreamStateChanged, + int /* stream id */, + ViewMsg_AudioStreamState_Params /* new state */) + +IPC_MESSAGE_ROUTED2(ViewMsg_NotifyAudioStreamVolume, + int /* stream id */, + double /* volume */) + +// Notification that a move or resize renderer's containing window has +// started. +IPC_MESSAGE_ROUTED0(ViewMsg_MoveOrResizeStarted) + +// The browser sends this message in response to all extension api calls. +IPC_MESSAGE_ROUTED4(ViewMsg_ExtensionResponse, + int /* request_id */, + bool /* success */, + std::string /* response */, + std::string /* error */) + +// This message is optionally routed. If used as a control message, it +// will call a javascript function in every registered context in the +// target process. If routed, it will be restricted to the contexts that +// are part of the target RenderView. +// If |extension_id| is non-empty, the function will be invoked only in +// contexts owned by the extension. |args| is a list of primitive Value types +// that are passed to the function. +IPC_MESSAGE_ROUTED4(ViewMsg_ExtensionMessageInvoke, + std::string /* extension_id */, + std::string /* function_name */, + ListValue /* args */, + GURL /* event URL */) + +// Tell the renderer process all known extension function names. +IPC_MESSAGE_CONTROL1(ViewMsg_Extension_SetFunctionNames, + std::vector<std::string>) + +// Tell the renderer process which permissions the given extension has. See +// Extension::Permissions for which elements correspond to which permissions. +IPC_MESSAGE_CONTROL2(ViewMsg_Extension_SetAPIPermissions, + std::string /* extension_id */, + std::set<std::string> /* permissions */) + +// Tell the renderer process which host permissions the given extension has. +IPC_MESSAGE_CONTROL2( + ViewMsg_Extension_SetHostPermissions, + GURL /* source extension's origin */, + std::vector<URLPattern> /* URLPatterns the extension can access */) + +// Tell the renderer process all known page action ids for a particular +// extension. +IPC_MESSAGE_CONTROL2(ViewMsg_Extension_UpdatePageActions, + std::string /* extension_id */, + std::vector<std::string> /* page_action_ids */) + +// Changes the text direction of the currently selected input field (if any). +IPC_MESSAGE_ROUTED1(ViewMsg_SetTextDirection, + WebKit::WebTextDirection /* direction */) + +// Tells the renderer to clear the focused node (if any). +IPC_MESSAGE_ROUTED0(ViewMsg_ClearFocusedNode) + +// Make the RenderView transparent and render it onto a custom background. The +// background will be tiled in both directions if it is not large enough. +IPC_MESSAGE_ROUTED1(ViewMsg_SetBackground, + SkBitmap /* background */) + +// Reply to ViewHostMsg_RequestMove, ViewHostMsg_ShowView, and +// ViewHostMsg_ShowWidget to inform the renderer that the browser has +// processed the move. The browser may have ignored the move, but it finished +// processing. This is used because the renderer keeps a temporary cache of +// the widget position while these asynchronous operations are in progress. +IPC_MESSAGE_ROUTED0(ViewMsg_Move_ACK) + +// Used to instruct the RenderView to send back updates to the preferred size. +IPC_MESSAGE_ROUTED1(ViewMsg_EnablePreferredSizeChangedMode, int /*flags*/) + +IPC_MESSAGE_ROUTED4(ViewMsg_SearchBoxChange, + string16 /*value*/, + bool /*verbatim*/, + int /*selection_start*/, + int /*selection_end*/) +IPC_MESSAGE_ROUTED2(ViewMsg_SearchBoxSubmit, + string16 /*value*/, + bool /*verbatim*/) +IPC_MESSAGE_ROUTED0(ViewMsg_SearchBoxCancel) +IPC_MESSAGE_ROUTED1(ViewMsg_SearchBoxResize, + gfx::Rect /*search_box_bounds*/) +IPC_MESSAGE_ROUTED2(ViewMsg_DetermineIfPageSupportsInstant, + string16 /*value*/, + bool /* verbatim */) + +// Used to tell the renderer not to add scrollbars with height and +// width below a threshold. +IPC_MESSAGE_ROUTED1(ViewMsg_DisableScrollbarsForSmallWindows, + gfx::Size /* disable_scrollbar_size_limit */) + +// Used to inform the renderer that the browser has displayed its +// requested notification. +IPC_MESSAGE_ROUTED1(ViewMsg_PostDisplayToNotificationObject, + int /* notification_id */) + +// Used to inform the renderer that the browser has encountered an error +// trying to display a notification. +IPC_MESSAGE_ROUTED2(ViewMsg_PostErrorToNotificationObject, + int /* notification_id */, + string16 /* message */) + +// Informs the renderer that the one if its notifications has closed. +IPC_MESSAGE_ROUTED2(ViewMsg_PostCloseToNotificationObject, + int /* notification_id */, + bool /* by_user */) + +// Informs the renderer that one of its notifications was clicked on. +IPC_MESSAGE_ROUTED1(ViewMsg_PostClickToNotificationObject, + int /* notification_id */) + +// Informs the renderer that the one if its notifications has closed. +IPC_MESSAGE_ROUTED1(ViewMsg_PermissionRequestDone, + int /* request_id */) + +// Activate/deactivate the RenderView (i.e., set its controls' tint +// accordingly, etc.). +IPC_MESSAGE_ROUTED1(ViewMsg_SetActive, + bool /* active */) #if defined(OS_MACOSX) - // Let the RenderView know its window has changed visibility. - IPC_MESSAGE_ROUTED1(ViewMsg_SetWindowVisibility, - bool /* visibile */) - - // Let the RenderView know its window's frame has changed. - IPC_MESSAGE_ROUTED2(ViewMsg_WindowFrameChanged, - gfx::Rect /* window frame */, - gfx::Rect /* content view frame */) - - // Tell the renderer that text has been retured from plugin IME. - IPC_MESSAGE_ROUTED2(ViewMsg_PluginImeCompositionConfirmed, - string16 /* text */, - int /* plugin_id */) +// Let the RenderView know its window has changed visibility. +IPC_MESSAGE_ROUTED1(ViewMsg_SetWindowVisibility, + bool /* visibile */) + +// Let the RenderView know its window's frame has changed. +IPC_MESSAGE_ROUTED2(ViewMsg_WindowFrameChanged, + gfx::Rect /* window frame */, + gfx::Rect /* content view frame */) + +// Tell the renderer that text has been retured from plugin IME. +IPC_MESSAGE_ROUTED2(ViewMsg_PluginImeCompositionConfirmed, + string16 /* text */, + int /* plugin_id */) #endif - // Response message to ViewHostMsg_CreateShared/DedicatedWorker. - // Sent when the worker has started. - IPC_MESSAGE_ROUTED0(ViewMsg_WorkerCreated) - - // Tell the renderer which browser window it's being attached to. - IPC_MESSAGE_ROUTED1(ViewMsg_UpdateBrowserWindowId, - int /* id of browser window */) - - // Tell the renderer which type this view is. - IPC_MESSAGE_ROUTED1(ViewMsg_NotifyRenderViewType, - ViewType::Type /* view_type */) - - // Notification that renderer should run some JavaScript code. - IPC_MESSAGE_ROUTED1(ViewMsg_ExecuteCode, - ViewMsg_ExecuteCode_Params) - - // Notifies the child process of the new database size - IPC_MESSAGE_CONTROL4(ViewMsg_DatabaseUpdateSize, - string16 /* the origin */, - string16 /* the database name */, - int64 /* the new database size */, - int64 /* space available to origin */) - - // Asks the child process to close a database immediately - IPC_MESSAGE_CONTROL2(ViewMsg_DatabaseCloseImmediately, - string16 /* the origin */, - string16 /* the database name */) - - // Storage events are broadcast to renderer processes. - IPC_MESSAGE_CONTROL1(ViewMsg_DOMStorageEvent, - ViewMsg_DOMStorageEvent_Params) - - // IDBCallback message handlers. - IPC_MESSAGE_CONTROL1(ViewMsg_IDBCallbacksSuccessNull, - int32 /* response_id */) - IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIDBCursor, - int32 /* response_id */, - int32 /* cursor_id */) - IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIDBDatabase, - int32 /* response_id */, - int32 /* idb_database_id */) - IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIndexedDBKey, - int32 /* response_id */, - IndexedDBKey /* indexed_db_key */) - IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIDBIndex, - int32 /* response_id */, - int32 /* idb_index_id */) - IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIDBObjectStore, - int32 /* response_id */, - int32 /* idb_object_store_id */) - IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessIDBTransaction, - int32 /* response_id */, - int32 /* idb_transaction_id */) - IPC_MESSAGE_CONTROL2(ViewMsg_IDBCallbacksSuccessSerializedScriptValue, - int32 /* response_id */, - SerializedScriptValue /* serialized_script_value */) - IPC_MESSAGE_CONTROL3(ViewMsg_IDBCallbacksError, - int32 /* response_id */, - int /* code */, - string16 /* message */) - - // IDBTransactionCallback message handlers. - IPC_MESSAGE_CONTROL1(ViewMsg_IDBTransactionCallbacksAbort, - int32 /* transaction_id */) - IPC_MESSAGE_CONTROL1(ViewMsg_IDBTransactionCallbacksComplete, - int32 /* transaction_id */) - IPC_MESSAGE_CONTROL1(ViewMsg_IDBTransactionCallbacksTimeout, - int32 /* transaction_id */) +// Response message to ViewHostMsg_CreateShared/DedicatedWorker. +// Sent when the worker has started. +IPC_MESSAGE_ROUTED0(ViewMsg_WorkerCreated) + +// Tell the renderer which browser window it's being attached to. +IPC_MESSAGE_ROUTED1(ViewMsg_UpdateBrowserWindowId, + int /* id of browser window */) + +// Tell the renderer which type this view is. +IPC_MESSAGE_ROUTED1(ViewMsg_NotifyRenderViewType, + ViewType::Type /* view_type */) + +// Notification that renderer should run some JavaScript code. +IPC_MESSAGE_ROUTED1(ViewMsg_ExecuteCode, + ViewMsg_ExecuteCode_Params) #if defined(IPC_MESSAGE_LOG_ENABLED) - // Tell the renderer process to begin or end IPC message logging. - IPC_MESSAGE_CONTROL1(ViewMsg_SetIPCLoggingEnabled, - bool /* on or off */) +// Tell the renderer process to begin or end IPC message logging. +IPC_MESSAGE_CONTROL1(ViewMsg_SetIPCLoggingEnabled, + bool /* on or off */) #endif - // Socket Stream messages: - // These are messages from the browser to the SocketStreamHandle on - // a renderer. - - // A |socket_id| is assigned by ViewHostMsg_SocketStream_Connect. - // The Socket Stream is connected. The SocketStreamHandle should keep track - // of how much it has pending (how much it has requested to be sent) and - // shouldn't go over |max_pending_send_allowed| bytes. - IPC_MESSAGE_CONTROL2(ViewMsg_SocketStream_Connected, - int /* socket_id */, - int /* max_pending_send_allowed */) - - // |data| is received on the Socket Stream. - IPC_MESSAGE_CONTROL2(ViewMsg_SocketStream_ReceivedData, - int /* socket_id */, - std::vector<char> /* data */) - - // |amount_sent| bytes of data requested by - // ViewHostMsg_SocketStream_SendData has been sent on the Socket Stream. - IPC_MESSAGE_CONTROL2(ViewMsg_SocketStream_SentData, - int /* socket_id */, - int /* amount_sent */) - - // The Socket Stream is closed. - IPC_MESSAGE_CONTROL1(ViewMsg_SocketStream_Closed, - int /* socket_id */) - - // SpellChecker messages. - - // Passes some initialization params to the renderer's spellchecker. This can - // be called directly after startup or in (async) response to a - // RequestDictionary ViewHost message. - IPC_MESSAGE_CONTROL4(ViewMsg_SpellChecker_Init, - IPC::PlatformFileForTransit /* bdict_file */, - std::vector<std::string> /* custom_dict_words */, - std::string /* language */, - bool /* auto spell correct */) - - // A word has been added to the custom dictionary; update the local custom - // word list. - IPC_MESSAGE_CONTROL1(ViewMsg_SpellChecker_WordAdded, - std::string /* word */) - - // Toggle the auto spell correct functionality. - IPC_MESSAGE_CONTROL1(ViewMsg_SpellChecker_EnableAutoSpellCorrect, - bool /* enable */) - - // Executes custom context menu action that was provided from WebKit. - IPC_MESSAGE_ROUTED1(ViewMsg_CustomContextMenuAction, - unsigned /* action */) - - // Tells the renderer to translate the page contents from one language to - // another. - IPC_MESSAGE_ROUTED4(ViewMsg_TranslatePage, - int /* page id */, - std::string, /* the script injected in the page */ - std::string, /* BCP 47/RFC 5646 language code the page - is in */ - std::string /* BCP 47/RFC 5646 language code to translate - to */) - - // Tells the renderer to revert the text of translated page to its original - // contents. - IPC_MESSAGE_ROUTED1(ViewMsg_RevertTranslation, - int /* page id */) - - // Reply in response to ViewHostMsg_Geolocation_RequestPermission. - IPC_MESSAGE_ROUTED2(ViewMsg_Geolocation_PermissionSet, - int /* bridge_id */, - bool /* is_allowed */) - - // Sent after ViewHostMsg_Geolocation_StartUpdating iff the user has granted - // permission and we have a position available or an error occurs (such as - // permission denied, position unavailable, etc.) - IPC_MESSAGE_ROUTED1(ViewMsg_Geolocation_PositionUpdated, - Geoposition /* geoposition */) - - // Sent on process startup to indicate whether this process is running in - // incognito mode. - IPC_MESSAGE_CONTROL1(ViewMsg_SetIsIncognitoProcess, - bool /* is_incognito_processs */) - - // Notification that the list of extensions has been updated. - IPC_MESSAGE_CONTROL1(ViewMsg_ExtensionsUpdated, - ViewMsg_ExtensionsUpdated_Params) - - // Enable accessibility in the renderer process. - IPC_MESSAGE_ROUTED0(ViewMsg_EnableAccessibility) - - // Relay a request from assistive technology to set focus to a given node. - IPC_MESSAGE_ROUTED1(ViewMsg_SetAccessibilityFocus, - int /* object id */) - - // Relay a request from assistive technology to perform the default action - // on a given node. - IPC_MESSAGE_ROUTED1(ViewMsg_AccessibilityDoDefaultAction, - int /* object id */) - - // Tells the render view that a ViewHostMsg_AccessibilityNotifications - // message was processed and it can send addition notifications. - IPC_MESSAGE_ROUTED0(ViewMsg_AccessibilityNotifications_ACK) - - // Relay a speech recognition result, either partial or final. - IPC_MESSAGE_ROUTED2(ViewMsg_SpeechInput_SetRecognitionResult, - int /* request id */, - speech_input::SpeechInputResultArray /* result */) - - // Indicate that speech recognizer has stopped recording and started - // recognition. - IPC_MESSAGE_ROUTED1(ViewMsg_SpeechInput_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(ViewMsg_SpeechInput_RecognitionComplete, - int /* request id */) - - // Notification that the device's orientation has changed. - IPC_MESSAGE_ROUTED1(ViewMsg_DeviceOrientationUpdated, - ViewMsg_DeviceOrientationUpdated_Params) - - // WebFrameClient::openFileSystem response messages. - IPC_MESSAGE_CONTROL4(ViewMsg_OpenFileSystemRequest_Complete, - int /* request_id */, - bool /* accepted */, - std::string /* name */, - FilePath /* root_path */) - - // WebFileSystem response messages. - IPC_MESSAGE_CONTROL1(ViewMsg_FileSystem_DidSucceed, - int /* request_id */) - IPC_MESSAGE_CONTROL2(ViewMsg_FileSystem_DidReadMetadata, - int /* request_id */, - base::PlatformFileInfo) - IPC_MESSAGE_CONTROL3(ViewMsg_FileSystem_DidReadDirectory, - int /* request_id */, - std::vector<base::FileUtilProxy::Entry> /* entries */, - bool /* has_more */) - - IPC_MESSAGE_CONTROL3(ViewMsg_FileSystem_DidWrite, - int /* request_id */, - int64 /* byte count */, - bool /* complete */) - IPC_MESSAGE_CONTROL2(ViewMsg_FileSystem_DidFail, - int /* request_id */, - base::PlatformFileError /* error_code */) - - // The response to ViewHostMsg_AsyncOpenFile. - IPC_MESSAGE_ROUTED3(ViewMsg_AsyncOpenFile_ACK, - base::PlatformFileError /* error_code */, - IPC::PlatformFileForTransit /* file descriptor */, - int /* message_id */) - - // A classification model for client-side phishing detection. - // The given file contains an encoded safe_browsing::ClientSideModel - // protocol buffer. - IPC_MESSAGE_CONTROL1(ViewMsg_SetPhishingModel, - IPC::PlatformFileForTransit /* model_file */) - - // External popup menus. - IPC_MESSAGE_ROUTED1(ViewMsg_SelectPopupMenuItem, - int /* selected index, -1 means no selection */) - - // Indicate whether speech input API is enabled or not. - IPC_MESSAGE_CONTROL1(ViewMsg_SpeechInput_SetFeatureEnabled, - bool /* enabled */) - -IPC_END_MESSAGES(View) - +// Socket Stream messages: +// These are messages from the browser to the SocketStreamHandle on +// a renderer. + +// A |socket_id| is assigned by ViewHostMsg_SocketStream_Connect. +// The Socket Stream is connected. The SocketStreamHandle should keep track +// of how much it has pending (how much it has requested to be sent) and +// shouldn't go over |max_pending_send_allowed| bytes. +IPC_MESSAGE_CONTROL2(ViewMsg_SocketStream_Connected, + int /* socket_id */, + int /* max_pending_send_allowed */) + +// |data| is received on the Socket Stream. +IPC_MESSAGE_CONTROL2(ViewMsg_SocketStream_ReceivedData, + int /* socket_id */, + std::vector<char> /* data */) + +// |amount_sent| bytes of data requested by +// ViewHostMsg_SocketStream_SendData has been sent on the Socket Stream. +IPC_MESSAGE_CONTROL2(ViewMsg_SocketStream_SentData, + int /* socket_id */, + int /* amount_sent */) + +// The Socket Stream is closed. +IPC_MESSAGE_CONTROL1(ViewMsg_SocketStream_Closed, + int /* socket_id */) + +// SpellChecker messages. + +// Passes some initialization params to the renderer's spellchecker. This can +// be called directly after startup or in (async) response to a +// RequestDictionary ViewHost message. +IPC_MESSAGE_CONTROL4(ViewMsg_SpellChecker_Init, + IPC::PlatformFileForTransit /* bdict_file */, + std::vector<std::string> /* custom_dict_words */, + std::string /* language */, + bool /* auto spell correct */) + +// A word has been added to the custom dictionary; update the local custom +// word list. +IPC_MESSAGE_CONTROL1(ViewMsg_SpellChecker_WordAdded, + std::string /* word */) + +// Toggle the auto spell correct functionality. +IPC_MESSAGE_CONTROL1(ViewMsg_SpellChecker_EnableAutoSpellCorrect, + bool /* enable */) + +// Executes custom context menu action that was provided from WebKit. +IPC_MESSAGE_ROUTED1(ViewMsg_CustomContextMenuAction, + unsigned /* action */) + +// Tells the renderer to translate the page contents from one language to +// another. +IPC_MESSAGE_ROUTED4(ViewMsg_TranslatePage, + int /* page id */, + std::string, /* the script injected in the page */ + std::string, /* BCP 47/RFC 5646 language code the page + is in */ + std::string /* BCP 47/RFC 5646 language code to translate + to */) + +// Tells the renderer to revert the text of translated page to its original +// contents. +IPC_MESSAGE_ROUTED1(ViewMsg_RevertTranslation, + int /* page id */) + +// Reply in response to ViewHostMsg_Geolocation_RequestPermission. +IPC_MESSAGE_ROUTED2(ViewMsg_Geolocation_PermissionSet, + int /* bridge_id */, + bool /* is_allowed */) + +// Sent after ViewHostMsg_Geolocation_StartUpdating iff the user has granted +// permission and we have a position available or an error occurs (such as +// permission denied, position unavailable, etc.) +IPC_MESSAGE_ROUTED1(ViewMsg_Geolocation_PositionUpdated, + Geoposition /* geoposition */) + +// Sent on process startup to indicate whether this process is running in +// incognito mode. +IPC_MESSAGE_CONTROL1(ViewMsg_SetIsIncognitoProcess, + bool /* is_incognito_processs */) + +// Notification that the list of extensions has been updated. +IPC_MESSAGE_CONTROL1(ViewMsg_ExtensionsUpdated, + ViewMsg_ExtensionsUpdated_Params) + +// Enable accessibility in the renderer process. +IPC_MESSAGE_ROUTED0(ViewMsg_EnableAccessibility) + +// Relay a request from assistive technology to set focus to a given node. +IPC_MESSAGE_ROUTED1(ViewMsg_SetAccessibilityFocus, + int /* object id */) + +// Relay a request from assistive technology to perform the default action +// on a given node. +IPC_MESSAGE_ROUTED1(ViewMsg_AccessibilityDoDefaultAction, + int /* object id */) + +// Tells the render view that a ViewHostMsg_AccessibilityNotifications +// message was processed and it can send addition notifications. +IPC_MESSAGE_ROUTED0(ViewMsg_AccessibilityNotifications_ACK) + +// Relay a speech recognition result, either partial or final. +IPC_MESSAGE_ROUTED2(ViewMsg_SpeechInput_SetRecognitionResult, + int /* request id */, + speech_input::SpeechInputResultArray /* result */) + +// Indicate that speech recognizer has stopped recording and started +// recognition. +IPC_MESSAGE_ROUTED1(ViewMsg_SpeechInput_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(ViewMsg_SpeechInput_RecognitionComplete, + int /* request id */) + +// Notification that the device's orientation has changed. +IPC_MESSAGE_ROUTED1(ViewMsg_DeviceOrientationUpdated, + ViewMsg_DeviceOrientationUpdated_Params) + +// WebFrameClient::openFileSystem response messages. +IPC_MESSAGE_CONTROL4(ViewMsg_OpenFileSystemRequest_Complete, + int /* request_id */, + bool /* accepted */, + std::string /* name */, + FilePath /* root_path */) + +// WebFileSystem response messages. +IPC_MESSAGE_CONTROL1(ViewMsg_FileSystem_DidSucceed, + int /* request_id */) +IPC_MESSAGE_CONTROL2(ViewMsg_FileSystem_DidReadMetadata, + int /* request_id */, + base::PlatformFileInfo) +IPC_MESSAGE_CONTROL3(ViewMsg_FileSystem_DidReadDirectory, + int /* request_id */, + std::vector<base::FileUtilProxy::Entry> /* entries */, + bool /* has_more */) + +IPC_MESSAGE_CONTROL3(ViewMsg_FileSystem_DidWrite, + int /* request_id */, + int64 /* byte count */, + bool /* complete */) +IPC_MESSAGE_CONTROL2(ViewMsg_FileSystem_DidFail, + int /* request_id */, + base::PlatformFileError /* error_code */) + +// The response to ViewHostMsg_AsyncOpenFile. +IPC_MESSAGE_ROUTED3(ViewMsg_AsyncOpenFile_ACK, + base::PlatformFileError /* error_code */, + IPC::PlatformFileForTransit /* file descriptor */, + int /* message_id */) + +// A classification model for client-side phishing detection. +// The given file contains an encoded safe_browsing::ClientSideModel +// protocol buffer. +IPC_MESSAGE_CONTROL1(ViewMsg_SetPhishingModel, + IPC::PlatformFileForTransit /* model_file */) + +// External popup menus. +IPC_MESSAGE_ROUTED1(ViewMsg_SelectPopupMenuItem, + int /* selected index, -1 means no selection */) + +// Indicate whether speech input API is enabled or not. +IPC_MESSAGE_CONTROL1(ViewMsg_SpeechInput_SetFeatureEnabled, + bool /* enabled */) //----------------------------------------------------------------------------- // TabContents messages // These are messages sent from the renderer to the browser process. -IPC_BEGIN_MESSAGES(ViewHost) - // Sent by the renderer when it is creating a new window. The browser creates - // a tab for it and responds with a ViewMsg_CreatingNew_ACK. If route_id is - // MSG_ROUTING_NONE, the view couldn't be created. - IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_CreateWindow, - ViewHostMsg_CreateWindow_Params, - int /* route_id */, - int64 /* cloned_session_storage_namespace_id */) - - // Similar to ViewHostMsg_CreateWindow, except used for sub-widgets, like - // <select> dropdowns. This message is sent to the TabContents that - // contains the widget being created. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_CreateWidget, - int /* opener_id */, - WebKit::WebPopupType /* popup type */, - int /* route_id */) - - // Similar to ViewHostMsg_CreateWidget except the widget is a full screen - // window. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_CreateFullscreenWidget, - int /* opener_id */, - WebKit::WebPopupType /* popup type */, - int /* route_id */) - - // These three messages are sent to the parent RenderViewHost to display the - // page/widget that was created by - // CreateWindow/CreateWidget/CreateFullscreenWidget. routing_id - // refers to the id that was returned from the Create message above. - // The initial_position parameter is a rectangle in screen coordinates. - // - // FUTURE: there will probably be flags here to control if the result is - // in a new window. - IPC_MESSAGE_ROUTED4(ViewHostMsg_ShowView, - int /* route_id */, - WindowOpenDisposition /* disposition */, - gfx::Rect /* initial_pos */, - bool /* opened_by_user_gesture */) - - IPC_MESSAGE_ROUTED2(ViewHostMsg_ShowWidget, - int /* route_id */, - gfx::Rect /* initial_pos */) - - // Message to show a full screen widget. - IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowFullscreenWidget, - int /* route_id */) - - // Message to show a popup menu using native cocoa controls (Mac only). - IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowPopup, - ViewHostMsg_ShowPopup_Params) - - // This message is sent after ViewHostMsg_ShowView to cause the RenderView - // to run in a modal fashion until it is closed. - IPC_SYNC_MESSAGE_ROUTED0_0(ViewHostMsg_RunModal) - - IPC_MESSAGE_CONTROL1(ViewHostMsg_UpdatedCacheStats, - WebKit::WebCache::UsageStats /* stats */) - - // Indicates the renderer is ready in response to a ViewMsg_New or - // a ViewMsg_CreatingNew_ACK. - IPC_MESSAGE_ROUTED0(ViewHostMsg_RenderViewReady) - - // Indicates the renderer process is gone. This actually is sent by the - // browser process to itself, but keeps the interface cleaner. - IPC_MESSAGE_ROUTED0(ViewHostMsg_RenderViewGone) - - // Sent by the renderer process to request that the browser close the view. - // This corresponds to the window.close() API, and the browser may ignore - // this message. Otherwise, the browser will generates a ViewMsg_Close - // message to close the view. - IPC_MESSAGE_ROUTED0(ViewHostMsg_Close) - - // Sent by the renderer process to request that the browser move the view. - // This corresponds to the window.resizeTo() and window.moveTo() APIs, and - // the browser may ignore this message. - IPC_MESSAGE_ROUTED1(ViewHostMsg_RequestMove, - gfx::Rect /* position */) - - // Notifies the browser that a frame in the view has changed. This message - // has a lot of parameters and is packed/unpacked by functions defined in - // render_messages.h. - IPC_MESSAGE_ROUTED1(ViewHostMsg_FrameNavigate, - ViewHostMsg_FrameNavigate_Params) - - // Notifies the browser that we have session history information. - // page_id: unique ID that allows us to distinguish between history entries. - IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateState, - int32 /* page_id */, - std::string /* state */) - - // Notifies the browser that a document has been loaded in a frame. - IPC_MESSAGE_ROUTED1(ViewHostMsg_DocumentLoadedInFrame, - long long /* frame_id */) - - // Notifies the browser that a frame finished loading. - IPC_MESSAGE_ROUTED1(ViewHostMsg_DidFinishLoad, - long long /* frame_id */) - - // Changes the title for the page in the UI when the page is navigated or the - // title changes. - // TODO(darin): use a UTF-8 string to reduce data size - IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateTitle, int32, std::wstring) - - // Changes the icon url for the page in the UI. - IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateIconURL, int32, GURL) - - // Change the encoding name of the page in UI when the page has detected - // proper encoding name. - IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateEncoding, - std::string /* new encoding name */) - - // Notifies the browser that we want to show a destination url for a potential - // action (e.g. when the user is hovering over a link). - IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateTargetURL, int32, GURL) - - // Sent when the renderer starts loading the page. This corresponds to - // WebKit's notion of the throbber starting. Note that sometimes you may get - // duplicates of these during a single load. - IPC_MESSAGE_ROUTED0(ViewHostMsg_DidStartLoading) - - // Sent when the renderer is done loading a page. This corresponds to WebKit's - // notion of the throbber stopping. - IPC_MESSAGE_ROUTED0(ViewHostMsg_DidStopLoading) - - // Sent when the document element is available for the toplevel frame. This - // happens after the page starts loading, but before all resources are - // finished. - IPC_MESSAGE_ROUTED0(ViewHostMsg_DocumentAvailableInMainFrame) - - // Sent when after the onload handler has been invoked for the document - // in the toplevel frame. - IPC_MESSAGE_ROUTED1(ViewHostMsg_DocumentOnLoadCompletedInMainFrame, - int32 /* page_id */) - - // Sent when the renderer loads a resource from its memory cache. - // The security info is non empty if the resource was originally loaded over - // a secure connection. - // Note: May only be sent once per URL per frame per committed load. - IPC_MESSAGE_ROUTED4(ViewHostMsg_DidLoadResourceFromMemoryCache, - GURL /* url */, - std::string /* frame_origin */, - std::string /* main_frame_origin */, - std::string /* security info */) - - // Sent when the renderer displays insecure content in a secure page. - IPC_MESSAGE_ROUTED0(ViewHostMsg_DidDisplayInsecureContent) - - // Sent when the renderer runs insecure content in a secure origin. - IPC_MESSAGE_ROUTED1(ViewHostMsg_DidRunInsecureContent, - std::string /* security_origin */) - - // Sent when the renderer starts a provisional load for a frame. - IPC_MESSAGE_ROUTED3(ViewHostMsg_DidStartProvisionalLoadForFrame, - long long /* frame_id */, - bool /* true if it is the main frame */, - GURL /* url */) - - // Sent when the renderer fails a provisional load with an error. - IPC_MESSAGE_ROUTED5(ViewHostMsg_DidFailProvisionalLoadWithError, - long long /* frame_id */, - bool /* true if it is the main frame */, - int /* error_code */, - GURL /* url */, - bool /* true if the failure is the result of - navigating to a POST again and we're going to - show the POST interstitial */) - - // Tells the render view that a ViewHostMsg_PaintAtSize message was - // processed, and the DIB is ready for use. |tag| has the same value that - // the tag sent along with ViewMsg_PaintAtSize. - IPC_MESSAGE_ROUTED2(ViewHostMsg_PaintAtSize_ACK, - int /* tag */, - gfx::Size /* size */) - - // Sent to update part of the view. In response to this message, the host - // generates a ViewMsg_UpdateRect_ACK message. - IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateRect, - ViewHostMsg_UpdateRect_Params) - - // Sent by the renderer when accelerated compositing is enabled or disabled to - // notify the browser whether or not is should do painting. - IPC_MESSAGE_ROUTED1(ViewHostMsg_DidActivateAcceleratedCompositing, - bool /* true if the accelerated compositor is actve */) - - // Acknowledges receipt of a ViewMsg_HandleInputEvent message. - // Payload is a WebInputEvent::Type which is the type of the event, followed - // by an optional WebInputEvent which is provided only if the event was not - // processed. - IPC_MESSAGE_ROUTED0(ViewHostMsg_HandleInputEvent_ACK) - - IPC_MESSAGE_ROUTED0(ViewHostMsg_Focus) - IPC_MESSAGE_ROUTED0(ViewHostMsg_Blur) - - // Message sent from renderer to the browser when focus changes inside the - // webpage. The parameter says whether the newly focused element needs - // keyboard input (true for textfields, text areas and content editable divs). - IPC_MESSAGE_ROUTED1(ViewHostMsg_FocusedNodeChanged, - bool /* is_editable_node */) - - // Returns the window location of the given window. - // TODO(shess): Provide a mapping from reply_msg->routing_id() to - // HWND so that we can eliminate the NativeViewId parameter. - IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetWindowRect, - gfx::NativeViewId /* window */, - gfx::Rect /* Out: Window location */) - - IPC_MESSAGE_ROUTED1(ViewHostMsg_SetCursor, WebCursor) - // Result of string search in the page. - // Response to ViewMsg_Find with the results of the requested find-in-page - // search, the number of matches found and the selection rect (in screen - // coordinates) for the string found. If |final_update| is false, it signals - // that this is not the last Find_Reply message - more will be sent as the - // scoping effort continues. - IPC_MESSAGE_ROUTED5(ViewHostMsg_Find_Reply, - int /* request_id */, - int /* number of matches */, - gfx::Rect /* selection_rect */, - int /* active_match_ordinal */, - bool /* final_update */) - - // Makes a resource request via the browser. - IPC_MESSAGE_ROUTED2(ViewHostMsg_RequestResource, - int /* request_id */, - ViewHostMsg_Resource_Request) - - // Cancels a resource request with the ID given as the parameter. - IPC_MESSAGE_ROUTED1(ViewHostMsg_CancelRequest, - int /* request_id */) - - // Follows a redirect that occured for the resource request with the ID given - // as the parameter. - IPC_MESSAGE_ROUTED3(ViewHostMsg_FollowRedirect, - int /* request_id */, - bool /* has_new_first_party_for_cookies */, - GURL /* new_first_party_for_cookies */) - - // Makes a synchronous resource request via the browser. - IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_SyncLoad, - int /* request_id */, - ViewHostMsg_Resource_Request, - SyncLoadResult) - - // Used to set a cookie. The cookie is set asynchronously, but will be - // available to a subsequent ViewHostMsg_GetCookies request. - IPC_MESSAGE_ROUTED3(ViewHostMsg_SetCookie, - GURL /* url */, - GURL /* first_party_for_cookies */, - std::string /* cookie */) - - // Used to get cookies for the given URL. This may block waiting for a - // previous SetCookie message to be processed. - IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_GetCookies, - GURL /* url */, - GURL /* first_party_for_cookies */, - std::string /* cookies */) - - // Used to get raw cookie information for the given URL. This may block - // waiting for a previous SetCookie message to be processed. - IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_GetRawCookies, - GURL /* url */, - GURL /* first_party_for_cookies */, - std::vector<webkit_glue::WebCookie> - /* raw_cookies */) - - // Used to delete cookie for the given URL and name - IPC_SYNC_MESSAGE_CONTROL2_0(ViewHostMsg_DeleteCookie, - GURL /* url */, - std::string /* cookie_name */) - - // Used to check if cookies are enabled for the given URL. This may block - // waiting for a previous SetCookie message to be processed. - IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_CookiesEnabled, - GURL /* url */, - GURL /* first_party_for_cookies */, - bool /* cookies_enabled */) - - // Used to get the list of plugins - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetPlugins, - bool /* refresh*/, - std::vector<WebPluginInfo> /* plugins */) - - // Return information about a plugin for the given URL and MIME - // type. If there is no matching plugin, |found| is false. If - // |enabled| in the WebPluginInfo struct is false, the plug-in is - // treated as if it was not installed at all. - // - // If |setting| is set to CONTENT_SETTING_BLOCK, the plug-in is - // blocked by the content settings for |policy_url|. It still - // appears in navigator.plugins in Javascript though, and can be - // loaded via click-to-play. - // - // If |setting| is set to CONTENT_SETTING_ALLOW, the domain is - // explicitly white-listed for the plug-in, or the user has chosen - // not to block nonsandboxed plugins. - // - // If |setting| is set to CONTENT_SETTING_DEFAULT, the plug-in is - // neither blocked nor white-listed, which means that it's allowed - // by default and can still be blocked if it's non-sandboxed. - // - // |actual_mime_type| is the actual mime type supported by the - // plugin found that match the URL given (one for each item in - // |info|). - IPC_SYNC_MESSAGE_CONTROL3_4(ViewHostMsg_GetPluginInfo, - GURL /* url */, - GURL /* policy_url */, - std::string /* mime_type */, - bool /* found */, - WebPluginInfo /* plugin info */, - ContentSetting /* setting */, - std::string /* actual_mime_type */) - - // Requests spellcheck for a word. - IPC_SYNC_MESSAGE_ROUTED2_2(ViewHostMsg_SpellCheck, - string16 /* word to check */, - int /* document tag*/, - int /* misspell location */, - int /* misspell length */) - - // Asks the browser for a unique document tag. - IPC_SYNC_MESSAGE_ROUTED0_1(ViewHostMsg_GetDocumentTag, - int /* the tag */) - - - // This message tells the spellchecker that a document, identified by an int - // tag, has been closed and all of the ignored words for that document can be - // forgotten. - IPC_MESSAGE_ROUTED1(ViewHostMsg_DocumentWithTagClosed, - int /* the tag */) - - // Tells the browser to display or not display the SpellingPanel - IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowSpellingPanel, - bool /* if true, then show it, otherwise hide it*/) - - // Tells the browser to update the spelling panel with the given word. - IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateSpellingPanelWithMisspelledWord, - string16 /* the word to update the panel with */) - - // Tells the browser that content in the current page was blocked due to the - // user's content settings. - IPC_MESSAGE_ROUTED2(ViewHostMsg_ContentBlocked, - ContentSettingsType, /* type of blocked content */ - std::string /* resource identifier */) - - // Tells the browser that a specific Appcache manifest in the current page - // was accessed. - IPC_MESSAGE_ROUTED2(ViewHostMsg_AppCacheAccessed, - GURL /* manifest url */, - bool /* blocked by policy */) - - // Tells the browser that a specific Web database in the current page was - // accessed. - IPC_MESSAGE_ROUTED5(ViewHostMsg_WebDatabaseAccessed, - GURL /* origin url */, - string16 /* database name */, - string16 /* database display name */, - unsigned long /* estimated size */, - bool /* blocked by policy */) - - // Initiates a download based on user actions like 'ALT+click'. - IPC_MESSAGE_ROUTED2(ViewHostMsg_DownloadUrl, - GURL /* url */, - GURL /* referrer */) - - // Used to go to the session history entry at the given offset (ie, -1 will - // return the "back" item). - IPC_MESSAGE_ROUTED1(ViewHostMsg_GoToEntryAtOffset, - int /* offset (from current) of history item to get */) - - IPC_SYNC_MESSAGE_ROUTED4_2(ViewHostMsg_RunJavaScriptMessage, - std::wstring /* in - alert message */, - std::wstring /* in - default prompt */, - GURL /* in - originating page URL */, - int /* in - dialog flags */, - bool /* out - success */, - std::wstring /* out - prompt field */) - - // Provides the contents for the given page that was loaded recently. - IPC_MESSAGE_ROUTED5(ViewHostMsg_PageContents, - GURL /* URL of the page */, - int32 /* page id */, - string16 /* page contents */, - std::string /* page ISO639_1 language code */, - bool /* whether the page can be translated */) - - // Used to get the extension message bundle. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetExtensionMessageBundle, - std::string /* extension id */, - SubstitutionMap /* message bundle */) - - // Specifies the URL as the first parameter (a wstring) and thumbnail as - // binary data as the second parameter. - IPC_MESSAGE_ROUTED3(ViewHostMsg_Thumbnail, - GURL /* url */, - ThumbnailScore /* score */, - SkBitmap /* bitmap */) - - // Send a snapshot of the tab contents to the render host. - IPC_MESSAGE_ROUTED1(ViewHostMsg_Snapshot, - SkBitmap /* bitmap */) - - // Notification that the url for the favicon of a site has been determined. - IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateFavIconURL, - int32 /* page_id */, - GURL /* url of the favicon */) - - // Used to tell the parent that the user right clicked on an area of the - // content area, and a context menu should be shown for it. The params - // object contains information about the node(s) that were selected when the - // user right clicked. - IPC_MESSAGE_ROUTED1(ViewHostMsg_ContextMenu, ContextMenuParams) - - // Requests that the given URL be opened in the specified manner. - IPC_MESSAGE_ROUTED3(ViewHostMsg_OpenURL, - GURL /* url */, - GURL /* referrer */, - WindowOpenDisposition /* disposition */) - - // Notifies that the preferred size of the content changed. - IPC_MESSAGE_ROUTED1(ViewHostMsg_DidContentsPreferredSizeChange, - gfx::Size /* pref_size */) - - // Following message is used to communicate the values received by the - // callback binding the JS to Cpp. - // An instance of browser that has an automation host listening to it can - // have a javascript send a native value (string, number, boolean) to the - // listener in Cpp. (DomAutomationController) - IPC_MESSAGE_ROUTED2(ViewHostMsg_DomOperationResponse, - std::string /* json_string */, - int /* automation_id */) - - // A message from HTML-based UI. When (trusted) Javascript calls - // send(message, args), this message is sent to the browser. - IPC_MESSAGE_ROUTED3(ViewHostMsg_DOMUISend, - GURL /* source_url */, - std::string /* message */, - std::string /* args (as a JSON string) */) - - // A message for an external host. - IPC_MESSAGE_ROUTED3(ViewHostMsg_ForwardMessageToExternalHost, - std::string /* message */, - std::string /* origin */, - std::string /* target */) - - // A renderer sends this to the browser process when it wants to - // create a plugin. The browser will create the plugin process if - // necessary, and will return a handle to the channel on success. - // On error an empty string is returned. - IPC_SYNC_MESSAGE_CONTROL2_2(ViewHostMsg_OpenChannelToPlugin, - GURL /* url */, - std::string /* mime_type */, - IPC::ChannelHandle /* handle to channel */, - WebPluginInfo /* info */) - - // A renderer sends this to the browser process when it wants to - // create a pepper plugin. The browser will create the plugin process if - // necessary, and will return a handle to the channel on success. - // On error an empty string is returned. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_OpenChannelToPepperPlugin, - FilePath /* path */, - IPC::ChannelHandle /* handle to channel */) - - // A renderer sends this to the browser process when it wants to - // create connect to the GPU. The browser will create the GPU process if - // necessary, and will return a handle to the channel via - // a GpuChannelEstablished message. - IPC_MESSAGE_CONTROL0(ViewHostMsg_EstablishGpuChannel) - - // A renderer sends this to the browser process to provide a synchronization - // point for GPU operations, in particular to make sure the GPU channel has - // been established. - IPC_SYNC_MESSAGE_CONTROL0_0(ViewHostMsg_SynchronizeGpu) - - // A renderer sends this to the browser process when it wants to start - // a new instance of the Native Client process. The browser will launch - // the process and return a handle to an IMC channel. - IPC_SYNC_MESSAGE_CONTROL2_3(ViewHostMsg_LaunchNaCl, - std::wstring /* url for the NaCl module */, - int /* socket count */, - std::vector<nacl::FileDescriptor> - /* imc channel handles */, - base::ProcessHandle /* NaCl process handle */, - base::ProcessId /* NaCl process id */) +// Sent by the renderer when it is creating a new window. The browser creates +// a tab for it and responds with a ViewMsg_CreatingNew_ACK. If route_id is +// MSG_ROUTING_NONE, the view couldn't be created. +IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_CreateWindow, + ViewHostMsg_CreateWindow_Params, + int /* route_id */, + int64 /* cloned_session_storage_namespace_id */) + +// Similar to ViewHostMsg_CreateWindow, except used for sub-widgets, like +// <select> dropdowns. This message is sent to the TabContents that +// contains the widget being created. +IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_CreateWidget, + int /* opener_id */, + WebKit::WebPopupType /* popup type */, + int /* route_id */) + +// Similar to ViewHostMsg_CreateWidget except the widget is a full screen +// window. +IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_CreateFullscreenWidget, + int /* opener_id */, + WebKit::WebPopupType /* popup type */, + int /* route_id */) + +// These three messages are sent to the parent RenderViewHost to display the +// page/widget that was created by +// CreateWindow/CreateWidget/CreateFullscreenWidget. routing_id +// refers to the id that was returned from the Create message above. +// The initial_position parameter is a rectangle in screen coordinates. +// +// FUTURE: there will probably be flags here to control if the result is +// in a new window. +IPC_MESSAGE_ROUTED4(ViewHostMsg_ShowView, + int /* route_id */, + WindowOpenDisposition /* disposition */, + gfx::Rect /* initial_pos */, + bool /* opened_by_user_gesture */) + +IPC_MESSAGE_ROUTED2(ViewHostMsg_ShowWidget, + int /* route_id */, + gfx::Rect /* initial_pos */) + +// Message to show a full screen widget. +IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowFullscreenWidget, + int /* route_id */) + +// Message to show a popup menu using native cocoa controls (Mac only). +IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowPopup, + ViewHostMsg_ShowPopup_Params) + +// This message is sent after ViewHostMsg_ShowView to cause the RenderView +// to run in a modal fashion until it is closed. +IPC_SYNC_MESSAGE_ROUTED0_0(ViewHostMsg_RunModal) + +IPC_MESSAGE_CONTROL1(ViewHostMsg_UpdatedCacheStats, + WebKit::WebCache::UsageStats /* stats */) + +// Indicates the renderer is ready in response to a ViewMsg_New or +// a ViewMsg_CreatingNew_ACK. +IPC_MESSAGE_ROUTED0(ViewHostMsg_RenderViewReady) + + +// Indicates the renderer process is gone. This actually is sent by the +// browser process to itself, but keeps the interface cleaner. +IPC_MESSAGE_ROUTED2(ViewHostMsg_RenderViewGone, + int, /* this really is base::TerminationStatus */ + int /* exit_code */) + +// Sent by the renderer process to request that the browser close the view. +// This corresponds to the window.close() API, and the browser may ignore +// this message. Otherwise, the browser will generates a ViewMsg_Close +// message to close the view. +IPC_MESSAGE_ROUTED0(ViewHostMsg_Close) + +// Sent by the renderer process to request that the browser move the view. +// This corresponds to the window.resizeTo() and window.moveTo() APIs, and +// the browser may ignore this message. +IPC_MESSAGE_ROUTED1(ViewHostMsg_RequestMove, + gfx::Rect /* position */) + +// Notifies the browser that a frame in the view has changed. This message +// has a lot of parameters and is packed/unpacked by functions defined in +// render_messages.h. +IPC_MESSAGE_ROUTED1(ViewHostMsg_FrameNavigate, + ViewHostMsg_FrameNavigate_Params) + +// Notifies the browser that we have session history information. +// page_id: unique ID that allows us to distinguish between history entries. +IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateState, + int32 /* page_id */, + std::string /* state */) + +// Notifies the browser that a document has been loaded in a frame. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DocumentLoadedInFrame, + int64 /* frame_id */) + +// Notifies the browser that a frame finished loading. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DidFinishLoad, + int64 /* frame_id */) + +// Changes the title for the page in the UI when the page is navigated or the +// title changes. +// TODO(darin): use a UTF-8 string to reduce data size +IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateTitle, int32, std::wstring) + +// Changes the icon url for the page in the UI. +IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateIconURL, int32, GURL) + +// Change the encoding name of the page in UI when the page has detected +// proper encoding name. +IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateEncoding, + std::string /* new encoding name */) + +// Notifies the browser that we want to show a destination url for a potential +// action (e.g. when the user is hovering over a link). +IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateTargetURL, int32, GURL) + +// Sent when the renderer starts loading the page. This corresponds to +// WebKit's notion of the throbber starting. Note that sometimes you may get +// duplicates of these during a single load. +IPC_MESSAGE_ROUTED0(ViewHostMsg_DidStartLoading) + +// Sent when the renderer is done loading a page. This corresponds to WebKit's +// notion of the throbber stopping. +IPC_MESSAGE_ROUTED0(ViewHostMsg_DidStopLoading) + +// Sent when the renderer main frame has made progress loading. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DidChangeLoadProgress, + double /* load_progress */) + +// Sent when the document element is available for the toplevel frame. This +// happens after the page starts loading, but before all resources are +// finished. +IPC_MESSAGE_ROUTED0(ViewHostMsg_DocumentAvailableInMainFrame) + +// Sent when after the onload handler has been invoked for the document +// in the toplevel frame. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DocumentOnLoadCompletedInMainFrame, + int32 /* page_id */) + +// Sent when the renderer loads a resource from its memory cache. +// The security info is non empty if the resource was originally loaded over +// a secure connection. +// Note: May only be sent once per URL per frame per committed load. +IPC_MESSAGE_ROUTED4(ViewHostMsg_DidLoadResourceFromMemoryCache, + GURL /* url */, + std::string /* frame_origin */, + std::string /* main_frame_origin */, + std::string /* security info */) + +// Sent when the renderer displays insecure content in a secure page. +IPC_MESSAGE_ROUTED0(ViewHostMsg_DidDisplayInsecureContent) + +// Sent when the renderer runs insecure content in a secure origin. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DidRunInsecureContent, + std::string /* security_origin */) + +// Sent when the renderer starts a provisional load for a frame. +IPC_MESSAGE_ROUTED3(ViewHostMsg_DidStartProvisionalLoadForFrame, + int64 /* frame_id */, + bool /* true if it is the main frame */, + GURL /* url */) + +// Sent when the renderer fails a provisional load with an error. +IPC_MESSAGE_ROUTED5(ViewHostMsg_DidFailProvisionalLoadWithError, + int64 /* frame_id */, + bool /* true if it is the main frame */, + int /* error_code */, + GURL /* url */, + bool /* true if the failure is the result of + navigating to a POST again and we're going to + show the POST interstitial */) + +// Tells the render view that a ViewHostMsg_PaintAtSize message was +// processed, and the DIB is ready for use. |tag| has the same value that +// the tag sent along with ViewMsg_PaintAtSize. +IPC_MESSAGE_ROUTED2(ViewHostMsg_PaintAtSize_ACK, + int /* tag */, + gfx::Size /* size */) + +// Sent to update part of the view. In response to this message, the host +// generates a ViewMsg_UpdateRect_ACK message. +IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateRect, + ViewHostMsg_UpdateRect_Params) + +// Sent by the renderer when accelerated compositing is enabled or disabled to +// notify the browser whether or not is should do painting. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DidActivateAcceleratedCompositing, + bool /* true if the accelerated compositor is actve */) + +// Acknowledges receipt of a ViewMsg_HandleInputEvent message. +// Payload is a WebInputEvent::Type which is the type of the event, followed +// by an optional WebInputEvent which is provided only if the event was not +// processed. +IPC_MESSAGE_ROUTED0(ViewHostMsg_HandleInputEvent_ACK) + +IPC_MESSAGE_ROUTED0(ViewHostMsg_Focus) +IPC_MESSAGE_ROUTED0(ViewHostMsg_Blur) + +// Message sent from renderer to the browser when focus changes inside the +// webpage. The parameter says whether the newly focused element needs +// keyboard input (true for textfields, text areas and content editable divs). +IPC_MESSAGE_ROUTED1(ViewHostMsg_FocusedNodeChanged, + bool /* is_editable_node */) + +// Returns the window location of the given window. +// TODO(shess): Provide a mapping from reply_msg->routing_id() to +// HWND so that we can eliminate the NativeViewId parameter. +IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetWindowRect, + gfx::NativeViewId /* window */, + gfx::Rect /* Out: Window location */) + +IPC_MESSAGE_ROUTED1(ViewHostMsg_SetCursor, WebCursor) +// Result of string search in the page. +// Response to ViewMsg_Find with the results of the requested find-in-page +// search, the number of matches found and the selection rect (in screen +// coordinates) for the string found. If |final_update| is false, it signals +// that this is not the last Find_Reply message - more will be sent as the +// scoping effort continues. +IPC_MESSAGE_ROUTED5(ViewHostMsg_Find_Reply, + int /* request_id */, + int /* number of matches */, + gfx::Rect /* selection_rect */, + int /* active_match_ordinal */, + bool /* final_update */) + +// Makes a resource request via the browser. +IPC_MESSAGE_ROUTED2(ViewHostMsg_RequestResource, + int /* request_id */, + ViewHostMsg_Resource_Request) + +// Cancels a resource request with the ID given as the parameter. +IPC_MESSAGE_ROUTED1(ViewHostMsg_CancelRequest, + int /* request_id */) + +// Follows a redirect that occured for the resource request with the ID given +// as the parameter. +IPC_MESSAGE_ROUTED3(ViewHostMsg_FollowRedirect, + int /* request_id */, + bool /* has_new_first_party_for_cookies */, + GURL /* new_first_party_for_cookies */) + +// Makes a synchronous resource request via the browser. +IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_SyncLoad, + int /* request_id */, + ViewHostMsg_Resource_Request, + SyncLoadResult) + +// Used to set a cookie. The cookie is set asynchronously, but will be +// available to a subsequent ViewHostMsg_GetCookies request. +IPC_MESSAGE_ROUTED3(ViewHostMsg_SetCookie, + GURL /* url */, + GURL /* first_party_for_cookies */, + std::string /* cookie */) + +// Used to get cookies for the given URL. This may block waiting for a +// previous SetCookie message to be processed. +IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_GetCookies, + GURL /* url */, + GURL /* first_party_for_cookies */, + std::string /* cookies */) + +// Used to get raw cookie information for the given URL. This may block +// waiting for a previous SetCookie message to be processed. +IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_GetRawCookies, + GURL /* url */, + GURL /* first_party_for_cookies */, + std::vector<webkit_glue::WebCookie> + /* raw_cookies */) + +// Used to delete cookie for the given URL and name +IPC_SYNC_MESSAGE_CONTROL2_0(ViewHostMsg_DeleteCookie, + GURL /* url */, + std::string /* cookie_name */) + +// Used to check if cookies are enabled for the given URL. This may block +// waiting for a previous SetCookie message to be processed. +IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_CookiesEnabled, + GURL /* url */, + GURL /* first_party_for_cookies */, + bool /* cookies_enabled */) + +// Used to get the list of plugins +IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetPlugins, + bool /* refresh*/, + std::vector<webkit::npapi::WebPluginInfo> /* plugins */) + +// Return information about a plugin for the given URL and MIME +// type. If there is no matching plugin, |found| is false. If +// |enabled| in the WebPluginInfo struct is false, the plug-in is +// treated as if it was not installed at all. +// +// If |setting| is set to CONTENT_SETTING_BLOCK, the plug-in is +// blocked by the content settings for |policy_url|. It still +// appears in navigator.plugins in Javascript though, and can be +// loaded via click-to-play. +// +// If |setting| is set to CONTENT_SETTING_ALLOW, the domain is +// explicitly white-listed for the plug-in, or the user has chosen +// not to block nonsandboxed plugins. +// +// If |setting| is set to CONTENT_SETTING_DEFAULT, the plug-in is +// neither blocked nor white-listed, which means that it's allowed +// by default and can still be blocked if it's non-sandboxed. +// +// |actual_mime_type| is the actual mime type supported by the +// plugin found that match the URL given (one for each item in +// |info|). +IPC_SYNC_MESSAGE_CONTROL3_4(ViewHostMsg_GetPluginInfo, + GURL /* url */, + GURL /* policy_url */, + std::string /* mime_type */, + bool /* found */, + webkit::npapi::WebPluginInfo /* plugin info */, + ContentSetting /* setting */, + std::string /* actual_mime_type */) + +// Requests spellcheck for a word. +IPC_SYNC_MESSAGE_ROUTED2_2(ViewHostMsg_SpellCheck, + string16 /* word to check */, + int /* document tag*/, + int /* misspell location */, + int /* misspell length */) + +// Asks the browser for a unique document tag. +IPC_SYNC_MESSAGE_ROUTED0_1(ViewHostMsg_GetDocumentTag, + int /* the tag */) + + +// This message tells the spellchecker that a document, identified by an int +// tag, has been closed and all of the ignored words for that document can be +// forgotten. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DocumentWithTagClosed, + int /* the tag */) + +// Tells the browser to display or not display the SpellingPanel +IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowSpellingPanel, + bool /* if true, then show it, otherwise hide it*/) + +// Tells the browser to update the spelling panel with the given word. +IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateSpellingPanelWithMisspelledWord, + string16 /* the word to update the panel with */) + +// Tells the browser that content in the current page was blocked due to the +// user's content settings. +IPC_MESSAGE_ROUTED2(ViewHostMsg_ContentBlocked, + ContentSettingsType, /* type of blocked content */ + std::string /* resource identifier */) + +// Tells the browser that a specific Appcache manifest in the current page +// was accessed. +IPC_MESSAGE_ROUTED2(ViewHostMsg_AppCacheAccessed, + GURL /* manifest url */, + bool /* blocked by policy */) + +// Tells the browser that a specific Web database in the current page was +// accessed. +IPC_MESSAGE_ROUTED5(ViewHostMsg_WebDatabaseAccessed, + GURL /* origin url */, + string16 /* database name */, + string16 /* database display name */, + unsigned long /* estimated size */, + bool /* blocked by policy */) + +// Initiates a download based on user actions like 'ALT+click'. +IPC_MESSAGE_ROUTED2(ViewHostMsg_DownloadUrl, + GURL /* url */, + GURL /* referrer */) + +// Used to go to the session history entry at the given offset (ie, -1 will +// return the "back" item). +IPC_MESSAGE_ROUTED1(ViewHostMsg_GoToEntryAtOffset, + int /* offset (from current) of history item to get */) + +IPC_SYNC_MESSAGE_ROUTED4_2(ViewHostMsg_RunJavaScriptMessage, + std::wstring /* in - alert message */, + std::wstring /* in - default prompt */, + GURL /* in - originating page URL */, + int /* in - dialog flags */, + bool /* out - success */, + std::wstring /* out - prompt field */) + +// Provides the contents for the given page that was loaded recently. +IPC_MESSAGE_ROUTED5(ViewHostMsg_PageContents, + GURL /* URL of the page */, + int32 /* page id */, + string16 /* page contents */, + std::string /* page ISO639_1 language code */, + bool /* whether the page can be translated */) + +// Used to get the extension message bundle. +IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetExtensionMessageBundle, + std::string /* extension id */, + SubstitutionMap /* message bundle */) + +// Specifies the URL as the first parameter (a wstring) and thumbnail as +// binary data as the second parameter. +IPC_MESSAGE_ROUTED3(ViewHostMsg_Thumbnail, + GURL /* url */, + ThumbnailScore /* score */, + SkBitmap /* bitmap */) + +// Send a snapshot of the tab contents to the render host. +IPC_MESSAGE_ROUTED1(ViewHostMsg_Snapshot, + SkBitmap /* bitmap */) + +// Notification that the url for the favicon of a site has been determined. +IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateFavIconURL, + int32 /* page_id */, + GURL /* url of the favicon */) + +// Used to tell the parent that the user right clicked on an area of the +// content area, and a context menu should be shown for it. The params +// object contains information about the node(s) that were selected when the +// user right clicked. +IPC_MESSAGE_ROUTED1(ViewHostMsg_ContextMenu, ContextMenuParams) + +// Requests that the given URL be opened in the specified manner. +IPC_MESSAGE_ROUTED3(ViewHostMsg_OpenURL, + GURL /* url */, + GURL /* referrer */, + WindowOpenDisposition /* disposition */) + +// Notifies that the preferred size of the content changed. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DidContentsPreferredSizeChange, + gfx::Size /* pref_size */) + +// Following message is used to communicate the values received by the +// callback binding the JS to Cpp. +// An instance of browser that has an automation host listening to it can +// have a javascript send a native value (string, number, boolean) to the +// listener in Cpp. (DomAutomationController) +IPC_MESSAGE_ROUTED2(ViewHostMsg_DomOperationResponse, + std::string /* json_string */, + int /* automation_id */) + +// A message from HTML-based UI. When (trusted) Javascript calls +// send(message, args), this message is sent to the browser. +IPC_MESSAGE_ROUTED3(ViewHostMsg_DOMUISend, + GURL /* source_url */, + std::string /* message */, + std::string /* args (as a JSON string) */) + +// A message for an external host. +IPC_MESSAGE_ROUTED3(ViewHostMsg_ForwardMessageToExternalHost, + std::string /* message */, + std::string /* origin */, + std::string /* target */) + +// A renderer sends this to the browser process when it wants to +// create a plugin. The browser will create the plugin process if +// necessary, and will return a handle to the channel on success. +// On error an empty string is returned. +IPC_SYNC_MESSAGE_CONTROL2_2(ViewHostMsg_OpenChannelToPlugin, + GURL /* url */, + std::string /* mime_type */, + IPC::ChannelHandle /* channel_handle */, + webkit::npapi::WebPluginInfo /* info */) + +// A renderer sends this to the browser process when it wants to +// create a pepper plugin. The browser will create the plugin process if +// necessary, and will return a handle to the channel on success. +// On error an empty string is returned. +IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_OpenChannelToPepperPlugin, + FilePath /* path */, + base::ProcessHandle /* plugin_process_handle */, + IPC::ChannelHandle /* handle to channel */) + +// A renderer sends this to the browser process when it wants to +// create connect to the GPU. The browser will create the GPU process if +// necessary, and will return a handle to the channel via +// a GpuChannelEstablished message. +IPC_MESSAGE_CONTROL0(ViewHostMsg_EstablishGpuChannel) + +// A renderer sends this to the browser process to provide a synchronization +// point for GPU operations, in particular to make sure the GPU channel has +// been established. +IPC_SYNC_MESSAGE_CONTROL0_0(ViewHostMsg_SynchronizeGpu) + +// A renderer sends this to the browser process when it wants to start +// a new instance of the Native Client process. The browser will launch +// the process and return a handle to an IMC channel. +IPC_SYNC_MESSAGE_CONTROL2_3(ViewHostMsg_LaunchNaCl, + std::wstring /* url for the NaCl module */, + int /* socket count */, + std::vector<nacl::FileDescriptor> + /* imc channel handles */, + base::ProcessHandle /* NaCl process handle */, + base::ProcessId /* NaCl process id */) #if defined(USE_X11) - // A renderer sends this when it needs a browser-side widget for - // hosting a windowed plugin. id is the XID of the plugin window, for which - // the container is created. - IPC_SYNC_MESSAGE_ROUTED1_0(ViewHostMsg_CreatePluginContainer, - gfx::PluginWindowHandle /* id */) - - // Destroy a plugin container previously created using CreatePluginContainer. - // id is the XID of the plugin window corresponding to the container that is - // to be destroyed. - IPC_SYNC_MESSAGE_ROUTED1_0(ViewHostMsg_DestroyPluginContainer, - gfx::PluginWindowHandle /* id */) +// A renderer sends this when it needs a browser-side widget for +// hosting a windowed plugin. id is the XID of the plugin window, for which +// the container is created. +IPC_SYNC_MESSAGE_ROUTED1_0(ViewHostMsg_CreatePluginContainer, + gfx::PluginWindowHandle /* id */) + +// Destroy a plugin container previously created using CreatePluginContainer. +// id is the XID of the plugin window corresponding to the container that is +// to be destroyed. +IPC_SYNC_MESSAGE_ROUTED1_0(ViewHostMsg_DestroyPluginContainer, + gfx::PluginWindowHandle /* id */) #endif - // Clipboard IPC messages - - // This message is used when the object list does not contain a bitmap. - IPC_MESSAGE_CONTROL1(ViewHostMsg_ClipboardWriteObjectsAsync, - 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(ViewHostMsg_ClipboardWriteObjectsSync, - Clipboard::ObjectMap /* objects */, - base::SharedMemoryHandle /* bitmap handle */) - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_ClipboardIsFormatAvailable, - std::string /* format */, - Clipboard::Buffer /* buffer */, - bool /* result */) - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_ClipboardReadText, - Clipboard::Buffer /* buffer */, - string16 /* result */) - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_ClipboardReadAsciiText, - Clipboard::Buffer /* buffer */, - std::string /* result */) - IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ClipboardReadHTML, - Clipboard::Buffer /* buffer */, - string16 /* markup */, - GURL /* url */) - - IPC_SYNC_MESSAGE_CONTROL1_3(ViewHostMsg_ClipboardReadAvailableTypes, - Clipboard::Buffer /* buffer */, - bool /* result */, - std::vector<string16> /* types */, - bool /* contains filenames */) - IPC_SYNC_MESSAGE_CONTROL2_3(ViewHostMsg_ClipboardReadData, - Clipboard::Buffer /* buffer */, - string16 /* type */, - bool /* succeeded */, - string16 /* data */, - string16 /* metadata */) - IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ClipboardReadFilenames, - Clipboard::Buffer /* buffer */, - bool /* result */, - std::vector<string16> /* filenames */) +// Clipboard IPC messages + +// This message is used when the object list does not contain a bitmap. +IPC_MESSAGE_CONTROL1(ViewHostMsg_ClipboardWriteObjectsAsync, + 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(ViewHostMsg_ClipboardWriteObjectsSync, + Clipboard::ObjectMap /* objects */, + base::SharedMemoryHandle /* bitmap handle */) +IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_ClipboardIsFormatAvailable, + std::string /* format */, + Clipboard::Buffer /* buffer */, + bool /* result */) +IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_ClipboardReadText, + Clipboard::Buffer /* buffer */, + string16 /* result */) +IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_ClipboardReadAsciiText, + Clipboard::Buffer /* buffer */, + std::string /* result */) +IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ClipboardReadHTML, + Clipboard::Buffer /* buffer */, + string16 /* markup */, + GURL /* url */) + +IPC_SYNC_MESSAGE_CONTROL1_3(ViewHostMsg_ClipboardReadAvailableTypes, + Clipboard::Buffer /* buffer */, + bool /* result */, + std::vector<string16> /* types */, + bool /* contains filenames */) +IPC_SYNC_MESSAGE_CONTROL2_3(ViewHostMsg_ClipboardReadData, + Clipboard::Buffer /* buffer */, + string16 /* type */, + bool /* succeeded */, + string16 /* data */, + string16 /* metadata */) +IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ClipboardReadFilenames, + Clipboard::Buffer /* buffer */, + bool /* result */, + std::vector<string16> /* filenames */) #if defined(OS_MACOSX) - IPC_MESSAGE_CONTROL1(ViewHostMsg_ClipboardFindPboardWriteStringAsync, - string16 /* text */) - - // Request that the browser load a font into shared memory for us. - IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_LoadFont, - FontDescriptor /* font to load */, - uint32 /* buffer size */, - base::SharedMemoryHandle /* font data */) +IPC_MESSAGE_CONTROL1(ViewHostMsg_ClipboardFindPboardWriteStringAsync, + string16 /* text */) + +// Request that the browser load a font into shared memory for us. +IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_LoadFont, + FontDescriptor /* font to load */, + uint32 /* buffer size */, + base::SharedMemoryHandle /* font data */) #endif #if defined(OS_WIN) - // Request that the given font be loaded by the browser so it's cached by the - // OS. Please see ChildProcessHost::PreCacheFont for details. - IPC_SYNC_MESSAGE_CONTROL1_0(ViewHostMsg_PreCacheFont, - LOGFONT /* font data */) +// Request that the given font be loaded by the browser so it's cached by the +// OS. Please see ChildProcessHost::PreCacheFont for details. +IPC_SYNC_MESSAGE_CONTROL1_0(ViewHostMsg_PreCacheFont, + LOGFONT /* font data */) #endif // defined(OS_WIN) - // Returns WebScreenInfo corresponding to the view. - // TODO(shess): Provide a mapping from reply_msg->routing_id() to - // HWND so that we can eliminate the NativeViewId parameter. - IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetScreenInfo, - gfx::NativeViewId /* view */, - WebKit::WebScreenInfo /* results */) - - // Send the tooltip text for the current mouse position to the browser. - IPC_MESSAGE_ROUTED2(ViewHostMsg_SetTooltipText, - std::wstring /* tooltip text string */, - WebKit::WebTextDirection /* text direction hint */) - - // Notification that the text selection has changed. - IPC_MESSAGE_ROUTED1(ViewHostMsg_SelectionChanged, - std::string /* currently selected text */) - - // Asks the browser to display the file chooser. The result is returned in a - // ViewHost_RunFileChooserResponse message. - IPC_MESSAGE_ROUTED1(ViewHostMsg_RunFileChooser, - ViewHostMsg_RunFileChooser_Params) - - // Notification that forms have been seen that are candidates for - // filling/submitting by the AutoFillManager. - IPC_MESSAGE_ROUTED1(ViewHostMsg_FormsSeen, - std::vector<webkit_glue::FormData> /* forms */) - - // Notification that password forms have been seen that are candidates for - // filling/submitting by the password manager. - IPC_MESSAGE_ROUTED1(ViewHostMsg_PasswordFormsFound, - std::vector<webkit_glue::PasswordForm> /* forms */) - - // Notification that initial layout has occurred and the following password - // forms are visible on the page (e.g. not set to display:none.) - IPC_MESSAGE_ROUTED1(ViewHostMsg_PasswordFormsVisible, - std::vector<webkit_glue::PasswordForm> /* forms */) - - // Notification that a form has been submitted. The user hit the button. - IPC_MESSAGE_ROUTED1(ViewHostMsg_FormSubmitted, - webkit_glue::FormData /* form */) - - // Used to tell the parent the user started dragging in the content area. The - // WebDropData struct contains contextual information about the pieces of the - // page the user dragged. The parent uses this notification to initiate a - // drag session at the OS level. - IPC_MESSAGE_ROUTED4(ViewHostMsg_StartDragging, - WebDropData /* drop_data */, - WebKit::WebDragOperationsMask /* ops_allowed */, - SkBitmap /* image */, - gfx::Point /* image_offset */) - - // The page wants to update the mouse cursor during a drag & drop operation. - // |is_drop_target| is true if the mouse is over a valid drop target. - IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateDragCursor, - WebKit::WebDragOperation /* drag_operation */) - - // Tells the browser to move the focus to the next (previous if reverse is - // true) focusable element. - IPC_MESSAGE_ROUTED1(ViewHostMsg_TakeFocus, bool /* reverse */) - - // Notification that the page has an OpenSearch description document - // associated with it. - IPC_MESSAGE_ROUTED3(ViewHostMsg_PageHasOSDD, - int32 /* page_id */, - GURL /* url of OS description document */, - ViewHostMsg_PageHasOSDD_Type) - - // Find out if the given url's security origin is installed as a search - // provider. - IPC_SYNC_MESSAGE_ROUTED2_1( - ViewHostMsg_GetSearchProviderInstallState, - GURL /* page url */, - GURL /* inquiry url */, - ViewHostMsg_GetSearchProviderInstallState_Params /* install */) - - // Required for updating text input state. - IPC_MESSAGE_ROUTED2(ViewHostMsg_ImeUpdateTextInputState, - WebKit::WebTextInputType, /* text_input_type */ - gfx::Rect /* caret_rect */) - - // Required for cancelling an ongoing input method composition. - IPC_MESSAGE_ROUTED0(ViewHostMsg_ImeCancelComposition) - - // Tells the browser that the renderer is done calculating the number of - // rendered pages according to the specified settings. - IPC_MESSAGE_ROUTED2(ViewHostMsg_DidGetPrintedPagesCount, - int /* rendered document cookie */, - int /* number of rendered pages */) - - // Sends back to the browser the rendered "printed page" that was requested by - // a ViewMsg_PrintPage message or from scripted printing. The memory handle in - // this message is already valid in the browser process. - IPC_MESSAGE_ROUTED1(ViewHostMsg_DidPrintPage, - ViewHostMsg_DidPrintPage_Params /* page content */) - - // The renderer wants to know the default print settings. - IPC_SYNC_MESSAGE_ROUTED0_1(ViewHostMsg_GetDefaultPrintSettings, - ViewMsg_Print_Params /* default_settings */) - - // It's the renderer that controls the printing process when it is generated - // by javascript. This step is about showing UI to the user to select the - // final print settings. The output parameter is the same as - // ViewMsg_PrintPages which is executed implicitly. - IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_ScriptedPrint, - ViewHostMsg_ScriptedPrint_Params, - ViewMsg_PrintPages_Params - /* settings chosen by the user*/) - - // WebKit and JavaScript error messages to log to the console - // or debugger UI. - IPC_MESSAGE_ROUTED3(ViewHostMsg_AddMessageToConsole, - std::wstring, /* msg */ - int32, /* line number */ - std::wstring /* source id */) - - // Stores new inspector setting in the profile. - IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateInspectorSetting, - std::string, /* key */ - std::string /* value */) - - // Wraps an IPC message that's destined to the DevToolsClient on - // DevToolsAgent->browser hop. - IPC_MESSAGE_ROUTED1(ViewHostMsg_ForwardToDevToolsClient, - IPC::Message /* one of DevToolsClientMsg_XXX types */) - - // Wraps an IPC message that's destined to the DevToolsAgent on - // DevToolsClient->browser hop. - IPC_MESSAGE_ROUTED1(ViewHostMsg_ForwardToDevToolsAgent, - IPC::Message /* one of DevToolsAgentMsg_XXX types */) - - // Activates (brings to the front) corresponding dev tools window. - IPC_MESSAGE_ROUTED0(ViewHostMsg_ActivateDevToolsWindow) - - // Closes dev tools window that is inspecting current render_view_host. - IPC_MESSAGE_ROUTED0(ViewHostMsg_CloseDevToolsWindow) - - // Attaches dev tools window that is inspecting current render_view_host. - IPC_MESSAGE_ROUTED0(ViewHostMsg_RequestDockDevToolsWindow) - - // Detaches dev tools window that is inspecting current render_view_host. - IPC_MESSAGE_ROUTED0(ViewHostMsg_RequestUndockDevToolsWindow) - - // Updates runtime features store in devtools manager in order to support - // cross-navigation instrumentation. - IPC_MESSAGE_ROUTED2(ViewHostMsg_DevToolsRuntimePropertyChanged, - std::string /* name */, - std::string /* value */) - - // Send back a string to be recorded by UserMetrics. - IPC_MESSAGE_CONTROL1(ViewHostMsg_UserMetricsRecordAction, - std::string /* action */) - - // Send back histograms as vector of pickled-histogram strings. - IPC_MESSAGE_CONTROL2(ViewHostMsg_RendererHistograms, - int, /* sequence number of Renderer Histograms. */ - std::vector<std::string>) +// Returns WebScreenInfo corresponding to the view. +// TODO(shess): Provide a mapping from reply_msg->routing_id() to +// HWND so that we can eliminate the NativeViewId parameter. +IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetScreenInfo, + gfx::NativeViewId /* view */, + WebKit::WebScreenInfo /* results */) + +// Send the tooltip text for the current mouse position to the browser. +IPC_MESSAGE_ROUTED2(ViewHostMsg_SetTooltipText, + std::wstring /* tooltip text string */, + WebKit::WebTextDirection /* text direction hint */) + +// Notification that the text selection has changed. +IPC_MESSAGE_ROUTED1(ViewHostMsg_SelectionChanged, + std::string /* currently selected text */) + +// Asks the browser to display the file chooser. The result is returned in a +// ViewHost_RunFileChooserResponse message. +IPC_MESSAGE_ROUTED1(ViewHostMsg_RunFileChooser, + ViewHostMsg_RunFileChooser_Params) + +// Notification that forms have been seen that are candidates for +// filling/submitting by the AutoFillManager. +IPC_MESSAGE_ROUTED1(ViewHostMsg_FormsSeen, + std::vector<webkit_glue::FormData> /* forms */) + +// Notification that password forms have been seen that are candidates for +// filling/submitting by the password manager. +IPC_MESSAGE_ROUTED1(ViewHostMsg_PasswordFormsFound, + std::vector<webkit_glue::PasswordForm> /* forms */) + +// Notification that initial layout has occurred and the following password +// forms are visible on the page (e.g. not set to display:none.) +IPC_MESSAGE_ROUTED1(ViewHostMsg_PasswordFormsVisible, + std::vector<webkit_glue::PasswordForm> /* forms */) + +// Notification that a form has been submitted. The user hit the button. +IPC_MESSAGE_ROUTED1(ViewHostMsg_FormSubmitted, + webkit_glue::FormData /* form */) + +// Used to tell the parent the user started dragging in the content area. The +// WebDropData struct contains contextual information about the pieces of the +// page the user dragged. The parent uses this notification to initiate a +// drag session at the OS level. +IPC_MESSAGE_ROUTED4(ViewHostMsg_StartDragging, + WebDropData /* drop_data */, + WebKit::WebDragOperationsMask /* ops_allowed */, + SkBitmap /* image */, + gfx::Point /* image_offset */) + +// The page wants to update the mouse cursor during a drag & drop operation. +// |is_drop_target| is true if the mouse is over a valid drop target. +IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateDragCursor, + WebKit::WebDragOperation /* drag_operation */) + +// Tells the browser to move the focus to the next (previous if reverse is +// true) focusable element. +IPC_MESSAGE_ROUTED1(ViewHostMsg_TakeFocus, bool /* reverse */) + +// Notification that the page has an OpenSearch description document +// associated with it. +IPC_MESSAGE_ROUTED3(ViewHostMsg_PageHasOSDD, + int32 /* page_id */, + GURL /* url of OS description document */, + ViewHostMsg_PageHasOSDD_Type) + +// Find out if the given url's security origin is installed as a search +// provider. +IPC_SYNC_MESSAGE_ROUTED2_1( + ViewHostMsg_GetSearchProviderInstallState, + GURL /* page url */, + GURL /* inquiry url */, + ViewHostMsg_GetSearchProviderInstallState_Params /* install */) + +// Required for updating text input state. +IPC_MESSAGE_ROUTED2(ViewHostMsg_ImeUpdateTextInputState, + WebKit::WebTextInputType, /* text_input_type */ + gfx::Rect /* caret_rect */) + +// Required for cancelling an ongoing input method composition. +IPC_MESSAGE_ROUTED0(ViewHostMsg_ImeCancelComposition) + +// Tells the browser that the renderer is done calculating the number of +// rendered pages according to the specified settings. +IPC_MESSAGE_ROUTED2(ViewHostMsg_DidGetPrintedPagesCount, + int /* rendered document cookie */, + int /* number of rendered pages */) + +// Sends back to the browser the rendered "printed page" that was requested by +// a ViewMsg_PrintPage message or from scripted printing. The memory handle in +// this message is already valid in the browser process. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DidPrintPage, + ViewHostMsg_DidPrintPage_Params /* page content */) + +// The renderer wants to know the default print settings. +IPC_SYNC_MESSAGE_ROUTED0_1(ViewHostMsg_GetDefaultPrintSettings, + ViewMsg_Print_Params /* default_settings */) + +// It's the renderer that controls the printing process when it is generated +// by javascript. This step is about showing UI to the user to select the +// final print settings. The output parameter is the same as +// ViewMsg_PrintPages which is executed implicitly. +IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_ScriptedPrint, + ViewHostMsg_ScriptedPrint_Params, + ViewMsg_PrintPages_Params + /* settings chosen by the user*/) + +// WebKit and JavaScript error messages to log to the console +// or debugger UI. +IPC_MESSAGE_ROUTED3(ViewHostMsg_AddMessageToConsole, + std::wstring, /* msg */ + int32, /* line number */ + std::wstring /* source id */) + +// Stores new inspector setting in the profile. +IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateInspectorSetting, + std::string, /* key */ + std::string /* value */) + +// Wraps an IPC message that's destined to the DevToolsClient on +// DevToolsAgent->browser hop. +IPC_MESSAGE_ROUTED1(ViewHostMsg_ForwardToDevToolsClient, + IPC::Message /* one of DevToolsClientMsg_XXX types */) + +// Wraps an IPC message that's destined to the DevToolsAgent on +// DevToolsClient->browser hop. +IPC_MESSAGE_ROUTED1(ViewHostMsg_ForwardToDevToolsAgent, + IPC::Message /* one of DevToolsAgentMsg_XXX types */) + +// Activates (brings to the front) corresponding dev tools window. +IPC_MESSAGE_ROUTED0(ViewHostMsg_ActivateDevToolsWindow) + +// Closes dev tools window that is inspecting current render_view_host. +IPC_MESSAGE_ROUTED0(ViewHostMsg_CloseDevToolsWindow) + +// Attaches dev tools window that is inspecting current render_view_host. +IPC_MESSAGE_ROUTED0(ViewHostMsg_RequestDockDevToolsWindow) + +// Detaches dev tools window that is inspecting current render_view_host. +IPC_MESSAGE_ROUTED0(ViewHostMsg_RequestUndockDevToolsWindow) + +// Updates runtime features store in devtools manager in order to support +// cross-navigation instrumentation. +IPC_MESSAGE_ROUTED2(ViewHostMsg_DevToolsRuntimePropertyChanged, + std::string /* name */, + std::string /* value */) + +// Send back a string to be recorded by UserMetrics. +IPC_MESSAGE_CONTROL1(ViewHostMsg_UserMetricsRecordAction, + std::string /* action */) + +// Send back histograms as vector of pickled-histogram strings. +IPC_MESSAGE_CONTROL2(ViewHostMsg_RendererHistograms, + int, /* sequence number of Renderer Histograms. */ + std::vector<std::string>) #if defined USE_TCMALLOC - // Send back tcmalloc stats output. - IPC_MESSAGE_CONTROL2(ViewHostMsg_RendererTcmalloc, - int /* pid */, - std::string /* tcmalloc debug output */) +// Send back tcmalloc stats output. +IPC_MESSAGE_CONTROL2(ViewHostMsg_RendererTcmalloc, + int /* pid */, + std::string /* tcmalloc debug output */) #endif - // Sends back stats about the V8 heap. - IPC_MESSAGE_CONTROL2(ViewHostMsg_V8HeapStats, - int /* size of heap (allocated from the OS) */, - int /* bytes in use */) - - // Request for a DNS prefetch of the names in the array. - // NameList is typedef'ed std::vector<std::string> - IPC_MESSAGE_CONTROL1(ViewHostMsg_DnsPrefetch, - std::vector<std::string> /* hostnames */) - - // Notifies when default plugin updates status of the missing plugin. - IPC_MESSAGE_ROUTED1(ViewHostMsg_MissingPluginStatus, - int /* status */) - - // Sent by the renderer process to indicate that a plugin instance has - // crashed. - IPC_MESSAGE_ROUTED1(ViewHostMsg_CrashedPlugin, - FilePath /* plugin_path */) - - // Notifies when a plugin couldn't be loaded because it's outdated. - IPC_MESSAGE_ROUTED2(ViewHostMsg_DisabledOutdatedPlugin, - string16, /* name */ - GURL /* update_url */) - - // Displays a JavaScript out-of-memory message in the infobar. - IPC_MESSAGE_ROUTED0(ViewHostMsg_JSOutOfMemory) - - // Displays a box to confirm that the user wants to navigate away from the - // page. Replies true if yes, false otherwise, the reply string is ignored, - // but is included so that we can use OnJavaScriptMessageBoxClosed. - IPC_SYNC_MESSAGE_ROUTED2_2(ViewHostMsg_RunBeforeUnloadConfirm, - GURL, /* in - originating frame URL */ - std::wstring /* in - alert message */, - bool /* out - success */, - std::wstring /* out - This is ignored.*/) - - IPC_MESSAGE_ROUTED3(ViewHostMsg_SendCurrentPageAllSavableResourceLinks, - std::vector<GURL> /* all savable resource links */, - std::vector<GURL> /* all referrers of resource links */, - std::vector<GURL> /* all frame links */) - - IPC_MESSAGE_ROUTED3(ViewHostMsg_SendSerializedHtmlData, - GURL /* frame's url */, - std::string /* data buffer */, - int32 /* complete status */) - - IPC_SYNC_MESSAGE_ROUTED4_1(ViewHostMsg_ShowModalHTMLDialog, - GURL /* url */, - int /* width */, - int /* height */, - std::string /* json_arguments */, - std::string /* json_retval */) - - IPC_MESSAGE_ROUTED2(ViewHostMsg_DidGetApplicationInfo, - int32 /* page_id */, - WebApplicationInfo) - - // Sent by the renderer to implement chrome.app.installApplication(). - IPC_MESSAGE_ROUTED1(ViewHostMsg_InstallApplication, - WebApplicationInfo) - - // Provides the result from running OnMsgShouldClose. |proceed| matches the - // return value of the the frame's shouldClose method (which includes the - // onbeforeunload handler): true if the user decided to proceed with leaving - // the page. - IPC_MESSAGE_ROUTED1(ViewHostMsg_ShouldClose_ACK, - bool /* proceed */) - - // Indicates that the current page has been closed, after a ClosePage - // message. The parameters are just echoed from the ClosePage request. - IPC_MESSAGE_ROUTED1(ViewHostMsg_ClosePage_ACK, - ViewMsg_ClosePage_Params) - - IPC_MESSAGE_ROUTED4(ViewHostMsg_DidDownloadFavIcon, - int /* Identifier of the request */, - GURL /* URL of the image */, - bool /* true if there was a network error */, - SkBitmap /* image_data */) - - // Sent to query MIME information. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetMimeTypeFromExtension, - FilePath::StringType /* extension */, - std::string /* mime_type */) - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetMimeTypeFromFile, - FilePath /* file_path */, - std::string /* mime_type */) - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetPreferredExtensionForMimeType, - std::string /* mime_type */, - FilePath::StringType /* extension */) - - // Get the CPBrowsingContext associated with the renderer sending this - // message. - IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_GetCPBrowsingContext, - uint32 /* context */) - - // Sent when the renderer process is done processing a DataReceived - // message. - IPC_MESSAGE_ROUTED1(ViewHostMsg_DataReceived_ACK, - int /* request_id */) - - IPC_MESSAGE_CONTROL1(ViewHostMsg_RevealFolderInOS, - FilePath /* path */) - - // Sent when the renderer has processed a DataDownloaded message. - IPC_MESSAGE_ROUTED1(ViewHostMsg_DataDownloaded_ACK, - int /* request_id */) - - // Sent when the renderer process deletes a resource loader. - IPC_MESSAGE_CONTROL1(ViewHostMsg_ReleaseDownloadedFile, - int /* request_id */) - - // Sent when a provisional load on the main frame redirects. - IPC_MESSAGE_ROUTED3(ViewHostMsg_DidRedirectProvisionalLoad, - int /* page_id */, - GURL /* last url */, - GURL /* url redirected to */) - - // Sent by the renderer process to acknowledge receipt of a - // UploadProgress message. - IPC_MESSAGE_ROUTED1(ViewHostMsg_UploadProgress_ACK, - int /* request_id */) - - // Sent when the renderer changes the zoom level for a particular url, so the - // browser can update its records. If remember is true, then url is used to - // update the zoom level for all pages in that site. Otherwise, the render - // view's id is used so that only the menu is updated. - IPC_MESSAGE_ROUTED3(ViewHostMsg_DidZoomURL, - double /* zoom_level */, - bool /* remember */, - GURL /* url */) +// Sends back stats about the V8 heap. +IPC_MESSAGE_CONTROL2(ViewHostMsg_V8HeapStats, + int /* size of heap (allocated from the OS) */, + int /* bytes in use */) + +// Request for a DNS prefetch of the names in the array. +// NameList is typedef'ed std::vector<std::string> +IPC_MESSAGE_CONTROL1(ViewHostMsg_DnsPrefetch, + std::vector<std::string> /* hostnames */) + +// Notifies when default plugin updates status of the missing plugin. +IPC_MESSAGE_ROUTED1(ViewHostMsg_MissingPluginStatus, + int /* status */) + +// Sent by the renderer process to indicate that a plugin instance has +// crashed. +IPC_MESSAGE_ROUTED1(ViewHostMsg_CrashedPlugin, + FilePath /* plugin_path */) + +// Notifies when a plugin couldn't be loaded because it's outdated. +IPC_MESSAGE_ROUTED2(ViewHostMsg_BlockedOutdatedPlugin, + string16, /* name */ + GURL /* update_url */) + +// Displays a JavaScript out-of-memory message in the infobar. +IPC_MESSAGE_ROUTED0(ViewHostMsg_JSOutOfMemory) + +// Displays a box to confirm that the user wants to navigate away from the +// page. Replies true if yes, false otherwise, the reply string is ignored, +// but is included so that we can use OnJavaScriptMessageBoxClosed. +IPC_SYNC_MESSAGE_ROUTED2_2(ViewHostMsg_RunBeforeUnloadConfirm, + GURL, /* in - originating frame URL */ + std::wstring /* in - alert message */, + bool /* out - success */, + std::wstring /* out - This is ignored.*/) + +IPC_MESSAGE_ROUTED3(ViewHostMsg_SendCurrentPageAllSavableResourceLinks, + std::vector<GURL> /* all savable resource links */, + std::vector<GURL> /* all referrers of resource links */, + std::vector<GURL> /* all frame links */) + +IPC_MESSAGE_ROUTED3(ViewHostMsg_SendSerializedHtmlData, + GURL /* frame's url */, + std::string /* data buffer */, + int32 /* complete status */) + +IPC_SYNC_MESSAGE_ROUTED4_1(ViewHostMsg_ShowModalHTMLDialog, + GURL /* url */, + int /* width */, + int /* height */, + std::string /* json_arguments */, + std::string /* json_retval */) + +IPC_MESSAGE_ROUTED2(ViewHostMsg_DidGetApplicationInfo, + int32 /* page_id */, + WebApplicationInfo) + +// Sent by the renderer to implement chrome.app.installApplication(). +IPC_MESSAGE_ROUTED1(ViewHostMsg_InstallApplication, + WebApplicationInfo) + +// Provides the result from running OnMsgShouldClose. |proceed| matches the +// return value of the the frame's shouldClose method (which includes the +// onbeforeunload handler): true if the user decided to proceed with leaving +// the page. +IPC_MESSAGE_ROUTED1(ViewHostMsg_ShouldClose_ACK, + bool /* proceed */) + +// Indicates that the current page has been closed, after a ClosePage +// message. The parameters are just echoed from the ClosePage request. +IPC_MESSAGE_ROUTED1(ViewHostMsg_ClosePage_ACK, + ViewMsg_ClosePage_Params) + +IPC_MESSAGE_ROUTED4(ViewHostMsg_DidDownloadFavIcon, + int /* Identifier of the request */, + GURL /* URL of the image */, + bool /* true if there was a network error */, + SkBitmap /* image_data */) + +// Get the CPBrowsingContext associated with the renderer sending this +// message. +IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_GetCPBrowsingContext, + uint32 /* context */) + +// Sent when the renderer process is done processing a DataReceived +// message. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DataReceived_ACK, + int /* request_id */) + +IPC_MESSAGE_CONTROL1(ViewHostMsg_RevealFolderInOS, + FilePath /* path */) + +// Sent when the renderer has processed a DataDownloaded message. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DataDownloaded_ACK, + int /* request_id */) + +// Sent when the renderer process deletes a resource loader. +IPC_MESSAGE_CONTROL1(ViewHostMsg_ReleaseDownloadedFile, + int /* request_id */) + +// Sent when a provisional load on the main frame redirects. +IPC_MESSAGE_ROUTED3(ViewHostMsg_DidRedirectProvisionalLoad, + int /* page_id */, + GURL /* last url */, + GURL /* url redirected to */) + +// Sent by the renderer process to acknowledge receipt of a +// UploadProgress message. +IPC_MESSAGE_ROUTED1(ViewHostMsg_UploadProgress_ACK, + int /* request_id */) + +// Sent when the renderer changes the zoom level for a particular url, so the +// browser can update its records. If remember is true, then url is used to +// update the zoom level for all pages in that site. Otherwise, the render +// view's id is used so that only the menu is updated. +IPC_MESSAGE_ROUTED3(ViewHostMsg_DidZoomURL, + double /* zoom_level */, + bool /* remember */, + GURL /* url */) #if defined(OS_WIN) - // Duplicates a shared memory handle from the renderer to the browser. Then - // the renderer can flush the handle. - IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_DuplicateSection, - base::SharedMemoryHandle /* renderer handle */, - base::SharedMemoryHandle /* browser handle */) +// Duplicates a shared memory handle from the renderer to the browser. Then +// the renderer can flush the handle. +IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_DuplicateSection, + base::SharedMemoryHandle /* renderer handle */, + base::SharedMemoryHandle /* browser handle */) #endif #if defined(USE_X11) - // Asks the browser to create a temporary file for the renderer to fill - // in resulting NativeMetafile in printing. - IPC_SYNC_MESSAGE_CONTROL0_2(ViewHostMsg_AllocateTempFileForPrinting, - base::FileDescriptor /* temp file fd */, - int /* fd in browser*/) - IPC_MESSAGE_CONTROL1(ViewHostMsg_TempFileForPrintingWritten, - int /* fd in browser */) -#endif - -#if defined(OS_MACOSX) - // Asks the browser to create a block of shared memory for the renderer to - // pass NativeMetafile data to the browser. - IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_AllocatePDFTransport, - uint32 /* buffer size */, - base::SharedMemoryHandle /* browser handle */) +// Asks the browser to create a temporary file for the renderer to fill +// in resulting NativeMetafile in printing. +IPC_SYNC_MESSAGE_CONTROL0_2(ViewHostMsg_AllocateTempFileForPrinting, + base::FileDescriptor /* temp file fd */, + int /* fd in browser*/) +IPC_MESSAGE_CONTROL1(ViewHostMsg_TempFileForPrintingWritten, + int /* fd in browser */) #endif #if defined(OS_POSIX) - // Asks the browser to create a block of shared memory for the renderer to - // fill in and pass back to the browser. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_AllocateSharedMemoryBuffer, - uint32 /* buffer size */, - base::SharedMemoryHandle /* browser handle */) +// Asks the browser to create a block of shared memory for the renderer to +// fill in and pass back to the browser. +IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_AllocateSharedMemoryBuffer, + uint32 /* buffer size */, + base::SharedMemoryHandle /* browser handle */) #endif - // Provide the browser process with information about the WebCore resource - // cache. - IPC_MESSAGE_CONTROL1(ViewHostMsg_ResourceTypeStats, - WebKit::WebCache::ResourceTypeStats) - - // Notify the browser that this render process can or can't be suddenly - // terminated. - IPC_MESSAGE_CONTROL1(ViewHostMsg_SuddenTerminationChanged, - bool /* enabled */) - - // Returns the window location of the window this widget is embeded. - // TODO(shess): Provide a mapping from reply_msg->routing_id() to - // HWND so that we can eliminate the NativeViewId parameter. - IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetRootWindowRect, - gfx::NativeViewId /* window */, - gfx::Rect /* Out: Window location */) - - // Informs the browser of a new appcache host. - IPC_MESSAGE_CONTROL1(AppCacheMsg_RegisterHost, - int /* host_id */) - - // Informs the browser of an appcache host being destroyed. - IPC_MESSAGE_CONTROL1(AppCacheMsg_UnregisterHost, - int /* host_id */) - - // Initiates the cache selection algorithm for the given host. - // This is sent prior to any subresource loads. An AppCacheMsg_CacheSelected - // message will be sent in response. - // 'host_id' indentifies a specific document or worker - // 'document_url' the url of the main resource - // 'appcache_document_was_loaded_from' the id of the appcache the main - // resource was loaded from or kNoCacheId - // 'opt_manifest_url' the manifest url specified in the <html> tag if any - IPC_MESSAGE_CONTROL4(AppCacheMsg_SelectCache, - int /* host_id */, - GURL /* document_url */, - int64 /* appcache_document_was_loaded_from */, - GURL /* opt_manifest_url */) - - // Initiates worker specific cache selection algorithm for the given host. - IPC_MESSAGE_CONTROL3(AppCacheMsg_SelectCacheForWorker, - int /* host_id */, - int /* parent_process_id */, - int /* parent_host_id */) - IPC_MESSAGE_CONTROL2(AppCacheMsg_SelectCacheForSharedWorker, - int /* host_id */, - int64 /* appcache_id */) - - // Informs the browser of a 'foreign' entry in an appcache. - IPC_MESSAGE_CONTROL3(AppCacheMsg_MarkAsForeignEntry, - int /* host_id */, - GURL /* document_url */, - int64 /* appcache_document_was_loaded_from */) - - // Returns the status of the appcache associated with host_id. - IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheMsg_GetStatus, - int /* host_id */, - appcache::Status) - - // Initiates an update of the appcache associated with host_id. - IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheMsg_StartUpdate, - int /* host_id */, - bool /* success */) - - // Swaps a new pending appcache, if there is one, into use for host_id. - IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheMsg_SwapCache, - int /* host_id */, - bool /* success */) - - // Gets resource list from appcache synchronously. - IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheMsg_GetResourceList, - int /* host_id in*/, - std::vector<appcache::AppCacheResourceInfo> - /* resources out */) - - // Queries the browser for AutoFill suggestions for a form input field. - IPC_MESSAGE_ROUTED3(ViewHostMsg_QueryFormFieldAutoFill, - int /* id of this message */, - webkit_glue::FormData /* the form */, - webkit_glue::FormField /* the form field */) - - // Sent when the popup with AutoFill suggestions for a form is shown. - IPC_MESSAGE_ROUTED0(ViewHostMsg_DidShowAutoFillSuggestions) - - // Instructs the browser to fill in the values for a form using AutoFill - // profile data. - IPC_MESSAGE_ROUTED4(ViewHostMsg_FillAutoFillFormData, - int /* id of this message */, - webkit_glue::FormData /* the form */, - webkit_glue::FormField /* the form field */, - int /* profile unique ID */) - - // Sent when a form is previewed or filled with AutoFill suggestions. - IPC_MESSAGE_ROUTED0(ViewHostMsg_DidFillAutoFillFormData) - - // Instructs the browser to remove the specified Autocomplete entry from the - // database. - IPC_MESSAGE_ROUTED2(ViewHostMsg_RemoveAutocompleteEntry, - string16 /* field name */, - string16 /* value */) - - // Instructs the browser to show the AutoFill dialog. - IPC_MESSAGE_ROUTED0(ViewHostMsg_ShowAutoFillDialog) - - // Get the list of proxies to use for |url|, as a semicolon delimited list - // of "<TYPE> <HOST>:<PORT>" | "DIRECT". See also - // PluginProcessHostMsg_ResolveProxy which does the same thing. - IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ResolveProxy, - GURL /* url */, - int /* network error */, - std::string /* proxy list */) - - // Request that got sent to browser for creating an audio output stream - IPC_MESSAGE_ROUTED3(ViewHostMsg_CreateAudioStream, - int /* stream_id */, - ViewHostMsg_Audio_CreateStream_Params, - bool /* low-latency */) - - // Tell the browser the audio buffer prepared for stream - // (render_view_id, stream_id) is filled and is ready to be consumed. - IPC_MESSAGE_ROUTED2(ViewHostMsg_NotifyAudioPacketReady, - int /* stream_id */, - uint32 /* packet size */) - - // Start buffering and play the audio stream specified by - // (render_view_id, stream_id). - IPC_MESSAGE_ROUTED1(ViewHostMsg_PlayAudioStream, - int /* stream_id */) - - // Pause the audio stream specified by (render_view_id, stream_id). - IPC_MESSAGE_ROUTED1(ViewHostMsg_PauseAudioStream, - int /* stream_id */) - - // Discard all buffered audio data for the specified audio stream. - IPC_MESSAGE_ROUTED1(ViewHostMsg_FlushAudioStream, - int /* stream_id */) - - // Close an audio stream specified by (render_view_id, stream_id). - IPC_MESSAGE_ROUTED1(ViewHostMsg_CloseAudioStream, - int /* stream_id */) - - // Get audio volume of the stream specified by (render_view_id, stream_id). - IPC_MESSAGE_ROUTED1(ViewHostMsg_GetAudioVolume, - int /* stream_id */) - - // Set audio volume of the stream specified by (render_view_id, stream_id). - // TODO(hclam): change this to vector if we have channel numbers other than 2. - IPC_MESSAGE_ROUTED2(ViewHostMsg_SetAudioVolume, - int /* stream_id */, - double /* volume */) - - // A renderer sends this message when an extension process starts an API - // request. The browser will always respond with a ViewMsg_ExtensionResponse. - IPC_MESSAGE_ROUTED1(ViewHostMsg_ExtensionRequest, - ViewHostMsg_DomMessage_Params) - - // Notify the browser that the given extension added a listener to an event. - IPC_MESSAGE_CONTROL2(ViewHostMsg_ExtensionAddListener, - std::string /* extension_id */, - std::string /* name */) - - // Notify the browser that the given extension removed a listener from an - // event. - IPC_MESSAGE_CONTROL2(ViewHostMsg_ExtensionRemoveListener, - std::string /* extension_id */, - std::string /* name */) +// Provide the browser process with information about the WebCore resource +// cache. +IPC_MESSAGE_CONTROL1(ViewHostMsg_ResourceTypeStats, + WebKit::WebCache::ResourceTypeStats) + +// Notify the browser that this render process can or can't be suddenly +// terminated. +IPC_MESSAGE_CONTROL1(ViewHostMsg_SuddenTerminationChanged, + bool /* enabled */) + +// Returns the window location of the window this widget is embeded. +// TODO(shess): Provide a mapping from reply_msg->routing_id() to +// HWND so that we can eliminate the NativeViewId parameter. +IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetRootWindowRect, + gfx::NativeViewId /* window */, + gfx::Rect /* Out: Window location */) + +// Informs the browser of a new appcache host. +IPC_MESSAGE_CONTROL1(AppCacheMsg_RegisterHost, + int /* host_id */) + +// Informs the browser of an appcache host being destroyed. +IPC_MESSAGE_CONTROL1(AppCacheMsg_UnregisterHost, + int /* host_id */) + +// Initiates the cache selection algorithm for the given host. +// This is sent prior to any subresource loads. An AppCacheMsg_CacheSelected +// message will be sent in response. +// 'host_id' indentifies a specific document or worker +// 'document_url' the url of the main resource +// 'appcache_document_was_loaded_from' the id of the appcache the main +// resource was loaded from or kNoCacheId +// 'opt_manifest_url' the manifest url specified in the <html> tag if any +IPC_MESSAGE_CONTROL4(AppCacheMsg_SelectCache, + int /* host_id */, + GURL /* document_url */, + int64 /* appcache_document_was_loaded_from */, + GURL /* opt_manifest_url */) + +// Initiates worker specific cache selection algorithm for the given host. +IPC_MESSAGE_CONTROL3(AppCacheMsg_SelectCacheForWorker, + int /* host_id */, + int /* parent_process_id */, + int /* parent_host_id */) +IPC_MESSAGE_CONTROL2(AppCacheMsg_SelectCacheForSharedWorker, + int /* host_id */, + int64 /* appcache_id */) + +// Informs the browser of a 'foreign' entry in an appcache. +IPC_MESSAGE_CONTROL3(AppCacheMsg_MarkAsForeignEntry, + int /* host_id */, + GURL /* document_url */, + int64 /* appcache_document_was_loaded_from */) + +// Returns the status of the appcache associated with host_id. +IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheMsg_GetStatus, + int /* host_id */, + appcache::Status) + +// Initiates an update of the appcache associated with host_id. +IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheMsg_StartUpdate, + int /* host_id */, + bool /* success */) + +// Swaps a new pending appcache, if there is one, into use for host_id. +IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheMsg_SwapCache, + int /* host_id */, + bool /* success */) + +// Gets resource list from appcache synchronously. +IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheMsg_GetResourceList, + int /* host_id in*/, + std::vector<appcache::AppCacheResourceInfo> + /* resources out */) + +// Queries the browser for AutoFill suggestions for a form input field. +IPC_MESSAGE_ROUTED3(ViewHostMsg_QueryFormFieldAutoFill, + int /* id of this message */, + webkit_glue::FormData /* the form */, + webkit_glue::FormField /* the form field */) + +// Sent when the popup with AutoFill suggestions for a form is shown. +IPC_MESSAGE_ROUTED0(ViewHostMsg_DidShowAutoFillSuggestions) + +// Instructs the browser to fill in the values for a form using AutoFill +// profile data. +IPC_MESSAGE_ROUTED4(ViewHostMsg_FillAutoFillFormData, + int /* id of this message */, + webkit_glue::FormData /* the form */, + webkit_glue::FormField /* the form field */, + int /* profile unique ID */) + +// Sent when a form is previewed or filled with AutoFill suggestions. +IPC_MESSAGE_ROUTED0(ViewHostMsg_DidFillAutoFillFormData) + +// Instructs the browser to remove the specified Autocomplete entry from the +// database. +IPC_MESSAGE_ROUTED2(ViewHostMsg_RemoveAutocompleteEntry, + string16 /* field name */, + string16 /* value */) + +// Instructs the browser to show the AutoFill dialog. +IPC_MESSAGE_ROUTED0(ViewHostMsg_ShowAutoFillDialog) + +// Get the list of proxies to use for |url|, as a semicolon delimited list +// of "<TYPE> <HOST>:<PORT>" | "DIRECT". See also +// PluginProcessHostMsg_ResolveProxy which does the same thing. +IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ResolveProxy, + GURL /* url */, + int /* network error */, + std::string /* proxy list */) + +// Request that got sent to browser for creating an audio output stream +IPC_MESSAGE_ROUTED3(ViewHostMsg_CreateAudioStream, + int /* stream_id */, + ViewHostMsg_Audio_CreateStream_Params, + bool /* low-latency */) + +// Tell the browser the audio buffer prepared for stream +// (render_view_id, stream_id) is filled and is ready to be consumed. +IPC_MESSAGE_ROUTED2(ViewHostMsg_NotifyAudioPacketReady, + int /* stream_id */, + uint32 /* packet size */) + +// Start buffering and play the audio stream specified by +// (render_view_id, stream_id). +IPC_MESSAGE_ROUTED1(ViewHostMsg_PlayAudioStream, + int /* stream_id */) + +// Pause the audio stream specified by (render_view_id, stream_id). +IPC_MESSAGE_ROUTED1(ViewHostMsg_PauseAudioStream, + int /* stream_id */) + +// Discard all buffered audio data for the specified audio stream. +IPC_MESSAGE_ROUTED1(ViewHostMsg_FlushAudioStream, + int /* stream_id */) + +// Close an audio stream specified by (render_view_id, stream_id). +IPC_MESSAGE_ROUTED1(ViewHostMsg_CloseAudioStream, + int /* stream_id */) + +// Get audio volume of the stream specified by (render_view_id, stream_id). +IPC_MESSAGE_ROUTED1(ViewHostMsg_GetAudioVolume, + int /* stream_id */) + +// Set audio volume of the stream specified by (render_view_id, stream_id). +// TODO(hclam): change this to vector if we have channel numbers other than 2. +IPC_MESSAGE_ROUTED2(ViewHostMsg_SetAudioVolume, + int /* stream_id */, + double /* volume */) + +// A renderer sends this message when an extension process starts an API +// request. The browser will always respond with a ViewMsg_ExtensionResponse. +IPC_MESSAGE_ROUTED1(ViewHostMsg_ExtensionRequest, + ViewHostMsg_DomMessage_Params) + +// Notify the browser that the given extension added a listener to an event. +IPC_MESSAGE_CONTROL2(ViewHostMsg_ExtensionAddListener, + std::string /* extension_id */, + std::string /* name */) + +// Notify the browser that the given extension removed a listener from an +// event. +IPC_MESSAGE_CONTROL2(ViewHostMsg_ExtensionRemoveListener, + std::string /* extension_id */, + std::string /* name */) #if defined(OS_MACOSX) - // On OSX, we cannot allocated shared memory from within the sandbox, so - // this call exists for the renderer to ask the browser to allocate memory - // on its behalf. We return a file descriptor to the POSIX shared memory. - // If the |cache_in_browser| flag is |true|, then a copy of the shmem is kept - // by the browser, and it is the caller's repsonsibility to send a - // ViewHostMsg_FreeTransportDIB message in order to release the cached shmem. - // In all cases, the caller is responsible for deleting the resulting - // TransportDIB. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_AllocTransportDIB, - size_t, /* bytes requested */ - bool, /* cache in the browser */ - TransportDIB::Handle /* DIB */) - - // Since the browser keeps handles to the allocated transport DIBs, this - // message is sent to tell the browser that it may release them when the - // renderer is finished with them. - IPC_MESSAGE_CONTROL1(ViewHostMsg_FreeTransportDIB, - TransportDIB::Id /* DIB id */) - - // Instructs the browser to start or stop plugin IME. - IPC_MESSAGE_ROUTED2(ViewHostMsg_SetPluginImeEnabled, - bool, /* enabled */ - int /* plugin_id */) - - //--------------------------------------------------------------------------- - // Messages related to accelerated plugins - - // This is sent from the renderer to the browser to allocate a fake - // PluginWindowHandle on the browser side which is used to identify - // the plugin to the browser later when backing store is allocated - // or reallocated. |opaque| indicates whether the plugin's output is - // considered to be opaque, as opposed to translucent. This message - // is reused for rendering the accelerated compositor's output. - // |root| indicates whether the output is supposed to cover the - // entire window. - IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_AllocateFakePluginWindowHandle, - bool /* opaque */, - bool /* root */, - gfx::PluginWindowHandle /* id */) - - // Destroys a fake window handle previously allocated using - // AllocateFakePluginWindowHandle. - IPC_MESSAGE_ROUTED1(ViewHostMsg_DestroyFakePluginWindowHandle, - gfx::PluginWindowHandle /* id */) - - // This message, used on Mac OS X 10.5 and earlier (no IOSurface support), - // is sent from the renderer to the browser on behalf of the plug-in - // to indicate that a new backing store was allocated for that plug-in - // instance. - IPC_MESSAGE_ROUTED4(ViewHostMsg_AcceleratedSurfaceSetTransportDIB, - gfx::PluginWindowHandle /* window */, - int32 /* width */, - int32 /* height */, - TransportDIB::Handle /* handle for the DIB */) - - // This message, used on Mac OS X 10.6 and later (where IOSurface is - // supported), is sent from the renderer to the browser on behalf of the - // plug-in to indicate that a new backing store was allocated for that - // plug-in instance. - // - // NOTE: the original intent was to pass a mach port as the IOSurface - // identifier but it looks like that will be a lot of work. For now we pass an - // ID from IOSurfaceGetID. - IPC_MESSAGE_ROUTED4(ViewHostMsg_AcceleratedSurfaceSetIOSurface, - gfx::PluginWindowHandle /* window */, - int32 /* width */, - int32 /* height */, - uint64 /* surface_id */) - - // This message notifies the browser process that the plug-in - // swapped the buffers associated with the given "window", which - // should cause the browser to redraw the various plug-ins' - // contents. - IPC_MESSAGE_ROUTED2(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, - gfx::PluginWindowHandle /* window */, - uint64 /* surface_id */) +// On OSX, we cannot allocated shared memory from within the sandbox, so +// this call exists for the renderer to ask the browser to allocate memory +// on its behalf. We return a file descriptor to the POSIX shared memory. +// If the |cache_in_browser| flag is |true|, then a copy of the shmem is kept +// by the browser, and it is the caller's repsonsibility to send a +// ViewHostMsg_FreeTransportDIB message in order to release the cached shmem. +// In all cases, the caller is responsible for deleting the resulting +// TransportDIB. +IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_AllocTransportDIB, + size_t, /* bytes requested */ + bool, /* cache in the browser */ + TransportDIB::Handle /* DIB */) + +// Since the browser keeps handles to the allocated transport DIBs, this +// message is sent to tell the browser that it may release them when the +// renderer is finished with them. +IPC_MESSAGE_CONTROL1(ViewHostMsg_FreeTransportDIB, + TransportDIB::Id /* DIB id */) + +// Instructs the browser to start or stop plugin IME. +IPC_MESSAGE_ROUTED2(ViewHostMsg_SetPluginImeEnabled, + bool, /* enabled */ + int /* plugin_id */) + +//--------------------------------------------------------------------------- +// Messages related to accelerated plugins + +// This is sent from the renderer to the browser to allocate a fake +// PluginWindowHandle on the browser side which is used to identify +// the plugin to the browser later when backing store is allocated +// or reallocated. |opaque| indicates whether the plugin's output is +// considered to be opaque, as opposed to translucent. This message +// is reused for rendering the accelerated compositor's output. +// |root| indicates whether the output is supposed to cover the +// entire window. +IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_AllocateFakePluginWindowHandle, + bool /* opaque */, + bool /* root */, + gfx::PluginWindowHandle /* id */) + +// Destroys a fake window handle previously allocated using +// AllocateFakePluginWindowHandle. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DestroyFakePluginWindowHandle, + gfx::PluginWindowHandle /* id */) + +// This message, used on Mac OS X 10.5 and earlier (no IOSurface support), +// is sent from the renderer to the browser on behalf of the plug-in +// to indicate that a new backing store was allocated for that plug-in +// instance. +IPC_MESSAGE_ROUTED4(ViewHostMsg_AcceleratedSurfaceSetTransportDIB, + gfx::PluginWindowHandle /* window */, + int32 /* width */, + int32 /* height */, + TransportDIB::Handle /* handle for the DIB */) + +// This message, used on Mac OS X 10.6 and later (where IOSurface is +// supported), is sent from the renderer to the browser on behalf of the +// plug-in to indicate that a new backing store was allocated for that +// plug-in instance. +// +// NOTE: the original intent was to pass a mach port as the IOSurface +// identifier but it looks like that will be a lot of work. For now we pass an +// ID from IOSurfaceGetID. +IPC_MESSAGE_ROUTED4(ViewHostMsg_AcceleratedSurfaceSetIOSurface, + gfx::PluginWindowHandle /* window */, + int32 /* width */, + int32 /* height */, + uint64 /* surface_id */) + +// This message notifies the browser process that the plug-in +// swapped the buffers associated with the given "window", which +// should cause the browser to redraw the various plug-ins' +// contents. +IPC_MESSAGE_ROUTED2(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, + gfx::PluginWindowHandle /* window */, + uint64 /* surface_id */) #endif - // A renderer sends this to the browser process when it wants to create a - // worker. The browser will create the worker process if necessary, and - // will return the route id on success. On error returns MSG_ROUTING_NONE. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_CreateWorker, - ViewHostMsg_CreateWorker_Params, - int /* route_id */) - - // This message is sent to the browser to see if an instance of this shared - // worker already exists. If so, it returns exists == true. If a - // non-empty name is passed, also validates that the url matches the url of - // the existing worker. If a matching worker is found, the passed-in - // document_id is associated with that worker, to ensure that the worker - // stays alive until the document is detached. - // The route_id returned can be used to forward messages to the worker via - // ForwardToWorker if it exists, otherwise it should be passed in to any - // future call to CreateWorker to avoid creating duplicate workers. - IPC_SYNC_MESSAGE_CONTROL1_3(ViewHostMsg_LookupSharedWorker, - ViewHostMsg_CreateWorker_Params, - bool /* exists */, - int /* route_id */, - bool /* url_mismatch */) - - // A renderer sends this to the browser process when a document has been - // detached. The browser will use this to constrain the lifecycle of worker - // processes (SharedWorkers are shut down when their last associated document - // is detached). - IPC_MESSAGE_CONTROL1(ViewHostMsg_DocumentDetached, - uint64 /* document_id */) - - // A message sent to the browser on behalf of a renderer which wants to show - // a desktop notification. - IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowDesktopNotification, - ViewHostMsg_ShowNotification_Params) - IPC_MESSAGE_ROUTED1(ViewHostMsg_CancelDesktopNotification, - int /* notification_id */ ) - IPC_MESSAGE_ROUTED2(ViewHostMsg_RequestNotificationPermission, - GURL /* origin */, - int /* callback_context */) - IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_CheckNotificationPermission, - GURL /* source page */, - int /* permission_result */) - - // Sent if the worker object has sent a ViewHostMsg_CreateDedicatedWorker - // message and not received a ViewMsg_WorkerCreated reply, but in the - // mean time it's destroyed. This tells the browser to not create the queued - // worker. - IPC_MESSAGE_CONTROL1(ViewHostMsg_CancelCreateDedicatedWorker, - int /* route_id */) - - // Wraps an IPC message that's destined to the worker on the renderer->browser - // hop. - IPC_MESSAGE_CONTROL1(ViewHostMsg_ForwardToWorker, - IPC::Message /* message */) - - // Open a channel to all listening contexts owned by the extension with - // the given ID. This always returns a valid port ID which can be used for - // sending messages. If an error occurred, the opener will be notified - // asynchronously. - IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_OpenChannelToExtension, - int /* routing_id */, - std::string /* source_extension_id */, - std::string /* target_extension_id */, - std::string /* channel_name */, - int /* port_id */) - - // Get a port handle to the given tab. The handle can be used for sending - // messages to the extension. - IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_OpenChannelToTab, - int /* routing_id */, - int /* tab_id */, - std::string /* extension_id */, - std::string /* channel_name */, - int /* port_id */) - - // Send a message to an extension process. The handle is the value returned - // by ViewHostMsg_OpenChannelTo*. - IPC_MESSAGE_ROUTED2(ViewHostMsg_ExtensionPostMessage, - int /* port_id */, - std::string /* message */) - - // Send a message to an extension process. The handle is the value returned - // by ViewHostMsg_OpenChannelTo*. - IPC_MESSAGE_CONTROL1(ViewHostMsg_ExtensionCloseChannel, - int /* port_id */) - - // Sent to notify the browser about renderer accessibility notifications. - // The browser responds with a ViewMsg_AccessibilityNotifications_ACK. - IPC_MESSAGE_ROUTED1( - ViewHostMsg_AccessibilityNotifications, - std::vector<ViewHostMsg_AccessibilityNotification_Params>) - - // Message sent from the renderer to the browser to request that the browser - // close all sockets. Used for debugging/testing. - IPC_MESSAGE_CONTROL0(ViewHostMsg_CloseCurrentConnections) - - // Message sent from the renderer to the browser to request that the browser - // enable or disable the cache. Used for debugging/testing. - IPC_MESSAGE_CONTROL1(ViewHostMsg_SetCacheMode, - bool /* enabled */) - - // Message sent from the renderer to the browser to request that the browser - // clear the cache. Used for debugging/testing. - IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_ClearCache, - int /* result */) - - // Message sent from the renderer to the browser to request that the browser - // enable or disable spdy. Used for debugging/testing/benchmarking. - IPC_MESSAGE_CONTROL1(ViewHostMsg_EnableSpdy, - bool /* enable */) - - // Message sent from the renderer to the browser to request that the browser - // cache |data| associated with |url|. - IPC_MESSAGE_CONTROL3(ViewHostMsg_DidGenerateCacheableMetadata, - GURL /* url */, - double /* expected_response_time */, - std::vector<char> /* data */) - - // Get the storage area id for a particular origin within a namespace. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DOMStorageStorageAreaId, - int64 /* namespace_id */, - string16 /* origin */, - int64 /* storage_area_id */) - - // Get the length of a storage area. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_DOMStorageLength, - int64 /* storage_area_id */, - unsigned /* length */) - - // Get a the ith key within a storage area. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DOMStorageKey, - int64 /* storage_area_id */, - unsigned /* index */, - NullableString16 /* key */) - - // Get a value based on a key from a storage area. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DOMStorageGetItem, - int64 /* storage_area_id */, - string16 /* key */, - NullableString16 /* value */) - - // Set a value that's associated with a key in a storage area. - IPC_SYNC_MESSAGE_ROUTED4_2(ViewHostMsg_DOMStorageSetItem, - 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(ViewHostMsg_DOMStorageRemoveItem, - int64 /* storage_area_id */, - string16 /* key */, - GURL /* url */, - NullableString16 /* old_value */) - - // Clear the storage area. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DOMStorageClear, - int64 /* storage_area_id */, - GURL /* url */, - bool /* something_cleared */) - - // WebIDBCursor::direction() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBCursorDirection, - int32, /* idb_cursor_id */ - int32 /* direction */) - - // WebIDBCursor::key() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBCursorKey, - int32, /* idb_cursor_id */ - IndexedDBKey) - - // WebIDBCursor::value() message. - IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_IDBCursorValue, - int32, /* idb_cursor_id */ - SerializedScriptValue, /* script_value */ - IndexedDBKey /* key */) - - // WebIDBCursor::update() message. - IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBCursorUpdate, - int32, /* idb_cursor_id */ - int32, /* response_id */ - SerializedScriptValue, /* value */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBCursor::continue() message. - IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBCursorContinue, - int32, /* idb_cursor_id */ - int32, /* response_id */ - IndexedDBKey, /* key */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBCursor::remove() message. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_IDBCursorRemove, - int32, /* idb_cursor_id */ - int32, /* response_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBFactory::open() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBFactoryOpen, - ViewHostMsg_IDBFactoryOpen_Params) - - // WebIDBDatabase::name() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBDatabaseName, - int32, /* idb_database_id */ - string16 /* name */) - - // WebIDBDatabase::version() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBDatabaseVersion, - int32, /* idb_database_id */ - string16 /* vesion */) - - // WebIDBDatabase::objectStoreNames() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBDatabaseObjectStoreNames, - int32, /* idb_database_id */ - std::vector<string16> /* objectStoreNames */) - - // WebIDBDatabase::createObjectStore() message. - IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_IDBDatabaseCreateObjectStore, - ViewHostMsg_IDBDatabaseCreateObjectStore_Params, - int32, /* object_store_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBDatabase::removeObjectStore() message. - IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBDatabaseRemoveObjectStore, - int32, /* idb_database_id */ - string16, /* name */ - int32, /* transaction_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBDatabase::setVersion() message. - IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBDatabaseSetVersion, - 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(ViewHostMsg_IDBDatabaseTransaction, - int32, /* idb_database_id */ - std::vector<string16>, /* object_stores */ - int32, /* mode */ - int32, /* timeout */ - int32, /* idb_transaction_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBDatabase::~WebIDBDatabase() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBDatabaseDestroyed, - int32 /* idb_database_id */) - - // WebIDBIndex::name() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexName, - int32, /* idb_index_id */ - string16 /* name */) - - // WebIDBIndex::storeName() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexStoreName, - int32, /* idb_index_id */ - string16 /* store_name */) - - // WebIDBIndex::keyPath() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexKeyPath, - int32, /* idb_index_id */ - NullableString16 /* key_path */) - - // WebIDBIndex::unique() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexUnique, - int32, /* idb_unique_id */ - bool /* unique */) - - // WebIDBIndex::openObjectCursor() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexOpenObjectCursor, - ViewHostMsg_IDBIndexOpenCursor_Params, - WebKit::WebExceptionCode /* ec */) - - // WebIDBIndex::openKeyCursor() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBIndexOpenKeyCursor, - ViewHostMsg_IDBIndexOpenCursor_Params, - WebKit::WebExceptionCode /* ec */) - - // WebIDBIndex::getObject() message. - IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_IDBIndexGetObject, - int32, /* idb_index_id */ - int32, /* response_id */ - IndexedDBKey, /* key */ - int32, /* transaction_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBIndex::getKey() message. - IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_IDBIndexGetKey, - int32, /* idb_index_id */ - int32, /* response_id */ - IndexedDBKey, /* key */ - int32, /* transaction_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBIndex::~WebIDBIndex() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBIndexDestroyed, - int32 /* idb_index_id */) - - // WebIDBObjectStore::name() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStoreName, - int32, /* idb_object_store_id */ - string16 /* name */) - - // WebIDBObjectStore::keyPath() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStoreKeyPath, - int32, /* idb_object_store_id */ - NullableString16 /* keyPath */) - - // WebIDBObjectStore::indexNames() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStoreIndexNames, - int32, /* idb_object_store_id */ - std::vector<string16> /* index_names */) - - // WebIDBObjectStore::get() message. - IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_IDBObjectStoreGet, - int32, /* idb_object_store_id */ - int32, /* response_id */ - IndexedDBKey, /* key */ - int32, /* transaction_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBObjectStore::put() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStorePut, - ViewHostMsg_IDBObjectStorePut_Params, - WebKit::WebExceptionCode /* ec */) - - // WebIDBObjectStore::remove() message. - IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_IDBObjectStoreRemove, - int32, /* idb_object_store_id */ - int32, /* response_id */ - IndexedDBKey, /* key */ - int32, /* transaction_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBObjectStore::createIndex() message. - IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_IDBObjectStoreCreateIndex, - ViewHostMsg_IDBObjectStoreCreateIndex_Params, - int32, /* index_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBObjectStore::index() message. - IPC_SYNC_MESSAGE_CONTROL2_2(ViewHostMsg_IDBObjectStoreIndex, - int32, /* idb_object_store_id */ - string16, /* name */ - int32, /* idb_index_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBObjectStore::removeIndex() message. - IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_IDBObjectStoreRemoveIndex, - int32, /* idb_object_store_id */ - string16, /* name */ - int32, /* transaction_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBObjectStore::openCursor() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBObjectStoreOpenCursor, - ViewHostMsg_IDBObjectStoreOpenCursor_Params, - WebKit::WebExceptionCode /* ec */) - - // WebIDBObjectStore::~WebIDBObjectStore() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBObjectStoreDestroyed, - int32 /* idb_object_store_id */) - - // WebIDBDatabase::~WebIDBCursor() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBCursorDestroyed, - int32 /* idb_cursor_id */) - - // IDBTransaction::ObjectStore message. - IPC_SYNC_MESSAGE_CONTROL2_2(ViewHostMsg_IDBTransactionObjectStore, - int32, /* transaction_id */ - string16, /* name */ - int32, /* object_store_id */ - WebKit::WebExceptionCode /* ec */) - - // WebIDBTransaction::mode() message. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBTransactionMode, - int32, /* idb_transaction_id */ - int /* mode */) - - // WebIDBTransaction::abort() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBTransactionAbort, - int32 /* idb_transaction_id */) - - // IDBTransaction::DidCompleteTaskEvents() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBTransactionDidCompleteTaskEvents, - int32 /* idb_transaction_id */) - - // WebIDBTransaction::~WebIDBTransaction() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBTransactionDestroyed, - int32 /* idb_transaction_id */) - - // Get file size in bytes. Set result to -1 if failed to get the file size. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetFileSize, - FilePath /* path */, - int64 /* result */) - - // Get file modification time in seconds. Set result to 0 if failed to get the - // file modification time. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetFileModificationTime, - FilePath /* path */, - base::Time /* result */) - - // Open the file. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_OpenFile, - FilePath /* path */, - int /* mode */, - IPC::PlatformFileForTransit /* result */) - - // Opens a file asynchronously. The response returns a file descriptor - // and an error code from base/platform_file.h. - IPC_MESSAGE_ROUTED3(ViewHostMsg_AsyncOpenFile, - FilePath /* file path */, - int /* flags */, - int /* message_id */) - - // Sent by the renderer process to acknowledge receipt of a - // ViewMsg_CSSInsertRequest message and css has been inserted into the frame. - IPC_MESSAGE_ROUTED0(ViewHostMsg_OnCSSInserted) - - // Sent by the renderer process to check whether access to web databases is - // granted by content settings. This may block and trigger a cookie prompt. - IPC_SYNC_MESSAGE_ROUTED4_1(ViewHostMsg_AllowDatabase, - std::string /* origin_url */, - string16 /* database name */, - string16 /* database display name */, - unsigned long /* estimated size */, - bool /* result */) - - // Asks the browser process to open a DB file with the given name. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DatabaseOpenFile, - string16 /* vfs file name */, - int /* desired flags */, - IPC::PlatformFileForTransit /* file_handle */) - - // Asks the browser process to delete a DB file - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_DatabaseDeleteFile, - string16 /* vfs file name */, - bool /* whether or not to sync the directory */, - int /* SQLite error code */) - - // Asks the browser process to return the attributes of a DB file - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_DatabaseGetFileAttributes, - string16 /* vfs file name */, - int32 /* the attributes for the given DB file */) - - // Asks the browser process to return the size of a DB file - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_DatabaseGetFileSize, - string16 /* vfs file name */, - int64 /* the size of the given DB file */) - - // Notifies the browser process that a new database has been opened - IPC_MESSAGE_CONTROL4(ViewHostMsg_DatabaseOpened, - string16 /* origin identifier */, - string16 /* database name */, - string16 /* database description */, - int64 /* estimated size */) - - // Notifies the browser process that a database might have been modified - IPC_MESSAGE_CONTROL2(ViewHostMsg_DatabaseModified, - string16 /* origin identifier */, - string16 /* database name */) - - // Notifies the browser process that a database is about to close - IPC_MESSAGE_CONTROL2(ViewHostMsg_DatabaseClosed, - string16 /* origin identifier */, - string16 /* database name */) - - // Notifies the browser of the language (ISO 639_1 code language, such as fr, - // en, zh...) of the current page. - IPC_MESSAGE_ROUTED1(ViewHostMsg_PageLanguageDetermined, - std::string /* the language */) - - // Notifies the browser that a page has been translated. - IPC_MESSAGE_ROUTED4(ViewHostMsg_PageTranslated, - int, /* page id */ - std::string /* the original language */, - std::string /* the translated language */, - TranslateErrors::Type /* the error type if available */) - - //--------------------------------------------------------------------------- - // Socket Stream messages: - // These are messages from the SocketStreamHandle to the browser. - - // Open new Socket Stream for the |socket_url| identified by |socket_id| - // in the renderer process. - // The browser starts connecting asynchronously. - // Once Socket Stream connection is established, the browser will send - // ViewMsg_SocketStream_Connected back. - IPC_MESSAGE_CONTROL2(ViewHostMsg_SocketStream_Connect, - GURL /* socket_url */, - int /* socket_id */) - - // Request to send data on the Socket Stream. - // SocketStreamHandle can send data at most |max_pending_send_allowed| bytes, - // which is given by ViewMsg_SocketStream_Connected at any time. - // The number of pending bytes can be tracked by size of |data| sent - // and |amount_sent| parameter of ViewMsg_SocketStream_DataSent. - // That is, the following constraints is applied: - // (accumulated total of |data|) - (accumulated total of |amount_sent|) - // <= |max_pending_send_allowed| - // If the SocketStreamHandle ever tries to exceed the - // |max_pending_send_allowed|, the connection will be closed. - IPC_MESSAGE_CONTROL2(ViewHostMsg_SocketStream_SendData, - int /* socket_id */, - std::vector<char> /* data */) - - // Request to close the Socket Stream. - // The browser will send ViewMsg_SocketStream_Closed back when the Socket - // Stream is completely closed. - IPC_MESSAGE_CONTROL1(ViewHostMsg_SocketStream_Close, - int /* socket_id */) - - //--------------------------------------------------------------------------- - // Request for cryptographic operation messages: - // These are messages from the renderer to the browser to perform a - // cryptographic operation. - - // Asks the browser process to generate a keypair for grabbing a client - // certificate from a CA (<keygen> tag), and returns the signed public - // key and challenge string. - IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_Keygen, - uint32 /* key size index */, - std::string /* challenge string */, - GURL /* URL of requestor */, - std::string /* signed public key and challenge */) - - // The renderer has tried to spell check a word, but couldn't because no - // dictionary was available to load. Request that the browser find an - // appropriate dictionary and return it. - IPC_MESSAGE_CONTROL0(ViewHostMsg_SpellChecker_RequestDictionary) - - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_SpellChecker_PlatformCheckSpelling, - string16 /* word */, - int /* document tag */, - bool /* correct */) - - IPC_SYNC_MESSAGE_CONTROL1_1( - ViewHostMsg_SpellChecker_PlatformFillSuggestionList, - string16 /* word */, - std::vector<string16> /* suggestions */) - - //--------------------------------------------------------------------------- - // Geolocation services messages - - // A GeolocationServiceBridgeImpl in the renderer process has been created. - // This is used to lazily initialize the host dispatchers and related - // Geolocation infrastructure in the browser process. - IPC_MESSAGE_CONTROL1(ViewHostMsg_Geolocation_RegisterDispatcher, - int /* render_view_id */) - - // A GeolocationServiceBridgeImpl has been destroyed. - // This is used to let the Geolocation infrastructure do its cleanup. - IPC_MESSAGE_CONTROL1(ViewHostMsg_Geolocation_UnregisterDispatcher, - int /* render_view_id */) - - // The |render_view_id| and |bridge_id| representing |host| is requesting - // permission to access geolocation position. - // This will be replied by ViewMsg_Geolocation_PermissionSet. - IPC_MESSAGE_CONTROL3(ViewHostMsg_Geolocation_RequestPermission, - int /* render_view_id */, - int /* bridge_id */, - GURL /* GURL of the frame requesting geolocation */) - - // The |render_view_id| and |bridge_id| representing |GURL| is cancelling its - // previous permission request to access geolocation position. - IPC_MESSAGE_CONTROL3(ViewHostMsg_Geolocation_CancelPermissionRequest, - int /* render_view_id */, - int /* bridge_id */, - GURL /* GURL of the frame */) - - // The |render_view_id| and |bridge_id| requests Geolocation service to start - // updating. - // This is an asynchronous call, and the browser process may eventually reply - // with the updated geoposition, or an error (access denied, location - // unavailable, etc.) - IPC_MESSAGE_CONTROL4(ViewHostMsg_Geolocation_StartUpdating, - int /* render_view_id */, - int /* bridge_id */, - GURL /* GURL of the frame requesting geolocation */, - bool /* enable_high_accuracy */) - - // The |render_view_id| and |bridge_id| requests Geolocation service to stop - // updating. - // Note that the geolocation service may continue to fetch geolocation data - // for other origins. - IPC_MESSAGE_CONTROL2(ViewHostMsg_Geolocation_StopUpdating, - int /* render_view_id */, - int /* bridge_id */) - - // The |render_view_id| and |bridge_id| requests Geolocation service to - // suspend. - // Note that the geolocation service may continue to fetch geolocation data - // for other origins. - IPC_MESSAGE_CONTROL2(ViewHostMsg_Geolocation_Suspend, - int /* render_view_id */, - int /* bridge_id */) - - // The |render_view_id| and |bridge_id| requests Geolocation service to - // resume. - IPC_MESSAGE_CONTROL2(ViewHostMsg_Geolocation_Resume, - int /* render_view_id */, - int /* bridge_id */) - - // Updates the minimum/maximum allowed zoom percent for this tab from the - // default values. If |remember| is true, then the zoom setting is applied to - // other pages in the site and is saved, otherwise it only applies to this - // tab. - IPC_MESSAGE_ROUTED3(ViewHostMsg_UpdateZoomLimits, - int /* minimum_percent */, - int /* maximum_percent */, - bool /* remember */) - - // Requests the speech input service to start speech recognition on behalf of - // the given |render_view_id|. - IPC_MESSAGE_CONTROL5(ViewHostMsg_SpeechInput_StartRecognition, - int /* render_view_id */, - int /* request_id */, - gfx::Rect /* element_rect */, - std::string /* language */, - std::string /* grammar */) - - // Requests the speech input service to cancel speech recognition on behalf of - // the given |render_view_id|. If speech recognition is not happening nor or - // is happening on behalf of some other render view, this call does nothing. - IPC_MESSAGE_CONTROL2(ViewHostMsg_SpeechInput_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(ViewHostMsg_SpeechInput_StopRecording, - int /* render_view_id */, - int /* request id */) - - //--------------------------------------------------------------------------- - // Device orientation services messages: - - // A RenderView requests to start receiving device orientation updates. - IPC_MESSAGE_CONTROL1(ViewHostMsg_DeviceOrientation_StartUpdating, - int /* render_view_id */) - - // A RenderView requests to stop receiving device orientation updates. - IPC_MESSAGE_CONTROL1(ViewHostMsg_DeviceOrientation_StopUpdating, - int /* render_view_id */) - - //--------------------------------------------------------------------------- - // FileSystem API messages - // These are messages sent from the renderer to the browser process. - - // WebFrameClient::openFileSystem() message. - IPC_MESSAGE_CONTROL5(ViewHostMsg_OpenFileSystemRequest, - int /* request_id */, - GURL /* origin_url */, - fileapi::FileSystemType /* type */, - int64 /* requested_size */, - bool /* create */) - - // WebFileSystem::move() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Move, - int /* request_id */, - FilePath /* src path */, - FilePath /* dest path */) - - // WebFileSystem::copy() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Copy, - int /* request_id */, - FilePath /* src path */, - FilePath /* dest path */) - - // WebFileSystem::remove() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Remove, - int /* request_id */, - FilePath /* path */, - bool /* recursive */) - - // WebFileSystem::readMetadata() message. - IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_ReadMetadata, - int /* request_id */, - FilePath /* path */) - - // WebFileSystem::create() message. - IPC_MESSAGE_CONTROL5(ViewHostMsg_FileSystem_Create, - int /* request_id */, - FilePath /* path */, - bool /* exclusive */, - bool /* is_directory */, - bool /* recursive */) - - // WebFileSystem::exists() messages. - IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Exists, - int /* request_id */, - FilePath /* path */, - bool /* is_directory */) - - // WebFileSystem::readDirectory() message. - IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_ReadDirectory, - int /* request_id */, - FilePath /* path */) - - // WebFileWriter::write() message. - IPC_MESSAGE_CONTROL4(ViewHostMsg_FileSystem_Write, - int /* request id */, - FilePath /* file path */, - GURL /* blob URL */, - int64 /* position */) - - // WebFileWriter::truncate() message. - IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Truncate, - int /* request id */, - FilePath /* file path */, - int64 /* length */) - - // Pepper's Touch() message. - IPC_MESSAGE_CONTROL4(ViewHostMsg_FileSystem_TouchFile, - int /* request_id */, - FilePath /* path */, - base::Time /* last_access_time */, - base::Time /* last_modified_time */) - - // WebFileWriter::cancel() message. - IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_CancelWrite, - int /* request id */, - int /* id of request to cancel */) - - //--------------------------------------------------------------------------- - // Blob messages: - - // Registers a blob URL referring to the specified blob data. - IPC_MESSAGE_CONTROL2(ViewHostMsg_RegisterBlobUrl, - GURL /* url */, - scoped_refptr<webkit_blob::BlobData> /* blob_data */) - - // Registers a blob URL referring to the blob data identified by the specified - // source URL. - IPC_MESSAGE_CONTROL2(ViewHostMsg_RegisterBlobUrlFrom, - GURL /* url */, - GURL /* src_url */) - - // Unregister a blob URL. - IPC_MESSAGE_CONTROL1(ViewHostMsg_UnregisterBlobUrl, GURL /* url */) - - // Suggest results ----------------------------------------------------------- - - IPC_MESSAGE_ROUTED2(ViewHostMsg_SetSuggestions, - int32 /* page_id */, - std::vector<std::string> /* suggestions */) - - IPC_MESSAGE_ROUTED2(ViewHostMsg_InstantSupportDetermined, - int32 /* page_id */, - bool /* result */) - - // Client-Side Phishing Detector --------------------------------------------- - // Inform the browser that the current URL is phishing according to the - // client-side phishing detector. - IPC_MESSAGE_ROUTED3(ViewHostMsg_DetectedPhishingSite, - GURL /* phishing_url */, - double /* phishing_score */, - SkBitmap /* thumbnail */) - - // Response from ViewMsg_ScriptEvalRequest. The ID is the parameter supplied - // to ViewMsg_ScriptEvalRequest. The result is true if the script evaluated - // to the boolean result true, false otherwise. - IPC_MESSAGE_ROUTED2(ViewHostMsg_ScriptEvalResponse, - int /* id */, - bool /* result */) - - // Updates the content restrictions, i.e. to disable print/copy. - IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateContentRestrictions, - int /* restrictions */) - - // Trusted Pepper Filesystem messages ---------------------------------------- - - // Open the file. - IPC_SYNC_MESSAGE_CONTROL2_2(ViewHostMsg_PepperOpenFile, - FilePath /* path */, - int /* flags */, - base::PlatformFileError /* error_code */, - IPC::PlatformFileForTransit /* result */) - - // Rename the file. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_PepperRenameFile, - FilePath /* path_from */, - FilePath /* path_to */, - base::PlatformFileError /* error_code */) - - // Delete the file. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_PepperDeleteFileOrDir, - FilePath /* path */, - bool /* recursive */, - base::PlatformFileError /* error_code */) - - // Create the directory. - IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_PepperCreateDir, - FilePath /* path */, - base::PlatformFileError /* error_code */) - - // Query the file's info. - IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_PepperQueryFile, - FilePath /* path */, - base::PlatformFileInfo, /* info */ - base::PlatformFileError /* error_code */) - - // Get the directory's contents. - IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_PepperGetDirContents, - FilePath /* path */, - PepperDirContents, /* contents */ - base::PlatformFileError /* error_code */) - -IPC_END_MESSAGES(ViewHost) +// A renderer sends this to the browser process when it wants to create a +// worker. The browser will create the worker process if necessary, and +// will return the route id on success. On error returns MSG_ROUTING_NONE. +IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_CreateWorker, + ViewHostMsg_CreateWorker_Params, + int /* route_id */) + +// This message is sent to the browser to see if an instance of this shared +// worker already exists. If so, it returns exists == true. If a +// non-empty name is passed, also validates that the url matches the url of +// the existing worker. If a matching worker is found, the passed-in +// document_id is associated with that worker, to ensure that the worker +// stays alive until the document is detached. +// The route_id returned can be used to forward messages to the worker via +// ForwardToWorker if it exists, otherwise it should be passed in to any +// future call to CreateWorker to avoid creating duplicate workers. +IPC_SYNC_MESSAGE_CONTROL1_3(ViewHostMsg_LookupSharedWorker, + ViewHostMsg_CreateWorker_Params, + bool /* exists */, + int /* route_id */, + bool /* url_mismatch */) + +// A renderer sends this to the browser process when a document has been +// detached. The browser will use this to constrain the lifecycle of worker +// processes (SharedWorkers are shut down when their last associated document +// is detached). +IPC_MESSAGE_CONTROL1(ViewHostMsg_DocumentDetached, + uint64 /* document_id */) + +// A message sent to the browser on behalf of a renderer which wants to show +// a desktop notification. +IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowDesktopNotification, + ViewHostMsg_ShowNotification_Params) +IPC_MESSAGE_ROUTED1(ViewHostMsg_CancelDesktopNotification, + int /* notification_id */ ) +IPC_MESSAGE_ROUTED2(ViewHostMsg_RequestNotificationPermission, + GURL /* origin */, + int /* callback_context */) +IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_CheckNotificationPermission, + GURL /* source page */, + int /* permission_result */) + +// Sent if the worker object has sent a ViewHostMsg_CreateDedicatedWorker +// message and not received a ViewMsg_WorkerCreated reply, but in the +// mean time it's destroyed. This tells the browser to not create the queued +// worker. +IPC_MESSAGE_CONTROL1(ViewHostMsg_CancelCreateDedicatedWorker, + int /* route_id */) + +// Wraps an IPC message that's destined to the worker on the renderer->browser +// hop. +IPC_MESSAGE_CONTROL1(ViewHostMsg_ForwardToWorker, + IPC::Message /* message */) + +// Open a channel to all listening contexts owned by the extension with +// the given ID. This always returns a valid port ID which can be used for +// sending messages. If an error occurred, the opener will be notified +// asynchronously. +IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_OpenChannelToExtension, + int /* routing_id */, + std::string /* source_extension_id */, + std::string /* target_extension_id */, + std::string /* channel_name */, + int /* port_id */) + +// Get a port handle to the given tab. The handle can be used for sending +// messages to the extension. +IPC_SYNC_MESSAGE_CONTROL4_1(ViewHostMsg_OpenChannelToTab, + int /* routing_id */, + int /* tab_id */, + std::string /* extension_id */, + std::string /* channel_name */, + int /* port_id */) + +// Send a message to an extension process. The handle is the value returned +// by ViewHostMsg_OpenChannelTo*. +IPC_MESSAGE_ROUTED2(ViewHostMsg_ExtensionPostMessage, + int /* port_id */, + std::string /* message */) + +// Send a message to an extension process. The handle is the value returned +// by ViewHostMsg_OpenChannelTo*. +IPC_MESSAGE_CONTROL1(ViewHostMsg_ExtensionCloseChannel, + int /* port_id */) + +// Sent to notify the browser about renderer accessibility notifications. +// The browser responds with a ViewMsg_AccessibilityNotifications_ACK. +IPC_MESSAGE_ROUTED1( + ViewHostMsg_AccessibilityNotifications, + std::vector<ViewHostMsg_AccessibilityNotification_Params>) + +// Message sent from the renderer to the browser to request that the browser +// close all sockets. Used for debugging/testing. +IPC_MESSAGE_CONTROL0(ViewHostMsg_CloseCurrentConnections) + +// Message sent from the renderer to the browser to request that the browser +// enable or disable the cache. Used for debugging/testing. +IPC_MESSAGE_CONTROL1(ViewHostMsg_SetCacheMode, + bool /* enabled */) + +// Message sent from the renderer to the browser to request that the browser +// clear the cache. Used for debugging/testing. +IPC_SYNC_MESSAGE_CONTROL0_1(ViewHostMsg_ClearCache, + int /* result */) + +// Message sent from the renderer to the browser to request that the browser +// enable or disable spdy. Used for debugging/testing/benchmarking. +IPC_MESSAGE_CONTROL1(ViewHostMsg_EnableSpdy, + bool /* enable */) + +// Message sent from the renderer to the browser to request that the browser +// cache |data| associated with |url|. +IPC_MESSAGE_CONTROL3(ViewHostMsg_DidGenerateCacheableMetadata, + GURL /* url */, + double /* expected_response_time */, + std::vector<char> /* data */) + +// Opens a file asynchronously. The response returns a file descriptor +// and an error code from base/platform_file.h. +IPC_MESSAGE_ROUTED3(ViewHostMsg_AsyncOpenFile, + FilePath /* file path */, + int /* flags */, + int /* message_id */) + +// Sent by the renderer process to acknowledge receipt of a +// ViewMsg_CSSInsertRequest message and css has been inserted into the frame. +IPC_MESSAGE_ROUTED0(ViewHostMsg_OnCSSInserted) + +// Notifies the browser of the language (ISO 639_1 code language, such as fr, +// en, zh...) of the current page. +IPC_MESSAGE_ROUTED1(ViewHostMsg_PageLanguageDetermined, + std::string /* the language */) + +// Notifies the browser that a page has been translated. +IPC_MESSAGE_ROUTED4(ViewHostMsg_PageTranslated, + int, /* page id */ + std::string /* the original language */, + std::string /* the translated language */, + TranslateErrors::Type /* the error type if available */) + +//--------------------------------------------------------------------------- +// Socket Stream messages: +// These are messages from the SocketStreamHandle to the browser. + +// Open new Socket Stream for the |socket_url| identified by |socket_id| +// in the renderer process. +// The browser starts connecting asynchronously. +// Once Socket Stream connection is established, the browser will send +// ViewMsg_SocketStream_Connected back. +IPC_MESSAGE_CONTROL2(ViewHostMsg_SocketStream_Connect, + GURL /* socket_url */, + int /* socket_id */) + +// Request to send data on the Socket Stream. +// SocketStreamHandle can send data at most |max_pending_send_allowed| bytes, +// which is given by ViewMsg_SocketStream_Connected at any time. +// The number of pending bytes can be tracked by size of |data| sent +// and |amount_sent| parameter of ViewMsg_SocketStream_DataSent. +// That is, the following constraints is applied: +// (accumulated total of |data|) - (accumulated total of |amount_sent|) +// <= |max_pending_send_allowed| +// If the SocketStreamHandle ever tries to exceed the +// |max_pending_send_allowed|, the connection will be closed. +IPC_MESSAGE_CONTROL2(ViewHostMsg_SocketStream_SendData, + int /* socket_id */, + std::vector<char> /* data */) + +// Request to close the Socket Stream. +// The browser will send ViewMsg_SocketStream_Closed back when the Socket +// Stream is completely closed. +IPC_MESSAGE_CONTROL1(ViewHostMsg_SocketStream_Close, + int /* socket_id */) + +//--------------------------------------------------------------------------- +// Request for cryptographic operation messages: +// These are messages from the renderer to the browser to perform a +// cryptographic operation. + +// Asks the browser process to generate a keypair for grabbing a client +// certificate from a CA (<keygen> tag), and returns the signed public +// key and challenge string. +IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_Keygen, + uint32 /* key size index */, + std::string /* challenge string */, + GURL /* URL of requestor */, + std::string /* signed public key and challenge */) + +// The renderer has tried to spell check a word, but couldn't because no +// dictionary was available to load. Request that the browser find an +// appropriate dictionary and return it. +IPC_MESSAGE_CONTROL0(ViewHostMsg_SpellChecker_RequestDictionary) + +IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_SpellChecker_PlatformCheckSpelling, + string16 /* word */, + int /* document tag */, + bool /* correct */) + +IPC_SYNC_MESSAGE_CONTROL1_1( + ViewHostMsg_SpellChecker_PlatformFillSuggestionList, + string16 /* word */, + std::vector<string16> /* suggestions */) + +//--------------------------------------------------------------------------- +// Geolocation services messages + +// A GeolocationServiceBridgeImpl in the renderer process has been created. +// This is used to lazily initialize the host dispatchers and related +// Geolocation infrastructure in the browser process. +IPC_MESSAGE_CONTROL1(ViewHostMsg_Geolocation_RegisterDispatcher, + int /* render_view_id */) + +// A GeolocationServiceBridgeImpl has been destroyed. +// This is used to let the Geolocation infrastructure do its cleanup. +IPC_MESSAGE_CONTROL1(ViewHostMsg_Geolocation_UnregisterDispatcher, + int /* render_view_id */) + +// The |render_view_id| and |bridge_id| representing |host| is requesting +// permission to access geolocation position. +// This will be replied by ViewMsg_Geolocation_PermissionSet. +IPC_MESSAGE_CONTROL3(ViewHostMsg_Geolocation_RequestPermission, + int /* render_view_id */, + int /* bridge_id */, + GURL /* GURL of the frame requesting geolocation */) + +// The |render_view_id| and |bridge_id| representing |GURL| is cancelling its +// previous permission request to access geolocation position. +IPC_MESSAGE_CONTROL3(ViewHostMsg_Geolocation_CancelPermissionRequest, + int /* render_view_id */, + int /* bridge_id */, + GURL /* GURL of the frame */) + +// The |render_view_id| and |bridge_id| requests Geolocation service to start +// updating. +// This is an asynchronous call, and the browser process may eventually reply +// with the updated geoposition, or an error (access denied, location +// unavailable, etc.) +IPC_MESSAGE_CONTROL4(ViewHostMsg_Geolocation_StartUpdating, + int /* render_view_id */, + int /* bridge_id */, + GURL /* GURL of the frame requesting geolocation */, + bool /* enable_high_accuracy */) + +// The |render_view_id| and |bridge_id| requests Geolocation service to stop +// updating. +// Note that the geolocation service may continue to fetch geolocation data +// for other origins. +IPC_MESSAGE_CONTROL2(ViewHostMsg_Geolocation_StopUpdating, + int /* render_view_id */, + int /* bridge_id */) + +// The |render_view_id| and |bridge_id| requests Geolocation service to +// suspend. +// Note that the geolocation service may continue to fetch geolocation data +// for other origins. +IPC_MESSAGE_CONTROL2(ViewHostMsg_Geolocation_Suspend, + int /* render_view_id */, + int /* bridge_id */) + +// The |render_view_id| and |bridge_id| requests Geolocation service to +// resume. +IPC_MESSAGE_CONTROL2(ViewHostMsg_Geolocation_Resume, + int /* render_view_id */, + int /* bridge_id */) + +// Updates the minimum/maximum allowed zoom percent for this tab from the +// default values. If |remember| is true, then the zoom setting is applied to +// other pages in the site and is saved, otherwise it only applies to this +// tab. +IPC_MESSAGE_ROUTED3(ViewHostMsg_UpdateZoomLimits, + int /* minimum_percent */, + int /* maximum_percent */, + bool /* remember */) + +// Requests the speech input service to start speech recognition on behalf of +// the given |render_view_id|. +IPC_MESSAGE_CONTROL5(ViewHostMsg_SpeechInput_StartRecognition, + int /* render_view_id */, + int /* request_id */, + gfx::Rect /* element_rect */, + std::string /* language */, + std::string /* grammar */) + +// Requests the speech input service to cancel speech recognition on behalf of +// the given |render_view_id|. If speech recognition is not happening nor or +// is happening on behalf of some other render view, this call does nothing. +IPC_MESSAGE_CONTROL2(ViewHostMsg_SpeechInput_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(ViewHostMsg_SpeechInput_StopRecording, + int /* render_view_id */, + int /* request id */) + +//--------------------------------------------------------------------------- +// Device orientation services messages: + +// A RenderView requests to start receiving device orientation updates. +IPC_MESSAGE_CONTROL1(ViewHostMsg_DeviceOrientation_StartUpdating, + int /* render_view_id */) + +// A RenderView requests to stop receiving device orientation updates. +IPC_MESSAGE_CONTROL1(ViewHostMsg_DeviceOrientation_StopUpdating, + int /* render_view_id */) + +//--------------------------------------------------------------------------- +// FileSystem API messages +// These are messages sent from the renderer to the browser process. + +// WebFrameClient::openFileSystem() message. +IPC_MESSAGE_CONTROL5(ViewHostMsg_OpenFileSystemRequest, + int /* request_id */, + GURL /* origin_url */, + fileapi::FileSystemType /* type */, + int64 /* requested_size */, + bool /* create */) + +// WebFileSystem::move() message. +IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Move, + int /* request_id */, + FilePath /* src path */, + FilePath /* dest path */) + +// WebFileSystem::copy() message. +IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Copy, + int /* request_id */, + FilePath /* src path */, + FilePath /* dest path */) + +// WebFileSystem::remove() message. +IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Remove, + int /* request_id */, + FilePath /* path */, + bool /* recursive */) + +// WebFileSystem::readMetadata() message. +IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_ReadMetadata, + int /* request_id */, + FilePath /* path */) + +// WebFileSystem::create() message. +IPC_MESSAGE_CONTROL5(ViewHostMsg_FileSystem_Create, + int /* request_id */, + FilePath /* path */, + bool /* exclusive */, + bool /* is_directory */, + bool /* recursive */) + +// WebFileSystem::exists() messages. +IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Exists, + int /* request_id */, + FilePath /* path */, + bool /* is_directory */) + +// WebFileSystem::readDirectory() message. +IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_ReadDirectory, + int /* request_id */, + FilePath /* path */) + +// WebFileWriter::write() message. +IPC_MESSAGE_CONTROL4(ViewHostMsg_FileSystem_Write, + int /* request id */, + FilePath /* file path */, + GURL /* blob URL */, + int64 /* position */) + +// WebFileWriter::truncate() message. +IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Truncate, + int /* request id */, + FilePath /* file path */, + int64 /* length */) + +// Pepper's Touch() message. +IPC_MESSAGE_CONTROL4(ViewHostMsg_FileSystem_TouchFile, + int /* request_id */, + FilePath /* path */, + base::Time /* last_access_time */, + base::Time /* last_modified_time */) + +// WebFileWriter::cancel() message. +IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_CancelWrite, + int /* request id */, + int /* id of request to cancel */) + +//--------------------------------------------------------------------------- +// Blob messages: + +// Registers a blob URL referring to the specified blob data. +IPC_MESSAGE_CONTROL2(ViewHostMsg_RegisterBlobUrl, + GURL /* url */, + scoped_refptr<webkit_blob::BlobData> /* blob_data */) + +// Registers a blob URL referring to the blob data identified by the specified +// source URL. +IPC_MESSAGE_CONTROL2(ViewHostMsg_RegisterBlobUrlFrom, + GURL /* url */, + GURL /* src_url */) + +// Unregister a blob URL. +IPC_MESSAGE_CONTROL1(ViewHostMsg_UnregisterBlobUrl, GURL /* url */) + +// Suggest results ----------------------------------------------------------- + +IPC_MESSAGE_ROUTED2(ViewHostMsg_SetSuggestions, + int32 /* page_id */, + std::vector<std::string> /* suggestions */) + +IPC_MESSAGE_ROUTED2(ViewHostMsg_InstantSupportDetermined, + int32 /* page_id */, + bool /* result */) + +// Client-Side Phishing Detector --------------------------------------------- +// Inform the browser that the current URL is phishing according to the +// client-side phishing detector. +IPC_MESSAGE_ROUTED3(ViewHostMsg_DetectedPhishingSite, + GURL /* phishing_url */, + double /* phishing_score */, + SkBitmap /* thumbnail */) + +// Response from ViewMsg_ScriptEvalRequest. The ID is the parameter supplied +// to ViewMsg_ScriptEvalRequest. The result has the value returned by the +// script as it's only element, one of Null, Boolean, Integer, Real, Date, or +// String. +IPC_MESSAGE_ROUTED2(ViewHostMsg_ScriptEvalResponse, + int /* id */, + ListValue /* result */) + +// Updates the content restrictions, i.e. to disable print/copy. +IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateContentRestrictions, + int /* restrictions */) diff --git a/chrome/common/render_messages_params.cc b/chrome/common/render_messages_params.cc index 2b8638d..7fab193 100644 --- a/chrome/common/render_messages_params.cc +++ b/chrome/common/render_messages_params.cc @@ -6,7 +6,6 @@ #include "chrome/common/navigation_gesture.h" #include "chrome/common/common_param_traits.h" -#include "chrome/common/indexed_db_param_traits.h" #include "chrome/common/render_messages.h" #include "net/base/upload_data.h" @@ -66,6 +65,7 @@ ViewHostMsg_Resource_Request::ViewHostMsg_Resource_Request() request_context(0), appcache_host_id(0), download_to_file(false), + has_user_gesture(false), host_renderer_id(0), host_render_view_id(0) { } @@ -118,6 +118,21 @@ ViewMsg_PrintPages_Params::ViewMsg_PrintPages_Params() { ViewMsg_PrintPages_Params::~ViewMsg_PrintPages_Params() { } +ViewHostMsg_DidPreviewDocument_Params::ViewHostMsg_DidPreviewDocument_Params() + : data_size(0) { +#if defined(OS_WIN) + // Initialize |metafile_data_handle| only on Windows because it maps + // base::SharedMemoryHandle to HANDLE. We do not need to initialize this + // variable on Posix because it maps base::SharedMemoryHandle to + // FileDescriptior, which has the default constructor. + metafile_data_handle = INVALID_HANDLE_VALUE; +#endif +} + +ViewHostMsg_DidPreviewDocument_Params:: + ~ViewHostMsg_DidPreviewDocument_Params() { +} + ViewHostMsg_DidPrintPage_Params::ViewHostMsg_DidPrintPage_Params() : data_size(0), document_cookie(0), @@ -165,83 +180,6 @@ ViewHostMsg_ScriptedPrint_Params::ViewHostMsg_ScriptedPrint_Params() ViewHostMsg_ScriptedPrint_Params::~ViewHostMsg_ScriptedPrint_Params() { } -ViewMsg_DOMStorageEvent_Params::ViewMsg_DOMStorageEvent_Params() - : storage_type_(DOM_STORAGE_LOCAL) { -} - -ViewMsg_DOMStorageEvent_Params::~ViewMsg_DOMStorageEvent_Params() { -} - -ViewHostMsg_IDBFactoryOpen_Params::ViewHostMsg_IDBFactoryOpen_Params() - : routing_id_(0), - response_id_(0), - maximum_size_(0) { -} - -ViewHostMsg_IDBFactoryOpen_Params::~ViewHostMsg_IDBFactoryOpen_Params() { -} - -ViewHostMsg_IDBDatabaseCreateObjectStore_Params:: - ViewHostMsg_IDBDatabaseCreateObjectStore_Params() - : auto_increment_(false), - transaction_id_(0), - idb_database_id_(0) { -} - -ViewHostMsg_IDBDatabaseCreateObjectStore_Params:: - ~ViewHostMsg_IDBDatabaseCreateObjectStore_Params() { -} - -ViewHostMsg_IDBIndexOpenCursor_Params::ViewHostMsg_IDBIndexOpenCursor_Params() - : response_id_(0), - lower_open_(false), - upper_open_(false), - direction_(0), - idb_index_id_(0), - transaction_id_(0) { -} - -ViewHostMsg_IDBIndexOpenCursor_Params:: - ~ViewHostMsg_IDBIndexOpenCursor_Params() { -} - - -ViewHostMsg_IDBObjectStorePut_Params::ViewHostMsg_IDBObjectStorePut_Params() - : idb_object_store_id_(0), - response_id_(0), - add_only_(false), - transaction_id_(0) { -} - -ViewHostMsg_IDBObjectStorePut_Params::~ViewHostMsg_IDBObjectStorePut_Params() { -} - -ViewHostMsg_IDBObjectStoreCreateIndex_Params:: -ViewHostMsg_IDBObjectStoreCreateIndex_Params() - : unique_(false), - transaction_id_(0), - idb_object_store_id_(0) { -} - -ViewHostMsg_IDBObjectStoreCreateIndex_Params:: -~ViewHostMsg_IDBObjectStoreCreateIndex_Params() { -} - - -ViewHostMsg_IDBObjectStoreOpenCursor_Params:: - ViewHostMsg_IDBObjectStoreOpenCursor_Params() - : response_id_(0), - lower_open_(false), - upper_open_(false), - direction_(0), - idb_object_store_id_(0), - transaction_id_(0) { -} - -ViewHostMsg_IDBObjectStoreOpenCursor_Params:: - ~ViewHostMsg_IDBObjectStoreOpenCursor_Params() { -} - ViewMsg_ExecuteCode_Params::ViewMsg_ExecuteCode_Params() { } @@ -942,6 +880,7 @@ void ParamTraits<ViewHostMsg_Resource_Request>::Write(Message* m, WriteParam(m, p.appcache_host_id); WriteParam(m, p.upload_data); WriteParam(m, p.download_to_file); + WriteParam(m, p.has_user_gesture); WriteParam(m, p.host_renderer_id); WriteParam(m, p.host_render_view_id); } @@ -964,6 +903,7 @@ bool ParamTraits<ViewHostMsg_Resource_Request>::Read(const Message* m, ReadParam(m, iter, &r->appcache_host_id) && ReadParam(m, iter, &r->upload_data) && ReadParam(m, iter, &r->download_to_file) && + ReadParam(m, iter, &r->has_user_gesture) && ReadParam(m, iter, &r->host_renderer_id) && ReadParam(m, iter, &r->host_render_view_id); } @@ -993,6 +933,8 @@ void ParamTraits<ViewHostMsg_Resource_Request>::Log(const param_type& p, l->append(", "); LogParam(p.download_to_file, l); l->append(", "); + LogParam(p.has_user_gesture, l); + l->append(", "); LogParam(p.host_renderer_id, l); l->append(", "); LogParam(p.host_render_view_id, l); @@ -1068,6 +1010,26 @@ void ParamTraits<ViewMsg_PrintPages_Params>::Log(const param_type& p, l->append("<ViewMsg_PrintPages_Params>"); } +void ParamTraits<ViewHostMsg_DidPreviewDocument_Params>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.metafile_data_handle); + WriteParam(m, p.data_size); + WriteParam(m, p.document_cookie); +} + +bool ParamTraits<ViewHostMsg_DidPreviewDocument_Params>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->metafile_data_handle) && + ReadParam(m, iter, &p->data_size) && + ReadParam(m, iter, &p->document_cookie); +} + +void ParamTraits<ViewHostMsg_DidPreviewDocument_Params>::Log( + const param_type& p, std::string* l) { + l->append("<ViewHostMsg_DidPreviewDocument_Params>"); +} + void ParamTraits<ViewHostMsg_DidPrintPage_Params>::Write(Message* m, const param_type& p) { WriteParam(m, p.metafile_data_handle); @@ -1213,303 +1175,6 @@ void ParamTraits<ViewHostMsg_ScriptedPrint_Params>::Log(const param_type& p, l->append(")"); } -void ParamTraits<ViewMsg_DOMStorageEvent_Params>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.key_); - WriteParam(m, p.old_value_); - WriteParam(m, p.new_value_); - WriteParam(m, p.origin_); - WriteParam(m, p.url_); - WriteParam(m, p.storage_type_); -} - -bool ParamTraits<ViewMsg_DOMStorageEvent_Params>::Read(const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->key_) && - ReadParam(m, iter, &p->old_value_) && - ReadParam(m, iter, &p->new_value_) && - ReadParam(m, iter, &p->origin_) && - ReadParam(m, iter, &p->url_) && - ReadParam(m, iter, &p->storage_type_); -} - -void ParamTraits<ViewMsg_DOMStorageEvent_Params>::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.key_, l); - l->append(", "); - LogParam(p.old_value_, l); - l->append(", "); - LogParam(p.new_value_, l); - l->append(", "); - LogParam(p.origin_, l); - l->append(", "); - LogParam(p.url_, l); - l->append(", "); - LogParam(p.storage_type_, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_IDBFactoryOpen_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.routing_id_); - WriteParam(m, p.response_id_); - WriteParam(m, p.origin_); - WriteParam(m, p.name_); - WriteParam(m, p.description_); - WriteParam(m, p.maximum_size_); -} - -bool ParamTraits<ViewHostMsg_IDBFactoryOpen_Params>::Read(const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->routing_id_) && - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->origin_) && - ReadParam(m, iter, &p->name_) && - ReadParam(m, iter, &p->description_) && - ReadParam(m, iter, &p->maximum_size_); -} - -void ParamTraits<ViewHostMsg_IDBFactoryOpen_Params>::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.routing_id_, l); - l->append(", "); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.origin_, l); - l->append(", "); - LogParam(p.name_, l); - l->append(", "); - LogParam(p.description_, l); - l->append(", "); - LogParam(p.maximum_size_, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_IDBDatabaseCreateObjectStore_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.name_); - WriteParam(m, p.key_path_); - WriteParam(m, p.auto_increment_); - WriteParam(m, p.transaction_id_); - WriteParam(m, p.idb_database_id_); -} - -bool ParamTraits<ViewHostMsg_IDBDatabaseCreateObjectStore_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->name_) && - ReadParam(m, iter, &p->key_path_) && - ReadParam(m, iter, &p->auto_increment_) && - ReadParam(m, iter, &p->transaction_id_) && - ReadParam(m, iter, &p->idb_database_id_); -} - -void ParamTraits<ViewHostMsg_IDBDatabaseCreateObjectStore_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.name_, l); - l->append(", "); - LogParam(p.key_path_, l); - l->append(", "); - LogParam(p.auto_increment_, l); - l->append(", "); - LogParam(p.transaction_id_, l); - l->append(", "); - LogParam(p.idb_database_id_, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.response_id_); - WriteParam(m, p.lower_key_); - WriteParam(m, p.upper_key_); - WriteParam(m, p.lower_open_); - WriteParam(m, p.upper_open_); - WriteParam(m, p.direction_); - WriteParam(m, p.idb_index_id_); - WriteParam(m, p.transaction_id_); -} - -bool ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->lower_key_) && - ReadParam(m, iter, &p->upper_key_) && - ReadParam(m, iter, &p->lower_open_) && - ReadParam(m, iter, &p->upper_open_) && - ReadParam(m, iter, &p->direction_) && - ReadParam(m, iter, &p->idb_index_id_) && - ReadParam(m, iter, &p->transaction_id_); -} - -void ParamTraits<ViewHostMsg_IDBIndexOpenCursor_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.lower_key_, l); - l->append(", "); - LogParam(p.upper_key_, l); - l->append(", "); - LogParam(p.lower_open_, l); - l->append(", "); - LogParam(p.upper_open_, l); - l->append(", "); - LogParam(p.direction_, l); - l->append(", "); - LogParam(p.idb_index_id_, l); - l->append(","); - LogParam(p.transaction_id_, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_IDBObjectStorePut_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.idb_object_store_id_); - WriteParam(m, p.response_id_); - WriteParam(m, p.serialized_value_); - WriteParam(m, p.key_); - WriteParam(m, p.add_only_); - WriteParam(m, p.transaction_id_); -} - -bool ParamTraits<ViewHostMsg_IDBObjectStorePut_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->idb_object_store_id_) && - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->serialized_value_) && - ReadParam(m, iter, &p->key_) && - ReadParam(m, iter, &p->add_only_) && - ReadParam(m, iter, &p->transaction_id_); -} - -void ParamTraits<ViewHostMsg_IDBObjectStorePut_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.idb_object_store_id_, l); - l->append(", "); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.serialized_value_, l); - l->append(", "); - LogParam(p.key_, l); - l->append(", "); - LogParam(p.add_only_, l); - l->append(", "); - LogParam(p.transaction_id_, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_IDBObjectStoreCreateIndex_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.name_); - WriteParam(m, p.key_path_); - WriteParam(m, p.unique_); - WriteParam(m, p.transaction_id_); - WriteParam(m, p.idb_object_store_id_); -} - -bool ParamTraits<ViewHostMsg_IDBObjectStoreCreateIndex_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->name_) && - ReadParam(m, iter, &p->key_path_) && - ReadParam(m, iter, &p->unique_) && - ReadParam(m, iter, &p->transaction_id_) && - ReadParam(m, iter, &p->idb_object_store_id_); -} - -void ParamTraits<ViewHostMsg_IDBObjectStoreCreateIndex_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.name_, l); - l->append(", "); - LogParam(p.key_path_, l); - l->append(", "); - LogParam(p.unique_, l); - l->append(", "); - LogParam(p.transaction_id_, l); - l->append(", "); - LogParam(p.idb_object_store_id_, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.response_id_); - WriteParam(m, p.lower_key_); - WriteParam(m, p.upper_key_); - WriteParam(m, p.lower_open_); - WriteParam(m, p.upper_open_); - WriteParam(m, p.direction_); - WriteParam(m, p.idb_object_store_id_); - WriteParam(m, p.transaction_id_); -} - -bool ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->lower_key_) && - ReadParam(m, iter, &p->upper_key_) && - ReadParam(m, iter, &p->lower_open_) && - ReadParam(m, iter, &p->upper_open_) && - ReadParam(m, iter, &p->direction_) && - ReadParam(m, iter, &p->idb_object_store_id_) && - ReadParam(m, iter, &p->transaction_id_); -} - -void ParamTraits<ViewHostMsg_IDBObjectStoreOpenCursor_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.lower_key_, l); - l->append(", "); - LogParam(p.upper_key_, l); - l->append(", "); - LogParam(p.lower_open_, l); - l->append(", "); - LogParam(p.upper_open_, l); - l->append(", "); - LogParam(p.direction_, l); - l->append(", "); - LogParam(p.idb_object_store_id_, l); - l->append(","); - LogParam(p.transaction_id_, l); - l->append(")"); -} - void ParamTraits<ViewMsg_ExecuteCode_Params>::Write(Message* m, const param_type& p) { WriteParam(m, p.request_id); diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h index 64cf1e5..97817d2 100644 --- a/chrome/common/render_messages_params.h +++ b/chrome/common/render_messages_params.h @@ -16,11 +16,9 @@ #include "base/shared_memory.h" #include "base/time.h" #include "base/values.h" -#include "chrome/common/dom_storage_common.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_extent.h" #include "chrome/common/extensions/url_pattern.h" -#include "chrome/common/indexed_db_key.h" #include "chrome/common/navigation_gesture.h" #include "chrome/common/navigation_types.h" #include "chrome/common/page_transition_types.h" @@ -34,11 +32,11 @@ #include "media/audio/audio_parameters.h" #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" #include "webkit/glue/password_form.h" -#include "webkit/glue/plugins/webplugin.h" #include "webkit/glue/resource_type.h" #include "webkit/glue/webaccessibility.h" #include "webkit/glue/webmenuitem.h" #include "webkit/glue/webpreferences.h" +#include "webkit/plugins/npapi/webplugin.h" // TODO(erg): Split this file into $1_db_params.h, $1_audio_params.h, // $1_print_params.h and $1_render_params.h. @@ -249,7 +247,7 @@ struct ViewHostMsg_FrameNavigate_Params { // The frame ID for this navigation. The frame ID uniquely identifies the // frame the navigation happened in for a given renderer. - long long frame_id; + int64 frame_id; // URL of the page being loaded. GURL url; @@ -358,7 +356,7 @@ struct ViewHostMsg_UpdateRect_Params { gfx::Rect resizer_rect; // New window locations for plugin child windows. - std::vector<webkit_glue::WebPluginGeometry> plugin_window_moves; + std::vector<webkit::npapi::WebPluginGeometry> plugin_window_moves; // The following describes the various bits that may be set in flags: // @@ -449,7 +447,7 @@ struct ViewHostMsg_Resource_Request { // Additional HTTP request headers. std::string headers; - // URLRequest load flags (0 by default). + // net::URLRequest load flags (0 by default). int load_flags; // Unique ID of process that originated this request. For normal renderer @@ -473,6 +471,9 @@ struct ViewHostMsg_Resource_Request { bool download_to_file; + // True if the request was user initiated. + bool has_user_gesture; + // The following two members are specified if the request is initiated by // a plugin like Gears. @@ -551,6 +552,21 @@ struct ViewMsg_PrintPages_Params { std::vector<int> pages; }; +//Parameters to describe a rendered document. +struct ViewHostMsg_DidPreviewDocument_Params { + ViewHostMsg_DidPreviewDocument_Params(); + ~ViewHostMsg_DidPreviewDocument_Params(); + + // A shared memory handle to metafile data. + base::SharedMemoryHandle metafile_data_handle; + + // Size of metafile data. + uint32 data_size; + + // Cookie for the document to ensure correctness. + int document_cookie; +}; + // Parameters to describe a rendered page. struct ViewHostMsg_DidPrintPage_Params { ViewHostMsg_DidPrintPage_Params(); @@ -632,180 +648,6 @@ struct ViewHostMsg_ScriptedPrint_Params { bool use_overlays; }; -// Signals a storage event. -struct ViewMsg_DOMStorageEvent_Params { - ViewMsg_DOMStorageEvent_Params(); - ~ViewMsg_DOMStorageEvent_Params(); - - // The key that generated the storage event. Null if clear() was called. - NullableString16 key_; - - // The old value of this key. Null on clear() or if it didn't have a value. - NullableString16 old_value_; - - // The new value of this key. Null on removeItem() or clear(). - NullableString16 new_value_; - - // The origin this is associated with. - string16 origin_; - - // The URL of the page that caused the storage event. - GURL url_; - - // The storage type of this event. - DOMStorageType storage_type_; -}; - -// Used to open an indexed database. -struct ViewHostMsg_IDBFactoryOpen_Params { - ViewHostMsg_IDBFactoryOpen_Params(); - ~ViewHostMsg_IDBFactoryOpen_Params(); - - // The routing ID of the view initiating the open. - int32 routing_id_; - - // The response should have this id. - int32 response_id_; - - // The origin doing the initiating. - string16 origin_; - - // The name of the database. - string16 name_; - - // The description of the database. - string16 description_; - - // The maximum size of the database. - uint64 maximum_size_; -}; - -// Used to create an object store. -struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params { - ViewHostMsg_IDBDatabaseCreateObjectStore_Params(); - ~ViewHostMsg_IDBDatabaseCreateObjectStore_Params(); - - // The name of the object store. - string16 name_; - - // The keyPath of the object store. - NullableString16 key_path_; - - // Whether the object store created should have a key generator. - bool auto_increment_; - - // The transaction this is associated with. - int32 transaction_id_; - - // The database the object store belongs to. - int32 idb_database_id_; -}; - -// Used to open both cursors and object cursors in IndexedDB. -struct ViewHostMsg_IDBIndexOpenCursor_Params { - ViewHostMsg_IDBIndexOpenCursor_Params(); - ~ViewHostMsg_IDBIndexOpenCursor_Params(); - - // The response should have this id. - int32 response_id_; - - // The serialized lower key. - IndexedDBKey lower_key_; - - // The serialized upper key. - IndexedDBKey upper_key_; - - // Is the lower bound open? - bool lower_open_; - - // Is the upper bound open? - bool upper_open_; - - // The direction of this cursor. - int32 direction_; - - // The index the index belongs to. - int32 idb_index_id_; - - // The transaction this request belongs to. - int transaction_id_; -}; - -// Used to set a value in an object store. -struct ViewHostMsg_IDBObjectStorePut_Params { - ViewHostMsg_IDBObjectStorePut_Params(); - ~ViewHostMsg_IDBObjectStorePut_Params(); - - // The object store's id. - int32 idb_object_store_id_; - - // The id any response should contain. - int32 response_id_; - - // The value to set. - SerializedScriptValue serialized_value_; - - // The key to set it on (may not be "valid"/set in some cases). - IndexedDBKey key_; - - // If it already exists, don't update (just return an error). - bool add_only_; - - // The transaction it's associated with. - int transaction_id_; -}; - -// Used to create an index. -struct ViewHostMsg_IDBObjectStoreCreateIndex_Params { - ViewHostMsg_IDBObjectStoreCreateIndex_Params(); - ~ViewHostMsg_IDBObjectStoreCreateIndex_Params(); - - // The name of the index. - string16 name_; - - // The keyPath of the index. - NullableString16 key_path_; - - // Whether the index created has unique keys. - bool unique_; - - // The transaction this is associated with. - int32 transaction_id_; - - // The object store the index belongs to. - int32 idb_object_store_id_; -}; - -// Used to open an IndexedDB cursor. -struct ViewHostMsg_IDBObjectStoreOpenCursor_Params { - ViewHostMsg_IDBObjectStoreOpenCursor_Params(); - ~ViewHostMsg_IDBObjectStoreOpenCursor_Params(); - - // The response should have this id. - int32 response_id_; - - // The serialized lower key. - IndexedDBKey lower_key_; - - // The serialized upper key. - IndexedDBKey upper_key_; - - // Is the lower bound open? - bool lower_open_; - - // Is the upper bound open? - bool upper_open_; - - // The direction of this cursor. - int32 direction_; - - // The object store the cursor belongs to. - int32 idb_object_store_id_; - - // The transaction this request belongs to. - int transaction_id_; -}; - // Allows an extension to execute code in a tab. struct ViewMsg_ExecuteCode_Params { ViewMsg_ExecuteCode_Params(); @@ -1159,6 +1001,14 @@ struct ParamTraits<ViewMsg_PrintPages_Params> { }; template <> +struct ParamTraits<ViewHostMsg_DidPreviewDocument_Params> { + typedef ViewHostMsg_DidPreviewDocument_Params 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<ViewHostMsg_DidPrintPage_Params> { typedef ViewHostMsg_DidPrintPage_Params param_type; static void Write(Message* m, const param_type& p); @@ -1191,62 +1041,6 @@ struct ParamTraits<ViewHostMsg_ScriptedPrint_Params> { }; template <> -struct ParamTraits<ViewMsg_DOMStorageEvent_Params> { - typedef ViewMsg_DOMStorageEvent_Params 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<ViewHostMsg_IDBFactoryOpen_Params> { - typedef ViewHostMsg_IDBFactoryOpen_Params 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<ViewHostMsg_IDBDatabaseCreateObjectStore_Params> { - typedef ViewHostMsg_IDBDatabaseCreateObjectStore_Params 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<ViewHostMsg_IDBIndexOpenCursor_Params> { - typedef ViewHostMsg_IDBIndexOpenCursor_Params 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<ViewHostMsg_IDBObjectStorePut_Params> { - typedef ViewHostMsg_IDBObjectStorePut_Params 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<ViewHostMsg_IDBObjectStoreCreateIndex_Params> { - typedef ViewHostMsg_IDBObjectStoreCreateIndex_Params 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<ViewHostMsg_IDBObjectStoreOpenCursor_Params> { - typedef ViewHostMsg_IDBObjectStoreOpenCursor_Params 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<ViewMsg_ExecuteCode_Params> { typedef ViewMsg_ExecuteCode_Params param_type; static void Write(Message* m, const param_type& p); diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc index aff0367..e4747b9 100644 --- a/chrome/common/resource_dispatcher.cc +++ b/chrome/common/resource_dispatcher.cc @@ -111,6 +111,7 @@ IPCResourceLoaderBridge::IPCResourceLoaderBridge( request_.request_context = request_info.request_context; request_.appcache_host_id = request_info.appcache_host_id; request_.download_to_file = request_info.download_to_file; + request_.has_user_gesture = request_info.has_user_gesture; request_.host_renderer_id = host_renderer_id_; request_.host_render_view_id = host_render_view_id_; } @@ -401,11 +402,6 @@ void ResourceDispatcher::OnReceivedRedirect( if (request_info->peer->OnReceivedRedirect(new_url, info, &has_new_first_party_for_cookies, &new_first_party_for_cookies)) { - // Double-check if the request is still around. The call above could - // potentially remove it. - request_info = GetPendingRequestInfo(request_id); - if (!request_info) - return; request_info->pending_redirect_message.reset( new ViewHostMsg_FollowRedirect(routing_id, request_id, has_new_first_party_for_cookies, diff --git a/chrome/common/resource_dispatcher.h b/chrome/common/resource_dispatcher.h index 3ca3492..52c6589 100644 --- a/chrome/common/resource_dispatcher.h +++ b/chrome/common/resource_dispatcher.h @@ -23,13 +23,12 @@ struct ResourceResponseHead; // This class serves as a communication interface between the // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in // the child process. It can be used from any child process. -class ResourceDispatcher { +class ResourceDispatcher : public IPC::Channel::Listener { public: explicit ResourceDispatcher(IPC::Message::Sender* sender); ~ResourceDispatcher(); - // Called to possibly handle the incoming IPC message. Returns true if - // handled, else false. + // IPC::Channel::Listener implementation. bool OnMessageReceived(const IPC::Message& message); // Creates a ResourceLoaderBridge for this type of dispatcher, this is so diff --git a/chrome/common/result_codes.h b/chrome/common/result_codes.h index 6625cb0..ae842bb 100644 --- a/chrome/common/result_codes.h +++ b/chrome/common/result_codes.h @@ -21,9 +21,9 @@ class ResultCodes { public: enum ExitCode { - NORMAL_EXIT = base::PROCESS_END_NORMAL_TERMINATION, - TASKMAN_KILL = base::PROCESS_END_KILLED_BY_USER, - HUNG = base::PROCESS_END_PROCESS_WAS_HUNG, + NORMAL_EXIT = 0, // Process terminated normally. + KILLED = 1, // Process was killed by user or system. + HUNG = 2, // Process hung. INVALID_CMDLINE_URL, // An invalid command line url was given. SBOX_INIT_FAILED, // The sandbox could not be initialized. GOOGLE_UPDATE_INIT_FAILED, // The Google Update client stub init failed. @@ -58,6 +58,7 @@ class ResultCodes { PROFILE_IN_USE, // The profile was in use on another host. UNINSTALL_EXTENSION_ERROR, // Failed to silently uninstall an extension. + PACK_EXTENSION_ERROR, // Failed to pack an extension via the cmd line. EXIT_LAST_CODE // Last return code (keep it last). }; diff --git a/chrome/common/sandbox_init_wrapper.h b/chrome/common/sandbox_init_wrapper.h index 56716fc..3c70a7a 100644 --- a/chrome/common/sandbox_init_wrapper.h +++ b/chrome/common/sandbox_init_wrapper.h @@ -32,8 +32,9 @@ class SandboxInitWrapper { sandbox::BrokerServices* BrokerServices() const { return broker_services_; } sandbox::TargetServices* TargetServices() const { return target_services_; } - // Initialize the sandbox for renderer and plug-in processes, depending on - // the command line flags. The browser process is not sandboxed. + // Initialize the sandbox for renderer, gpu, utility, worker, nacl, and + // plug-in processes, depending on the command line flags. The browser + // process is not sandboxed. // Returns true if the sandbox was initialized succesfully, false if an error // occurred. If process_type isn't one that needs sandboxing true is always // returned. diff --git a/chrome/common/sandbox_init_wrapper_mac.cc b/chrome/common/sandbox_init_wrapper_mac.cc index adffd0c..b9cfa50 100644 --- a/chrome/common/sandbox_init_wrapper_mac.cc +++ b/chrome/common/sandbox_init_wrapper_mac.cc @@ -54,9 +54,10 @@ bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, } else if (process_type == switches::kNaClLoaderProcess) { // Native Client sel_ldr (user untrusted code) sandbox. sandbox_process_type = Sandbox::SANDBOX_TYPE_NACL_LOADER; + } else if (process_type == switches::kGpuProcess) { + sandbox_process_type = Sandbox::SANDBOX_TYPE_GPU; } else if ((process_type == switches::kPluginProcess) || (process_type == switches::kProfileImportProcess) || - (process_type == switches::kGpuProcess) || (process_type == switches::kServiceProcess)) { return true; } else { @@ -67,7 +68,7 @@ bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, } // Warm up APIs before turning on the sandbox. - Sandbox::SandboxWarmup(); + Sandbox::SandboxWarmup(sandbox_process_type); // Actually sandbox the process. return Sandbox::EnableSandbox(sandbox_process_type, allowed_dir); diff --git a/chrome/common/sandbox_mac.h b/chrome/common/sandbox_mac.h index f16fdb5..e81f72e 100644 --- a/chrome/common/sandbox_mac.h +++ b/chrome/common/sandbox_mac.h @@ -75,12 +75,15 @@ class Sandbox { // Native Client sandbox for the user's untrusted code. SANDBOX_TYPE_NACL_LOADER, + // GPU process. + SANDBOX_TYPE_GPU, + SANDBOX_AFTER_TYPE_LAST_TYPE, // Placeholder to ease iteration. }; // Warm up System APIs that empirically need to be accessed before the Sandbox - // is turned on. - static void SandboxWarmup(); + // is turned on. |sandbox_type| is the type of sandbox to warm up. + static void SandboxWarmup(SandboxProcessType sandbox_type); // Turns on the OS X sandbox for this process. // |sandbox_type| - type of Sandbox to use. diff --git a/chrome/common/sandbox_mac.mm b/chrome/common/sandbox_mac.mm index 81defc7..b5f9d22 100644 --- a/chrome/common/sandbox_mac.mm +++ b/chrome/common/sandbox_mac.mm @@ -7,11 +7,15 @@ #include "base/debug_util.h" #import <Cocoa/Cocoa.h> +#import <OpenGL/OpenGL.h> + extern "C" { #include <sandbox.h> } +#include <signal.h> #include <sys/param.h> +#include "app/gfx/gl/gl_context.h" #include "base/basictypes.h" #include "base/command_line.h" #include "base/file_util.h" @@ -24,6 +28,7 @@ extern "C" { #include "base/sys_info.h" #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" +#include "chrome/common/chrome_application_mac.h" #include "chrome/common/chrome_switches.h" #include "unicode/uchar.h" @@ -177,7 +182,7 @@ bool Sandbox::QuoteStringForRegex(const std::string& str_utf8, // 10.5.6, 10.6.0 // static -void Sandbox::SandboxWarmup() { +void Sandbox::SandboxWarmup(SandboxProcessType sandbox_type) { base::mac::ScopedNSAutoreleasePool scoped_pool; { // CGColorSpaceCreateWithName(), CGBitmapContextCreate() - 10.5.6 @@ -228,8 +233,41 @@ void Sandbox::SandboxWarmup() { CGImageSourceGetStatus(img); } - { // Native Client access to /dev/random. - GetUrandomFD(); + // Process-type dependent warm-up. + switch (sandbox_type) { + case SANDBOX_TYPE_NACL_LOADER: + { + // Native Client access to /dev/random. + GetUrandomFD(); + } + break; + + case SANDBOX_TYPE_GPU: + { // GPU-related stuff is very slow without this, probably because + // the sandbox prevents loading graphics drivers or some such. + CGLPixelFormatAttribute attribs[] = { (CGLPixelFormatAttribute)0 }; + CGLPixelFormatObj format; + GLint n; + CGLChoosePixelFormat(attribs, &format, &n); + if (format) + CGLReleasePixelFormat(format); + } + + { + // Preload either the desktop GL or the osmesa so, depending on the + // --use-gl flag. + gfx::GLContext::InitializeOneOff(); + } + + { + // Access to /dev/random is required for the field trial code. + GetUrandomFD(); + } + break; + + default: + // To shut up a gcc warning. + break; } } @@ -314,6 +352,9 @@ NSString* LoadSandboxTemplate(Sandbox::SandboxProcessType sandbox_type) { // untrusted code within Native Client. sandbox_config_filename = @"nacl_loader"; break; + case Sandbox::SANDBOX_TYPE_GPU: + sandbox_config_filename = @"gpu"; + break; default: NOTREACHED(); return nil; @@ -465,7 +506,7 @@ bool Sandbox::EnableSandbox(SandboxProcessType sandbox_type, // Enable verbose logging if enabled on the command line. (See common.sb // for details). - const CommandLine *command_line = CommandLine::ForCurrentProcess(); + const CommandLine* command_line = CommandLine::ForCurrentProcess(); bool enable_logging = command_line->HasSwitch(switches::kEnableSandboxLogging);; if (enable_logging) { diff --git a/chrome/common/sandbox_mac_unittest_helper.mm b/chrome/common/sandbox_mac_unittest_helper.mm index 4e885b5..aff7471 100644 --- a/chrome/common/sandbox_mac_unittest_helper.mm +++ b/chrome/common/sandbox_mac_unittest_helper.mm @@ -50,13 +50,14 @@ void AddSandboxTestCase(const char* test_name, MacSandboxTestCase* test_class) { } // namespace internal -bool MacSandboxTest:: RunTestInAllSandboxTypes(const char* test_name, - const char* test_data) { +bool MacSandboxTest::RunTestInAllSandboxTypes(const char* test_name, + const char* test_data) { // Go through all the sandbox types, and run the test case in each of them // if one fails, abort. for(int i = static_cast<int>(Sandbox::SANDBOX_TYPE_FIRST_TYPE); i < Sandbox::SANDBOX_AFTER_TYPE_LAST_TYPE; ++i) { + if (!RunTestInSandbox(static_cast<Sandbox::SandboxProcessType>(i), test_name, test_data)) { LOG(ERROR) << "Sandboxed test (" << test_name << ")" << @@ -143,7 +144,7 @@ MULTIPROCESS_TEST_MAIN(mac_sandbox_test_runner) { return -1; } - Sandbox::SandboxWarmup(); + Sandbox::SandboxWarmup(sandbox_type); if (!Sandbox::EnableSandbox(sandbox_type, FilePath())) { LOG(ERROR) << "Failed to initialize sandbox " << sandbox_type; diff --git a/chrome/common/sandbox_policy.cc b/chrome/common/sandbox_policy.cc index 75e6469..2667cf9 100644 --- a/chrome/common/sandbox_policy.cc +++ b/chrome/common/sandbox_policy.cc @@ -116,29 +116,28 @@ PluginPolicyCategory GetPolicyCategoryForPlugin( bool AddDirectory(int path, const wchar_t* sub_dir, bool children, sandbox::TargetPolicy::Semantics access, sandbox::TargetPolicy* policy) { - std::wstring directory; + FilePath directory; if (!PathService::Get(path, &directory)) return false; if (sub_dir) { - file_util::AppendToPath(&directory, sub_dir); + directory = directory.Append(sub_dir); file_util::AbsolutePath(&directory); } sandbox::ResultCode result; result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, access, - directory.c_str()); + directory.value().c_str()); if (result != sandbox::SBOX_ALL_OK) return false; + std::wstring directory_str = directory.value() + L"\\"; if (children) - file_util::AppendToPath(&directory, L"*"); - else - // Add the version of the path that ends with a separator. - file_util::AppendToPath(&directory, L""); + directory_str += L"*"; + // Otherwise, add the version of the path that ends with a separator. result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, access, - directory.c_str()); + directory_str.c_str()); if (result != sandbox::SBOX_ALL_OK) return false; @@ -198,10 +197,11 @@ bool AddGenericPolicy(sandbox::TargetPolicy* policy) { // Add the policy for debug message only in debug #ifndef NDEBUG - std::wstring debug_message; - if (!PathService::Get(chrome::DIR_APP, &debug_message)) + FilePath app_dir; + if (!PathService::Get(chrome::DIR_APP, &app_dir)) return false; - if (!win_util::ConvertToLongPath(debug_message, &debug_message)) + std::wstring debug_message; + if (!win_util::ConvertToLongPath(app_dir.value(), &debug_message)) return false; file_util::AppendToPath(&debug_message, L"debug_message.exe"); result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_PROCESS, @@ -532,7 +532,7 @@ base::ProcessHandle StartProcessWithAccess(CommandLine* cmd_line, if (!in_sandbox && (type == ChildProcessInfo::PLUGIN_PROCESS)) { in_sandbox = browser_command_line.HasSwitch(switches::kSafePlugins) || (IsBuiltInFlash(cmd_line, NULL) && - browser_command_line.HasSwitch(switches::kEnableFlashSandbox)); + !browser_command_line.HasSwitch(switches::kDisableFlashSandbox)); } if (browser_command_line.HasSwitch(switches::kNoSandbox)) { diff --git a/chrome/common/security_filter_peer.h b/chrome/common/security_filter_peer.h index 2559bf3..e82f748 100644 --- a/chrome/common/security_filter_peer.h +++ b/chrome/common/security_filter_peer.h @@ -110,10 +110,10 @@ class ReplaceContentPeer : public SecurityFilterPeer { virtual void OnReceivedResponse( const webkit_glue::ResourceResponseInfo& info, bool content_filtered); - void OnReceivedData(const char* data, int len); - void OnCompletedRequest(const URLRequestStatus& status, - const std::string& security_info, - const base::Time& completion_time); + virtual void OnReceivedData(const char* data, int len); + virtual void OnCompletedRequest(const URLRequestStatus& status, + const std::string& security_info, + const base::Time& completion_time); private: webkit_glue::ResourceResponseInfo response_info_; diff --git a/chrome/common/service_messages.cc b/chrome/common/service_messages.cc index 97a10fd..b221881 100644 --- a/chrome/common/service_messages.cc +++ b/chrome/common/service_messages.cc @@ -2,8 +2,46 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/common/remoting/chromoting_host_info.h" +#include "ipc/ipc_channel_handle.h" + +#define IPC_MESSAGE_IMPL #include "chrome/common/service_messages.h" -#define MESSAGES_INTERNAL_IMPL_FILE \ - "chrome/common/service_messages_internal.h" -#include "ipc/ipc_message_impl_macros.h" +namespace IPC { + +void ParamTraits<remoting::ChromotingHostInfo> ::Write( + Message* m, const param_type& p) { + WriteParam(m, p.host_id); + WriteParam(m, p.hostname); + WriteParam(m, p.public_key); + WriteParam(m, p.enabled); + WriteParam(m, p.login); +} + +bool ParamTraits<remoting::ChromotingHostInfo> ::Read( + const Message* m, void** iter, param_type* p) { + bool ret = ReadParam(m, iter, &p->host_id); + ret = ret && ReadParam(m, iter, &p->hostname); + ret = ret && ReadParam(m, iter, &p->public_key); + ret = ret && ReadParam(m, iter, &p->enabled); + ret = ret && ReadParam(m, iter, &p->login); + return ret; +} + +void ParamTraits<remoting::ChromotingHostInfo> ::Log( + const param_type& p, std::string* l) { + l->append("("); + LogParam(p.host_id, l); + l->append(", "); + LogParam(p.hostname, l); + l->append(", "); + LogParam(p.public_key, l); + l->append(", "); + LogParam(p.enabled, l); + l->append(", "); + LogParam(p.login, l); + l->append(")"); +} + +} // namespace IPC diff --git a/chrome/common/service_messages.h b/chrome/common/service_messages.h index d514bff..1f8d75e 100644 --- a/chrome/common/service_messages.h +++ b/chrome/common/service_messages.h @@ -5,10 +5,22 @@ #ifndef CHROME_COMMON_SERVICE_MESSAGES_H_ #define CHROME_COMMON_SERVICE_MESSAGES_H_ -#include "ipc/ipc_message_utils.h" +#include "chrome/common/service_messages_internal.h" -#define MESSAGES_INTERNAL_FILE "chrome/common/service_messages_internal.h" -#include "ipc/ipc_message_macros.h" +namespace remoting { +struct ChromotingHostInfo; +} // namespace remoting -#endif // CHROME_COMMON_SERVICE_MESSAGES_H_ +namespace IPC { + +template <> +struct ParamTraits<remoting::ChromotingHostInfo> { + typedef remoting::ChromotingHostInfo 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_SERVICE_MESSAGES_H_ diff --git a/chrome/common/service_messages_internal.h b/chrome/common/service_messages_internal.h index bb6e34d..94a0215 100644 --- a/chrome/common/service_messages_internal.h +++ b/chrome/common/service_messages_internal.h @@ -4,66 +4,67 @@ #include <string> -// This header is meant to be included in multiple passes, hence no traditional -// header guard. -// See ipc_message_macros.h for explanation of the macros and passes. - -// This file needs to be included again, even though we're actually included -// from it via utility_messages.h. #include "ipc/ipc_message_macros.h" +#include "chrome/common/remoting/chromoting_host_info.h" + +#define IPC_MESSAGE_START ServiceMsgStart + //------------------------------------------------------------------------------ // Service process messages: // These are messages from the browser to the service process. -IPC_BEGIN_MESSAGES(Service) +// Tell the service process to enable the cloud proxy passing in the lsid +// of the account to be used. +IPC_MESSAGE_CONTROL1(ServiceMsg_EnableCloudPrintProxy, + std::string /* lsid */) +// Tell the service process to enable the cloud proxy passing in specific +// tokens to be used. +IPC_MESSAGE_CONTROL2(ServiceMsg_EnableCloudPrintProxyWithTokens, + std::string, /* token for cloudprint service */ + std::string /* token for Google Talk service */) +// Tell the service process to disable the cloud proxy. +IPC_MESSAGE_CONTROL0(ServiceMsg_DisableCloudPrintProxy) - // Tell the service process to enable the cloud proxy passing in the lsid - // of the account to be used. - IPC_MESSAGE_CONTROL1(ServiceMsg_EnableCloudPrintProxy, - std::string /* lsid */) - // Tell the service process to enable the cloud proxy passing in specific - // tokens to be used. - IPC_MESSAGE_CONTROL2(ServiceMsg_EnableCloudPrintProxyWithTokens, - std::string, /* token for cloudprint service */ - std::string /* token for Google Talk service */) - // Tell the service process to disable the cloud proxy. - IPC_MESSAGE_CONTROL0(ServiceMsg_DisableCloudPrintProxy) +// Requests a message back on whether the cloud print proxy is +// enabled. +IPC_MESSAGE_CONTROL0(ServiceMsg_IsCloudPrintProxyEnabled) - // Requests a message back on whether the cloud print proxy is - // enabled. - IPC_MESSAGE_CONTROL0(ServiceMsg_IsCloudPrintProxyEnabled) +// This message is for testing purpose. +IPC_MESSAGE_CONTROL0(ServiceMsg_Hello) - // This message is for testing purpose. - IPC_MESSAGE_CONTROL0(ServiceMsg_Hello) +// Set credentials used by the RemotingHost. +IPC_MESSAGE_CONTROL2(ServiceMsg_SetRemotingHostCredentials, + std::string, /* username */ + std::string /* token for XMPP */) - // This message is for enabling the remoting process. - IPC_MESSAGE_CONTROL3(ServiceMsg_EnableRemotingWithTokens, - std::string, /* username */ - std::string, /* Token for remoting */ - std::string /* Token for Google Talk */) +// Enabled remoting host. +IPC_MESSAGE_CONTROL0(ServiceMsg_EnableRemotingHost) - // Tell the service process to shutdown. - IPC_MESSAGE_CONTROL0(ServiceMsg_Shutdown) +// Disable remoting host. +IPC_MESSAGE_CONTROL0(ServiceMsg_DisableRemotingHost) - // Tell the service process that an update is available. - IPC_MESSAGE_CONTROL0(ServiceMsg_UpdateAvailable) +// Get remoting host status information. +IPC_MESSAGE_CONTROL0(ServiceMsg_GetRemotingHostInfo) -IPC_END_MESSAGES(Service) +// Tell the service process to shutdown. +IPC_MESSAGE_CONTROL0(ServiceMsg_Shutdown) + +// Tell the service process that an update is available. +IPC_MESSAGE_CONTROL0(ServiceMsg_UpdateAvailable) //------------------------------------------------------------------------------ // Service process host messages: // These are messages from the service process to the browser. -IPC_BEGIN_MESSAGES(ServiceHost) - - // Sent when the cloud print proxy has an authentication error. - IPC_MESSAGE_CONTROL0(ServiceHostMsg_CloudPrintProxy_AuthError) +// Sent when the cloud print proxy has an authentication error. +IPC_MESSAGE_CONTROL0(ServiceHostMsg_CloudPrintProxy_AuthError) - // Sent as a response to a request for enablement status. - IPC_MESSAGE_CONTROL2(ServiceHostMsg_CloudPrintProxy_IsEnabled, - bool, /* Is the proxy enabled? */ - std::string /* Email address of account */) +// Sent as a response to a request for enablement status. +IPC_MESSAGE_CONTROL2(ServiceHostMsg_CloudPrintProxy_IsEnabled, + bool, /* Is the proxy enabled? */ + std::string /* Email address of account */) - // Sent from the service process in response to a Hello message. - IPC_MESSAGE_CONTROL0(ServiceHostMsg_GoodDay) +IPC_MESSAGE_CONTROL1(ServiceHostMsg_RemotingHost_HostInfo, + remoting::ChromotingHostInfo /* host_info */) -IPC_END_MESSAGES(ServiceHost) +// Sent from the service process in response to a Hello message. +IPC_MESSAGE_CONTROL0(ServiceHostMsg_GoodDay) diff --git a/chrome/common/service_process_util.cc b/chrome/common/service_process_util.cc index 489610a..bcbac69 100644 --- a/chrome/common/service_process_util.cc +++ b/chrome/common/service_process_util.cc @@ -6,14 +6,15 @@ #include "base/logging.h" #include "base/path_service.h" #include "base/process_util.h" +#include "base/singleton.h" #include "base/string16.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "base/version.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/service_process_util.h" -#include "chrome/installer/util/version.h" namespace { @@ -74,9 +75,7 @@ ServiceProcessRunningState GetServiceProcessRunningState( if (service_version_out) *service_version_out = version; - scoped_ptr<installer::Version> service_version; - service_version.reset( - installer::Version::GetVersionFromString(ASCIIToUTF16(version))); + scoped_ptr<Version> service_version(Version::GetVersionFromString(version)); // If the version string is invalid, treat it like an older version. if (!service_version.get()) return SERVICE_OLDER_VERSION_RUNNING; @@ -89,9 +88,8 @@ ServiceProcessRunningState GetServiceProcessRunningState( // are out of date. return SERVICE_NEWER_VERSION_RUNNING; } - scoped_ptr<installer::Version> running_version( - installer::Version::GetVersionFromString( - ASCIIToUTF16(version_info.Version()))); + scoped_ptr<Version> running_version(Version::GetVersionFromString( + version_info.Version())); if (!running_version.get()) { NOTREACHED() << "Failed to parse version info"; // Our own version is invalid. This is an error case. Pretend that we @@ -99,9 +97,9 @@ ServiceProcessRunningState GetServiceProcessRunningState( return SERVICE_NEWER_VERSION_RUNNING; } - if (running_version->IsHigherThan(service_version.get())) { + if (running_version->CompareTo(*service_version) > 0) { return SERVICE_OLDER_VERSION_RUNNING; - } else if (service_version->IsHigherThan(running_version.get())) { + } else if (service_version->CompareTo(*running_version) > 0) { return SERVICE_NEWER_VERSION_RUNNING; } return SERVICE_SAME_VERSION_RUNNING; @@ -156,6 +154,11 @@ ServiceProcessState::~ServiceProcessState() { TearDownState(); } +// static +ServiceProcessState* ServiceProcessState::GetInstance() { + return Singleton<ServiceProcessState>::get(); +} + bool ServiceProcessState::Initialize() { if (!TakeSingletonLock()) { return false; diff --git a/chrome/common/service_process_util.h b/chrome/common/service_process_util.h index 28304e1..6f2685e 100644 --- a/chrome/common/service_process_util.h +++ b/chrome/common/service_process_util.h @@ -12,6 +12,8 @@ #include "base/shared_memory.h" #include "base/task.h" +template <typename T> struct DefaultSingletonTraits; + // Return the IPC channel to connect to the service process. // std::string GetServiceProcessChannelName(); @@ -48,11 +50,11 @@ bool ForceServiceProcessShutdown(const std::string& version); // and this class are shared. class ServiceProcessState { public: - ServiceProcessState(); - ~ServiceProcessState(); + // Returns the singleton instance. + static ServiceProcessState* GetInstance(); // Tries to become the sole service process for the current user data dir. - // Returns false is another service process is already running. + // Returns false if another service process is already running. bool Initialize(); // Signal that the service process is ready. @@ -69,7 +71,10 @@ class ServiceProcessState { // Unregister the service process to run on startup. bool RemoveFromAutoRun(); + private: + ServiceProcessState(); + ~ServiceProcessState(); // Create the shared memory data for the service process. bool CreateSharedData(); @@ -95,6 +100,8 @@ class ServiceProcessState { struct StateData; StateData* state_; scoped_ptr<base::SharedMemory> shared_mem_service_data_; + + friend struct DefaultSingletonTraits<ServiceProcessState>; }; #endif // CHROME_COMMON_SERVICE_PROCESS_UTIL_H_ diff --git a/chrome/common/service_process_util_unittest.cc b/chrome/common/service_process_util_unittest.cc index 6000b5c..58b68e1 100644 --- a/chrome/common/service_process_util_unittest.cc +++ b/chrome/common/service_process_util_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/at_exit.h" #include "base/process_util.h" #include "base/string_util.h" #include "chrome/common/chrome_version_info.h" @@ -18,18 +19,28 @@ TEST(ServiceProcessUtilTest, ScopedVersionedName) { EXPECT_NE(std::string::npos, scoped_name.find(version_info.Version())); } +class ServiceProcessStateTest : public testing::Test { + private: + // This is used to release the ServiceProcessState singleton after each test. + base::ShadowingAtExitManager at_exit_manager_; +}; + #if defined(OS_WIN) // Singleton-ness is only implemented on Windows. -TEST(ServiceProcessStateTest, Singleton) { +// TODO(sanjeev): Rewrite this test to spawn a new process and test using the +// ServiceProcessState singleton across processes. +/* +TEST_F(ServiceProcessStateTest, Singleton) { ServiceProcessState state; EXPECT_TRUE(state.Initialize()); // The second instance should fail to Initialize. ServiceProcessState another_state; EXPECT_FALSE(another_state.Initialize()); } +*/ #endif // defined(OS_WIN) -TEST(ServiceProcessStateTest, ReadyState) { +TEST_F(ServiceProcessStateTest, ReadyState) { #if defined(OS_WIN) // On Posix, we use a lock file on disk to signal readiness. This lock file // could be lying around from previous crashes which could cause @@ -38,15 +49,15 @@ TEST(ServiceProcessStateTest, ReadyState) { // Posix, this check will only execute on Windows. EXPECT_FALSE(CheckServiceProcessReady()); #endif // defined(OS_WIN) - ServiceProcessState state; - EXPECT_TRUE(state.Initialize()); - state.SignalReady(NULL); + ServiceProcessState* state = ServiceProcessState::GetInstance(); + EXPECT_TRUE(state->Initialize()); + state->SignalReady(NULL); EXPECT_TRUE(CheckServiceProcessReady()); - state.SignalStopped(); + state->SignalStopped(); EXPECT_FALSE(CheckServiceProcessReady()); } -TEST(ServiceProcessStateTest, SharedMem) { +TEST_F(ServiceProcessStateTest, SharedMem) { #if defined(OS_WIN) // On Posix, named shared memory uses a file on disk. This file // could be lying around from previous crashes which could cause @@ -55,8 +66,8 @@ TEST(ServiceProcessStateTest, SharedMem) { // implementation on Posix, this check will only execute on Windows. EXPECT_EQ(0, GetServiceProcessPid()); #endif // defined(OS_WIN) - ServiceProcessState state; - EXPECT_TRUE(state.Initialize()); + ServiceProcessState* state = ServiceProcessState::GetInstance(); + EXPECT_TRUE(state->Initialize()); EXPECT_EQ(base::GetCurrentProcId(), GetServiceProcessPid()); } diff --git a/chrome/common/socket_stream_dispatcher.h b/chrome/common/socket_stream_dispatcher.h index e0bf58f..01c5421 100644 --- a/chrome/common/socket_stream_dispatcher.h +++ b/chrome/common/socket_stream_dispatcher.h @@ -9,10 +9,7 @@ #include <vector> #include "base/basictypes.h" - -namespace IPC { -class Message; -} +#include "ipc/ipc_channel.h" namespace WebKit { class WebSocketStreamHandle; @@ -27,7 +24,7 @@ class WebSocketStreamHandleDelegate; // main browser process. There is one instance per child process. Messages // are dispatched on the main child thread. The RenderThread class // creates an instance of SocketStreamDispatcher and delegates calls to it. -class SocketStreamDispatcher { +class SocketStreamDispatcher : public IPC::Channel::Listener { public: SocketStreamDispatcher(); ~SocketStreamDispatcher() {} @@ -35,6 +32,8 @@ class SocketStreamDispatcher { static webkit_glue::WebSocketStreamHandleBridge* CreateBridge( WebKit::WebSocketStreamHandle* handle, webkit_glue::WebSocketStreamHandleDelegate* delegate); + + // IPC::Channel::Listener implementation. bool OnMessageReceived(const IPC::Message& msg); private: diff --git a/chrome/common/sqlite_utils.cc b/chrome/common/sqlite_utils.cc index d11b925..9d16c7f 100644 --- a/chrome/common/sqlite_utils.cc +++ b/chrome/common/sqlite_utils.cc @@ -8,8 +8,8 @@ #include "base/file_path.h" #include "base/lock.h" +#include "base/lazy_instance.h" #include "base/logging.h" -#include "base/singleton.h" #include "base/stl_util-inl.h" #include "base/string16.h" @@ -76,10 +76,13 @@ class DefaultSQLErrorHandlerFactory : public SQLErrorHandlerFactory { Lock lock_; }; +static base::LazyInstance<DefaultSQLErrorHandlerFactory> + g_default_sql_error_handler_factory(base::LINKER_INITIALIZED); + SQLErrorHandlerFactory* GetErrorHandlerFactory() { // TODO(cpu): Testing needs to override the error handler. // Destruction of DefaultSQLErrorHandlerFactory handled by at_exit manager. - return Singleton<DefaultSQLErrorHandlerFactory>::get(); + return g_default_sql_error_handler_factory.Pointer(); } namespace sqlite_utils { diff --git a/chrome/common/time_format.cc b/chrome/common/time_format.cc index c62f4f5..9de3a40 100644 --- a/chrome/common/time_format.cc +++ b/chrome/common/time_format.cc @@ -7,9 +7,9 @@ #include <vector> #include "app/l10n_util.h" +#include "base/lazy_instance.h" #include "base/logging.h" #include "base/scoped_ptr.h" -#include "base/singleton.h" #include "base/stl_util-inl.h" #include "base/string16.h" #include "base/time.h" @@ -168,8 +168,7 @@ class TimeFormatter { STLDeleteContainerPointers(time_elapsed_formatter_.begin(), time_elapsed_formatter_.end()); } - friend class Singleton<TimeFormatter>; - friend struct DefaultSingletonTraits<TimeFormatter>; + friend struct base::DefaultLazyInstanceTraits<TimeFormatter>; std::vector<icu::PluralFormat*> short_formatter_; std::vector<icu::PluralFormat*> time_left_formatter_; @@ -182,6 +181,9 @@ class TimeFormatter { DISALLOW_COPY_AND_ASSIGN(TimeFormatter); }; +static base::LazyInstance<TimeFormatter> g_time_formatter( + base::LINKER_INITIALIZED); + void TimeFormatter::BuildFormats( FormatType format_type, std::vector<icu::PluralFormat*>* time_formats) { static const icu::UnicodeString kKeywords[] = { @@ -253,8 +255,6 @@ icu::PluralFormat* TimeFormatter::createFallbackFormat( return format; } -Singleton<TimeFormatter> time_formatter; - static string16 FormatTimeImpl(const TimeDelta& delta, FormatType format_type) { if (delta.ToInternalValue() < 0) { NOTREACHED() << "Negative duration"; @@ -264,7 +264,7 @@ static string16 FormatTimeImpl(const TimeDelta& delta, FormatType format_type) { int number; const std::vector<icu::PluralFormat*>& formatters = - time_formatter->formatter(format_type); + g_time_formatter.Get().formatter(format_type); UErrorCode error = U_ZERO_ERROR; icu::UnicodeString time_string; diff --git a/chrome/common/unix_domain_socket_posix.cc b/chrome/common/unix_domain_socket_posix.cc new file mode 100644 index 0000000..31f0135 --- /dev/null +++ b/chrome/common/unix_domain_socket_posix.cc @@ -0,0 +1,151 @@ +// 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 "chrome/common/unix_domain_socket_posix.h" + +#include <errno.h> +#include <unistd.h> +#include <sys/uio.h> +#include <sys/socket.h> + +#include "base/eintr_wrapper.h" +#include "base/logging.h" +#include "base/pickle.h" + +// static +bool UnixDomainSocket::SendMsg(int fd, + const void* buf, + size_t length, + const std::vector<int>& fds) { + struct msghdr msg; + memset(&msg, 0, sizeof(msg)); + struct iovec iov = {const_cast<void*>(buf), length}; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + + char* control_buffer = NULL; + if (fds.size()) { + const unsigned control_len = CMSG_SPACE(sizeof(int) * fds.size()); + control_buffer = new char[control_len]; + + struct cmsghdr *cmsg; + msg.msg_control = control_buffer; + msg.msg_controllen = control_len; + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int) * fds.size()); + memcpy(CMSG_DATA(cmsg), &fds[0], sizeof(int) * fds.size()); + msg.msg_controllen = cmsg->cmsg_len; + } + + const ssize_t r = HANDLE_EINTR(sendmsg(fd, &msg, 0)); + const bool ret = static_cast<ssize_t>(length) == r; + delete[] control_buffer; + return ret; +} + +// static +ssize_t UnixDomainSocket::RecvMsg(int fd, + void* buf, + size_t length, + std::vector<int>* fds) { + static const unsigned kMaxDescriptors = 16; + + fds->clear(); + + struct msghdr msg; + memset(&msg, 0, sizeof(msg)); + struct iovec iov = {buf, length}; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + + char control_buffer[CMSG_SPACE(sizeof(int) * kMaxDescriptors)]; + msg.msg_control = control_buffer; + msg.msg_controllen = sizeof(control_buffer); + + const ssize_t r = HANDLE_EINTR(recvmsg(fd, &msg, 0)); + if (r == -1) + return -1; + + int* wire_fds = NULL; + unsigned wire_fds_len = 0; + + if (msg.msg_controllen > 0) { + struct cmsghdr* cmsg; + for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) { + if (cmsg->cmsg_level == SOL_SOCKET && + cmsg->cmsg_type == SCM_RIGHTS) { + const unsigned payload_len = cmsg->cmsg_len - CMSG_LEN(0); + DCHECK(payload_len % sizeof(int) == 0); + wire_fds = reinterpret_cast<int*>(CMSG_DATA(cmsg)); + wire_fds_len = payload_len / sizeof(int); + break; + } + } + } + + if (msg.msg_flags & MSG_TRUNC || msg.msg_flags & MSG_CTRUNC) { + for (unsigned i = 0; i < wire_fds_len; ++i) + close(wire_fds[i]); + errno = EMSGSIZE; + return -1; + } + + fds->resize(wire_fds_len); + memcpy(&(*fds)[0], wire_fds, sizeof(int) * wire_fds_len); + + return r; +} + +// static +ssize_t UnixDomainSocket::SendRecvMsg(int fd, + uint8_t* reply, + unsigned max_reply_len, + int* result_fd, + const Pickle& request) { + int fds[2]; + + // This socketpair is only used for the IPC and is cleaned up before + // returning. + if (socketpair(AF_UNIX, SOCK_DGRAM, 0, fds) == -1) + return false; + + std::vector<int> fd_vector; + fd_vector.push_back(fds[1]); + if (!SendMsg(fd, request.data(), request.size(), fd_vector)) { + close(fds[0]); + close(fds[1]); + return -1; + } + close(fds[1]); + + fd_vector.clear(); + const ssize_t reply_len = RecvMsg(fds[0], reply, max_reply_len, &fd_vector); + close(fds[0]); + if (reply_len == -1) + return -1; + + if ((fd_vector.size() > 0 && result_fd == NULL) || fd_vector.size() > 1) { + for (std::vector<int>::const_iterator + i = fd_vector.begin(); i != fd_vector.end(); ++i) { + close(*i); + } + + NOTREACHED(); + + return -1; + } + + if (result_fd) { + if (fd_vector.size() == 0) { + *result_fd = -1; + } else { + *result_fd = fd_vector[0]; + } + } + + return reply_len; +} + diff --git a/chrome/common/unix_domain_socket_posix.h b/chrome/common/unix_domain_socket_posix.h new file mode 100644 index 0000000..405ca95 --- /dev/null +++ b/chrome/common/unix_domain_socket_posix.h @@ -0,0 +1,54 @@ +// 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 CHROME_COMMON_UNIX_DOMAIN_SOCKET_POSIX_H_ +#define CHROME_COMMON_UNIX_DOMAIN_SOCKET_POSIX_H_ +#pragma once + +#include <stdint.h> +#include <sys/types.h> +#include <vector> + +class Pickle; + +class UnixDomainSocket { + public: + // Use sendmsg to write the given msg and include a vector of file + // descriptors. Returns true if successful. + static bool SendMsg(int fd, + const void* msg, + size_t length, + const std::vector<int>& fds); + + // Use recvmsg to read a message and an array of file descriptors. Returns + // -1 on failure. Note: will read, at most, 16 descriptors. + static ssize_t RecvMsg(int fd, + void* msg, + size_t length, + std::vector<int>* fds); + + // Perform a sendmsg/recvmsg pair. + // 1. This process creates a UNIX DGRAM socketpair. + // 2. This proces writes a request to |fd| with an SCM_RIGHTS control + // message containing on end of the fresh socket pair. + // 3. This process blocks reading from the other end of the fresh + // socketpair. + // 4. The target process receives the request, processes it and writes the + // reply to the end of the socketpair contained in the request. + // 5. This process wakes up and continues. + // + // fd: descriptor to send the request on + // reply: buffer for the reply + // reply_len: size of |reply| + // result_fd: (may be NULL) the file descriptor returned in the reply + // (if any) + // request: the bytes to send in the request + static ssize_t SendRecvMsg(int fd, + uint8_t* reply, + unsigned reply_len, + int* result_fd, + const Pickle& request); +}; + +#endif // CHROME_COMMON_UNIX_DOMAIN_SOCKET_POSIX_H_ diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 6a1c6a2..12ab2de 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -54,6 +54,7 @@ const char kAboutCrashURL[] = "about:crash"; const char kAboutCreditsURL[] = "about:credits"; const char kAboutDNSURL[] = "about:dns"; const char kAboutFlagsURL[] = "about:flags"; +const char kAboutGpuURL[] = "about:gpu"; const char kAboutGpuCrashURL[] = "about:gpucrash"; const char kAboutGpuHangURL[] = "about:gpuhang"; const char kAboutHangURL[] = "about:hang"; @@ -113,10 +114,12 @@ const char kChromeUIDownloadsHost[] = "downloads"; const char kChromeUIExtensionsHost[] = "extensions"; const char kChromeUIFavIconHost[] = "favicon"; const char kChromeUIFlagsHost[] = "flags"; +const char kChromeUIGpuInternalsHost[] = "gpu-internals"; const char kChromeUIHistoryHost[] = "history"; const char kChromeUIHistory2Host[] = "history2"; const char kChromeUIInspectorHost[] = "inspector"; const char kChromeUIKeyboardHost[] = "keyboard"; +const char kChromeUILoginHost[] = "login"; const char kChromeUINetInternalsHost[] = "net-internals"; const char kChromeUINewTabHost[] = "newtab"; const char kChromeUIPluginsHost[] = "plugins"; @@ -158,6 +161,9 @@ const char kCloudPrintSetupHost[] = "cloudprintsetup"; const char kNetworkViewInternalsURL[] = "chrome://net-internals/"; const char kNetworkViewCacheURL[] = "chrome://view-http-cache/"; +// GPU sub pages +const char kGpuInternalsURL[] = "chrome://gpu-internals/"; + // Option sub pages. const char kAdvancedOptionsSubPage[] = "advanced"; const char kAutoFillSubPage[] = "autoFillOptions"; diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index 1980b6e..9b7c519 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -47,6 +47,7 @@ extern const char kAboutCrashURL[]; extern const char kAboutCreditsURL[]; extern const char kAboutDNSURL[]; extern const char kAboutFlagsURL[]; +extern const char kAboutGpuURL[]; extern const char kAboutGpuCrashURL[]; extern const char kAboutGpuHangURL[]; extern const char kAboutHangURL[]; @@ -105,9 +106,11 @@ extern const char kChromeUIDownloadsHost[]; extern const char kChromeUIExtensionsHost[]; extern const char kChromeUIFavIconHost[]; extern const char kChromeUIFlagsHost[]; +extern const char kChromeUIGpuInternalsHost[]; extern const char kChromeUIHistory2Host[]; extern const char kChromeUIHistoryHost[]; extern const char kChromeUIKeyboardHost[]; +extern const char kChromeUILoginHost[]; extern const char kChromeUINetInternalsHost[]; extern const char kChromeUINewTabHost[]; extern const char kChromeUIPluginsHost[]; @@ -154,6 +157,9 @@ extern const char kCloudPrintSetupHost[]; extern const char kNetworkViewCacheURL[]; extern const char kNetworkViewInternalsURL[]; +// GPU related URLs +extern const char kGpuInternalsURL[]; + // Options sub-pages. extern const char kAdvancedOptionsSubPage[]; extern const char kAutoFillSubPage[]; diff --git a/chrome/common/utility_messages.cc b/chrome/common/utility_messages.cc index b0cd5cc..ee079aa 100644 --- a/chrome/common/utility_messages.cc +++ b/chrome/common/utility_messages.cc @@ -2,15 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/utility_messages.h" - +#include "base/file_path.h" #include "base/values.h" #include "chrome/common/common_param_traits.h" #include "chrome/common/indexed_db_key.h" #include "chrome/common/serialized_script_value.h" -#include "base/file_path.h" -#include "third_party/skia/include/core/SkBitmap.h" -#define MESSAGES_INTERNAL_IMPL_FILE \ - "chrome/common/utility_messages_internal.h" -#include "ipc/ipc_message_impl_macros.h" +#define IPC_MESSAGE_IMPL +#include "chrome/common/utility_messages.h" diff --git a/chrome/common/utility_messages.h b/chrome/common/utility_messages.h index 49bc9ce..3e298d6 100644 --- a/chrome/common/utility_messages.h +++ b/chrome/common/utility_messages.h @@ -71,7 +71,6 @@ struct ParamTraits<UpdateManifest::Results> { } // namespace IPC -#define MESSAGES_INTERNAL_FILE "chrome/common/utility_messages_internal.h" -#include "ipc/ipc_message_macros.h" +#include "chrome/common/utility_messages_internal.h" #endif // CHROME_COMMON_UTILITY_MESSAGES_H_ diff --git a/chrome/common/utility_messages_internal.h b/chrome/common/utility_messages_internal.h index adb7077..5381155 100644 --- a/chrome/common/utility_messages_internal.h +++ b/chrome/common/utility_messages_internal.h @@ -5,17 +5,14 @@ #include <string> #include <vector> -// This header is meant to be included in multiple passes, hence no traditional -// header guard. It is included by utility_messages_internal.h -// See ipc_message_macros.h for explanation of the macros and passes. - -// This file needs to be included again, even though we're actually included -// from it via utility_messages.h. -#include "ipc/ipc_message_macros.h" - #include "base/platform_file.h" #include "gfx/rect.h" +#include "ipc/ipc_message_macros.h" +#include "printing/backend/print_backend.h" #include "printing/page_range.h" +#include "third_party/skia/include/core/SkBitmap.h" + +#define IPC_MESSAGE_START NaClMsgStart class FilePath; class IndexedDBKey; @@ -25,118 +22,129 @@ class SkBitmap; //------------------------------------------------------------------------------ // Utility process messages: // These are messages from the browser to the utility process. -IPC_BEGIN_MESSAGES(Utility) - - // Tell the utility process to unpack the given extension file in its - // directory and verify that it is valid. - IPC_MESSAGE_CONTROL1(UtilityMsg_UnpackExtension, - FilePath /* extension_filename */) - - // Tell the utility process to parse the given JSON data and verify its - // validity. - IPC_MESSAGE_CONTROL1(UtilityMsg_UnpackWebResource, - std::string /* JSON data */) - - // Tell the utility process to parse the given xml document. - IPC_MESSAGE_CONTROL1(UtilityMsg_ParseUpdateManifest, - std::string /* xml document contents */) - - // Tell the utility process to decode the given image data. - IPC_MESSAGE_CONTROL1(UtilityMsg_DecodeImage, - std::vector<unsigned char>) // encoded image contents - - // Tell the utility process to render the given PDF into a metafile. - IPC_MESSAGE_CONTROL5(UtilityMsg_RenderPDFPagesToMetafile, - base::PlatformFile, // PDF file - FilePath, // Location for output metafile - gfx::Rect, // Render Area - int, // DPI - std::vector<printing::PageRange>) - - // Tell the utility process to extract the given IDBKeyPath from the - // SerializedScriptValue vector and reply with the corresponding IDBKeys. - IPC_MESSAGE_CONTROL3(UtilityMsg_IDBKeysFromValuesAndKeyPath, - int, // id - std::vector<SerializedScriptValue>, - string16) // IDBKeyPath - - // Tells the utility process that it's running in batch mode. - IPC_MESSAGE_CONTROL0(UtilityMsg_BatchMode_Started) - - // Tells the utility process that it can shutdown. - IPC_MESSAGE_CONTROL0(UtilityMsg_BatchMode_Finished) - -IPC_END_MESSAGES(Utility) +// Tell the utility process to unpack the given extension file in its +// directory and verify that it is valid. +IPC_MESSAGE_CONTROL1(UtilityMsg_UnpackExtension, + FilePath /* extension_filename */) + +// Tell the utility process to parse the given JSON data and verify its +// validity. +IPC_MESSAGE_CONTROL1(UtilityMsg_UnpackWebResource, + std::string /* JSON data */) + +// Tell the utility process to parse the given xml document. +IPC_MESSAGE_CONTROL1(UtilityMsg_ParseUpdateManifest, + std::string /* xml document contents */) + +// Tell the utility process to decode the given image data. +IPC_MESSAGE_CONTROL1(UtilityMsg_DecodeImage, + std::vector<unsigned char>) // encoded image contents + +// Tell the utility process to render the given PDF into a metafile. +IPC_MESSAGE_CONTROL5(UtilityMsg_RenderPDFPagesToMetafile, + base::PlatformFile, // PDF file + FilePath, // Location for output metafile + gfx::Rect, // Render Area + int, // DPI + std::vector<printing::PageRange>) + +// Tell the utility process to extract the given IDBKeyPath from the +// SerializedScriptValue vector and reply with the corresponding IDBKeys. +IPC_MESSAGE_CONTROL3(UtilityMsg_IDBKeysFromValuesAndKeyPath, + int, // id + std::vector<SerializedScriptValue>, + string16) // IDBKeyPath + +// Tells the utility process that it's running in batch mode. +IPC_MESSAGE_CONTROL0(UtilityMsg_BatchMode_Started) + +// Tells the utility process that it can shutdown. +IPC_MESSAGE_CONTROL0(UtilityMsg_BatchMode_Finished) + +// Tells the utility process to get capabilities and defaults for the specified +// printer. Used on Windows to isolate the service process from printer driver +// crashes by executing this in a separate process. This does not run in a +// sandbox. +IPC_MESSAGE_CONTROL1(UtilityMsg_GetPrinterCapsAndDefaults, + std::string /* printer name */) //------------------------------------------------------------------------------ // Utility process host messages: // These are messages from the utility process to the browser. -IPC_BEGIN_MESSAGES(UtilityHost) - - // Reply when the utility process is done unpacking an extension. |manifest| - // is the parsed manifest.json file. - // The unpacker should also have written out files containing the decoded - // images and message catalogs from the extension. See ExtensionUnpacker for - // details. - IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackExtension_Succeeded, - DictionaryValue /* manifest */) - - // Reply when the utility process has failed while unpacking an extension. - // |error_message| is a user-displayable explanation of what went wrong. - IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackExtension_Failed, - std::string /* error_message, if any */) - - // Reply when the utility process is done unpacking and parsing JSON data - // from a web resource. - IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackWebResource_Succeeded, - DictionaryValue /* json data */) - - // Reply when the utility process has failed while unpacking and parsing a - // web resource. |error_message| is a user-readable explanation of what - // went wrong. - IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackWebResource_Failed, - std::string /* error_message, if any */) - - // Reply when the utility process has succeeded in parsing an update manifest - // xml document. - IPC_MESSAGE_CONTROL1(UtilityHostMsg_ParseUpdateManifest_Succeeded, - UpdateManifest::Results /* updates */) - - // Reply when an error occured parsing the update manifest. |error_message| - // is a description of what went wrong suitable for logging. - IPC_MESSAGE_CONTROL1(UtilityHostMsg_ParseUpdateManifest_Failed, - std::string /* error_message, if any */) - - // Reply when the utility process has succeeded in decoding the image. - IPC_MESSAGE_CONTROL1(UtilityHostMsg_DecodeImage_Succeeded, - SkBitmap) // decoded image - - // Reply when an error occured decoding the image. - IPC_MESSAGE_CONTROL0(UtilityHostMsg_DecodeImage_Failed) - - // Reply when the utility process has succeeded in rendering the PDF. - IPC_MESSAGE_CONTROL1(UtilityHostMsg_RenderPDFPagesToMetafile_Succeeded, - int) // Highest rendered page number - - // Reply when an error occured rendering the PDF. - IPC_MESSAGE_CONTROL0(UtilityHostMsg_RenderPDFPagesToMetafile_Failed) +// Reply when the utility process is done unpacking an extension. |manifest| +// is the parsed manifest.json file. +// The unpacker should also have written out files containing the decoded +// images and message catalogs from the extension. See ExtensionUnpacker for +// details. +IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackExtension_Succeeded, + DictionaryValue /* manifest */) + +// Reply when the utility process has failed while unpacking an extension. +// |error_message| is a user-displayable explanation of what went wrong. +IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackExtension_Failed, + std::string /* error_message, if any */) + +// Reply when the utility process is done unpacking and parsing JSON data +// from a web resource. +IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackWebResource_Succeeded, + DictionaryValue /* json data */) + +// Reply when the utility process has failed while unpacking and parsing a +// web resource. |error_message| is a user-readable explanation of what +// went wrong. +IPC_MESSAGE_CONTROL1(UtilityHostMsg_UnpackWebResource_Failed, + std::string /* error_message, if any */) + +// Reply when the utility process has succeeded in parsing an update manifest +// xml document. +IPC_MESSAGE_CONTROL1(UtilityHostMsg_ParseUpdateManifest_Succeeded, + UpdateManifest::Results /* updates */) + +// Reply when an error occured parsing the update manifest. |error_message| +// is a description of what went wrong suitable for logging. +IPC_MESSAGE_CONTROL1(UtilityHostMsg_ParseUpdateManifest_Failed, + std::string /* error_message, if any */) + +// Reply when the utility process has succeeded in decoding the image. +IPC_MESSAGE_CONTROL1(UtilityHostMsg_DecodeImage_Succeeded, + SkBitmap) // decoded image + +// Reply when an error occured decoding the image. +IPC_MESSAGE_CONTROL0(UtilityHostMsg_DecodeImage_Failed) + +// Reply when the utility process has succeeded in rendering the PDF. +IPC_MESSAGE_CONTROL1(UtilityHostMsg_RenderPDFPagesToMetafile_Succeeded, + int) // Highest rendered page number + +// Reply when an error occured rendering the PDF. +IPC_MESSAGE_CONTROL0(UtilityHostMsg_RenderPDFPagesToMetafile_Failed) #if defined(OS_WIN) - // Request that the given font be loaded by the host so it's cached by the - // OS. Please see ChildProcessHost::PreCacheFont for details. - IPC_SYNC_MESSAGE_CONTROL1_0(UtilityHostMsg_PreCacheFont, - LOGFONT /* font data */) +// Request that the given font be loaded by the host so it's cached by the +// OS. Please see ChildProcessHost::PreCacheFont for details. +IPC_SYNC_MESSAGE_CONTROL1_0(UtilityHostMsg_PreCacheFont, + LOGFONT /* font data */) #endif // defined(OS_WIN) - // Reply when the utility process has succeeded in obtaining the value for - // IDBKeyPath. - IPC_MESSAGE_CONTROL2(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded, - int /* id */, - std::vector<IndexedDBKey> /* value */) +// Reply when the utility process has succeeded in obtaining the value for +// IDBKeyPath. +IPC_MESSAGE_CONTROL2(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded, + int /* id */, + std::vector<IndexedDBKey> /* value */) + +// Reply when the utility process has failed in obtaining the value for +// IDBKeyPath. +IPC_MESSAGE_CONTROL1(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Failed, + int /* id */) + +// Reply when the utility process has succeeded in obtaining the printer +// capabilities and defaults. +IPC_MESSAGE_CONTROL2(UtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded, + std::string /* printer name */, + printing::PrinterCapsAndDefaults) - // Reply when the utility process has failed in obtaining the value for - // IDBKeyPath. - IPC_MESSAGE_CONTROL1(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Failed, - int /* id */) +// Reply when the utility process has failed to obtain the printer +// capabilities and defaults. +IPC_MESSAGE_CONTROL1(UtilityHostMsg_GetPrinterCapsAndDefaults_Failed, + std::string /* printer name */) -IPC_END_MESSAGES(UtilityHost) diff --git a/chrome/common/web_database_observer_impl.cc b/chrome/common/web_database_observer_impl.cc index 8c008e4..b683b72 100644 --- a/chrome/common/web_database_observer_impl.cc +++ b/chrome/common/web_database_observer_impl.cc @@ -7,8 +7,9 @@ #include "base/auto_reset.h" #include "base/message_loop.h" #include "base/string16.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/database_messages.h" #include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h" +#include "third_party/WebKit/WebKit/chromium/public/WebString.h" WebDatabaseObserverImpl::WebDatabaseObserverImpl( IPC::Message::Sender* sender) @@ -20,7 +21,7 @@ void WebDatabaseObserverImpl::databaseOpened( const WebKit::WebDatabase& database) { string16 origin_identifier = database.securityOrigin().databaseIdentifier(); string16 database_name = database.name(); - sender_->Send(new ViewHostMsg_DatabaseOpened( + sender_->Send(new DatabaseHostMsg_Opened( origin_identifier, database_name, database.displayName(), database.estimatedSize())); database_connections_.AddConnection(origin_identifier, database_name); @@ -28,7 +29,7 @@ void WebDatabaseObserverImpl::databaseOpened( void WebDatabaseObserverImpl::databaseModified( const WebKit::WebDatabase& database) { - sender_->Send(new ViewHostMsg_DatabaseModified( + sender_->Send(new DatabaseHostMsg_Modified( database.securityOrigin().databaseIdentifier(), database.name())); } @@ -36,7 +37,7 @@ void WebDatabaseObserverImpl::databaseClosed( const WebKit::WebDatabase& database) { string16 origin_identifier = database.securityOrigin().databaseIdentifier(); string16 database_name = database.name(); - sender_->Send(new ViewHostMsg_DatabaseClosed( + sender_->Send(new DatabaseHostMsg_Closed( origin_identifier, database_name)); database_connections_.RemoveConnection(origin_identifier, database_name); if (waiting_for_dbs_to_close_ && database_connections_.IsEmpty()) diff --git a/chrome/common/webmessageportchannel_impl.cc b/chrome/common/webmessageportchannel_impl.cc index b7a9388..0778871 100644 --- a/chrome/common/webmessageportchannel_impl.cc +++ b/chrome/common/webmessageportchannel_impl.cc @@ -180,11 +180,14 @@ void WebMessagePortChannelImpl::Send(IPC::Message* message) { ChildThread::current()->Send(message); } -void WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) { +bool WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebMessagePortChannelImpl, message) IPC_MESSAGE_HANDLER(WorkerProcessMsg_Message, OnMessage) IPC_MESSAGE_HANDLER(WorkerProcessMsg_MessagesQueued, OnMessagedQueued) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void WebMessagePortChannelImpl::OnMessage( diff --git a/chrome/common/webmessageportchannel_impl.h b/chrome/common/webmessageportchannel_impl.h index 3c96fc3..0199ebb 100644 --- a/chrome/common/webmessageportchannel_impl.h +++ b/chrome/common/webmessageportchannel_impl.h @@ -48,7 +48,7 @@ class WebMessagePortChannelImpl void Send(IPC::Message* message); // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); void OnMessage(const string16& message, const std::vector<int>& sent_message_port_ids, diff --git a/chrome/common/worker_messages.cc b/chrome/common/worker_messages.cc index 192e4fd..19b8d23 100644 --- a/chrome/common/worker_messages.cc +++ b/chrome/common/worker_messages.cc @@ -2,13 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/worker_messages.h" - #include "chrome/common/common_param_traits.h" -#define MESSAGES_INTERNAL_IMPL_FILE \ - "chrome/common/worker_messages_internal.h" -#include "ipc/ipc_message_impl_macros.h" +#define IPC_MESSAGE_IMPL +#include "chrome/common/worker_messages.h" WorkerHostMsg_PostConsoleMessageToWorkerObject_Params:: WorkerHostMsg_PostConsoleMessageToWorkerObject_Params() diff --git a/chrome/common/worker_messages.h b/chrome/common/worker_messages.h index 0e76c4f..28fec62 100644 --- a/chrome/common/worker_messages.h +++ b/chrome/common/worker_messages.h @@ -71,7 +71,6 @@ struct ParamTraits<WorkerProcessMsg_CreateWorker_Params> { } // namespace IPC -#define MESSAGES_INTERNAL_FILE "chrome/common/worker_messages_internal.h" -#include "ipc/ipc_message_macros.h" +#include "chrome/common/worker_messages_internal.h" #endif // CHROME_COMMON_WORKER_MESSAGES_H_ diff --git a/chrome/common/worker_messages_internal.h b/chrome/common/worker_messages_internal.h index 5d0cb62..e661f67 100644 --- a/chrome/common/worker_messages_internal.h +++ b/chrome/common/worker_messages_internal.h @@ -8,128 +8,122 @@ #include "googleurl/src/gurl.h" #include "ipc/ipc_message_macros.h" +#define IPC_MESSAGE_START WorkerMsgStart //----------------------------------------------------------------------------- // WorkerProcess messages // These are messages sent from the browser to the worker process. -IPC_BEGIN_MESSAGES(WorkerProcess) - IPC_MESSAGE_CONTROL1(WorkerProcessMsg_CreateWorker, - WorkerProcessMsg_CreateWorker_Params) +IPC_MESSAGE_CONTROL1(WorkerProcessMsg_CreateWorker, + WorkerProcessMsg_CreateWorker_Params) - // Note: these Message Port related messages can also be sent to the - // renderer process. Putting them here since we don't have a shared place - // like common_messages_internal.h - IPC_MESSAGE_ROUTED3(WorkerProcessMsg_Message, - string16 /* message */, - std::vector<int> /* sent_message_port_ids */, - std::vector<int> /* new_routing_ids */) +// Note: these Message Port related messages can also be sent to the +// renderer process. Putting them here since we don't have a shared place +// like common_messages_internal.h +IPC_MESSAGE_ROUTED3(WorkerProcessMsg_Message, + string16 /* message */, + std::vector<int> /* sent_message_port_ids */, + std::vector<int> /* new_routing_ids */) - // Tells the Message Port Channel object that there are no more in-flight - // messages arriving. - IPC_MESSAGE_ROUTED0(WorkerProcessMsg_MessagesQueued) -IPC_END_MESSAGES(WorkerProcess) +// Tells the Message Port Channel object that there are no more in-flight +// messages arriving. +IPC_MESSAGE_ROUTED0(WorkerProcessMsg_MessagesQueued) //----------------------------------------------------------------------------- // WorkerProcessHost messages // These are messages sent from the worker process to the browser process. -IPC_BEGIN_MESSAGES(WorkerProcessHost) - // Note: these Message Port related messages can also be sent out from the - // renderer process. Putting them here since we don't have a shared place - // like common_messages_internal.h - - // Creates a new Message Port Channel object. The first paramaeter is the - // message port channel's routing id in this process. The second parameter - // is the process-wide-unique identifier for that port. - IPC_SYNC_MESSAGE_CONTROL0_2(WorkerProcessHostMsg_CreateMessagePort, - int /* route_id */, - int /* message_port_id */) - - // Sent when a Message Port Channel object is destroyed. - IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_DestroyMessagePort, - int /* message_port_id */) - - // Sends a message to a message port. Optionally sends a message port as - // as well if sent_message_port_id != MSG_ROUTING_NONE. - IPC_MESSAGE_CONTROL3(WorkerProcessHostMsg_PostMessage, - int /* sender_message_port_id */, - string16 /* message */, - std::vector<int> /* sent_message_port_ids */) - - // Causes messages sent to the remote port to be delivered to this local port. - IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_Entangle, - int /* local_message_port_id */, - int /* remote_message_port_id */) - - // Causes the browser to queue messages sent to this port until the the port - // has made sure that all in-flight messages were routed to the new - // destination. - IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_QueueMessages, - int /* message_port_id */) - - // Sends the browser all the queued messages that arrived at this message port - // after it was sent in a postMessage call. - // NOTE: MSVS can't compile the macro if std::vector<std::pair<string16, int> > - // is used, so we typedef it in worker_messages.h. - IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_SendQueuedMessages, - int /* message_port_id */, - std::vector<QueuedMessage> /* queued_messages */) - - // Sent by the worker process to check whether access to web databases is - // granted by content settings. - IPC_SYNC_MESSAGE_ROUTED4_1(WorkerProcessHostMsg_AllowDatabase, - GURL /* origin url */, - string16 /* database name */, - string16 /* database display name */, - unsigned long /* estimated size */, - bool /* result */) -IPC_END_MESSAGES(WorkerProcessHost) +// Note: these Message Port related messages can also be sent out from the +// renderer process. Putting them here since we don't have a shared place +// like common_messages_internal.h + +// Creates a new Message Port Channel object. The first paramaeter is the +// message port channel's routing id in this process. The second parameter +// is the process-wide-unique identifier for that port. +IPC_SYNC_MESSAGE_CONTROL0_2(WorkerProcessHostMsg_CreateMessagePort, + int /* route_id */, + int /* message_port_id */) + +// Sent when a Message Port Channel object is destroyed. +IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_DestroyMessagePort, + int /* message_port_id */) + +// Sends a message to a message port. Optionally sends a message port as +// as well if sent_message_port_id != MSG_ROUTING_NONE. +IPC_MESSAGE_CONTROL3(WorkerProcessHostMsg_PostMessage, + int /* sender_message_port_id */, + string16 /* message */, + std::vector<int> /* sent_message_port_ids */) + +// Causes messages sent to the remote port to be delivered to this local port. +IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_Entangle, + int /* local_message_port_id */, + int /* remote_message_port_id */) + +// Causes the browser to queue messages sent to this port until the the port +// has made sure that all in-flight messages were routed to the new +// destination. +IPC_MESSAGE_CONTROL1(WorkerProcessHostMsg_QueueMessages, + int /* message_port_id */) + +// Sends the browser all the queued messages that arrived at this message port +// after it was sent in a postMessage call. +// NOTE: MSVS can't compile the macro if std::vector<std::pair<string16, int> > +// is used, so we typedef it in worker_messages.h. +IPC_MESSAGE_CONTROL2(WorkerProcessHostMsg_SendQueuedMessages, + int /* message_port_id */, + std::vector<QueuedMessage> /* queued_messages */) + +// Sent by the worker process to check whether access to web databases is +// granted by content settings. +IPC_SYNC_MESSAGE_CONTROL5_1(WorkerProcessHostMsg_AllowDatabase, + int /* worker_route_id */, + GURL /* origin url */, + string16 /* database name */, + string16 /* database display name */, + unsigned long /* estimated size */, + bool /* result */) //----------------------------------------------------------------------------- // Worker messages // These are messages sent from the renderer process to the worker process. -IPC_BEGIN_MESSAGES(Worker) - IPC_MESSAGE_ROUTED3(WorkerMsg_StartWorkerContext, - GURL /* url */, - string16 /* user_agent */, - string16 /* source_code */) +IPC_MESSAGE_ROUTED3(WorkerMsg_StartWorkerContext, + GURL /* url */, + string16 /* user_agent */, + string16 /* source_code */) - IPC_MESSAGE_ROUTED0(WorkerMsg_TerminateWorkerContext) +IPC_MESSAGE_ROUTED0(WorkerMsg_TerminateWorkerContext) - IPC_MESSAGE_ROUTED3(WorkerMsg_PostMessage, - string16 /* message */, - std::vector<int> /* sent_message_port_ids */, - std::vector<int> /* new_routing_ids */) +IPC_MESSAGE_ROUTED3(WorkerMsg_PostMessage, + string16 /* message */, + std::vector<int> /* sent_message_port_ids */, + std::vector<int> /* new_routing_ids */) - IPC_MESSAGE_ROUTED2(WorkerMsg_Connect, - int /* sent_message_port_id */, - int /* routing_id */) +IPC_MESSAGE_ROUTED2(WorkerMsg_Connect, + int /* sent_message_port_id */, + int /* routing_id */) - IPC_MESSAGE_ROUTED0(WorkerMsg_WorkerObjectDestroyed) -IPC_END_MESSAGES(Worker) +IPC_MESSAGE_ROUTED0(WorkerMsg_WorkerObjectDestroyed) //----------------------------------------------------------------------------- // WorkerHost messages // These are messages sent from the worker process to the renderer process. -IPC_BEGIN_MESSAGES(WorkerHost) - // WorkerMsg_PostMessage is also sent here. - IPC_MESSAGE_ROUTED3(WorkerHostMsg_PostExceptionToWorkerObject, - string16 /* error_message */, - int /* line_number */, - string16 /* source_url*/) - - IPC_MESSAGE_ROUTED1(WorkerHostMsg_PostConsoleMessageToWorkerObject, - WorkerHostMsg_PostConsoleMessageToWorkerObject_Params) - - IPC_MESSAGE_ROUTED1(WorkerHostMsg_ConfirmMessageFromWorkerObject, - bool /* bool has_pending_activity */) - - IPC_MESSAGE_ROUTED1(WorkerHostMsg_ReportPendingActivity, - bool /* bool has_pending_activity */) - - IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextClosed, - int /* worker_route_id */) - IPC_MESSAGE_ROUTED0(WorkerHostMsg_WorkerContextDestroyed) -IPC_END_MESSAGES(WorkerHost) +// WorkerMsg_PostMessage is also sent here. +IPC_MESSAGE_ROUTED3(WorkerHostMsg_PostExceptionToWorkerObject, + string16 /* error_message */, + int /* line_number */, + string16 /* source_url*/) + +IPC_MESSAGE_ROUTED1(WorkerHostMsg_PostConsoleMessageToWorkerObject, + WorkerHostMsg_PostConsoleMessageToWorkerObject_Params) + +IPC_MESSAGE_ROUTED1(WorkerHostMsg_ConfirmMessageFromWorkerObject, + bool /* bool has_pending_activity */) + +IPC_MESSAGE_ROUTED1(WorkerHostMsg_ReportPendingActivity, + bool /* bool has_pending_activity */) + +IPC_MESSAGE_CONTROL1(WorkerHostMsg_WorkerContextClosed, + int /* worker_route_id */) +IPC_MESSAGE_ROUTED0(WorkerHostMsg_WorkerContextDestroyed) |