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

Side by Side Diff: extensions/common/extension_messages.cc

Issue 2697463002: Convert utility process extension Unpacker IPC to mojo (Closed)
Patch Set: Set the IPC enum traits limit to extensions::Manifest::NUM_LOCATIONS - 1. Created 3 years, 9 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
« no previous file with comments | « extensions/common/OWNERS ('k') | extensions/common/extension_unpacker.mojom » ('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 2014 The Chromium Authors. All rights reserved. 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 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 "extensions/common/extension_messages.h" 5 #include "extensions/common/extension_messages.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "content/public/common/common_param_traits.h" 12 #include "content/public/common/common_param_traits.h"
13 #include "extensions/common/extension.h" 13 #include "extensions/common/extension.h"
14 #include "extensions/common/manifest.h" 14 #include "extensions/common/manifest.h"
15 #include "extensions/common/manifest_handler.h" 15 #include "extensions/common/manifest_handler.h"
16 #include "extensions/common/manifest_location_param_traits.h"
16 #include "extensions/common/permissions/permissions_data.h" 17 #include "extensions/common/permissions/permissions_data.h"
17 #include "extensions/common/permissions/permissions_info.h" 18 #include "extensions/common/permissions/permissions_info.h"
18 19
19 using extensions::APIPermission; 20 using extensions::APIPermission;
20 using extensions::APIPermissionInfo; 21 using extensions::APIPermissionInfo;
21 using extensions::APIPermissionSet; 22 using extensions::APIPermissionSet;
22 using extensions::Extension; 23 using extensions::Extension;
23 using extensions::Manifest; 24 using extensions::Manifest;
24 using extensions::ManifestHandler; 25 using extensions::ManifestHandler;
25 using extensions::ManifestPermission; 26 using extensions::ManifestPermission;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 for (const auto& pair : tab_specific_permissions) { 95 for (const auto& pair : tab_specific_permissions) {
95 permissions_data->UpdateTabSpecificPermissions( 96 permissions_data->UpdateTabSpecificPermissions(
96 pair.first, *pair.second.ToPermissionSet()); 97 pair.first, *pair.second.ToPermissionSet());
97 } 98 }
98 } 99 }
99 return extension; 100 return extension;
100 } 101 }
101 102
102 namespace IPC { 103 namespace IPC {
103 104
104 template <>
105 struct ParamTraits<Manifest::Location> {
106 typedef Manifest::Location param_type;
107 static void Write(base::Pickle* m, const param_type& p) {
108 int val = static_cast<int>(p);
109 WriteParam(m, val);
110 }
111 static bool Read(const base::Pickle* m,
112 base::PickleIterator* iter,
113 param_type* p) {
114 int val = 0;
115 if (!ReadParam(m, iter, &val) ||
116 val < Manifest::INVALID_LOCATION ||
117 val >= Manifest::NUM_LOCATIONS)
118 return false;
119 *p = static_cast<param_type>(val);
120 return true;
121 }
122 static void Log(const param_type& p, std::string* l) {
123 ParamTraits<int>::Log(static_cast<int>(p), l);
124 }
125 };
126
127 void ParamTraits<URLPattern>::GetSize(base::PickleSizer* s, 105 void ParamTraits<URLPattern>::GetSize(base::PickleSizer* s,
128 const param_type& p) { 106 const param_type& p) {
129 GetParamSize(s, p.valid_schemes()); 107 GetParamSize(s, p.valid_schemes());
130 GetParamSize(s, p.GetAsString()); 108 GetParamSize(s, p.GetAsString());
131 } 109 }
132 110
133 void ParamTraits<URLPattern>::Write(base::Pickle* m, const param_type& p) { 111 void ParamTraits<URLPattern>::Write(base::Pickle* m, const param_type& p) {
134 WriteParam(m, p.valid_schemes()); 112 WriteParam(m, p.valid_schemes());
135 WriteParam(m, p.GetAsString()); 113 WriteParam(m, p.GetAsString());
136 } 114 }
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 ReadParam(m, iter, &p->withheld_permissions) && 372 ReadParam(m, iter, &p->withheld_permissions) &&
395 ReadParam(m, iter, &p->tab_specific_permissions); 373 ReadParam(m, iter, &p->tab_specific_permissions);
396 } 374 }
397 375
398 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, 376 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p,
399 std::string* l) { 377 std::string* l) {
400 l->append(p.id); 378 l->append(p.id);
401 } 379 }
402 380
403 } // namespace IPC 381 } // namespace IPC
OLDNEW
« no previous file with comments | « extensions/common/OWNERS ('k') | extensions/common/extension_unpacker.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698