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

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

Issue 8897005: 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: Fix stupid C++98 warning. 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
« no previous file with comments | « base/memory/scoped_ptr_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « base/memory/scoped_ptr_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698