OLD | NEW |
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/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 class Manifest { | 67 class Manifest { |
68 public: | 68 public: |
69 // Purposely not marked explicit for convenience. The vast majority of | 69 // Purposely not marked explicit for convenience. The vast majority of |
70 // callers pass string literal. | 70 // callers pass string literal. |
71 Manifest(const char* name) | 71 Manifest(const char* name) |
72 : name_(name), manifest_(NULL) { | 72 : name_(name), manifest_(NULL) { |
73 } | 73 } |
74 Manifest(DictionaryValue* manifest, const char* name) | 74 Manifest(DictionaryValue* manifest, const char* name) |
75 : name_(name), manifest_(manifest) { | 75 : name_(name), manifest_(manifest) { |
76 } | 76 } |
77 Manifest(const Manifest& m) { | |
78 // C++98 requires the copy constructor for a type to be visiable if you | |
79 // take a const-ref of a temporary for that type. Since Manifest | |
80 // contains a scoped_ptr, its implicit copy constructor is declared | |
81 // Manifest(Manifest&) according to spec 12.8.5. This breaks the first | |
82 // requirement and thus you cannot use it with LoadAndExpectError() or | |
83 // LoadAndExpectSuccess() easily. | |
84 // | |
85 // To get around this spec pedantry, we declare the copy constructor | |
86 // explicitly. It will never get invoked. | |
87 NOTREACHED(); | |
88 } | |
89 | |
90 | 77 |
91 const std::string& name() const { return name_; } | 78 const std::string& name() const { return name_; } |
92 | 79 |
93 DictionaryValue* GetManifest(std::string* error) const { | 80 DictionaryValue* GetManifest(std::string* error) const { |
94 if (manifest_) | 81 if (manifest_) |
95 return manifest_; | 82 return manifest_; |
96 | 83 |
97 manifest_ = LoadManifestFile(name_, error); | 84 manifest_ = LoadManifestFile(name_, error); |
98 manifest_holder_.reset(manifest_); | 85 manifest_holder_.reset(manifest_); |
99 return manifest_; | 86 return manifest_; |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 // This guy is identical to the previous but doesn't ask for any | 992 // This guy is identical to the previous but doesn't ask for any |
1006 // platform-app-only permissions. We should be able to load him and ask | 993 // platform-app-only permissions. We should be able to load him and ask |
1007 // questions about his permissions. | 994 // questions about his permissions. |
1008 scoped_refptr<Extension> extension( | 995 scoped_refptr<Extension> extension( |
1009 LoadAndExpectSuccess("not_platform_app.json")); | 996 LoadAndExpectSuccess("not_platform_app.json")); |
1010 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis(); | 997 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis(); |
1011 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); | 998 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); |
1012 i != apis.end(); ++i) | 999 i != apis.end(); ++i) |
1013 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions()); | 1000 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions()); |
1014 } | 1001 } |
OLD | NEW |