OLD | NEW |
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/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 ComponentExtensionIMEManagerImpl::~ComponentExtensionIMEManagerImpl() { | 253 ComponentExtensionIMEManagerImpl::~ComponentExtensionIMEManagerImpl() { |
254 } | 254 } |
255 | 255 |
256 std::vector<ComponentExtensionIME> ComponentExtensionIMEManagerImpl::ListIME() { | 256 std::vector<ComponentExtensionIME> ComponentExtensionIMEManagerImpl::ListIME() { |
257 return component_extension_list_; | 257 return component_extension_list_; |
258 } | 258 } |
259 | 259 |
260 bool ComponentExtensionIMEManagerImpl::Load(const std::string& extension_id, | 260 bool ComponentExtensionIMEManagerImpl::Load(const std::string& extension_id, |
261 const std::string& manifest, | 261 const std::string& manifest, |
262 const base::FilePath& file_path) { | 262 const base::FilePath& file_path) { |
263 // If current environment is linux_chromeos, there should be no file path for | |
264 // the component extensions, so avoid loading them. | |
265 // The tests are also running on linux_chromeos environment. No test should | |
266 // run with the real component extensions because the component extension | |
267 // contents are not in chromium code base. They're installed through ebuild | |
268 // scripts from chromeos. | |
269 if (!base::SysInfo::IsRunningOnChromeOS()) | |
270 return false; | |
271 | |
272 Profile* profile = ProfileManager::GetActiveUserProfile(); | 263 Profile* profile = ProfileManager::GetActiveUserProfile(); |
273 extensions::ExtensionSystem* extension_system = | 264 extensions::ExtensionSystem* extension_system = |
274 extensions::ExtensionSystem::Get(profile); | 265 extensions::ExtensionSystem::Get(profile); |
275 ExtensionService* extension_service = extension_system->extension_service(); | 266 ExtensionService* extension_service = extension_system->extension_service(); |
276 if (extension_service->GetExtensionById(extension_id, false)) | 267 if (extension_service->GetExtensionById(extension_id, false)) |
277 return false; | 268 return false; |
278 const std::string loaded_extension_id = | 269 const std::string loaded_extension_id = |
279 GetComponentLoader()->Add(manifest, file_path); | 270 GetComponentLoader()->Add(manifest, file_path); |
280 DCHECK_EQ(loaded_extension_id, extension_id); | 271 DCHECK_EQ(loaded_extension_id, extension_id); |
281 return true; | 272 return true; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 448 |
458 ComponentExtensionEngine engine; | 449 ComponentExtensionEngine engine; |
459 ReadEngineComponent(component_ime, *dictionary, &engine); | 450 ReadEngineComponent(component_ime, *dictionary, &engine); |
460 component_ime.engines.push_back(engine); | 451 component_ime.engines.push_back(engine); |
461 } | 452 } |
462 out_imes->push_back(component_ime); | 453 out_imes->push_back(component_ime); |
463 } | 454 } |
464 } | 455 } |
465 | 456 |
466 } // namespace chromeos | 457 } // namespace chromeos |
OLD | NEW |