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(TOUCH_UI) | 19 #if defined(TOUCH_UI) |
20 #include "content/common/notification_service.h" | 20 #include "content/common/notification_service.h" |
21 #endif | 21 #endif |
22 | 22 |
23 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) | 23 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) |
24 #include "chrome/browser/chromeos/cros/cros_library.h" | 24 #include "chrome/browser/chromeos/cros/cros_library.h" |
25 #include "chrome/browser/chromeos/cros/input_method_library.h" | 25 #include "chrome/browser/chromeos/cros/input_method_library.h" |
| 26 #include "chrome/browser/chromeos/login/dom_login_display.h" |
26 #endif | 27 #endif |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 // Keys. | 31 // Keys. |
31 const char kType[] = "type"; | 32 const char kType[] = "type"; |
32 const char kKeyIdentifier[] = "keyIdentifier"; | 33 const char kKeyIdentifier[] = "keyIdentifier"; |
33 const char kAlt[] = "altKey"; | 34 const char kAlt[] = "altKey"; |
34 const char kCtrl[] = "ctrlKey"; | 35 const char kCtrl[] = "ctrlKey"; |
35 const char kMeta[] = "metaKey"; | 36 const char kMeta[] = "metaKey"; |
(...skipping 21 matching lines...) Expand all Loading... |
57 return ui::ET_UNKNOWN; | 58 return ui::ET_UNKNOWN; |
58 } | 59 } |
59 | 60 |
60 } // namespace | 61 } // namespace |
61 | 62 |
62 void InputFunction::Run() { | 63 void InputFunction::Run() { |
63 SendResponse(RunImpl()); | 64 SendResponse(RunImpl()); |
64 } | 65 } |
65 | 66 |
66 views::Widget* SendKeyboardEventInputFunction::GetTopLevelWidget() { | 67 views::Widget* SendKeyboardEventInputFunction::GetTopLevelWidget() { |
| 68 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) |
| 69 views::Widget* login_window = chromeos::DOMLoginDisplay::GetLoginWindow(); |
| 70 if (login_window) |
| 71 return login_window; |
| 72 #endif |
| 73 |
67 Browser* browser = GetCurrentBrowser(); | 74 Browser* browser = GetCurrentBrowser(); |
68 if (!browser) | 75 if (!browser) |
69 return NULL; | 76 return NULL; |
70 | 77 |
71 BrowserWindow* window = browser->window(); | 78 BrowserWindow* window = browser->window(); |
72 if (!window) | 79 if (!window) |
73 return NULL; | 80 return NULL; |
74 | 81 |
75 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( | 82 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( |
76 window->GetNativeHandle()); | 83 window->GetNativeHandle()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // TODO(yusukes): Add a parameter for an input context ID. | 183 // TODO(yusukes): Add a parameter for an input context ID. |
177 int stroke_count = 0; // zero means 'clear all strokes'. | 184 int stroke_count = 0; // zero means 'clear all strokes'. |
178 if (HasOptionalArgument(0)) { | 185 if (HasOptionalArgument(0)) { |
179 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &stroke_count)); | 186 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &stroke_count)); |
180 EXTENSION_FUNCTION_VALIDATE(stroke_count >= 0); | 187 EXTENSION_FUNCTION_VALIDATE(stroke_count >= 0); |
181 } | 188 } |
182 cros_library->GetInputMethodLibrary()->CancelHandwritingStrokes(stroke_count); | 189 cros_library->GetInputMethodLibrary()->CancelHandwritingStrokes(stroke_count); |
183 return true; | 190 return true; |
184 } | 191 } |
185 #endif | 192 #endif |
OLD | NEW |