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

Side by Side Diff: chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iwyu fixes Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/input_method/component_extension_ime_manager_i mpl.h" 5 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i mpl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 void ComponentExtensionIMEManagerImpl::Unload(Profile* profile, 161 void ComponentExtensionIMEManagerImpl::Unload(Profile* profile,
162 const std::string& extension_id, 162 const std::string& extension_id,
163 const base::FilePath& file_path) { 163 const base::FilePath& file_path) {
164 // Remove(extension_id) does nothing when the extension has already been 164 // Remove(extension_id) does nothing when the extension has already been
165 // removed or not been registered. 165 // removed or not been registered.
166 GetComponentLoader(profile)->Remove(extension_id); 166 GetComponentLoader(profile)->Remove(extension_id);
167 } 167 }
168 168
169 scoped_ptr<base::DictionaryValue> ComponentExtensionIMEManagerImpl::GetManifest( 169 std::unique_ptr<base::DictionaryValue>
170 ComponentExtensionIMEManagerImpl::GetManifest(
170 const std::string& manifest_string) { 171 const std::string& manifest_string) {
171 std::string error; 172 std::string error;
172 JSONStringValueDeserializer deserializer(manifest_string); 173 JSONStringValueDeserializer deserializer(manifest_string);
173 scoped_ptr<base::Value> manifest = deserializer.Deserialize(NULL, &error); 174 std::unique_ptr<base::Value> manifest =
175 deserializer.Deserialize(NULL, &error);
174 if (!manifest.get()) 176 if (!manifest.get())
175 LOG(ERROR) << "Failed at getting manifest"; 177 LOG(ERROR) << "Failed at getting manifest";
176 178
177 return scoped_ptr<base::DictionaryValue>( 179 return std::unique_ptr<base::DictionaryValue>(
178 static_cast<base::DictionaryValue*>(manifest.release())); 180 static_cast<base::DictionaryValue*>(manifest.release()));
179 } 181 }
180 182
181 // static 183 // static
182 bool ComponentExtensionIMEManagerImpl::IsIMEExtensionID(const std::string& id) { 184 bool ComponentExtensionIMEManagerImpl::IsIMEExtensionID(const std::string& id) {
183 for (size_t i = 0; i < arraysize(whitelisted_component_extension); ++i) { 185 for (size_t i = 0; i < arraysize(whitelisted_component_extension); ++i) {
184 if (base::LowerCaseEqualsASCII(id, whitelisted_component_extension[i].id)) 186 if (base::LowerCaseEqualsASCII(id, whitelisted_component_extension[i].id))
185 return true; 187 return true;
186 } 188 }
187 return false; 189 return false;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 for (size_t i = 0; i < arraysize(whitelisted_component_extension); ++i) { 298 for (size_t i = 0; i < arraysize(whitelisted_component_extension); ++i) {
297 ComponentExtensionIME component_ime; 299 ComponentExtensionIME component_ime;
298 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 300 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
299 component_ime.manifest = 301 component_ime.manifest =
300 rb.GetRawDataResource( 302 rb.GetRawDataResource(
301 whitelisted_component_extension[i].manifest_resource_id) 303 whitelisted_component_extension[i].manifest_resource_id)
302 .as_string(); 304 .as_string();
303 if (component_ime.manifest.empty()) 305 if (component_ime.manifest.empty())
304 continue; 306 continue;
305 307
306 scoped_ptr<base::DictionaryValue> manifest = 308 std::unique_ptr<base::DictionaryValue> manifest =
307 GetManifest(component_ime.manifest); 309 GetManifest(component_ime.manifest);
308 if (!manifest.get()) 310 if (!manifest.get())
309 continue; 311 continue;
310 312
311 if (!ReadExtensionInfo(*manifest.get(), 313 if (!ReadExtensionInfo(*manifest.get(),
312 whitelisted_component_extension[i].id, 314 whitelisted_component_extension[i].id,
313 &component_ime)) 315 &component_ime))
314 continue; 316 continue;
315 component_ime.id = whitelisted_component_extension[i].id; 317 component_ime.id = whitelisted_component_extension[i].id;
316 318
(...skipping 16 matching lines...) Expand all
333 335
334 ComponentExtensionEngine engine; 336 ComponentExtensionEngine engine;
335 ReadEngineComponent(component_ime, *dictionary, &engine); 337 ReadEngineComponent(component_ime, *dictionary, &engine);
336 component_ime.engines.push_back(engine); 338 component_ime.engines.push_back(engine);
337 } 339 }
338 out_imes->push_back(component_ime); 340 out_imes->push_back(component_ime);
339 } 341 }
340 } 342 }
341 343
342 } // namespace chromeos 344 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698