OLD | NEW |
---|---|
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 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 ExtensionMsg_PermissionSetStruct(*pair.second); | 74 ExtensionMsg_PermissionSetStruct(*pair.second); |
75 } | 75 } |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( | 79 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( |
80 const ExtensionMsg_Loaded_Params& other) = default; | 80 const ExtensionMsg_Loaded_Params& other) = default; |
81 | 81 |
82 scoped_refptr<Extension> ExtensionMsg_Loaded_Params::ConvertToExtension( | 82 scoped_refptr<Extension> ExtensionMsg_Loaded_Params::ConvertToExtension( |
83 std::string* error) const { | 83 std::string* error) const { |
84 // We pass in the |id| to the create call because it will safe work in the | |
asargent_no_longer_on_chrome
2016/08/25 22:06:16
typo: "safe" - did you mean "still"? or maybe "sav
Devlin
2016/08/25 22:15:09
Save - whoops.
| |
85 // normal case, and because in tests, extensions may not have paths or keys, | |
86 // but it's important to retain the same id. | |
84 scoped_refptr<Extension> extension = | 87 scoped_refptr<Extension> extension = |
85 Extension::Create(path, location, *manifest, creation_flags, error); | 88 Extension::Create(path, location, *manifest, creation_flags, id, error); |
86 if (extension.get()) { | 89 if (extension.get()) { |
87 const extensions::PermissionsData* permissions_data = | 90 const extensions::PermissionsData* permissions_data = |
88 extension->permissions_data(); | 91 extension->permissions_data(); |
89 permissions_data->SetPermissions(active_permissions.ToPermissionSet(), | 92 permissions_data->SetPermissions(active_permissions.ToPermissionSet(), |
90 withheld_permissions.ToPermissionSet()); | 93 withheld_permissions.ToPermissionSet()); |
91 for (const auto& pair : tab_specific_permissions) { | 94 for (const auto& pair : tab_specific_permissions) { |
92 permissions_data->UpdateTabSpecificPermissions( | 95 permissions_data->UpdateTabSpecificPermissions( |
93 pair.first, *pair.second.ToPermissionSet()); | 96 pair.first, *pair.second.ToPermissionSet()); |
94 } | 97 } |
95 } | 98 } |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 LogParam(p.explicit_hosts, l); | 370 LogParam(p.explicit_hosts, l); |
368 LogParam(p.scriptable_hosts, l); | 371 LogParam(p.scriptable_hosts, l); |
369 } | 372 } |
370 | 373 |
371 void ParamTraits<ExtensionMsg_Loaded_Params>::Write(base::Pickle* m, | 374 void ParamTraits<ExtensionMsg_Loaded_Params>::Write(base::Pickle* m, |
372 const param_type& p) { | 375 const param_type& p) { |
373 WriteParam(m, p.location); | 376 WriteParam(m, p.location); |
374 WriteParam(m, p.path); | 377 WriteParam(m, p.path); |
375 WriteParam(m, *(p.manifest)); | 378 WriteParam(m, *(p.manifest)); |
376 WriteParam(m, p.creation_flags); | 379 WriteParam(m, p.creation_flags); |
380 WriteParam(m, p.id); | |
377 WriteParam(m, p.active_permissions); | 381 WriteParam(m, p.active_permissions); |
378 WriteParam(m, p.withheld_permissions); | 382 WriteParam(m, p.withheld_permissions); |
383 WriteParam(m, p.tab_specific_permissions); | |
379 } | 384 } |
380 | 385 |
381 bool ParamTraits<ExtensionMsg_Loaded_Params>::Read(const base::Pickle* m, | 386 bool ParamTraits<ExtensionMsg_Loaded_Params>::Read(const base::Pickle* m, |
382 base::PickleIterator* iter, | 387 base::PickleIterator* iter, |
383 param_type* p) { | 388 param_type* p) { |
384 p->manifest.reset(new base::DictionaryValue()); | 389 p->manifest.reset(new base::DictionaryValue()); |
385 return ReadParam(m, iter, &p->location) && ReadParam(m, iter, &p->path) && | 390 return ReadParam(m, iter, &p->location) && ReadParam(m, iter, &p->path) && |
386 ReadParam(m, iter, p->manifest.get()) && | 391 ReadParam(m, iter, p->manifest.get()) && |
387 ReadParam(m, iter, &p->creation_flags) && | 392 ReadParam(m, iter, &p->creation_flags) && ReadParam(m, iter, &p->id) && |
388 ReadParam(m, iter, &p->active_permissions) && | 393 ReadParam(m, iter, &p->active_permissions) && |
389 ReadParam(m, iter, &p->withheld_permissions); | 394 ReadParam(m, iter, &p->withheld_permissions) && |
395 ReadParam(m, iter, &p->tab_specific_permissions); | |
390 } | 396 } |
391 | 397 |
392 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, | 398 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, |
393 std::string* l) { | 399 std::string* l) { |
394 l->append(p.id); | 400 l->append(p.id); |
395 } | 401 } |
396 | 402 |
397 } // namespace IPC | 403 } // namespace IPC |
OLD | NEW |