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

Side by Side Diff: chrome/browser/extensions/api/input/input.cc

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First cut for review/trybots Created 7 years, 1 month 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/api/input/input.h" 5 #include "chrome/browser/extensions/api/input/input.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 bool VirtualKeyboardPrivateMoveCursorFunction::RunImpl() { 43 bool VirtualKeyboardPrivateMoveCursorFunction::RunImpl() {
44 #if defined(USE_ASH) 44 #if defined(USE_ASH)
45 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 45 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
46 46
47 int swipe_direction; 47 int swipe_direction;
48 int modifier_flags; 48 int modifier_flags;
49 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &swipe_direction)); 49 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &swipe_direction));
50 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &modifier_flags)); 50 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &modifier_flags));
51 51
52 return keyboard::MoveCursor(swipe_direction, modifier_flags, 52 return keyboard::MoveCursor(
53 ash::Shell::GetPrimaryRootWindow()); 53 swipe_direction,
54 modifier_flags,
55 ash::Shell::GetPrimaryRootWindow()->GetDispatcher());
54 #endif 56 #endif
55 error_ = kNotYetImplementedError; 57 error_ = kNotYetImplementedError;
56 return false; 58 return false;
57 } 59 }
58 60
59 bool VirtualKeyboardPrivateSendKeyEventFunction::RunImpl() { 61 bool VirtualKeyboardPrivateSendKeyEventFunction::RunImpl() {
60 #if defined(USE_ASH) 62 #if defined(USE_ASH)
61 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 63 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
62 64
63 base::Value* options_value = NULL; 65 base::Value* options_value = NULL;
64 base::DictionaryValue* params = NULL; 66 base::DictionaryValue* params = NULL;
65 std::string type; 67 std::string type;
66 int char_value; 68 int char_value;
67 int key_code; 69 int key_code;
68 bool shift_modifier; 70 bool shift_modifier;
69 71
70 EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &options_value)); 72 EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &options_value));
71 EXTENSION_FUNCTION_VALIDATE(options_value->GetAsDictionary(&params)); 73 EXTENSION_FUNCTION_VALIDATE(options_value->GetAsDictionary(&params));
72 EXTENSION_FUNCTION_VALIDATE(params->GetString("type", &type)); 74 EXTENSION_FUNCTION_VALIDATE(params->GetString("type", &type));
73 EXTENSION_FUNCTION_VALIDATE(params->GetInteger("charValue", &char_value)); 75 EXTENSION_FUNCTION_VALIDATE(params->GetInteger("charValue", &char_value));
74 EXTENSION_FUNCTION_VALIDATE(params->GetInteger("keyCode", &key_code)); 76 EXTENSION_FUNCTION_VALIDATE(params->GetInteger("keyCode", &key_code));
75 EXTENSION_FUNCTION_VALIDATE(params->GetBoolean("shiftKey", &shift_modifier)); 77 EXTENSION_FUNCTION_VALIDATE(params->GetBoolean("shiftKey", &shift_modifier));
76 78
77 return keyboard::SendKeyEvent(type, 79 return keyboard::SendKeyEvent(
78 char_value, 80 type,
79 key_code, 81 char_value,
80 shift_modifier, 82 key_code,
81 ash::Shell::GetPrimaryRootWindow()); 83 shift_modifier,
84 ash::Shell::GetPrimaryRootWindow()->GetDispatcher());
82 #endif 85 #endif
83 error_ = kNotYetImplementedError; 86 error_ = kNotYetImplementedError;
84 return false; 87 return false;
85 } 88 }
86 89
87 bool VirtualKeyboardPrivateHideKeyboardFunction::RunImpl() { 90 bool VirtualKeyboardPrivateHideKeyboardFunction::RunImpl() {
88 #if defined(USE_ASH) 91 #if defined(USE_ASH)
89 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 92 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
90 93
91 UMA_HISTOGRAM_ENUMERATION( 94 UMA_HISTOGRAM_ENUMERATION(
(...skipping 20 matching lines...) Expand all
112 115
113 static base::LazyInstance<ProfileKeyedAPIFactory<InputAPI> > 116 static base::LazyInstance<ProfileKeyedAPIFactory<InputAPI> >
114 g_factory = LAZY_INSTANCE_INITIALIZER; 117 g_factory = LAZY_INSTANCE_INITIALIZER;
115 118
116 // static 119 // static
117 ProfileKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() { 120 ProfileKeyedAPIFactory<InputAPI>* InputAPI::GetFactoryInstance() {
118 return &g_factory.Get(); 121 return &g_factory.Get();
119 } 122 }
120 123
121 } // namespace extensions 124 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698