Commit 8049de56 authored by shuchen@chromium.org's avatar shuchen@chromium.org

Remove the check for loading component IME extensions.

After below CLs, the check is unnecessary, because for linux_chromeos,
if no extension background pages, key events won't be blocked by IMF.

https://codereview.chromium.org/433163005/
https://codereview.chromium.org/444523003/

BUG=None
TEST=Verified on linux_chromeos.

Review URL: https://codereview.chromium.org/462383003

Cr-Commit-Position: refs/heads/master@{#289566}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289566 0039d316-1c4b-4281-b951-d872f2087c98
parent 0213eef9
...@@ -260,15 +260,6 @@ std::vector<ComponentExtensionIME> ComponentExtensionIMEManagerImpl::ListIME() { ...@@ -260,15 +260,6 @@ std::vector<ComponentExtensionIME> ComponentExtensionIMEManagerImpl::ListIME() {
bool ComponentExtensionIMEManagerImpl::Load(const std::string& extension_id, bool ComponentExtensionIMEManagerImpl::Load(const std::string& extension_id,
const std::string& manifest, const std::string& manifest,
const base::FilePath& file_path) { const base::FilePath& file_path) {
// If current environment is linux_chromeos, there should be no file path for
// the component extensions, so avoid loading them.
// The tests are also running on linux_chromeos environment. No test should
// run with the real component extensions because the component extension
// contents are not in chromium code base. They're installed through ebuild
// scripts from chromeos.
if (!base::SysInfo::IsRunningOnChromeOS())
return false;
Profile* profile = ProfileManager::GetActiveUserProfile(); Profile* profile = ProfileManager::GetActiveUserProfile();
extensions::ExtensionSystem* extension_system = extensions::ExtensionSystem* extension_system =
extensions::ExtensionSystem::Get(profile); extensions::ExtensionSystem::Get(profile);
......
...@@ -25,6 +25,8 @@ void OnSessionStateChange(InputMethodManagerImpl* input_method_manager_impl, ...@@ -25,6 +25,8 @@ void OnSessionStateChange(InputMethodManagerImpl* input_method_manager_impl,
input_method_manager_impl->SetState(new_state); input_method_manager_impl->SetState(new_state);
} }
bool g_disable_extension_loading = false;
class InputMethodConfiguration { class InputMethodConfiguration {
public: public:
InputMethodConfiguration() {} InputMethodConfiguration() {}
...@@ -34,7 +36,8 @@ class InputMethodConfiguration { ...@@ -34,7 +36,8 @@ class InputMethodConfiguration {
IMEBridge::Initialize(); IMEBridge::Initialize();
InputMethodManagerImpl* impl = new InputMethodManagerImpl( InputMethodManagerImpl* impl = new InputMethodManagerImpl(
scoped_ptr<InputMethodDelegate>(new InputMethodDelegateImpl)); scoped_ptr<InputMethodDelegate>(new InputMethodDelegateImpl),
!g_disable_extension_loading);
InputMethodManager::Initialize(impl); InputMethodManager::Initialize(impl);
DCHECK(InputMethodManager::Get()); DCHECK(InputMethodManager::Get());
...@@ -88,6 +91,10 @@ void InitializeForTesting(InputMethodManager* mock_manager) { ...@@ -88,6 +91,10 @@ void InitializeForTesting(InputMethodManager* mock_manager) {
g_input_method_configuration->InitializeForTesting(mock_manager); g_input_method_configuration->InitializeForTesting(mock_manager);
} }
void DisableExtensionLoading() {
g_disable_extension_loading = true;
}
void Shutdown() { void Shutdown() {
if (!g_input_method_configuration) if (!g_input_method_configuration)
return; return;
......
...@@ -24,6 +24,9 @@ void Initialize(); ...@@ -24,6 +24,9 @@ void Initialize();
// TODO(nona): Remove this and use InputMethodManager::Initialize instead. // TODO(nona): Remove this and use InputMethodManager::Initialize instead.
void InitializeForTesting(InputMethodManager* mock_manager); void InitializeForTesting(InputMethodManager* mock_manager);
// Disables the IME extension loading (e.g. for browser tests).
void DisableExtensionLoading();
// Destroys the global InputMethodManager instance. // Destroys the global InputMethodManager instance.
void Shutdown(); void Shutdown();
......
...@@ -57,11 +57,12 @@ bool InputMethodManagerImpl::MigrateInputMethods( ...@@ -57,11 +57,12 @@ bool InputMethodManagerImpl::MigrateInputMethods(
} }
InputMethodManagerImpl::InputMethodManagerImpl( InputMethodManagerImpl::InputMethodManagerImpl(
scoped_ptr<InputMethodDelegate> delegate) scoped_ptr<InputMethodDelegate> delegate, bool enable_extension_loading)
: delegate_(delegate.Pass()), : delegate_(delegate.Pass()),
state_(STATE_LOGIN_SCREEN), state_(STATE_LOGIN_SCREEN),
util_(delegate_.get()), util_(delegate_.get()),
component_extension_ime_manager_(new ComponentExtensionIMEManager()) { component_extension_ime_manager_(new ComponentExtensionIMEManager()),
enable_extension_loading_(enable_extension_loading) {
if (base::SysInfo::IsRunningOnChromeOS()) if (base::SysInfo::IsRunningOnChromeOS())
keyboard_.reset(ImeKeyboard::Create()); keyboard_.reset(ImeKeyboard::Create());
else else
...@@ -426,6 +427,7 @@ void InputMethodManagerImpl::LoadNecessaryComponentExtensions() { ...@@ -426,6 +427,7 @@ void InputMethodManagerImpl::LoadNecessaryComponentExtensions() {
active_input_method_ids_.push_back(unfiltered_input_method_ids[i]); active_input_method_ids_.push_back(unfiltered_input_method_ids[i]);
} else if (component_extension_ime_manager_->IsWhitelisted( } else if (component_extension_ime_manager_->IsWhitelisted(
unfiltered_input_method_ids[i])) { unfiltered_input_method_ids[i])) {
if (enable_extension_loading_)
component_extension_ime_manager_->LoadComponentExtensionIME( component_extension_ime_manager_->LoadComponentExtensionIME(
unfiltered_input_method_ids[i]); unfiltered_input_method_ids[i]);
active_input_method_ids_.push_back(unfiltered_input_method_ids[i]); active_input_method_ids_.push_back(unfiltered_input_method_ids[i]);
......
...@@ -32,7 +32,8 @@ class InputMethodManagerImpl : public InputMethodManager, ...@@ -32,7 +32,8 @@ class InputMethodManagerImpl : public InputMethodManager,
public: public:
// Constructs an InputMethodManager instance. The client is responsible for // Constructs an InputMethodManager instance. The client is responsible for
// calling |SetState| in response to relevant changes in browser state. // calling |SetState| in response to relevant changes in browser state.
explicit InputMethodManagerImpl(scoped_ptr<InputMethodDelegate> delegate); InputMethodManagerImpl(scoped_ptr<InputMethodDelegate> delegate,
bool enable_extension_loading);
virtual ~InputMethodManagerImpl(); virtual ~InputMethodManagerImpl();
// Receives notification of an InputMethodManager::State transition. // Receives notification of an InputMethodManager::State transition.
...@@ -206,6 +207,9 @@ class InputMethodManagerImpl : public InputMethodManager, ...@@ -206,6 +207,9 @@ class InputMethodManagerImpl : public InputMethodManager,
// The engine map from extension_id to an engine. // The engine map from extension_id to an engine.
std::map<std::string, InputMethodEngineInterface*> engine_map_; std::map<std::string, InputMethodEngineInterface*> engine_map_;
// Whether load IME extensions.
bool enable_extension_loading_;
DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl);
}; };
......
...@@ -130,7 +130,7 @@ class InputMethodManagerImplTest : public BrowserWithTestWindowTest { ...@@ -130,7 +130,7 @@ class InputMethodManagerImplTest : public BrowserWithTestWindowTest {
delegate_ = new FakeInputMethodDelegate(); delegate_ = new FakeInputMethodDelegate();
manager_.reset(new InputMethodManagerImpl( manager_.reset(new InputMethodManagerImpl(
scoped_ptr<InputMethodDelegate>(delegate_))); scoped_ptr<InputMethodDelegate>(delegate_), false));
manager_->GetInputMethodUtil()->UpdateHardwareLayoutCache(); manager_->GetInputMethodUtil()->UpdateHardwareLayoutCache();
candidate_window_controller_ = new MockCandidateWindowController; candidate_window_controller_ = new MockCandidateWindowController;
manager_->SetCandidateWindowControllerForTesting( manager_->SetCandidateWindowControllerForTesting(
......
...@@ -70,6 +70,10 @@ ...@@ -70,6 +70,10 @@
#include "components/storage_monitor/test_storage_monitor.h" #include "components/storage_monitor/test_storage_monitor.h"
#endif #endif
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/input_method/input_method_configuration.h"
#endif
namespace { namespace {
// Passed as value of kTestType. // Passed as value of kTestType.
...@@ -176,6 +180,8 @@ void InProcessBrowserTest::SetUp() { ...@@ -176,6 +180,8 @@ void InProcessBrowserTest::SetUp() {
// Make sure that the log directory exists. // Make sure that the log directory exists.
base::FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); base::FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName();
base::CreateDirectory(log_dir); base::CreateDirectory(log_dir);
// Disable IME extension loading to avoid many browser tests failures.
chromeos::input_method::DisableExtensionLoading();
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment