| 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 |
| 77 | 90 |
| 78 const std::string& name() const { return name_; } | 91 const std::string& name() const { return name_; } |
| 79 | 92 |
| 80 DictionaryValue* GetManifest(std::string* error) const { | 93 DictionaryValue* GetManifest(std::string* error) const { |
| 81 if (manifest_) | 94 if (manifest_) |
| 82 return manifest_; | 95 return manifest_; |
| 83 | 96 |
| 84 manifest_ = LoadManifestFile(name_, error); | 97 manifest_ = LoadManifestFile(name_, error); |
| 85 manifest_holder_.reset(manifest_); | 98 manifest_holder_.reset(manifest_); |
| 86 return manifest_; | 99 return manifest_; |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 // This guy is identical to the previous but doesn't ask for any | 1005 // This guy is identical to the previous but doesn't ask for any |
| 993 // platform-app-only permissions. We should be able to load him and ask | 1006 // platform-app-only permissions. We should be able to load him and ask |
| 994 // questions about his permissions. | 1007 // questions about his permissions. |
| 995 scoped_refptr<Extension> extension( | 1008 scoped_refptr<Extension> extension( |
| 996 LoadAndExpectSuccess("not_platform_app.json")); | 1009 LoadAndExpectSuccess("not_platform_app.json")); |
| 997 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis(); | 1010 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis(); |
| 998 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); | 1011 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); |
| 999 i != apis.end(); ++i) | 1012 i != apis.end(); ++i) |
| 1000 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions()); | 1013 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions()); |
| 1001 } | 1014 } |
| OLD | NEW |