Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / chrome / common / safe_browsing / safebrowsing_messages.h
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, so no include guard.
6
7 #include <string>
8 #include <vector>
9
10 #include "ipc/ipc_message_macros.h"
11 #include "url/gurl.h"
12
13 #if !defined(FULL_SAFE_BROWSING) && !defined(MOBILE_SAFE_BROWSING)
14 #error "Safe browsing should be enabled"
15 #endif
16
17 #define IPC_MESSAGE_START SafeBrowsingMsgStart
18
19 // A node is essentially a frame.
20 IPC_STRUCT_BEGIN(SafeBrowsingHostMsg_MalwareDOMDetails_Node)
21   // URL of this resource. Can be empty.
22   IPC_STRUCT_MEMBER(GURL, url)
23
24   // If this resource was in the "src" attribute of a tag, this is the tagname
25   // (eg "IFRAME"). Can be empty.
26   IPC_STRUCT_MEMBER(std::string, tag_name)
27
28   // URL of the parent node. Can be empty.
29   IPC_STRUCT_MEMBER(GURL, parent)
30
31   // children of this node. Can be emtpy.
32   IPC_STRUCT_MEMBER(std::vector<GURL>, children)
33 IPC_STRUCT_END()
34
35 // SafeBrowsing client-side detection messages sent from the renderer to the
36 // browser.
37
38 // Send part of the DOM to the browser, to be used in a malware report.
39 IPC_MESSAGE_ROUTED1(SafeBrowsingHostMsg_MalwareDOMDetails,
40                     std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>)
41
42 #if defined(FULL_SAFE_BROWSING)
43 // Inform the browser that the client-side phishing detector running in the
44 // renderer is done classifying the current URL.  If the URL is phishing
45 // the request proto will have |is_phishing()| set to true.
46 // TODO(noelutz): we may want to create custom ParamTraits for MessageLite to
47 // have a generic way to send protocol messages over IPC.
48 IPC_MESSAGE_ROUTED1(SafeBrowsingHostMsg_PhishingDetectionDone,
49                     std::string /* encoded ClientPhishingRequest proto */)
50 #endif
51
52 // SafeBrowsing client-side detection messages sent from the browser to the
53 // renderer.
54
55 // Request a DOM tree when a malware interstitial is shown.
56 IPC_MESSAGE_ROUTED0(SafeBrowsingMsg_GetMalwareDOMDetails)
57
58 #if defined(FULL_SAFE_BROWSING)
59 // A classification model for client-side phishing detection.
60 // The string is an encoded safe_browsing::ClientSideModel protocol buffer, or
61 // empty to disable client-side phishing detection for this renderer.
62 IPC_MESSAGE_CONTROL1(SafeBrowsingMsg_SetPhishingModel,
63                      std::string /* encoded ClientSideModel proto */)
64
65 // Tells the renderer to begin phishing detection for the given toplevel URL
66 // which it has started loading.
67 IPC_MESSAGE_ROUTED1(SafeBrowsingMsg_StartPhishingDetection,
68                     GURL)
69 #endif