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

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

Issue 9021032: Redo r113722 - Add Pass(), which implements move semantics, to scoped_ptr, scoped_array.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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) 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
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 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 // This guy is identical to the previous but doesn't ask for any 973 // This guy is identical to the previous but doesn't ask for any
961 // platform-app-only permissions. We should be able to load him and ask 974 // platform-app-only permissions. We should be able to load him and ask
962 // questions about his permissions. 975 // questions about his permissions.
963 scoped_refptr<Extension> extension( 976 scoped_refptr<Extension> extension(
964 LoadAndExpectSuccess("not_platform_app.json")); 977 LoadAndExpectSuccess("not_platform_app.json"));
965 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis(); 978 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis();
966 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); 979 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin();
967 i != apis.end(); ++i) 980 i != apis.end(); ++i)
968 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions()); 981 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions());
969 } 982 }
OLDNEW
« no previous file with comments | « base/memory/scoped_ptr_unittest.cc ('k') | content/browser/renderer_host/render_widget_host_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698