diff options
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/accessibility.h | 86 | ||||
-rw-r--r-- | chrome/common/common.scons | 1 | ||||
-rw-r--r-- | chrome/common/common.vcproj | 4 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 159 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 11 | ||||
-rw-r--r-- | chrome/common/resource_dispatcher.cc | 5 | ||||
-rw-r--r-- | chrome/common/resource_dispatcher.h | 8 | ||||
-rw-r--r-- | chrome/common/resource_dispatcher_unittest.cc | 3 |
8 files changed, 122 insertions, 155 deletions
diff --git a/chrome/common/accessibility.h b/chrome/common/accessibility.h new file mode 100644 index 0000000..11272a5 --- /dev/null +++ b/chrome/common/accessibility.h @@ -0,0 +1,86 @@ +// Copyright (c) 2006-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. + +#ifndef CHROME_COMMON_ACCESSIBILITY_H_ +#define CHROME_COMMON_ACCESSIBILITY_H_ + +// This defines an enumeration of IDs that can uniquely identify a call to a +// specific IAccessible function. Should match the support implemented in WebKit +// (functions marked with return value E_NOTIMPL are also excluded). +enum IAccessibleID { + IACCESSIBLE_FUNC_NONE = 0, + + // Supported IAccessible interface functions. + IACCESSIBLE_FUNC_ACCDODEFAULTACTION, + IACCESSIBLE_FUNC_ACCHITTEST, + IACCESSIBLE_FUNC_ACCLOCATION, + IACCESSIBLE_FUNC_ACCNAVIGATE, + IACCESSIBLE_FUNC_GET_ACCCHILD, + IACCESSIBLE_FUNC_GET_ACCCHILDCOUNT, + IACCESSIBLE_FUNC_GET_ACCDEFAULTACTION, + IACCESSIBLE_FUNC_GET_ACCDESCRIPTION, + IACCESSIBLE_FUNC_GET_ACCFOCUS, + IACCESSIBLE_FUNC_GET_ACCHELP, + IACCESSIBLE_FUNC_GET_ACCKEYBOARDSHORTCUT, + IACCESSIBLE_FUNC_GET_ACCNAME, + IACCESSIBLE_FUNC_GET_ACCPARENT, + IACCESSIBLE_FUNC_GET_ACCROLE, + IACCESSIBLE_FUNC_GET_ACCSTATE, + IACCESSIBLE_FUNC_GET_ACCVALUE + + // The deprecated put_accName and put_accValue are not supported here, nor is + // accSelect, get_accHelpTopic and get_accSelection (matching WebKit's + // support). +}; + +// Parameters structure to hold a union of the possible IAccessible function +// INPUT variables, with the unused fields always set to default value. Used in +// ViewMsg_GetAccessibilityInfo, as only parameter. +struct AccessibilityInParams { + // Identifier to uniquely distinguish which instance of IAccessible is being + // called upon on the renderer side. + int iaccessible_id; + + // Identifier to resolve which IAccessible interface function is being called. + int iaccessible_function_id; + + // Function input parameters. + // Input VARIANT structure's LONG field to specify requested object. + long input_variant_lval; + + // LONG input parameters, used differently depending on the function called. + long input_long1; + long input_long2; +}; + +// Parameters structure to hold a union of the possible IAccessible function +// OUTPUT variables, with the unused fields always set to default value. Used in +// ViewHostMsg_GetAccessibilityInfoResponse, as only parameter. +struct AccessibilityOutParams { + // Identifier to uniquely distinguish which instance of IAccessible is being + // called upon on the renderer side. + int iaccessible_id; + + // Function output parameters. + // Output VARIANT structure's LONG field to specify requested object. + long output_variant_lval; + + // LONG output parameters, used differently depending on the function called. + // output_long1 can in some cases be set to -1 to indicate that the child + // object found by the called IAccessible function is not a simple object. + long output_long1; + long output_long2; + long output_long3; + long output_long4; + + // String output parameter. + std::wstring output_string; + + // Return code, either S_OK (true) or S_FALSE (false). WebKit MSAA error + // return codes (E_POINTER, E_INVALIDARG, E_FAIL, E_NOTIMPL) must be handled + // on the browser side by input validation. + bool return_code; +}; + +#endif // CHROME_COMMON_ACCESSIBILITY_H_ diff --git a/chrome/common/common.scons b/chrome/common/common.scons index 9066f8e..23fa414 100644 --- a/chrome/common/common.scons +++ b/chrome/common/common.scons @@ -99,6 +99,7 @@ input_files = ChromeFileList([ 'render_messages.h', 'render_messages_internal.h', ]), + 'accessibility.h', 'animation.cc', 'animation.h', 'child_process.cc', diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj index c3986d2b..9557647 100644 --- a/chrome/common/common.vcproj +++ b/chrome/common/common.vcproj @@ -314,6 +314,10 @@ </File> </Filter> <File + RelativePath=".\accessibility.h" + > + </File> + <File RelativePath=".\animation.cc" > </File> diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index c1f056a..b2ef967 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -13,6 +13,8 @@ #include "base/gfx/native_widget_types.h" #include "base/ref_counted.h" #include "base/shared_memory.h" +#include "chrome/browser/renderer_host/resource_handler.h" +#include "chrome/common/accessibility.h" #include "chrome/common/bitmap_wire_data.h" #include "chrome/common/filter_policy.h" #include "chrome/common/ipc_message_utils.h" @@ -23,7 +25,7 @@ #include "net/url_request/url_request_status.h" #include "webkit/glue/autofill_form.h" #include "webkit/glue/cache_manager.h" -#include "webkit/glue/context_node_types.h" +#include "webkit/glue/context_menu.h" #include "webkit/glue/form_data.h" #include "webkit/glue/password_form.h" #include "webkit/glue/password_form_dom_manager.h" @@ -121,61 +123,6 @@ struct ViewHostMsg_FrameNavigate_Params { bool is_content_filtered; }; -// Parameters structure for ViewHostMsg_ContextMenu, which has too many data -// parameters to be reasonably put in a predefined IPC message. -// FIXME(beng): This would be more useful in the future and more efficient -// if the parameters here weren't so literally mapped to what -// they contain for the ContextMenu task. It might be better -// to make the string fields more generic so that this object -// could be used for more contextual actions. -struct ViewHostMsg_ContextMenu_Params { - // This is the type of Context Node that the context menu was invoked on. - ContextNode node; - - // These values represent the coordinates of the mouse when the context menu - // was invoked. Coords are relative to the associated RenderView's origin. - int x; - int y; - - // This is the URL of the link that encloses the node the context menu was - // invoked on. - GURL link_url; - - // This is the URL of the image the context menu was invoked on. - GURL image_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; - - // This is the text of the selection that the context menu was invoked on. - std::wstring selection_text; - - // The misspelled word under the cursor, if any. Used to generate the - // |dictionary_suggestions| list. - std::wstring misspelled_word; - - // Suggested replacements for a misspelled word under the cursor. - // This vector gets populated in the render process host - // by intercepting ViewHostMsg_ContextMenu in ResourceMessageFilter - // and populating dictionary_suggestions if the type is EDITABLE - // and the misspelled_word is not empty. - std::vector<std::wstring> dictionary_suggestions; - - // If editable, flag for whether spell check is enabled or not. - bool spellcheck_enabled; - - // These flags indicate to the browser whether the renderer believes it is - // able to perform the corresponding action. - int edit_flags; - - // The security info for the resource we are showing the menu on. - std::string security_info; -}; - // Values that may be OR'd together to form the 'flags' parameter of a // ViewHostMsg_PaintRect message. struct ViewHostMsg_PaintRect_Flags { @@ -302,26 +249,6 @@ struct ViewHostMsg_Resource_Request { std::vector<net::UploadData::Element> upload_content; }; -// Parameters for a resource response header. -struct ViewMsg_Resource_ResponseHead - : webkit_glue::ResourceLoaderBridge::ResponseInfo { - // The response status. - URLRequestStatus status; - - // Specifies if the resource should be filtered before being displayed - // (insecure resources can be filtered to keep the page secure). - FilterPolicy::Type filter_policy; -}; - -// Parameters for a synchronous resource response. -struct ViewHostMsg_SyncLoad_Result : ViewMsg_Resource_ResponseHead { - // The final URL after any redirects. - GURL final_url; - - // The response data. - std::string data; -}; - // Parameters for a render request. struct ViewMsg_Print_Params { // In pixels according to dpi_x and dpi_y. @@ -390,55 +317,6 @@ struct ViewHostMsg_DidPrintPage_Params { double actual_shrink; }; -// Parameters structure to hold a union of the possible IAccessible function -// INPUT variables, with the unused fields always set to default value. Used in -// ViewMsg_GetAccessibilityInfo, as only parameter. -struct ViewMsg_Accessibility_In_Params { - // Identifier to uniquely distinguish which instance of IAccessible is being - // called upon on the renderer side. - int iaccessible_id; - - // Identifier to resolve which IAccessible interface function is being called. - int iaccessible_function_id; - - // Function input parameters. - // Input VARIANT structure's LONG field to specify requested object. - long input_variant_lval; - - // LONG input parameters, used differently depending on the function called. - long input_long1; - long input_long2; -}; - -// Parameters structure to hold a union of the possible IAccessible function -// OUTPUT variables, with the unused fields always set to default value. Used in -// ViewHostMsg_GetAccessibilityInfoResponse, as only parameter. -struct ViewHostMsg_Accessibility_Out_Params { - // Identifier to uniquely distinguish which instance of IAccessible is being - // called upon on the renderer side. - int iaccessible_id; - - // Function output parameters. - // Output VARIANT structure's LONG field to specify requested object. - long output_variant_lval; - - // LONG output parameters, used differently depending on the function called. - // output_long1 can in some cases be set to -1 to indicate that the child - // object found by the called IAccessible function is not a simple object. - long output_long1; - long output_long2; - long output_long3; - long output_long4; - - // String output parameter. - std::wstring output_string; - - // Return code, either S_OK (true) or S_FALSE (false). WebKit MSAA error - // return codes (E_POINTER, E_INVALIDARG, E_FAIL, E_NOTIMPL) must be handled - // on the browser side by input validation. - bool return_code; -}; - // The first parameter for the ViewHostMsg_ImeUpdateStatus message. enum ViewHostMsg_ImeControl { IME_DISABLE = 0, @@ -610,10 +488,9 @@ struct ParamTraits<WebInputEvent::Type> { } }; -// Traits for ViewMsg_Accessibility_In_Params structure to pack/unpack. template <> -struct ParamTraits<ViewMsg_Accessibility_In_Params> { - typedef ViewMsg_Accessibility_In_Params param_type; +struct ParamTraits<AccessibilityInParams> { + typedef AccessibilityInParams param_type; static void Write(Message* m, const param_type& p) { WriteParam(m, p.iaccessible_id); WriteParam(m, p.iaccessible_function_id); @@ -644,10 +521,9 @@ struct ParamTraits<ViewMsg_Accessibility_In_Params> { } }; -// Traits for ViewHostMsg_Accessibility_Out_Params structure to pack/unpack. template <> -struct ParamTraits<ViewHostMsg_Accessibility_Out_Params> { - typedef ViewHostMsg_Accessibility_Out_Params param_type; +struct ParamTraits<AccessibilityOutParams> { + typedef AccessibilityOutParams param_type; static void Write(Message* m, const param_type& p) { WriteParam(m, p.iaccessible_id); WriteParam(m, p.output_variant_lval); @@ -905,10 +781,9 @@ struct ParamTraits<ViewHostMsg_FrameNavigate_Params> { } }; -// Traits for ViewHostMsg_ContextMenu_Params structure to pack/unpack. template <> -struct ParamTraits<ViewHostMsg_ContextMenu_Params> { - typedef ViewHostMsg_ContextMenu_Params param_type; +struct ParamTraits<ContextMenuParams> { + typedef ContextMenuParams param_type; static void Write(Message* m, const param_type& p) { WriteParam(m, p.node); WriteParam(m, p.x); @@ -941,7 +816,7 @@ struct ParamTraits<ViewHostMsg_ContextMenu_Params> { ReadParam(m, iter, &p->security_info); } static void Log(const param_type& p, std::wstring* l) { - l->append(L"<ViewHostMsg_ContextMenu_Params>"); + l->append(L"<ContextMenuParams>"); } }; @@ -1423,10 +1298,9 @@ struct ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo> { } }; -// Traits for ViewMsg_Resource_ResponseHead template <> -struct ParamTraits<ViewMsg_Resource_ResponseHead> { - typedef ViewMsg_Resource_ResponseHead param_type; +struct ParamTraits<ResourceResponseHead> { + typedef ResourceResponseHead param_type; static void Write(Message* m, const param_type& p) { ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Write(m, p); WriteParam(m, p.status); @@ -1444,18 +1318,17 @@ struct ParamTraits<ViewMsg_Resource_ResponseHead> { } }; -// Traits for ViewHostMsg_Resource_SyncLoad_Response template <> -struct ParamTraits<ViewHostMsg_SyncLoad_Result> { - typedef ViewHostMsg_SyncLoad_Result param_type; +struct ParamTraits<SyncLoadResult> { + typedef SyncLoadResult param_type; static void Write(Message* m, const param_type& p) { - ParamTraits<ViewMsg_Resource_ResponseHead>::Write(m, p); + ParamTraits<ResourceResponseHead>::Write(m, p); WriteParam(m, p.final_url); WriteParam(m, p.data); } static bool Read(const Message* m, void** iter, param_type* r) { return - ParamTraits<ViewMsg_Resource_ResponseHead>::Read(m, iter, r) && + ParamTraits<ResourceResponseHead>::Read(m, iter, r) && ReadParam(m, iter, &r->final_url) && ReadParam(m, iter, &r->data); } diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 30c23ba..e6b401e 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -18,7 +18,6 @@ #include "chrome/common/ipc_message_macros.h" #include "skia/include/SkBitmap.h" #include "webkit/glue/console_message_level.h" -#include "webkit/glue/context_node_types.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/screen_info.h" #include "webkit/glue/webcursor.h" @@ -170,7 +169,7 @@ IPC_BEGIN_MESSAGES(View) // Sent when the headers are available for a resource request. IPC_MESSAGE_ROUTED2(ViewMsg_Resource_ReceivedResponse, int /* request_id */, - ViewMsg_Resource_ResponseHead) + ResourceResponseHead) // Sent as upload progress is being made IPC_MESSAGE_ROUTED3(ViewMsg_Resource_UploadProgress, @@ -382,9 +381,9 @@ IPC_BEGIN_MESSAGES(View) // Retreive information from the MSAA DOM subtree, for accessibility purposes. IPC_SYNC_MESSAGE_ROUTED1_1(ViewMsg_GetAccessibilityInfo, - ViewMsg_Accessibility_In_Params + AccessibilityInParams /* input parameters */, - ViewHostMsg_Accessibility_Out_Params + AccessibilityOutParams /* output parameters */) // Requests the renderer to clear cashed accessibility information. Takes an @@ -662,7 +661,7 @@ IPC_BEGIN_MESSAGES(ViewHost) IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_SyncLoad, int /* request_id */, ViewHostMsg_Resource_Request, - ViewHostMsg_SyncLoad_Result) + SyncLoadResult) // Used to set a cookie. The cookie is set asynchronously, but will be // available to a subsequent ViewHostMsg_GetCookies request. @@ -751,7 +750,7 @@ IPC_BEGIN_MESSAGES(ViewHost) // 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, ViewHostMsg_ContextMenu_Params) + IPC_MESSAGE_ROUTED1(ViewHostMsg_ContextMenu, ContextMenuParams) // Request that the given URL be opened in the specified manner. IPC_MESSAGE_ROUTED3(ViewHostMsg_OpenURL, diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc index 822a720..7f64d32 100644 --- a/chrome/common/resource_dispatcher.cc +++ b/chrome/common/resource_dispatcher.cc @@ -210,7 +210,7 @@ void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) { request_id_ = MakeRequestID(); - ViewHostMsg_SyncLoad_Result result; + SyncLoadResult result; IPC::Message::Sender* sender = dispatcher_->message_sender(); if (sender) { @@ -303,8 +303,7 @@ void ResourceDispatcher::OnUploadProgress( } void ResourceDispatcher::OnReceivedResponse( - int request_id, - const ViewMsg_Resource_ResponseHead& response_head) { + int request_id, const ResourceResponseHead& response_head) { PendingRequestList::iterator it = pending_requests_.find(request_id); if (it == pending_requests_.end()) { // This might happen for kill()ed requests on the webkit end, so perhaps it diff --git a/chrome/common/resource_dispatcher.h b/chrome/common/resource_dispatcher.h index 13372a9..32e054b 100644 --- a/chrome/common/resource_dispatcher.h +++ b/chrome/common/resource_dispatcher.h @@ -10,11 +10,15 @@ #include <queue> #include "base/hash_tables.h" +#include "base/shared_memory.h" #include "base/task.h" +#include "chrome/common/filter_policy.h" #include "chrome/common/ipc_channel.h" -#include "chrome/common/render_messages.h" #include "webkit/glue/resource_loader_bridge.h" +struct ResourceResponseHead; +struct ViewMsg_Resource_ResponseHead; + // Uncomment this to disable loading resources via the parent process. This // may be useful for debugging purposes. //#define USING_SIMPLE_RESOURCE_LOADER_BRIDGE @@ -99,7 +103,7 @@ class ResourceDispatcher : public base::RefCounted<ResourceDispatcher> { // Message response handlers, called by the message handler for this process. void OnUploadProgress(int request_id, int64 position, int64 size); - void OnReceivedResponse(int request_id, const ViewMsg_Resource_ResponseHead&); + void OnReceivedResponse(int request_id, const ResourceResponseHead&); void OnReceivedRedirect(int request_id, const GURL& new_url); void OnReceivedData(int request_id, base::SharedMemoryHandle data, int data_len); diff --git a/chrome/common/resource_dispatcher_unittest.cc b/chrome/common/resource_dispatcher_unittest.cc index bf9cc51..43628b8 100644 --- a/chrome/common/resource_dispatcher_unittest.cc +++ b/chrome/common/resource_dispatcher_unittest.cc @@ -8,6 +8,7 @@ #include "base/process.h" #include "base/ref_counted.h" #include "chrome/common/filter_policy.h" +#include "chrome/common/render_messages.h" #include "chrome/common/resource_dispatcher.h" #include "testing/gtest/include/gtest/gtest.h" @@ -93,7 +94,7 @@ class ResourceDispatcherTest : public testing::Test, EXPECT_EQ(test_page_url, request.url.spec()); // received response message - ViewMsg_Resource_ResponseHead response; + ResourceResponseHead response; std::string raw_headers(test_page_headers); std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0'); response.headers = new net::HttpResponseHeaders(raw_headers); |