OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/extension_input_api.h" | 5 #include "chrome/browser/extensions/extension_input_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/extensions/key_identifier_conversion_views.h" | 11 #include "chrome/browser/extensions/key_identifier_conversion_views.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
15 #include "views/events/event.h" | 15 #include "views/events/event.h" |
16 #include "views/ime/input_method.h" | 16 #include "views/ime/input_method.h" |
17 #include "views/widget/widget.h" | 17 #include "views/widget/widget.h" |
18 | 18 |
19 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) | 19 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) |
20 #include "chrome/browser/chromeos/cros/cros_library.h" | 20 #include "chrome/browser/chromeos/cros/cros_library.h" |
21 #include "chrome/browser/chromeos/cros/input_method_library.h" | 21 #include "chrome/browser/chromeos/cros/input_method_library.h" |
| 22 #include "chrome/browser/chromeos/login/dom_login_display.h" |
22 #endif | 23 #endif |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 // Keys. | 27 // Keys. |
27 const char kType[] = "type"; | 28 const char kType[] = "type"; |
28 const char kKeyIdentifier[] = "keyIdentifier"; | 29 const char kKeyIdentifier[] = "keyIdentifier"; |
29 const char kAlt[] = "altKey"; | 30 const char kAlt[] = "altKey"; |
30 const char kCtrl[] = "ctrlKey"; | 31 const char kCtrl[] = "ctrlKey"; |
31 const char kMeta[] = "metaKey"; | 32 const char kMeta[] = "metaKey"; |
(...skipping 21 matching lines...) Expand all Loading... |
53 return ui::ET_UNKNOWN; | 54 return ui::ET_UNKNOWN; |
54 } | 55 } |
55 | 56 |
56 } // namespace | 57 } // namespace |
57 | 58 |
58 void InputFunction::Run() { | 59 void InputFunction::Run() { |
59 SendResponse(RunImpl()); | 60 SendResponse(RunImpl()); |
60 } | 61 } |
61 | 62 |
62 views::Widget* SendKeyboardEventInputFunction::GetTopLevelWidget() { | 63 views::Widget* SendKeyboardEventInputFunction::GetTopLevelWidget() { |
| 64 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) |
| 65 views::Widget* login_window = chromeos::DOMLoginDisplay::GetLoginWindow(); |
| 66 if (login_window) |
| 67 return login_window; |
| 68 #endif |
| 69 |
63 Browser* browser = GetCurrentBrowser(); | 70 Browser* browser = GetCurrentBrowser(); |
64 if (!browser) | 71 if (!browser) |
65 return NULL; | 72 return NULL; |
66 | 73 |
67 BrowserWindow* window = browser->window(); | 74 BrowserWindow* window = browser->window(); |
68 if (!window) | 75 if (!window) |
69 return NULL; | 76 return NULL; |
70 | 77 |
71 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( | 78 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( |
72 window->GetNativeHandle()); | 79 window->GetNativeHandle()); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // TODO(yusukes): Add a parameter for an input context ID. | 169 // TODO(yusukes): Add a parameter for an input context ID. |
163 int stroke_count = 0; // zero means 'clear all strokes'. | 170 int stroke_count = 0; // zero means 'clear all strokes'. |
164 if (HasOptionalArgument(0)) { | 171 if (HasOptionalArgument(0)) { |
165 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &stroke_count)); | 172 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &stroke_count)); |
166 EXTENSION_FUNCTION_VALIDATE(stroke_count >= 0); | 173 EXTENSION_FUNCTION_VALIDATE(stroke_count >= 0); |
167 } | 174 } |
168 cros_library->GetInputMethodLibrary()->CancelHandwritingStrokes(stroke_count); | 175 cros_library->GetInputMethodLibrary()->CancelHandwritingStrokes(stroke_count); |
169 return true; | 176 return true; |
170 } | 177 } |
171 #endif | 178 #endif |
OLD | NEW |