1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Multiply-included message file, no traditional include guard. 6 #include <string> 7 #include <vector> 8 9 #include "base/basictypes.h" 10 #include "base/memory/ref_counted.h" 11 #include "chrome/common/automation_constants.h" 12 #include "chrome/common/common_param_traits.h" 13 #include "chrome/common/content_settings.h" 14 #include "content/public/common/common_param_traits.h" 15 #include "content/public/common/page_type.h" 16 #include "content/public/common/security_style.h" 17 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_utils.h" 19 #include "net/base/host_port_pair.h" 20 #include "net/base/upload_data.h" 21 #include "net/cert/cert_status_flags.h" 22 #include "net/url_request/url_request_status.h" 23 #include "ui/base/window_open_disposition.h" 24 #include "ui/gfx/rect.h" 25 #include "url/gurl.h" 26 27 IPC_ENUM_TRAITS(AutomationMsg_NavigationResponseValues) 28 IPC_ENUM_TRAITS(content::PageType) 29 30 IPC_STRUCT_BEGIN(AutomationMsg_Find_Params) 31 // The word(s) to find on the page. 32 IPC_STRUCT_MEMBER(base::string16, search_string) 33 34 // Whether to search forward or backward within the page. 35 IPC_STRUCT_MEMBER(bool, forward) 36 37 // Whether search should be Case sensitive. 38 IPC_STRUCT_MEMBER(bool, match_case) 39 40 // Whether this operation is first request (Find) or a follow-up (FindNext). 41 IPC_STRUCT_MEMBER(bool, find_next) 42 IPC_STRUCT_END() 43 44 IPC_STRUCT_BEGIN(AutomationURLResponse) 45 IPC_STRUCT_MEMBER(std::string, mime_type) 46 IPC_STRUCT_MEMBER(std::string, headers) 47 IPC_STRUCT_MEMBER(int64, content_length) 48 IPC_STRUCT_MEMBER(base::Time, last_modified) 49 IPC_STRUCT_MEMBER(std::string, redirect_url) 50 IPC_STRUCT_MEMBER(int, redirect_status) 51 IPC_STRUCT_MEMBER(net::HostPortPair, socket_address) 52 IPC_STRUCT_MEMBER(uint64, upload_size) 53 IPC_STRUCT_END() 54 55 #if defined(OS_WIN) 56 57 IPC_STRUCT_BEGIN(ExternalTabSettings) 58 IPC_STRUCT_MEMBER(HWND, parent) 59 IPC_STRUCT_MEMBER(gfx::Rect, dimensions) 60 IPC_STRUCT_MEMBER(unsigned int, style) 61 IPC_STRUCT_MEMBER(bool, is_incognito) 62 IPC_STRUCT_MEMBER(bool, load_requests_via_automation) 63 IPC_STRUCT_MEMBER(bool, handle_top_level_requests) 64 IPC_STRUCT_MEMBER(GURL, initial_url) 65 IPC_STRUCT_MEMBER(GURL, referrer) 66 IPC_STRUCT_MEMBER(bool, infobars_enabled) 67 IPC_STRUCT_MEMBER(bool, route_all_top_level_navigations) 68 IPC_STRUCT_END() 69 70 #endif // defined(OS_WIN) 71 72 IPC_STRUCT_BEGIN(NavigationInfo) 73 IPC_STRUCT_MEMBER(int, navigation_type) 74 IPC_STRUCT_MEMBER(int, relative_offset) 75 IPC_STRUCT_MEMBER(int, navigation_index) 76 IPC_STRUCT_MEMBER(std::wstring, title) 77 IPC_STRUCT_MEMBER(GURL, url) 78 IPC_STRUCT_MEMBER(GURL, referrer) 79 IPC_STRUCT_MEMBER(content::SecurityStyle, security_style) 80 IPC_STRUCT_MEMBER(bool, displayed_insecure_content) 81 IPC_STRUCT_MEMBER(bool, ran_insecure_content) 82 IPC_STRUCT_END() 83 84 // A stripped down version of ContextMenuParams. 85 IPC_STRUCT_BEGIN(MiniContextMenuParams) 86 // The x coordinate for displaying the menu. 87 IPC_STRUCT_MEMBER(int, screen_x) 88 89 // The y coordinate for displaying the menu. 90 IPC_STRUCT_MEMBER(int, screen_y) 91 92 // This is the URL of the link that encloses the node the context menu was 93 // invoked on. 94 IPC_STRUCT_MEMBER(GURL, link_url) 95 96 // The link URL to be used ONLY for "copy link address". We don't validate 97 // this field in the frontend process. 98 IPC_STRUCT_MEMBER(GURL, unfiltered_link_url) 99 100 // This is the source URL for the element that the context menu was 101 // invoked on. Example of elements with source URLs are img, audio, and 102 // video. 103 IPC_STRUCT_MEMBER(GURL, src_url) 104 105 // This is the URL of the top level page that the context menu was invoked 106 // on. 107 IPC_STRUCT_MEMBER(GURL, page_url) 108 109 // This is the absolute keyword search URL including the %s search tag when 110 // the "Add as search engine..." option is clicked (left empty if not used). 111 IPC_STRUCT_MEMBER(GURL, keyword_url) 112 113 // This is the URL of the subframe that the context menu was invoked on. 114 IPC_STRUCT_MEMBER(GURL, frame_url) 115 IPC_STRUCT_END() 116 117 IPC_STRUCT_BEGIN(AttachExternalTabParams) 118 IPC_STRUCT_MEMBER(uint64, cookie) 119 IPC_STRUCT_MEMBER(GURL, url) 120 IPC_STRUCT_MEMBER(gfx::Rect, dimensions) 121 IPC_STRUCT_MEMBER(int, disposition) 122 IPC_STRUCT_MEMBER(bool, user_gesture) 123 IPC_STRUCT_MEMBER(std::string, profile_name) 124 IPC_STRUCT_END() 125 126 #if defined(OS_WIN) 127 128 IPC_STRUCT_BEGIN(Reposition_Params) 129 IPC_STRUCT_MEMBER(HWND, window) 130 IPC_STRUCT_MEMBER(HWND, window_insert_after) 131 IPC_STRUCT_MEMBER(int, left) 132 IPC_STRUCT_MEMBER(int, top) 133 IPC_STRUCT_MEMBER(int, width) 134 IPC_STRUCT_MEMBER(int, height) 135 IPC_STRUCT_MEMBER(int, flags) 136 IPC_STRUCT_MEMBER(bool, set_parent) 137 IPC_STRUCT_MEMBER(HWND, parent_window) 138 IPC_STRUCT_END() 139 140 #endif // defined(OS_WIN) 141 142 IPC_STRUCT_BEGIN(AutomationURLRequest) 143 IPC_STRUCT_MEMBER(std::string, url) 144 IPC_STRUCT_MEMBER(std::string, method) 145 IPC_STRUCT_MEMBER(std::string, referrer) 146 IPC_STRUCT_MEMBER(std::string, extra_request_headers) 147 IPC_STRUCT_MEMBER(scoped_refptr<net::UploadData>, upload_data) 148 IPC_STRUCT_MEMBER(int, resource_type) // see webkit/common/resource_type.h 149 IPC_STRUCT_MEMBER(int, load_flags) // see net/base/load_flags.h 150 IPC_STRUCT_END() 151 152 // Singly-included section for struct and custom IPC traits. 153 #ifndef CHROME_COMMON_AUTOMATION_MESSAGES_H_ 154 #define CHROME_COMMON_AUTOMATION_MESSAGES_H_ 155 156 // This struct passes information about the context menu in Chrome stored 157 // as a ui::MenuModel to Chrome Frame. It is basically a container of 158 // items that go in the menu. An item may be a submenu, so the data 159 // structure may be a tree. 160 struct ContextMenuModel { 161 ContextMenuModel(); 162 ~ContextMenuModel(); 163 164 // This struct describes one item in the menu. 165 struct Item { 166 Item(); 167 168 // This is the type of the menu item, using values from the enum 169 // ui::MenuModel::ItemType (serialized as an int). 170 int type; 171 172 // This is the command id of the menu item, which will be passed by 173 // Chrome Frame to Chrome if the item is selected. 174 int item_id; 175 176 // This the the menu label, if needed. 177 std::wstring label; 178 179 // These are states of the menu item. 180 bool checked; 181 bool enabled; 182 183 // This recursively describes the submenu if type is 184 // ui::MenuModel::TYPE_SUBMENU. 185 ContextMenuModel* submenu; 186 }; 187 188 // This is the list of menu items. 189 std::vector<Item> items; 190 }; 191 192 namespace IPC { 193 194 template <> 195 struct ParamTraits<ContextMenuModel> { 196 typedef ContextMenuModel param_type; 197 static void Write(Message* m, const param_type& p); 198 static bool Read(const Message* m, PickleIterator* iter, param_type* p); 199 static void Log(const param_type& p, std::string* l); 200 }; 201 202 template <> 203 struct ParamTraits<scoped_refptr<net::UploadData> > { 204 typedef scoped_refptr<net::UploadData> param_type; 205 static void Write(Message* m, const param_type& p); 206 static bool Read(const Message* m, PickleIterator* iter, param_type* r); 207 static void Log(const param_type& p, std::string* l); 208 }; 209 210 template <> 211 struct ParamTraits<net::URLRequestStatus> { 212 typedef net::URLRequestStatus param_type; 213 static void Write(Message* m, const param_type& p); 214 static bool Read(const Message* m, PickleIterator* iter, param_type* r); 215 static void Log(const param_type& p, std::string* l); 216 }; 217 218 } // namespace IPC 219 220 #endif // CHROME_COMMON_AUTOMATION_MESSAGES_H_ 221 222 // Keep this internal message file unchanged to preserve line numbering 223 // (and hence the dubious __LINE__-based message numberings) across versions. 224 #include "chrome/common/automation_messages_internal.h" 225