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() {
bool ComponentExtensionIMEManagerImpl::Load(const std::string& extension_id,
const std::string& manifest,
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();
extensions::ExtensionSystem* extension_system =
extensions::ExtensionSystem::Get(profile);
......
......@@ -25,6 +25,8 @@ void OnSessionStateChange(InputMethodManagerImpl* input_method_manager_impl,
input_method_manager_impl->SetState(new_state);
}
bool g_disable_extension_loading = false;
class InputMethodConfiguration {
public:
InputMethodConfiguration() {}
......@@ -34,7 +36,8 @@ class InputMethodConfiguration {
IMEBridge::Initialize();
InputMethodManagerImpl* impl = new InputMethodManagerImpl(
scoped_ptr<InputMethodDelegate>(new InputMethodDelegateImpl));
scoped_ptr<InputMethodDelegate>(new InputMethodDelegateImpl),
!g_disable_extension_loading);
InputMethodManager::Initialize(impl);
DCHECK(InputMethodManager::Get());
......@@ -88,6 +91,10 @@ void InitializeForTesting(InputMethodManager* mock_manager) {
g_input_method_configuration->InitializeForTesting(mock_manager);
}
void DisableExtensionLoading() {
g_disable_extension_loading = true;
}
void Shutdown() {
if (!g_input_method_configuration)
return;
......
......@@ -24,6 +24,9 @@ void Initialize();
// TODO(nona): Remove this and use InputMethodManager::Initialize instead.
void InitializeForTesting(InputMethodManager* mock_manager);
// Disables the IME extension loading (e.g. for browser tests).
void DisableExtensionLoading();
// Destroys the global InputMethodManager instance.
void Shutdown();
......
......@@ -57,11 +57,12 @@ bool InputMethodManagerImpl::MigrateInputMethods(
}
InputMethodManagerImpl::InputMethodManagerImpl(
scoped_ptr<InputMethodDelegate> delegate)
scoped_ptr<InputMethodDelegate> delegate, bool enable_extension_loading)
: delegate_(delegate.Pass()),
state_(STATE_LOGIN_SCREEN),
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())
keyboard_.reset(ImeKeyboard::Create());
else
......@@ -426,8 +427,9 @@ void InputMethodManagerImpl::LoadNecessaryComponentExtensions() {
active_input_method_ids_.push_back(unfiltered_input_method_ids[i]);
} else if (component_extension_ime_manager_->IsWhitelisted(
unfiltered_input_method_ids[i])) {
component_extension_ime_manager_->LoadComponentExtensionIME(
unfiltered_input_method_ids[i]);
if (enable_extension_loading_)
component_extension_ime_manager_->LoadComponentExtensionIME(
unfiltered_input_method_ids[i]);
active_input_method_ids_.push_back(unfiltered_input_method_ids[i]);
}
}
......
......@@ -32,7 +32,8 @@ class InputMethodManagerImpl : public InputMethodManager,
public:
// Constructs an InputMethodManager instance. The client is responsible for
// 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();
// Receives notification of an InputMethodManager::State transition.
......@@ -206,6 +207,9 @@ class InputMethodManagerImpl : public InputMethodManager,
// The engine map from extension_id to an engine.
std::map<std::string, InputMethodEngineInterface*> engine_map_;
// Whether load IME extensions.
bool enable_extension_loading_;
DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl);
};
......
......@@ -130,7 +130,7 @@ class InputMethodManagerImplTest : public BrowserWithTestWindowTest {
delegate_ = new FakeInputMethodDelegate();
manager_.reset(new InputMethodManagerImpl(
scoped_ptr<InputMethodDelegate>(delegate_)));
scoped_ptr<InputMethodDelegate>(delegate_), false));
manager_->GetInputMethodUtil()->UpdateHardwareLayoutCache();
candidate_window_controller_ = new MockCandidateWindowController;
manager_->SetCandidateWindowControllerForTesting(
......
......@@ -70,6 +70,10 @@
#include "components/storage_monitor/test_storage_monitor.h"
#endif
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/input_method/input_method_configuration.h"
#endif
namespace {
// Passed as value of kTestType.
......@@ -176,6 +180,8 @@ void InProcessBrowserTest::SetUp() {
// Make sure that the log directory exists.
base::FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName();
base::CreateDirectory(log_dir);
// Disable IME extension loading to avoid many browser tests failures.
chromeos::input_method::DisableExtensionLoading();
#endif // defined(OS_CHROMEOS)
#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