1// Copyright 2014 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// Message definition file, included multiple times, hence no include guard.
6
7#include <string>
8#include <vector>
9
10#include "base/strings/string16.h"
11#include "components/password_manager/content/common/credential_manager_types.h"
12#include "content/public/common/common_param_traits.h"
13#include "content/public/common/common_param_traits_macros.h"
14#include "ipc/ipc_message_macros.h"
15#include "ipc/ipc_message_utils.h"
16#include "url/gurl.h"
17
18#define IPC_MESSAGE_START CredentialManagerMsgStart
19
20IPC_ENUM_TRAITS_MAX_VALUE(password_manager::CredentialType,
21                          password_manager::CREDENTIAL_TYPE_LAST)
22
23IPC_STRUCT_TRAITS_BEGIN(password_manager::CredentialInfo)
24  IPC_STRUCT_TRAITS_MEMBER(type)
25  IPC_STRUCT_TRAITS_MEMBER(id)
26  IPC_STRUCT_TRAITS_MEMBER(name)
27  IPC_STRUCT_TRAITS_MEMBER(avatar)
28  IPC_STRUCT_TRAITS_MEMBER(password)
29  IPC_STRUCT_TRAITS_MEMBER(federation)
30IPC_STRUCT_TRAITS_END()
31
32// ----------------------------------------------------------------------------
33// Messages sent from the renderer to the browser
34
35// Passes the notification from 'navigator.credentials.notifyFailedSignIn()' up
36// to the browser process in order to suppress the automatic bubble which would
37// pop up in order to prompt the user to save the credential she used for
38// signin. The browser process will respond with a
39// CredentialManagerMsg_AcknowledgeFailedSignedIn message.
40IPC_MESSAGE_ROUTED2(CredentialManagerHostMsg_NotifyFailedSignIn,
41                    int /* request_id */,
42                    password_manager::CredentialInfo /* credential */)
43
44// Passes the notification from 'navigator.credentials.notifySignedIn()' up to
45// the browser process in order to (among other things) prompt the user to save
46// the credential she used for signin. The browser process will respond with a
47// CredentialManagerMsg_AcknowledgeSignedIn message.
48IPC_MESSAGE_ROUTED2(CredentialManagerHostMsg_NotifySignedIn,
49                    int /* request_id */,
50                    password_manager::CredentialInfo /* credential */)
51
52// Passes the notification from 'navigator.credentials.notifySignedOut()' up to
53// the browser process in order to clear the "zeroclick" bit on that origin's
54// stored credentials. The browser process will respond with a
55// CredentialManagerMsg_AcknowledgeSignedOut message.
56IPC_MESSAGE_ROUTED1(CredentialManagerHostMsg_NotifySignedOut,
57                    int /* request_id */)
58
59// Requests a credential from the browser process in response to a page calling
60// 'navigator.credentials.request()'. The browser process will respond with a
61// CredentialManagerMsg_SendCredential message.
62IPC_MESSAGE_ROUTED3(CredentialManagerHostMsg_RequestCredential,
63                    int /* request_id */,
64                    bool /* zero_click_only */,
65                    std::vector<GURL> /* federations */)
66
67// ----------------------------------------------------------------------------
68// Messages sent from the browser to the renderer
69
70// Notify the renderer that the browser process has finished processing a
71// CredentialManagerHostMsg_NotifyFailedSignedIn message.
72IPC_MESSAGE_ROUTED1(CredentialManagerMsg_AcknowledgeFailedSignIn,
73                    int /* request_id */)
74
75// Notify the renderer that the browser process has finished processing a
76// CredentialManagerHostMsg_NotifySignedIn message.
77IPC_MESSAGE_ROUTED1(CredentialManagerMsg_AcknowledgeSignedIn,
78                    int /* request_id */)
79
80// Notify the renderer that the browser process has finished processing a
81// CredentialManagerHostMsg_NotifySignedOut message.
82IPC_MESSAGE_ROUTED1(CredentialManagerMsg_AcknowledgeSignedOut,
83                    int /* request_id */)
84
85// Send a credential to the renderer in response to a
86// CredentialManagerHostMsg_RequestCredential message.
87IPC_MESSAGE_ROUTED2(CredentialManagerMsg_SendCredential,
88                    int /* request_id */,
89                    password_manager::CredentialInfo /* credential */)
90