Home | History | Annotate | Download | only in common
      1 // Copyright (c) 2011 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, hence no include guard.
      6 
      7 #include "ipc/ipc_message_macros.h"
      8 #include "content/common/appcache_interfaces.h"
      9 
     10 #define IPC_MESSAGE_START AppCacheMsgStart
     11 
     12 IPC_ENUM_TRAITS_MAX_VALUE(content::AppCacheEventID,
     13                           content::APPCACHE_EVENT_ID_LAST)
     14 IPC_ENUM_TRAITS_MAX_VALUE(content::AppCacheStatus,
     15                           content::APPCACHE_STATUS_LAST)
     16 IPC_ENUM_TRAITS_MAX_VALUE(content::AppCacheErrorReason,
     17     content::APPCACHE_ERROR_REASON_LAST)
     18 
     19 IPC_STRUCT_TRAITS_BEGIN(content::AppCacheInfo)
     20   IPC_STRUCT_TRAITS_MEMBER(manifest_url)
     21   IPC_STRUCT_TRAITS_MEMBER(creation_time)
     22   IPC_STRUCT_TRAITS_MEMBER(last_update_time)
     23   IPC_STRUCT_TRAITS_MEMBER(last_access_time)
     24   IPC_STRUCT_TRAITS_MEMBER(cache_id)
     25   IPC_STRUCT_TRAITS_MEMBER(group_id)
     26   IPC_STRUCT_TRAITS_MEMBER(status)
     27   IPC_STRUCT_TRAITS_MEMBER(size)
     28   IPC_STRUCT_TRAITS_MEMBER(is_complete)
     29 IPC_STRUCT_TRAITS_END()
     30 
     31 IPC_STRUCT_TRAITS_BEGIN(content::AppCacheResourceInfo)
     32   IPC_STRUCT_TRAITS_MEMBER(url)
     33   IPC_STRUCT_TRAITS_MEMBER(size)
     34   IPC_STRUCT_TRAITS_MEMBER(is_master)
     35   IPC_STRUCT_TRAITS_MEMBER(is_manifest)
     36   IPC_STRUCT_TRAITS_MEMBER(is_fallback)
     37   IPC_STRUCT_TRAITS_MEMBER(is_foreign)
     38   IPC_STRUCT_TRAITS_MEMBER(is_explicit)
     39 IPC_STRUCT_TRAITS_END()
     40 
     41 IPC_STRUCT_TRAITS_BEGIN(content::AppCacheErrorDetails)
     42 IPC_STRUCT_TRAITS_MEMBER(message)
     43 IPC_STRUCT_TRAITS_MEMBER(reason)
     44 IPC_STRUCT_TRAITS_MEMBER(url)
     45 IPC_STRUCT_TRAITS_MEMBER(status)
     46 IPC_STRUCT_TRAITS_MEMBER(is_cross_origin)
     47 IPC_STRUCT_TRAITS_END()
     48 
     49 // AppCache messages sent from the child process to the browser.
     50 
     51 // Informs the browser of a new appcache host.
     52 IPC_MESSAGE_CONTROL1(AppCacheHostMsg_RegisterHost,
     53                      int /* host_id */)
     54 
     55 // Informs the browser of an appcache host being destroyed.
     56 IPC_MESSAGE_CONTROL1(AppCacheHostMsg_UnregisterHost,
     57                      int /* host_id */)
     58 
     59 // Informs the browser of which host caused another to be created.
     60 // This can influence which appcache should be utilized for the main
     61 // resource load into the newly created host, so it should be sent
     62 // prior to the main resource request being initiated.
     63 IPC_MESSAGE_CONTROL2(AppCacheHostMsg_SetSpawningHostId,
     64                      int /* host_id */,
     65                      int /* spawning_host_id */)
     66 
     67 // Initiates the cache selection algorithm for the given host.
     68 // This is sent prior to any subresource loads. An AppCacheMsg_CacheSelected
     69 // message will be sent in response.
     70 // 'host_id' indentifies a specific document or worker
     71 // 'document_url' the url of the main resource
     72 // 'appcache_document_was_loaded_from' the id of the appcache the main
     73 //     resource was loaded from or kAppCacheNoCacheId
     74 // 'opt_manifest_url' the manifest url specified in the <html> tag if any
     75 IPC_MESSAGE_CONTROL4(AppCacheHostMsg_SelectCache,
     76                      int /* host_id */,
     77                      GURL  /* document_url */,
     78                      int64 /* appcache_document_was_loaded_from */,
     79                      GURL  /* opt_manifest_url */)
     80 
     81 // Initiates worker specific cache selection algorithm for the given host.
     82 IPC_MESSAGE_CONTROL3(AppCacheHostMsg_SelectCacheForWorker,
     83                      int /* host_id */,
     84                      int /* parent_process_id */,
     85                      int /* parent_host_id */)
     86 IPC_MESSAGE_CONTROL2(AppCacheHostMsg_SelectCacheForSharedWorker,
     87                      int /* host_id */,
     88                      int64 /* appcache_id */)
     89 
     90 // Informs the browser of a 'foreign' entry in an appcache.
     91 IPC_MESSAGE_CONTROL3(AppCacheHostMsg_MarkAsForeignEntry,
     92                      int /* host_id */,
     93                      GURL  /* document_url */,
     94                      int64 /* appcache_document_was_loaded_from */)
     95 
     96 // Returns the status of the appcache associated with host_id.
     97 IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheHostMsg_GetStatus,
     98                             int /* host_id */,
     99                             content::AppCacheStatus)
    100 
    101 // Initiates an update of the appcache associated with host_id.
    102 IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheHostMsg_StartUpdate,
    103                             int /* host_id */,
    104                             bool /* success */)
    105 
    106 // Swaps a new pending appcache, if there is one, into use for host_id.
    107 IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheHostMsg_SwapCache,
    108                             int /* host_id */,
    109                             bool /* success */)
    110 
    111 // Gets resource list from appcache synchronously.
    112 IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheHostMsg_GetResourceList,
    113                             int /* host_id in*/,
    114                             std::vector<content::AppCacheResourceInfo>
    115                             /* resources out */)
    116 
    117 
    118 // AppCache messages sent from the browser to the child process.
    119 
    120 // Notifies the renderer of the appcache that has been selected for a
    121 // a particular host. This is sent in reply to AppCacheHostMsg_SelectCache.
    122 IPC_MESSAGE_CONTROL2(AppCacheMsg_CacheSelected,
    123                      int /* host_id */,
    124                      content::AppCacheInfo)
    125 
    126 // Notifies the renderer of an AppCache status change.
    127 IPC_MESSAGE_CONTROL2(AppCacheMsg_StatusChanged,
    128                      std::vector<int> /* host_ids */,
    129                      content::AppCacheStatus)
    130 
    131 // Notifies the renderer of an AppCache event other than the
    132 // progress event which has a seperate message.
    133 IPC_MESSAGE_CONTROL2(AppCacheMsg_EventRaised,
    134                      std::vector<int> /* host_ids */,
    135                      content::AppCacheEventID)
    136 
    137 // Notifies the renderer of an AppCache progress event.
    138 IPC_MESSAGE_CONTROL4(AppCacheMsg_ProgressEventRaised,
    139                      std::vector<int> /* host_ids */,
    140                      GURL /* url being processed */,
    141                      int /* total */,
    142                      int /* complete */)
    143 
    144 // Notifies the renderer of an AppCache error event.
    145 IPC_MESSAGE_CONTROL2(AppCacheMsg_ErrorEventRaised,
    146                      std::vector<int> /* host_ids */,
    147                      content::AppCacheErrorDetails)
    148 
    149 // Notifies the renderer of an AppCache logging message.
    150 IPC_MESSAGE_CONTROL3(AppCacheMsg_LogMessage,
    151                      int /* host_id */,
    152                      int /* log_level */,
    153                      std::string /* message */)
    154 
    155 // Notifies the renderer of the fact that AppCache access was blocked.
    156 IPC_MESSAGE_CONTROL2(AppCacheMsg_ContentBlocked,
    157                      int /* host_id */,
    158                      GURL /* manifest_url */)
    159