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 "android_webview/common/aw_hit_test_data.h"
      7 #include "content/public/common/common_param_traits.h"
      8 #include "ipc/ipc_channel_handle.h"
      9 #include "ipc/ipc_message_macros.h"
     10 #include "ipc/ipc_platform_file.h"
     11 #include "third_party/skia/include/core/SkColor.h"
     12 
     13 // Singly-included section for enums and custom IPC traits.
     14 #ifndef ANDROID_WEBVIEW_COMMON_RENDER_VIEW_MESSAGES_H_
     15 #define ANDROID_WEBVIEW_COMMON_RENDER_VIEW_MESSAGES_H_
     16 
     17 namespace IPC {
     18 
     19 // TODO - add enums and custom IPC traits here when needed.
     20 
     21 }  // namespace IPC
     22 
     23 #endif  // ANDROID_WEBVIEW_COMMON_RENDER_VIEW_MESSAGES_H_
     24 
     25 IPC_STRUCT_TRAITS_BEGIN(android_webview::AwHitTestData)
     26   IPC_STRUCT_TRAITS_MEMBER(type)
     27   IPC_STRUCT_TRAITS_MEMBER(extra_data_for_type)
     28   IPC_STRUCT_TRAITS_MEMBER(href)
     29   IPC_STRUCT_TRAITS_MEMBER(anchor_text)
     30   IPC_STRUCT_TRAITS_MEMBER(img_src)
     31 IPC_STRUCT_TRAITS_END()
     32 
     33 #define IPC_MESSAGE_START AndroidWebViewMsgStart
     34 
     35 //-----------------------------------------------------------------------------
     36 // RenderView messages
     37 // These are messages sent from the browser to the renderer process.
     38 
     39 // Tells the renderer to drop all WebCore memory cache.
     40 IPC_MESSAGE_CONTROL0(AwViewMsg_ClearCache)
     41 
     42 // Request for the renderer to determine if the document contains any image
     43 // elements.  The id should be passed in the response message so the response
     44 // can be associated with the request.
     45 IPC_MESSAGE_ROUTED1(AwViewMsg_DocumentHasImages,
     46                     int /* id */)
     47 
     48 // Do hit test at the given webview coordinate. "Webview" coordinates are
     49 // physical pixel values with the 0,0 at the top left of the current displayed
     50 // view (ie 0,0 is not the top left of the page if the page is scrolled).
     51 IPC_MESSAGE_ROUTED2(AwViewMsg_DoHitTest,
     52                     int /* view_x */,
     53                     int /* view_y */)
     54 
     55 // Sets the zoom level for text only. Used in layout modes other than
     56 // Text Autosizing.
     57 IPC_MESSAGE_ROUTED1(AwViewMsg_SetTextZoomLevel,
     58                     double /* zoom_level */)
     59 
     60 // Resets WebKit WebView scrolling and scale state. We need to send this
     61 // message whenever we want to guarantee that page's scale will be
     62 // recalculated by WebKit.
     63 IPC_MESSAGE_ROUTED0(AwViewMsg_ResetScrollAndScaleState)
     64 
     65 // Sets the initial page scale. This overrides initial scale set by
     66 // the meta viewport tag.
     67 IPC_MESSAGE_ROUTED1(AwViewMsg_SetInitialPageScale,
     68                     double /* page_scale_factor */)
     69 
     70 // Makes the WebKit::WebView use the given size for layout regardless of what
     71 // the size of the RenderWidget or viewport settings are.
     72 IPC_MESSAGE_ROUTED1(AwViewMsg_SetFixedLayoutSize,
     73                     gfx::Size /* size */)
     74 
     75 // Sets the base background color for this view.
     76 IPC_MESSAGE_ROUTED1(AwViewMsg_SetBackgroundColor,
     77                     SkColor)
     78 
     79 IPC_MESSAGE_CONTROL1(AwViewMsg_SetJsOnlineProperty,
     80                      bool /* network_up */)
     81 
     82 //-----------------------------------------------------------------------------
     83 // RenderView messages
     84 // These are messages sent from the renderer to the browser process.
     85 
     86 // Response to AwViewMsg_DocumentHasImages request.
     87 IPC_MESSAGE_ROUTED2(AwViewHostMsg_DocumentHasImagesResponse,
     88                     int, /* id */
     89                     bool /* has_images */)
     90 
     91 // Response to AwViewMsg_DoHitTest.
     92 IPC_MESSAGE_ROUTED1(AwViewHostMsg_UpdateHitTestData,
     93                     android_webview::AwHitTestData)
     94 
     95 // Sent whenever the page scale factor (as seen by RenderView) is changed.
     96 IPC_MESSAGE_ROUTED1(AwViewHostMsg_PageScaleFactorChanged,
     97                     float /* page_scale_factor */)
     98 
     99 // Sent whenever the contents size (as seen by RenderView) is changed.
    100 IPC_MESSAGE_ROUTED1(AwViewHostMsg_OnContentsSizeChanged,
    101                     gfx::Size /* contents_size */)
    102 
    103 // Sent when there is a top level navigation. Returning true means
    104 // the application will handle this request and so will cancel the
    105 // navigation within Blink. The view id is used to identify the correct
    106 // WebContents. When a pop up is involved, the view id indicates the
    107 // id of the opener view and not the opened one.
    108 IPC_SYNC_MESSAGE_CONTROL2_1(AwViewHostMsg_ShouldOverrideUrlLoading,
    109                             int /* view id */,
    110                             string16 /* in - url */,
    111                             bool /* out - result */)
    112