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

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

Issue 8949057: Revert 115441 - Redo r113722 - Add Pass(), which implements move semantics, to scoped_ptr, scoped... (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
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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 // This guy is identical to the previous but doesn't ask for any 990 // This guy is identical to the previous but doesn't ask for any
1004 // platform-app-only permissions. We should be able to load him and ask 991 // platform-app-only permissions. We should be able to load him and ask
1005 // questions about his permissions. 992 // questions about his permissions.
1006 scoped_refptr<Extension> extension( 993 scoped_refptr<Extension> extension(
1007 LoadAndExpectSuccess("not_platform_app.json")); 994 LoadAndExpectSuccess("not_platform_app.json"));
1008 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis(); 995 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis();
1009 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); 996 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin();
1010 i != apis.end(); ++i) 997 i != apis.end(); ++i)
1011 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions()); 998 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions());
1012 } 999 }
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