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