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

Side by Side Diff: chrome/common/render_messages.cc

Issue 6735004: Move extension messages to their own file and add a RenderViewObserver to start moving the extens... (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/render_messages.h ('k') | chrome/common/render_messages_params.h » ('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 #include "chrome/common/render_messages.h" 5 #include "chrome/common/render_messages.h"
6 6
7 namespace IPC { 7 namespace IPC {
8 8
9 void ParamTraits<ContentSettings>::Write( 9 void ParamTraits<ContentSettings>::Write(
10 Message* m, const ContentSettings& settings) { 10 Message* m, const ContentSettings& settings) {
11 for (size_t i = 0; i < arraysize(settings.settings); ++i) 11 for (size_t i = 0; i < arraysize(settings.settings); ++i)
12 WriteParam(m, settings.settings[i]); 12 WriteParam(m, settings.settings[i]);
13 } 13 }
14 14
15 bool ParamTraits<ContentSettings>::Read( 15 bool ParamTraits<ContentSettings>::Read(
16 const Message* m, void** iter, ContentSettings* r) { 16 const Message* m, void** iter, ContentSettings* r) {
17 for (size_t i = 0; i < arraysize(r->settings); ++i) { 17 for (size_t i = 0; i < arraysize(r->settings); ++i) {
18 if (!ReadParam(m, iter, &r->settings[i])) 18 if (!ReadParam(m, iter, &r->settings[i]))
19 return false; 19 return false;
20 } 20 }
21 return true; 21 return true;
22 } 22 }
23 23
24 void ParamTraits<ContentSettings>::Log( 24 void ParamTraits<ContentSettings>::Log(
25 const ContentSettings& p, std::string* l) { 25 const ContentSettings& p, std::string* l) {
26 l->append("<ContentSettings>"); 26 l->append("<ContentSettings>");
27 } 27 }
28 28
29 void ParamTraits<URLPattern>::Write(Message* m, const param_type& p) {
30 WriteParam(m, p.valid_schemes());
31 WriteParam(m, p.GetAsString());
32 }
33
34 bool ParamTraits<URLPattern>::Read(const Message* m, void** iter,
35 param_type* p) {
36 int valid_schemes;
37 std::string spec;
38 if (!ReadParam(m, iter, &valid_schemes) ||
39 !ReadParam(m, iter, &spec))
40 return false;
41
42 p->set_valid_schemes(valid_schemes);
43 return URLPattern::PARSE_SUCCESS == p->Parse(spec, URLPattern::PARSE_LENIENT);
44 }
45
46 void ParamTraits<URLPattern>::Log(const param_type& p, std::string* l) {
47 LogParam(p.GetAsString(), l);
48 }
49
50 void ParamTraits<ExtensionExtent>::Write(Message* m, const param_type& p) {
51 WriteParam(m, p.patterns());
52 }
53
54 bool ParamTraits<ExtensionExtent>::Read(const Message* m, void** iter,
55 param_type* p) {
56 std::vector<URLPattern> patterns;
57 bool success =
58 ReadParam(m, iter, &patterns);
59 if (!success)
60 return false;
61
62 for (size_t i = 0; i < patterns.size(); ++i)
63 p->AddPattern(patterns[i]);
64 return true;
65 }
66
67 void ParamTraits<ExtensionExtent>::Log(const param_type& p, std::string* l) {
68 LogParam(p.patterns(), l);
69 }
70
71 } // namespace IPC 29 } // namespace IPC
OLDNEW
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/common/render_messages_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698