Home | History | Annotate | Download | only in common
      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 file, no traditional include guard.
      6 #include <map>
      7 #include <set>
      8 #include <string>
      9 #include <vector>
     10 
     11 #include "base/basictypes.h"
     12 #include "base/files/file_path.h"
     13 #include "base/memory/shared_memory.h"
     14 #include "base/process/process.h"
     15 #include "base/strings/string16.h"
     16 #include "base/strings/stringprintf.h"
     17 #include "base/values.h"
     18 #include "build/build_config.h"
     19 #include "chrome/common/autocomplete_match_type.h"
     20 #include "chrome/common/common_param_traits.h"
     21 #include "chrome/common/content_settings.h"
     22 #include "chrome/common/content_settings_pattern.h"
     23 #include "chrome/common/instant_types.h"
     24 #include "chrome/common/ntp_logging_events.h"
     25 #include "chrome/common/omnibox_focus_state.h"
     26 #include "chrome/common/search_provider.h"
     27 #include "chrome/common/translate/language_detection_details.h"
     28 #include "chrome/common/translate/translate_errors.h"
     29 #include "components/nacl/common/nacl_types.h"
     30 #include "content/public/common/common_param_traits.h"
     31 #include "content/public/common/referrer.h"
     32 #include "content/public/common/top_controls_state.h"
     33 #include "extensions/common/stack_frame.h"
     34 #include "ipc/ipc_channel_handle.h"
     35 #include "ipc/ipc_message_macros.h"
     36 #include "ipc/ipc_platform_file.h"
     37 #include "third_party/skia/include/core/SkBitmap.h"
     38 #include "third_party/WebKit/public/web/WebCache.h"
     39 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
     40 #include "ui/base/window_open_disposition.h"
     41 #include "ui/gfx/rect.h"
     42 
     43 // Singly-included section for enums and custom IPC traits.
     44 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_
     45 #define CHROME_COMMON_RENDER_MESSAGES_H_
     46 
     47 class SkBitmap;
     48 
     49 // Command values for the cmd parameter of the
     50 // ViewHost_JavaScriptStressTestControl message. For each command the parameter
     51 // passed has a different meaning:
     52 // For the command kJavaScriptStressTestSetStressRunType the parameter it the
     53 // type taken from the enumeration v8::Testing::StressType.
     54 // For the command kJavaScriptStressTestPrepareStressRun the parameter it the
     55 // number of the stress run about to take place.
     56 enum ViewHostMsg_JavaScriptStressTestControl_Commands {
     57   kJavaScriptStressTestSetStressRunType = 0,
     58   kJavaScriptStressTestPrepareStressRun = 1,
     59 };
     60 
     61 // This enum is inside a struct so that we can forward-declare the struct in
     62 // others headers without having to include this one.
     63 struct ChromeViewHostMsg_GetPluginInfo_Status {
     64   enum Value {
     65     kAllowed,
     66     kBlocked,
     67     kClickToPlay,
     68     kDisabled,
     69     kNotFound,
     70     kNPAPINotSupported,
     71     kOutdatedBlocked,
     72     kOutdatedDisallowed,
     73     kUnauthorized,
     74   };
     75 
     76   ChromeViewHostMsg_GetPluginInfo_Status() : value(kAllowed) {}
     77 
     78   Value value;
     79 };
     80 
     81 namespace IPC {
     82 
     83 #if defined(OS_POSIX) && !defined(USE_AURA) && !defined(OS_ANDROID)
     84 
     85 // TODO(port): this shouldn't exist. However, the plugin stuff is really using
     86 // HWNDS (NativeView), and making Windows calls based on them. I've not figured
     87 // out the deal with plugins yet.
     88 // TODO(android): a gfx::NativeView is the same as a gfx::NativeWindow.
     89 template <>
     90 struct ParamTraits<gfx::NativeView> {
     91   typedef gfx::NativeView param_type;
     92   static void Write(Message* m, const param_type& p) {
     93     NOTIMPLEMENTED();
     94   }
     95 
     96   static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
     97     NOTIMPLEMENTED();
     98     *p = NULL;
     99     return true;
    100   }
    101 
    102   static void Log(const param_type& p, std::string* l) {
    103     l->append(base::StringPrintf("<gfx::NativeView>"));
    104   }
    105 };
    106 
    107 #endif  // defined(OS_POSIX) && !defined(USE_AURA) && !defined(OS_ANDROID)
    108 
    109 template <>
    110 struct ParamTraits<ContentSettingsPattern> {
    111   typedef ContentSettingsPattern param_type;
    112   static void Write(Message* m, const param_type& p);
    113   static bool Read(const Message* m, PickleIterator* iter, param_type* r);
    114   static void Log(const param_type& p, std::string* l);
    115 };
    116 
    117 }  // namespace IPC
    118 
    119 #endif  // CHROME_COMMON_RENDER_MESSAGES_H_
    120 
    121 #define IPC_MESSAGE_START ChromeMsgStart
    122 
    123 IPC_ENUM_TRAITS(ChromeViewHostMsg_GetPluginInfo_Status::Value)
    124 IPC_ENUM_TRAITS(OmniboxFocusChangeReason)
    125 IPC_ENUM_TRAITS(OmniboxFocusState)
    126 IPC_ENUM_TRAITS(search_provider::OSDDType)
    127 IPC_ENUM_TRAITS(search_provider::InstallState)
    128 IPC_ENUM_TRAITS(ThemeBackgroundImageAlignment)
    129 IPC_ENUM_TRAITS(ThemeBackgroundImageTiling)
    130 IPC_ENUM_TRAITS(TranslateErrors::Type)
    131 IPC_ENUM_TRAITS(blink::WebConsoleMessage::Level)
    132 IPC_ENUM_TRAITS(content::TopControlsState)
    133 
    134 IPC_STRUCT_TRAITS_BEGIN(ChromeViewHostMsg_GetPluginInfo_Status)
    135 IPC_STRUCT_TRAITS_MEMBER(value)
    136 IPC_STRUCT_TRAITS_END()
    137 
    138 // Output parameters for ChromeViewHostMsg_GetPluginInfo message.
    139 IPC_STRUCT_BEGIN(ChromeViewHostMsg_GetPluginInfo_Output)
    140   IPC_STRUCT_MEMBER(ChromeViewHostMsg_GetPluginInfo_Status, status)
    141   IPC_STRUCT_MEMBER(content::WebPluginInfo, plugin)
    142   IPC_STRUCT_MEMBER(std::string, actual_mime_type)
    143   IPC_STRUCT_MEMBER(std::string, group_identifier)
    144   IPC_STRUCT_MEMBER(base::string16, group_name)
    145 IPC_STRUCT_END()
    146 
    147 IPC_STRUCT_TRAITS_BEGIN(ContentSettingsPattern::PatternParts)
    148   IPC_STRUCT_TRAITS_MEMBER(scheme)
    149   IPC_STRUCT_TRAITS_MEMBER(is_scheme_wildcard)
    150   IPC_STRUCT_TRAITS_MEMBER(host)
    151   IPC_STRUCT_TRAITS_MEMBER(has_domain_wildcard)
    152   IPC_STRUCT_TRAITS_MEMBER(port)
    153   IPC_STRUCT_TRAITS_MEMBER(is_port_wildcard)
    154   IPC_STRUCT_TRAITS_MEMBER(path)
    155   IPC_STRUCT_TRAITS_MEMBER(is_path_wildcard)
    156 IPC_STRUCT_TRAITS_END()
    157 
    158 IPC_STRUCT_TRAITS_BEGIN(ContentSettingPatternSource)
    159   IPC_STRUCT_TRAITS_MEMBER(primary_pattern)
    160   IPC_STRUCT_TRAITS_MEMBER(secondary_pattern)
    161   IPC_STRUCT_TRAITS_MEMBER(setting)
    162   IPC_STRUCT_TRAITS_MEMBER(source)
    163   IPC_STRUCT_TRAITS_MEMBER(incognito)
    164 IPC_STRUCT_TRAITS_END()
    165 
    166 IPC_STRUCT_TRAITS_BEGIN(InstantSuggestion)
    167   IPC_STRUCT_TRAITS_MEMBER(text)
    168   IPC_STRUCT_TRAITS_MEMBER(metadata)
    169 IPC_STRUCT_TRAITS_END()
    170 
    171 IPC_STRUCT_TRAITS_BEGIN(InstantMostVisitedItem)
    172   IPC_STRUCT_TRAITS_MEMBER(url)
    173   IPC_STRUCT_TRAITS_MEMBER(title)
    174 IPC_STRUCT_TRAITS_END()
    175 
    176 IPC_STRUCT_TRAITS_BEGIN(RendererContentSettingRules)
    177   IPC_STRUCT_TRAITS_MEMBER(image_rules)
    178   IPC_STRUCT_TRAITS_MEMBER(script_rules)
    179 IPC_STRUCT_TRAITS_END()
    180 
    181 IPC_STRUCT_TRAITS_BEGIN(RGBAColor)
    182   IPC_STRUCT_TRAITS_MEMBER(r)
    183   IPC_STRUCT_TRAITS_MEMBER(g)
    184   IPC_STRUCT_TRAITS_MEMBER(b)
    185   IPC_STRUCT_TRAITS_MEMBER(a)
    186 IPC_STRUCT_TRAITS_END()
    187 
    188 IPC_STRUCT_TRAITS_BEGIN(ThemeBackgroundInfo)
    189   IPC_STRUCT_TRAITS_MEMBER(using_default_theme)
    190   IPC_STRUCT_TRAITS_MEMBER(background_color)
    191   IPC_STRUCT_TRAITS_MEMBER(text_color)
    192   IPC_STRUCT_TRAITS_MEMBER(link_color)
    193   IPC_STRUCT_TRAITS_MEMBER(text_color_light)
    194   IPC_STRUCT_TRAITS_MEMBER(header_color)
    195   IPC_STRUCT_TRAITS_MEMBER(section_border_color)
    196   IPC_STRUCT_TRAITS_MEMBER(theme_id)
    197   IPC_STRUCT_TRAITS_MEMBER(image_horizontal_alignment)
    198   IPC_STRUCT_TRAITS_MEMBER(image_vertical_alignment)
    199   IPC_STRUCT_TRAITS_MEMBER(image_tiling)
    200   IPC_STRUCT_TRAITS_MEMBER(image_height)
    201   IPC_STRUCT_TRAITS_MEMBER(has_attribution)
    202   IPC_STRUCT_TRAITS_MEMBER(logo_alternate)
    203 IPC_STRUCT_TRAITS_END()
    204 
    205 IPC_STRUCT_TRAITS_BEGIN(blink::WebCache::ResourceTypeStat)
    206   IPC_STRUCT_TRAITS_MEMBER(count)
    207   IPC_STRUCT_TRAITS_MEMBER(size)
    208   IPC_STRUCT_TRAITS_MEMBER(liveSize)
    209   IPC_STRUCT_TRAITS_MEMBER(decodedSize)
    210 IPC_STRUCT_TRAITS_END()
    211 
    212 IPC_STRUCT_TRAITS_BEGIN(blink::WebCache::ResourceTypeStats)
    213   IPC_STRUCT_TRAITS_MEMBER(images)
    214   IPC_STRUCT_TRAITS_MEMBER(cssStyleSheets)
    215   IPC_STRUCT_TRAITS_MEMBER(scripts)
    216   IPC_STRUCT_TRAITS_MEMBER(xslStyleSheets)
    217   IPC_STRUCT_TRAITS_MEMBER(fonts)
    218 IPC_STRUCT_TRAITS_END()
    219 
    220 IPC_STRUCT_TRAITS_BEGIN(blink::WebCache::UsageStats)
    221   IPC_STRUCT_TRAITS_MEMBER(minDeadCapacity)
    222   IPC_STRUCT_TRAITS_MEMBER(maxDeadCapacity)
    223   IPC_STRUCT_TRAITS_MEMBER(capacity)
    224   IPC_STRUCT_TRAITS_MEMBER(liveSize)
    225   IPC_STRUCT_TRAITS_MEMBER(deadSize)
    226 IPC_STRUCT_TRAITS_END()
    227 
    228 IPC_STRUCT_TRAITS_BEGIN(LanguageDetectionDetails)
    229   IPC_STRUCT_TRAITS_MEMBER(time)
    230   IPC_STRUCT_TRAITS_MEMBER(url)
    231   IPC_STRUCT_TRAITS_MEMBER(content_language)
    232   IPC_STRUCT_TRAITS_MEMBER(cld_language)
    233   IPC_STRUCT_TRAITS_MEMBER(is_cld_reliable)
    234   IPC_STRUCT_TRAITS_MEMBER(html_root_language)
    235   IPC_STRUCT_TRAITS_MEMBER(adopted_language)
    236   IPC_STRUCT_TRAITS_MEMBER(contents)
    237 IPC_STRUCT_TRAITS_END()
    238 
    239 IPC_STRUCT_TRAITS_BEGIN(extensions::StackFrame)
    240   IPC_STRUCT_TRAITS_MEMBER(line_number)
    241   IPC_STRUCT_TRAITS_MEMBER(column_number)
    242   IPC_STRUCT_TRAITS_MEMBER(source)
    243   IPC_STRUCT_TRAITS_MEMBER(function)
    244 IPC_STRUCT_TRAITS_END()
    245 
    246 IPC_ENUM_TRAITS_MAX_VALUE(NTPLoggingEventType,
    247                           NTP_NUM_EVENT_TYPES)
    248 
    249 //-----------------------------------------------------------------------------
    250 // RenderView messages
    251 // These are messages sent from the browser to the renderer process.
    252 
    253 // Tells the renderer to set its maximum cache size to the supplied value.
    254 IPC_MESSAGE_CONTROL3(ChromeViewMsg_SetCacheCapacities,
    255                      size_t /* min_dead_capacity */,
    256                      size_t /* max_dead_capacity */,
    257                      size_t /* capacity */)
    258 
    259 // Tells the renderer to clear the cache.
    260 IPC_MESSAGE_CONTROL1(ChromeViewMsg_ClearCache,
    261                      bool /* on_navigation */)
    262 
    263 // Tells the renderer to dump as much memory as it can, perhaps because we
    264 // have memory pressure or the renderer is (or will be) paged out.  This
    265 // should only result in purging objects we can recalculate, e.g. caches or
    266 // JS garbage, not in purging irreplaceable objects.
    267 IPC_MESSAGE_CONTROL0(ChromeViewMsg_PurgeMemory)
    268 
    269 // For WebUI testing, this message stores parameters to do ScriptEvalRequest at
    270 // a time which is late enough to not be thrown out, and early enough to be
    271 // before onload events are fired.
    272 IPC_MESSAGE_ROUTED4(ChromeViewMsg_WebUIJavaScript,
    273                     base::string16,  /* frame_xpath */
    274                     base::string16,  /* jscript_url */
    275                     int,  /* ID */
    276                     bool  /* If true, result is sent back. */)
    277 
    278 // Set the content setting rules stored by the renderer.
    279 IPC_MESSAGE_CONTROL1(ChromeViewMsg_SetContentSettingRules,
    280                      RendererContentSettingRules /* rules */)
    281 
    282 // Tells the render view to load all blocked plugins with the given identifier.
    283 IPC_MESSAGE_ROUTED1(ChromeViewMsg_LoadBlockedPlugins,
    284                     std::string /* identifier */)
    285 
    286 // Asks the renderer to send back stats on the WebCore cache broken down by
    287 // resource types.
    288 IPC_MESSAGE_CONTROL0(ChromeViewMsg_GetCacheResourceStats)
    289 
    290 // Tells the renderer to create a FieldTrial, and by using a 100% probability
    291 // for the FieldTrial, forces the FieldTrial to have assigned group name.
    292 IPC_MESSAGE_CONTROL2(ChromeViewMsg_SetFieldTrialGroup,
    293                      std::string /* field trial name */,
    294                      std::string /* group name that was assigned. */)
    295 
    296 // Asks the renderer to send back V8 heap stats.
    297 IPC_MESSAGE_CONTROL0(ChromeViewMsg_GetV8HeapStats)
    298 
    299 // Posts a message to the renderer.
    300 IPC_MESSAGE_ROUTED3(ChromeViewMsg_HandleMessageFromExternalHost,
    301                     std::string /* The message */,
    302                     std::string /* The origin */,
    303                     std::string /* The target*/)
    304 
    305 IPC_MESSAGE_ROUTED0(ChromeViewMsg_DetermineIfPageSupportsInstant)
    306 
    307 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxSetDisplayInstantResults,
    308                     bool /* display_instant_results */)
    309 
    310 IPC_MESSAGE_ROUTED2(ChromeViewMsg_SearchBoxFocusChanged,
    311                     OmniboxFocusState /* new_focus_state */,
    312                     OmniboxFocusChangeReason /* reason */)
    313 
    314 IPC_MESSAGE_ROUTED2(ChromeViewMsg_SearchBoxMarginChange,
    315                     int /* start */,
    316                     int /* width */)
    317 
    318 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxMostVisitedItemsChanged,
    319                     std::vector<InstantMostVisitedItem> /* items */)
    320 
    321 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxPromoInformation,
    322                     bool /* is_app_launcher_enabled */)
    323 
    324 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxSetInputInProgress,
    325                     bool /* input_in_progress */)
    326 
    327 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxSetSuggestionToPrefetch,
    328                     InstantSuggestion /* suggestion */)
    329 
    330 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxSubmit,
    331                     base::string16 /* value */)
    332 
    333 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxThemeChanged,
    334                     ThemeBackgroundInfo /* value */)
    335 
    336 IPC_MESSAGE_ROUTED2(ChromeViewMsg_ChromeIdentityCheckResult,
    337                     base::string16 /* identity */,
    338                     bool /* identity_match */)
    339 
    340 IPC_MESSAGE_ROUTED0(ChromeViewMsg_SearchBoxToggleVoiceSearch)
    341 
    342 // Toggles visual muting of the render view area. This is on when a constrained
    343 // window is showing.
    344 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetVisuallyDeemphasized,
    345                     bool /* deemphazied */)
    346 
    347 // Tells the renderer to translate the page contents from one language to
    348 // another.
    349 IPC_MESSAGE_ROUTED4(ChromeViewMsg_TranslatePage,
    350                     int /* page id */,
    351                     std::string, /* the script injected in the page */
    352                     std::string, /* BCP 47/RFC 5646 language code the page
    353                                     is in */
    354                     std::string /* BCP 47/RFC 5646 language code to translate
    355                                    to */)
    356 
    357 // Tells the renderer to revert the text of translated page to its original
    358 // contents.
    359 IPC_MESSAGE_ROUTED1(ChromeViewMsg_RevertTranslation,
    360                     int /* page id */)
    361 
    362 // Sent on process startup to indicate whether this process is running in
    363 // incognito mode.
    364 IPC_MESSAGE_CONTROL1(ChromeViewMsg_SetIsIncognitoProcess,
    365                      bool /* is_incognito_processs */)
    366 
    367 // Sent in response to ViewHostMsg_DidBlockDisplayingInsecureContent.
    368 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetAllowDisplayingInsecureContent,
    369                     bool /* allowed */)
    370 
    371 // Sent in response to ViewHostMsg_DidBlockRunningInsecureContent.
    372 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetAllowRunningInsecureContent,
    373                     bool /* allowed */)
    374 
    375 // Sent when the profile changes the kSafeBrowsingEnabled preference.
    376 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetClientSidePhishingDetection,
    377                     bool /* enable_phishing_detection */)
    378 
    379 // Asks the renderer for a thumbnail of the image selected by the most
    380 // recently opened context menu, if there is one. If the image's area
    381 // is greater than thumbnail_min_area it will be downscaled to
    382 // be within thumbnail_max_size. The possibly downsampled image will be
    383 // returned in a ChromeViewHostMsg_RequestThumbnailForContextNode_ACK message.
    384 IPC_MESSAGE_ROUTED2(ChromeViewMsg_RequestThumbnailForContextNode,
    385                     int /* thumbnail_min_area_pixels */,
    386                     gfx::Size /* thumbnail_max_size_pixels */)
    387 
    388 // Notifies the renderer whether hiding/showing the top controls is enabled,
    389 // what the current state should be, and whether or not to animate to the
    390 // proper state.
    391 IPC_MESSAGE_ROUTED3(ChromeViewMsg_UpdateTopControlsState,
    392                     content::TopControlsState /* constraints */,
    393                     content::TopControlsState /* current */,
    394                     bool /* animate */)
    395 
    396 
    397 // Updates the window features of the render view.
    398 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetWindowFeatures,
    399                     blink::WebWindowFeatures /* window_features */)
    400 
    401 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_RequestThumbnailForContextNode_ACK,
    402                     SkBitmap /* thumbnail */,
    403                     gfx::Size /* original size of the image */)
    404 
    405 #if defined(OS_ANDROID)
    406 // Asks the renderer to return information about whether the current page can
    407 // be treated as a webapp.
    408 IPC_MESSAGE_ROUTED1(ChromeViewMsg_RetrieveWebappInformation,
    409                     GURL /* expected_url */)
    410 #endif  // defined(OS_ANDROID)
    411 
    412 // chrome.principals messages ------------------------------------------------
    413 
    414 // Message sent from the renderer to the browser to get the list of browser
    415 // managed accounts for the given origin.
    416 IPC_SYNC_MESSAGE_CONTROL1_1(ChromeViewHostMsg_GetManagedAccounts,
    417                             GURL /* current URL */,
    418                             std::vector<std::string> /* managed accounts */)
    419 
    420 // Message sent from the renderer to the browser to show the browser account
    421 // management UI.
    422 IPC_MESSAGE_CONTROL0(ChromeViewHostMsg_ShowBrowserAccountManagementUI)
    423 
    424 // JavaScript related messages -----------------------------------------------
    425 
    426 // Notify the JavaScript engine in the render to change its parameters
    427 // while performing stress testing.
    428 IPC_MESSAGE_ROUTED2(ChromeViewMsg_JavaScriptStressTestControl,
    429                     int /* cmd */,
    430                     int /* param */)
    431 
    432 // Asks the renderer to send back FPS.
    433 IPC_MESSAGE_ROUTED0(ChromeViewMsg_GetFPS)
    434 
    435 // Tells the view it is displaying an interstitial page.
    436 IPC_MESSAGE_ROUTED0(ChromeViewMsg_SetAsInterstitial)
    437 
    438 // Provides the renderer with the results of the browser's investigation into
    439 // why a recent main frame load failed (currently, just DNS probe result).
    440 // NetErrorHelper will receive this mesage and replace or update the error
    441 // page with more specific troubleshooting suggestions.
    442 IPC_MESSAGE_ROUTED1(ChromeViewMsg_NetErrorInfo,
    443                     int /* DNS probe status */)
    444 
    445 //-----------------------------------------------------------------------------
    446 // Misc messages
    447 // These are messages sent from the renderer to the browser process.
    448 
    449 // Notification that the language for the tab has been determined.
    450 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_TranslateLanguageDetermined,
    451                     LanguageDetectionDetails /* details about lang detection */,
    452                     bool /* whether the page needs translation */)
    453 
    454 IPC_MESSAGE_CONTROL1(ChromeViewHostMsg_UpdatedCacheStats,
    455                      blink::WebCache::UsageStats /* stats */)
    456 
    457 // Tells the browser that content in the current page was blocked due to the
    458 // user's content settings.
    459 IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_ContentBlocked,
    460                     ContentSettingsType /* type of blocked content */)
    461 
    462 // Sent by the renderer process to check whether access to web databases is
    463 // granted by content settings.
    464 IPC_SYNC_MESSAGE_CONTROL5_1(ChromeViewHostMsg_AllowDatabase,
    465                             int /* render_view_id */,
    466                             GURL /* origin_url */,
    467                             GURL /* top origin url */,
    468                             base::string16 /* database name */,
    469                             base::string16 /* database display name */,
    470                             bool /* allowed */)
    471 
    472 // Sent by the renderer process to check whether access to DOM Storage is
    473 // granted by content settings.
    474 IPC_SYNC_MESSAGE_CONTROL4_1(ChromeViewHostMsg_AllowDOMStorage,
    475                             int /* render_view_id */,
    476                             GURL /* origin_url */,
    477                             GURL /* top origin url */,
    478                             bool /* if true local storage, otherwise session */,
    479                             bool /* allowed */)
    480 
    481 // Sent by the renderer process to check whether access to FileSystem is
    482 // granted by content settings.
    483 IPC_SYNC_MESSAGE_CONTROL3_1(ChromeViewHostMsg_AllowFileSystem,
    484                             int /* render_view_id */,
    485                             GURL /* origin_url */,
    486                             GURL /* top origin url */,
    487                             bool /* allowed */)
    488 
    489 // Sent by the renderer process to check whether access to Indexed DBis
    490 // granted by content settings.
    491 IPC_SYNC_MESSAGE_CONTROL4_1(ChromeViewHostMsg_AllowIndexedDB,
    492                             int /* render_view_id */,
    493                             GURL /* origin_url */,
    494                             GURL /* top origin url */,
    495                             base::string16 /* database name */,
    496                             bool /* allowed */)
    497 
    498 // Return information about a plugin for the given URL and MIME type.
    499 // In contrast to ViewHostMsg_GetPluginInfo in content/, this IPC call knows
    500 // about specific reasons why a plug-in can't be used, for example because it's
    501 // disabled.
    502 IPC_SYNC_MESSAGE_CONTROL4_1(ChromeViewHostMsg_GetPluginInfo,
    503                             int /* render_frame_id */,
    504                             GURL /* url */,
    505                             GURL /* top origin url */,
    506                             std::string /* mime_type */,
    507                             ChromeViewHostMsg_GetPluginInfo_Output /* output */)
    508 
    509 // Returns whether any internal plugin supporting |mime_type| is registered
    510 // Does not determine whether the plugin can actually be instantiated
    511 // (e.g. whether it is allowed or has all its dependencies).
    512 // When the returned *|is_registered| is true, |additional_param_names| and
    513 // |additional_param_values| contain the name-value pairs, if any, specified
    514 // for the *first* plugin found that is registered for |mime_type|.
    515 IPC_SYNC_MESSAGE_CONTROL1_3(
    516     ChromeViewHostMsg_IsInternalPluginRegisteredForMimeType,
    517     std::string /* mime_type */,
    518     bool /* registered */,
    519     std::vector<base::string16> /* additional_param_names */,
    520     std::vector<base::string16> /* additional_param_values */)
    521 
    522 #if defined(ENABLE_PLUGIN_INSTALLATION)
    523 // Tells the browser to search for a plug-in that can handle the given MIME
    524 // type. The result will be sent asynchronously to the routing ID
    525 // |placeholder_id|.
    526 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_FindMissingPlugin,
    527                     int /* placeholder_id */,
    528                     std::string /* mime_type */)
    529 
    530 // Notifies the browser that a missing plug-in placeholder has been removed, so
    531 // the corresponding PluginPlaceholderHost can be deleted.
    532 IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_RemovePluginPlaceholderHost,
    533                     int /* placeholder_id */)
    534 
    535 // Notifies a missing plug-in placeholder that a plug-in with name |plugin_name|
    536 // has been found.
    537 IPC_MESSAGE_ROUTED1(ChromeViewMsg_FoundMissingPlugin,
    538                     base::string16 /* plugin_name */)
    539 
    540 // Notifies a missing plug-in placeholder that no plug-in has been found.
    541 IPC_MESSAGE_ROUTED0(ChromeViewMsg_DidNotFindMissingPlugin)
    542 
    543 // Notifies a missing plug-in placeholder that we have started downloading
    544 // the plug-in.
    545 IPC_MESSAGE_ROUTED0(ChromeViewMsg_StartedDownloadingPlugin)
    546 
    547 // Notifies a missing plug-in placeholder that we have finished downloading
    548 // the plug-in.
    549 IPC_MESSAGE_ROUTED0(ChromeViewMsg_FinishedDownloadingPlugin)
    550 
    551 // Notifies a missing plug-in placeholder that there was an error downloading
    552 // the plug-in.
    553 IPC_MESSAGE_ROUTED1(ChromeViewMsg_ErrorDownloadingPlugin,
    554                     std::string /* message */)
    555 #endif  // defined(ENABLE_PLUGIN_INSTALLATION)
    556 
    557 // Notifies a missing plug-in placeholder that the user cancelled downloading
    558 // the plug-in.
    559 IPC_MESSAGE_ROUTED0(ChromeViewMsg_CancelledDownloadingPlugin)
    560 
    561 // Tells the browser to open chrome://plugins in a new tab. We use a separate
    562 // message because renderer processes aren't allowed to directly navigate to
    563 // chrome:// URLs.
    564 IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_OpenAboutPlugins)
    565 
    566 // Tells the browser that there was an error loading a plug-in.
    567 IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_CouldNotLoadPlugin,
    568                     base::FilePath /* plugin_path */)
    569 
    570 // Tells the browser that we blocked a plug-in because NPAPI is not supported.
    571 IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_NPAPINotSupported,
    572                     std::string /* identifer */)
    573 
    574 // Tells the renderer that the NPAPI cannot be used. For example Ash on windows.
    575 IPC_MESSAGE_ROUTED0(ChromeViewMsg_NPAPINotSupported)
    576 
    577 // A message for an external host.
    578 IPC_MESSAGE_ROUTED3(ChromeViewHostMsg_ForwardMessageToExternalHost,
    579                     std::string  /* message */,
    580                     std::string  /* origin */,
    581                     std::string  /* target */)
    582 
    583 // Notification that the page has an OpenSearch description document
    584 // associated with it.
    585 IPC_MESSAGE_ROUTED3(ChromeViewHostMsg_PageHasOSDD,
    586                     int32 /* page_id */,
    587                     GURL /* url of OS description document */,
    588                     search_provider::OSDDType)
    589 
    590 // Find out if the given url's security origin is installed as a search
    591 // provider.
    592 IPC_SYNC_MESSAGE_ROUTED2_1(ChromeViewHostMsg_GetSearchProviderInstallState,
    593                            GURL /* page url */,
    594                            GURL /* inquiry url */,
    595                            search_provider::InstallState /* install */)
    596 
    597 // Sends back stats about the V8 heap.
    598 IPC_MESSAGE_CONTROL2(ChromeViewHostMsg_V8HeapStats,
    599                      int /* size of heap (allocated from the OS) */,
    600                      int /* bytes in use */)
    601 
    602 // Request for a DNS prefetch of the names in the array.
    603 // NameList is typedef'ed std::vector<std::string>
    604 IPC_MESSAGE_CONTROL1(ChromeViewHostMsg_DnsPrefetch,
    605                      std::vector<std::string> /* hostnames */)
    606 
    607 // Request for preconnect to host providing resource specified by URL
    608 IPC_MESSAGE_CONTROL1(ChromeViewHostMsg_Preconnect,
    609                      GURL /* preconnect target url */)
    610 
    611 // Notifies when a plugin couldn't be loaded because it's outdated.
    612 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_BlockedOutdatedPlugin,
    613                     int /* placeholder ID */,
    614                     std::string /* plug-in group identifier */)
    615 
    616 // Notifies when a plugin couldn't be loaded because it requires
    617 // user authorization.
    618 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_BlockedUnauthorizedPlugin,
    619                     base::string16 /* name */,
    620                     std::string /* plug-in group identifier */)
    621 
    622 // Provide the browser process with information about the WebCore resource
    623 // cache and current renderer framerate.
    624 IPC_MESSAGE_CONTROL1(ChromeViewHostMsg_ResourceTypeStats,
    625                      blink::WebCache::ResourceTypeStats)
    626 
    627 // Notifies the browser that a page has been translated.
    628 IPC_MESSAGE_ROUTED4(ChromeViewHostMsg_PageTranslated,
    629                     int,                  /* page id */
    630                     std::string           /* the original language */,
    631                     std::string           /* the translated language */,
    632                     TranslateErrors::Type /* the error type if available */)
    633 
    634 // Message sent from the renderer to the browser to notify it of a
    635 // window.print() call which should cancel the prerender. The message is sent
    636 // only when the renderer is prerendering.
    637 IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_CancelPrerenderForPrinting)
    638 
    639 // Sent by the renderer to check if a URL has permission to trigger a clipboard
    640 // read/write operation from the DOM.
    641 IPC_SYNC_MESSAGE_ROUTED1_1(ChromeViewHostMsg_CanTriggerClipboardRead,
    642                            GURL /* origin */,
    643                            bool /* allowed */)
    644 IPC_SYNC_MESSAGE_ROUTED1_1(ChromeViewHostMsg_CanTriggerClipboardWrite,
    645                            GURL /* origin */,
    646                            bool /* allowed */)
    647 
    648 // Sent by the renderer to check if a URL has permission to access WebGL
    649 // extension WEBGL_debug_renderer_info.
    650 IPC_SYNC_MESSAGE_ROUTED1_1(ChromeViewHostMsg_IsWebGLDebugRendererInfoAllowed,
    651                            GURL /* origin */,
    652                            bool /* allowed */)
    653 
    654 // Sent when the renderer was prevented from displaying insecure content in
    655 // a secure page by a security policy.  The page may appear incomplete.
    656 IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_DidBlockDisplayingInsecureContent)
    657 
    658 // Sent when the renderer was prevented from running insecure content in
    659 // a secure origin by a security policy.  The page may appear incomplete.
    660 IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_DidBlockRunningInsecureContent)
    661 
    662 #if defined(OS_ANDROID)
    663 // Contains info about whether the current page can be treated as a webapp.
    664 IPC_MESSAGE_ROUTED4(ChromeViewHostMsg_DidRetrieveWebappInformation,
    665                     bool /* success */,
    666                     bool /* is_mobile_webapp_capable */,
    667                     bool /* is_apple_mobile_webapp_capable */,
    668                     GURL /* expected_url */)
    669 #endif  // defined(OS_ANDROID)
    670 
    671 // The currently displayed PDF has an unsupported feature.
    672 IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_PDFHasUnsupportedFeature)
    673 
    674 // Brings up SaveAs... dialog to save specified URL.
    675 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_PDFSaveURLAs,
    676                     GURL /* url */,
    677                     content::Referrer /* referrer */)
    678 
    679 // Updates the content restrictions, i.e. to disable print/copy.
    680 IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_PDFUpdateContentRestrictions,
    681                     int /* restrictions */)
    682 
    683 // Brings up a Password... dialog for protected documents.
    684 IPC_SYNC_MESSAGE_ROUTED1_1(ChromeViewHostMsg_PDFModalPromptForPassword,
    685                            std::string /* prompt */,
    686                            std::string /* actual_value */)
    687 
    688 // This message indicates the error appeared in the frame.
    689 IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_FrameLoadingError,
    690                     int /* error */)
    691 
    692 // This message indicates the monitored frame loading had completed.
    693 IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_FrameLoadingCompleted)
    694 
    695 // Provide the browser process with current renderer framerate.
    696 IPC_MESSAGE_CONTROL2(ChromeViewHostMsg_FPS,
    697                      int /* routing id */,
    698                      float /* frames per second */)
    699 
    700 // Logs events from InstantExtended New Tab Pages.
    701 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_LogEvent,
    702                     int /* page_id */,
    703                     NTPLoggingEventType /* event */)
    704 
    705 // Logs an impression on one of the Most Visited tile on the InstantExtended
    706 // New Tab Page.
    707 IPC_MESSAGE_ROUTED3(ChromeViewHostMsg_LogImpression,
    708                     int /* page_id */,
    709                     int /* position */,
    710                     base::string16 /* provider */)
    711 
    712 // The Instant page asks for Chrome identity check against |identity|.
    713 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_ChromeIdentityCheck,
    714                     int /* page_id */,
    715                     base::string16 /* identity */)
    716 
    717 // Tells InstantExtended to set the omnibox focus state.
    718 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_FocusOmnibox,
    719                     int /* page_id */,
    720                     OmniboxFocusState /* state */)
    721 
    722 // Tells InstantExtended to paste text into the omnibox.  If text is empty,
    723 // the clipboard contents will be pasted. This causes the omnibox dropdown to
    724 // open.
    725 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_PasteAndOpenDropdown,
    726                     int /* page_id */,
    727                     base::string16 /* text to be pasted */)
    728 
    729 // Tells InstantExtended whether the embedded search API is supported.
    730 // See http://dev.chromium.org/embeddedsearch
    731 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_InstantSupportDetermined,
    732                     int /* page_id */,
    733                     bool /* result */)
    734 
    735 // Tells InstantExtended to delete a most visited item.
    736 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem,
    737                     int /* page_id */,
    738                     GURL /* url */)
    739 
    740 // Tells InstantExtended to navigate the active tab to a possibly privileged
    741 // URL.
    742 IPC_MESSAGE_ROUTED4(ChromeViewHostMsg_SearchBoxNavigate,
    743                     int /* page_id */,
    744                     GURL /* destination */,
    745                     WindowOpenDisposition /* disposition */,
    746                     bool /*is_most_visited_item_url*/)
    747 
    748 // Tells InstantExtended to undo all most visited item deletions.
    749 IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions,
    750                     int /* page_id */)
    751 
    752 // Tells InstantExtended to undo one most visited item deletion.
    753 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion,
    754                     int /* page_id */,
    755                     GURL /* url */)
    756 
    757 // Tells InstantExtended whether the page supports voice search.
    758 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_SetVoiceSearchSupported,
    759                     int /* page_id */,
    760                     bool /* supported */)
    761 
    762 // Tells the renderer a list of URLs which should be bounced back to the browser
    763 // process so that they can be assigned to an Instant renderer.
    764 IPC_MESSAGE_CONTROL2(ChromeViewMsg_SetSearchURLs,
    765                      std::vector<GURL> /* search_urls */,
    766                      GURL /* new_tab_page_url */)
    767 
    768 // Tells listeners that a detailed message was reported to the console by
    769 // WebKit.
    770 IPC_MESSAGE_ROUTED4(ChromeViewHostMsg_DetailedConsoleMessageAdded,
    771                     base::string16 /* message */,
    772                     base::string16 /* source */,
    773                     extensions::StackTrace /* stack trace */,
    774                     int32 /* severity level */)
    775