Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: chrome/browser/extensions/extension_input_api.cc

Issue 6973029: Integrate WebUI Login with cros. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated code in response to review comments Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 =
66 chromeos::DOMLoginDisplay::GetCurrentLoginWindow();
67 if (login_window)
68 return login_window;
69 #endif
70
63 Browser* browser = GetCurrentBrowser(); 71 Browser* browser = GetCurrentBrowser();
64 if (!browser) 72 if (!browser)
65 return NULL; 73 return NULL;
66 74
67 BrowserWindow* window = browser->window(); 75 BrowserWindow* window = browser->window();
68 if (!window) 76 if (!window)
69 return NULL; 77 return NULL;
70 78
71 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( 79 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow(
72 window->GetNativeHandle()); 80 window->GetNativeHandle());
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // TODO(yusukes): Add a parameter for an input context ID. 170 // TODO(yusukes): Add a parameter for an input context ID.
163 int stroke_count = 0; // zero means 'clear all strokes'. 171 int stroke_count = 0; // zero means 'clear all strokes'.
164 if (HasOptionalArgument(0)) { 172 if (HasOptionalArgument(0)) {
165 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &stroke_count)); 173 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &stroke_count));
166 EXTENSION_FUNCTION_VALIDATE(stroke_count >= 0); 174 EXTENSION_FUNCTION_VALIDATE(stroke_count >= 0);
167 } 175 }
168 cros_library->GetInputMethodLibrary()->CancelHandwritingStrokes(stroke_count); 176 cros_library->GetInputMethodLibrary()->CancelHandwritingStrokes(stroke_count);
169 return true; 177 return true;
170 } 178 }
171 #endif 179 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698