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

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

Issue 658183003: [Athena] Hotfix for IME component extension loading crash on sign in (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | 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 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 return extension_service->component_loader(); 247 return extension_service->component_loader();
248 } 248 }
249 249
250 void DoLoadExtension(Profile* profile, 250 void DoLoadExtension(Profile* profile,
251 const std::string& extension_id, 251 const std::string& extension_id,
252 const std::string& manifest, 252 const std::string& manifest,
253 const base::FilePath& file_path) { 253 const base::FilePath& file_path) {
254 extensions::ExtensionSystem* extension_system = 254 extensions::ExtensionSystem* extension_system =
255 extensions::ExtensionSystem::Get(profile); 255 extensions::ExtensionSystem::Get(profile);
256 ExtensionService* extension_service = extension_system->extension_service(); 256 ExtensionService* extension_service = extension_system->extension_service();
257 #if defined(USE_ATHENA)
258 // ExtensionService is not properly initialized for Athena yet.
259 // http://crbug.com/426787
260 if (!extension_service)
261 return;
262 #endif
263 DCHECK(extension_service);
257 if (extension_service->GetExtensionById(extension_id, false)) 264 if (extension_service->GetExtensionById(extension_id, false))
258 return; 265 return;
259 const std::string loaded_extension_id = 266 const std::string loaded_extension_id =
260 GetComponentLoader(profile)->Add(manifest, file_path); 267 GetComponentLoader(profile)->Add(manifest, file_path);
261 DCHECK_EQ(loaded_extension_id, extension_id); 268 DCHECK_EQ(loaded_extension_id, extension_id);
262 } 269 }
263 270
264 bool CheckFilePath(const base::FilePath* file_path) { 271 bool CheckFilePath(const base::FilePath* file_path) {
265 return base::PathExists(*file_path); 272 return base::PathExists(*file_path);
266 } 273 }
(...skipping 19 matching lines...) Expand all
286 } 293 }
287 294
288 std::vector<ComponentExtensionIME> ComponentExtensionIMEManagerImpl::ListIME() { 295 std::vector<ComponentExtensionIME> ComponentExtensionIMEManagerImpl::ListIME() {
289 return component_extension_list_; 296 return component_extension_list_;
290 } 297 }
291 298
292 void ComponentExtensionIMEManagerImpl::Load(Profile* profile, 299 void ComponentExtensionIMEManagerImpl::Load(Profile* profile,
293 const std::string& extension_id, 300 const std::string& extension_id,
294 const std::string& manifest, 301 const std::string& manifest,
295 const base::FilePath& file_path) { 302 const base::FilePath& file_path) {
296 if (base::SysInfo::IsRunningOnChromeOS()) { 303 // if (base::SysInfo::IsRunningOnChromeOS()) {
Nikita (slow) 2014/10/27 10:38:41 Removing these in next patchset.
297 // In the case of real Chrome OS device, the no need to check the file path 304 // In the case of real Chrome OS device, the no need to check the file path
298 // for preinstalled files existence. 305 // for preinstalled files existence.
299 DoLoadExtension(profile, extension_id, manifest, file_path); 306 DoLoadExtension(profile, extension_id, manifest, file_path);
300 return; 307 return;
301 } 308 // }
302 // If current environment is linux_chromeos, check the existence of file path 309 // If current environment is linux_chromeos, check the existence of file path
303 // to avoid unnecessary extension loading and InputMethodEngine creation, so 310 // to avoid unnecessary extension loading and InputMethodEngine creation, so
304 // that the virtual keyboard web content url won't be override by IME 311 // that the virtual keyboard web content url won't be override by IME
305 // component extensions. 312 // component extensions.
306 base::FilePath* copied_file_path = new base::FilePath(file_path); 313 base::FilePath* copied_file_path = new base::FilePath(file_path);
307 content::BrowserThread::PostTaskAndReplyWithResult( 314 content::BrowserThread::PostTaskAndReplyWithResult(
308 content::BrowserThread::FILE, 315 content::BrowserThread::FILE,
309 FROM_HERE, 316 FROM_HERE,
310 base::Bind(&CheckFilePath, 317 base::Bind(&CheckFilePath,
311 base::Unretained(copied_file_path)), 318 base::Unretained(copied_file_path)),
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 502
496 ComponentExtensionEngine engine; 503 ComponentExtensionEngine engine;
497 ReadEngineComponent(component_ime, *dictionary, &engine); 504 ReadEngineComponent(component_ime, *dictionary, &engine);
498 component_ime.engines.push_back(engine); 505 component_ime.engines.push_back(engine);
499 } 506 }
500 out_imes->push_back(component_ime); 507 out_imes->push_back(component_ime);
501 } 508 }
502 } 509 }
503 510
504 } // namespace chromeos 511 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698