Commit ef9a87ce authored by shuchen@chromium.org's avatar shuchen@chromium.org

Leverage OnFocus event to let component IME extension know about the current...

Leverage OnFocus event to let component IME extension know about the current screen type (e.g. login, lock, etc.) so that on-screen keyboard won't popup new window/page at login/lock screens.

BUG=395621
TEST=None

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285534 0039d316-1c4b-4281-b951-d872f2087c98
parent 63a97f9b
......@@ -6,6 +6,8 @@
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/chromeos/login/lock/screen_locker.h"
#include "chrome/browser/chromeos/login/users/user_manager.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile_manager.h"
......@@ -144,6 +146,22 @@ class ImeObserver : public InputMethodEngineInterface::Observer {
scoped_ptr<base::ListValue> args(input_ime::OnFocus::Create(context_value));
// The component IME extensions need to know the current screen type (e.g.
// lock screen, login screen, etc.) so that its on-screen keyboard page
// won't open new windows/pages. See crbug.com/395621.
base::DictionaryValue* val = NULL;
if (args->GetDictionary(0, &val)) {
std::string screen_type;
if (!UserManager::Get()->IsUserLoggedIn()) {
screen_type = "login";
} else if (chromeos::ScreenLocker::default_screen_locker() &&
chromeos::ScreenLocker::default_screen_locker()->locked()) {
screen_type = "lock";
}
if (!screen_type.empty())
val->SetStringWithoutPathExpansion("screen", screen_type);
}
DispatchEventToExtension(profile_, extension_id_,
input_ime::OnFocus::kEventName, args.Pass());
}
......
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