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

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

Issue 10443105: Take 2 at implementing activeTab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: many more tests Created 8 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/extension_messages.h" 5 #include "chrome/common/extensions/extension_messages.h"
6 6
7 #include "chrome/common/extensions/extension.h" 7 #include "chrome/common/extensions/extension.h"
8 #include "chrome/common/extensions/extension_constants.h" 8 #include "chrome/common/extensions/extension_constants.h"
9 #include "chrome/common/extensions/manifest.h" 9 #include "chrome/common/extensions/manifest.h"
10 #include "content/public/common/common_param_traits.h" 10 #include "content/public/common/common_param_traits.h"
11 11
12 using extensions::Extension; 12 using extensions::Extension;
13 13
14 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params() 14 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params()
15 : location(Extension::INVALID), 15 : location(Extension::INVALID),
16 creation_flags(Extension::NO_FLAGS){} 16 creation_flags(Extension::NO_FLAGS){}
17 17
18 ExtensionMsg_Loaded_Params::~ExtensionMsg_Loaded_Params() {} 18 ExtensionMsg_Loaded_Params::~ExtensionMsg_Loaded_Params() {}
19 19
20 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( 20 ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params(
21 const Extension* extension) 21 const Extension* extension)
22 : manifest(extension->manifest()->value()->DeepCopy()), 22 : manifest(extension->manifest()->value()->DeepCopy()),
23 location(extension->location()), 23 location(extension->location()),
24 path(extension->path()), 24 path(extension->path()),
25 apis(extension->GetActivePermissions()->apis()), 25 apis(extension->GetActivePermissions()->apis()),
26 explicit_hosts(extension->GetActivePermissions()->explicit_hosts()), 26 explicit_hosts(extension->GetActivePermissions()->explicit_hosts()),
27 scriptable_hosts(extension->GetActivePermissions()->scriptable_hosts()), 27 scriptable_hosts(extension->GetActivePermissions()->scriptable_hosts()),
28 id(extension->id()), 28 id(extension->id()),
29 creation_flags(extension->creation_flags()) { 29 creation_flags(extension->creation_flags()) {
30 extension->GetAllTabSpecificHostPermissions(&tab_specific_host_permissions);
30 } 31 }
31 32
32 scoped_refptr<Extension> 33 scoped_refptr<Extension>
33 ExtensionMsg_Loaded_Params::ConvertToExtension() const { 34 ExtensionMsg_Loaded_Params::ConvertToExtension() const {
34 std::string error; 35 std::string error;
35 36
36 scoped_refptr<Extension> extension( 37 scoped_refptr<Extension> extension(
37 Extension::Create(path, location, *manifest, creation_flags, 38 Extension::Create(path, location, *manifest, creation_flags,
38 &error)); 39 &error));
39 if (!extension.get()) { 40 if (!extension.get()) {
40 DLOG(ERROR) << "Error deserializing extension: " << error; 41 DLOG(ERROR) << "Error deserializing extension: " << error;
41 return extension; 42 return extension;
42 } 43 }
43 44
44 extension->SetActivePermissions( 45 extension->SetActivePermissions(
45 new ExtensionPermissionSet(apis, explicit_hosts, scriptable_hosts)); 46 new ExtensionPermissionSet(apis, explicit_hosts, scriptable_hosts));
47 extension->SetAllTabSpecificHostPermissions(tab_specific_host_permissions);
48
46 return extension; 49 return extension;
47 } 50 }
48 51
49 namespace IPC { 52 namespace IPC {
50 53
51 template <> 54 template <>
52 struct ParamTraits<Extension::Location> { 55 struct ParamTraits<Extension::Location> {
53 typedef Extension::Location param_type; 56 typedef Extension::Location param_type;
54 static void Write(Message* m, const param_type& p) { 57 static void Write(Message* m, const param_type& p) {
55 int val = static_cast<int>(p); 58 int val = static_cast<int>(p);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 ReadParam(m, iter, &p->explicit_hosts) && 163 ReadParam(m, iter, &p->explicit_hosts) &&
161 ReadParam(m, iter, &p->scriptable_hosts); 164 ReadParam(m, iter, &p->scriptable_hosts);
162 } 165 }
163 166
164 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, 167 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p,
165 std::string* l) { 168 std::string* l) {
166 l->append(p.id); 169 l->append(p.id);
167 } 170 }
168 171
169 } // namespace IPC 172 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698