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

Side by Side Diff: chrome/browser/extensions/test_extension_environment.cc

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/extensions/test_extension_environment.h" 5 #include "chrome/browser/extensions/test_extension_environment.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 ExtensionPrefs* TestExtensionEnvironment::GetExtensionPrefs() { 134 ExtensionPrefs* TestExtensionEnvironment::GetExtensionPrefs() {
135 return ExtensionPrefs::Get(profile_.get()); 135 return ExtensionPrefs::Get(profile_.get());
136 } 136 }
137 137
138 const Extension* TestExtensionEnvironment::MakeExtension( 138 const Extension* TestExtensionEnvironment::MakeExtension(
139 const base::Value& manifest_extra) { 139 const base::Value& manifest_extra) {
140 scoped_ptr<base::DictionaryValue> manifest = 140 scoped_ptr<base::DictionaryValue> manifest =
141 MakeExtensionManifest(manifest_extra); 141 MakeExtensionManifest(manifest_extra);
142 scoped_refptr<Extension> result = 142 scoped_refptr<Extension> result =
143 ExtensionBuilder().SetManifest(manifest.Pass()).Build(); 143 ExtensionBuilder().SetManifest(std::move(manifest)).Build();
144 GetExtensionService()->AddExtension(result.get()); 144 GetExtensionService()->AddExtension(result.get());
145 return result.get(); 145 return result.get();
146 } 146 }
147 147
148 const Extension* TestExtensionEnvironment::MakeExtension( 148 const Extension* TestExtensionEnvironment::MakeExtension(
149 const base::Value& manifest_extra, 149 const base::Value& manifest_extra,
150 const std::string& id) { 150 const std::string& id) {
151 scoped_ptr<base::DictionaryValue> manifest = 151 scoped_ptr<base::DictionaryValue> manifest =
152 MakeExtensionManifest(manifest_extra); 152 MakeExtensionManifest(manifest_extra);
153 scoped_refptr<Extension> result = 153 scoped_refptr<Extension> result =
154 ExtensionBuilder().SetManifest(manifest.Pass()).SetID(id).Build(); 154 ExtensionBuilder().SetManifest(std::move(manifest)).SetID(id).Build();
155 GetExtensionService()->AddExtension(result.get()); 155 GetExtensionService()->AddExtension(result.get());
156 return result.get(); 156 return result.get();
157 } 157 }
158 158
159 scoped_refptr<Extension> TestExtensionEnvironment::MakePackagedApp( 159 scoped_refptr<Extension> TestExtensionEnvironment::MakePackagedApp(
160 const std::string& id, 160 const std::string& id,
161 bool install) { 161 bool install) {
162 scoped_refptr<Extension> result = ExtensionBuilder() 162 scoped_refptr<Extension> result = ExtensionBuilder()
163 .SetManifest(MakePackagedAppManifest()) 163 .SetManifest(MakePackagedAppManifest())
164 .AddFlags(Extension::FROM_WEBSTORE) 164 .AddFlags(Extension::FROM_WEBSTORE)
165 .SetID(id) 165 .SetID(id)
166 .Build(); 166 .Build();
167 if (install) 167 if (install)
168 GetExtensionService()->AddExtension(result.get()); 168 GetExtensionService()->AddExtension(result.get());
169 return result; 169 return result;
170 } 170 }
171 171
172 scoped_ptr<content::WebContents> TestExtensionEnvironment::MakeTab() const { 172 scoped_ptr<content::WebContents> TestExtensionEnvironment::MakeTab() const {
173 scoped_ptr<content::WebContents> contents( 173 scoped_ptr<content::WebContents> contents(
174 content::WebContentsTester::CreateTestWebContents(profile(), NULL)); 174 content::WebContentsTester::CreateTestWebContents(profile(), NULL));
175 // Create a tab id. 175 // Create a tab id.
176 SessionTabHelper::CreateForWebContents(contents.get()); 176 SessionTabHelper::CreateForWebContents(contents.get());
177 return contents.Pass(); 177 return contents;
178 } 178 }
179 179
180 void TestExtensionEnvironment::DeleteProfile() { 180 void TestExtensionEnvironment::DeleteProfile() {
181 profile_.reset(); 181 profile_.reset();
182 extension_service_ = nullptr; 182 extension_service_ = nullptr;
183 } 183 }
184 184
185 } // namespace extensions 185 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/shared_module_service_unittest.cc ('k') | chrome/browser/extensions/test_extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698