Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: chrome/common/icon_messages.h

Issue 6883020: Make icon_messages use the IPC macros for defining the structs and the serialization code, and mo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/favicon_url.cc ('k') | chrome/common/icon_messages.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Multiply-included message file, no traditional include guard. 5 // Multiply-included message file, no traditional include guard.
6 #include "googleurl/src/gurl.h" 6 #include <vector>
7
8 #include "chrome/common/favicon_url.h"
7 #include "ipc/ipc_message.h" 9 #include "ipc/ipc_message.h"
8 #include "ipc/ipc_message_macros.h" 10 #include "ipc/ipc_message_macros.h"
9 #include "ipc/ipc_param_traits.h" 11 #include "ipc/ipc_param_traits.h"
12 #include "third_party/skia/include/core/SkBitmap.h"
10 13
11 // TODO : Pull ViewHostMsg_UpdateFaviconURL into this file 14 #define IPC_MESSAGE_START IconMsgStart
12 15
13 #ifndef CHROME_COMMON_ICON_MESSAGES_H__ 16 IPC_ENUM_TRAITS(FaviconURL::IconType)
14 #define CHROME_COMMON_ICON_MESSAGES_H__
15 17
16 // The icon type in a page. The definition must be same as history::IconType. 18 IPC_STRUCT_TRAITS_BEGIN(FaviconURL)
17 enum IconType { 19 IPC_STRUCT_TRAITS_MEMBER(icon_url)
18 INVALID_ICON = 0x0, 20 IPC_STRUCT_TRAITS_MEMBER(icon_type)
19 FAVICON = 1 << 0, 21 IPC_STRUCT_TRAITS_END()
20 TOUCH_ICON = 1 << 1,
21 TOUCH_PRECOMPOSED_ICON = 1 << 2
22 };
23 22
24 // The favicon url from the render. 23 // Messages sent from the browser to the renderer.
25 struct FaviconURL {
26 FaviconURL();
27 FaviconURL(const GURL& url, IconType type);
28 ~FaviconURL();
29 24
30 // The url of the icon. 25 // Requests the renderer to download the specified favicon image encode it as
31 GURL icon_url; 26 // PNG and send the PNG data back ala IconHostMsg_DidDownloadFavicon.
27 IPC_MESSAGE_ROUTED3(IconMsg_DownloadFavicon,
28 int /* identifier for the request */,
29 GURL /* URL of the image */,
30 int /* Size of the image. Normally 0, but set if you have
31 a preferred image size to request, such as when
32 downloading the favicon */)
32 33
33 // The type of the icon 34 // Messages sent from the renderer to the browser.
34 IconType icon_type;
35 };
36 35
37 namespace IPC { 36 // Notification that the urls for the favicon of a site has been determined.
37 IPC_MESSAGE_ROUTED2(IconHostMsg_UpdateFaviconURL,
38 int32 /* page_id */,
39 std::vector<FaviconURL> /* urls of the favicon */)
38 40
39 template <> 41 IPC_MESSAGE_ROUTED4(IconHostMsg_DidDownloadFavicon,
40 struct ParamTraits<IconType> { 42 int /* Identifier of the request */,
41 typedef IconType param_type; 43 GURL /* URL of the image */,
42 static void Write(Message* m, const param_type& p); 44 bool /* true if there was a network error */,
43 static bool Read(const Message* m, void** iter, param_type* p); 45 SkBitmap /* image_data */)
44 static void Log(const param_type& p, std::string* l);
45 };
46
47 template <>
48 struct ParamTraits<FaviconURL> {
49 typedef FaviconURL param_type;
50 static void Write(Message* m, const param_type& p);
51 static bool Read(const Message* m, void** iter, param_type* p);
52 static void Log(const param_type& p, std::string* l);
53 };
54
55 } // namespace IPC
56
57 #endif // CHROME_COMMON_ICON_MESSAGES_H__
OLDNEW
« no previous file with comments | « chrome/common/favicon_url.cc ('k') | chrome/common/icon_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698