OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/ui/ash/ash_keyboard_controller_proxy.h" | 5 #include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | |
7 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | |
8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 10 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 11 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
10 #include "content/public/browser/host_zoom_map.h" | 12 #include "content/public/browser/host_zoom_map.h" |
11 #include "content/public/browser/render_process_host.h" | 13 #include "content/public/browser/render_process_host.h" |
12 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
13 #include "content/public/browser/site_instance.h" | 15 #include "content/public/browser/site_instance.h" |
14 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
15 #include "extensions/browser/event_router.h" | 17 #include "extensions/browser/event_router.h" |
16 #include "extensions/browser/extension_registry.h" | 18 #include "extensions/browser/extension_registry.h" |
17 #include "extensions/browser/view_type_utils.h" | 19 #include "extensions/browser/view_type_utils.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 void AshKeyboardControllerProxy::ShowKeyboardContainer( | 176 void AshKeyboardControllerProxy::ShowKeyboardContainer( |
175 aura::Window* container) { | 177 aura::Window* container) { |
176 // TODO(bshe): Implement logic to decide which root window should display | 178 // TODO(bshe): Implement logic to decide which root window should display |
177 // virtual keyboard. http://crbug.com/303429 | 179 // virtual keyboard. http://crbug.com/303429 |
178 if (container->GetRootWindow() != ash::Shell::GetPrimaryRootWindow()) | 180 if (container->GetRootWindow() != ash::Shell::GetPrimaryRootWindow()) |
179 NOTIMPLEMENTED(); | 181 NOTIMPLEMENTED(); |
180 | 182 |
181 KeyboardControllerProxy::ShowKeyboardContainer(container); | 183 KeyboardControllerProxy::ShowKeyboardContainer(container); |
182 } | 184 } |
183 | 185 |
186 bool AshKeyboardControllerProxy::ShouldWindowOverscroll( | |
187 aura::Window* window) const { | |
188 ash::RootWindowController* root_window_controller = | |
189 ash::GetRootWindowController(window->GetRootWindow()); | |
190 if (!root_window_controller) | |
oshima
2015/09/23 19:57:27
can this happen? If not, please use DCHECK instead
bshe
2015/09/24 11:56:15
I think so. One window (I am not sure which) doesn
oshima
2015/09/24 17:28:07
can you check the root window instead then?
bshe
2015/09/28 14:42:40
Done.
| |
191 return true; | |
192 | |
193 // Shell ime window container contains virtual keyboard windows and IME | |
194 // windows(IME windows are created by chrome.app.window.create api). They | |
195 // should never be overscrolled. | |
196 return !root_window_controller | |
197 ->GetContainer(ash::kShellWindowId_ImeWindowParentContainer) | |
198 ->Contains(window); | |
199 } | |
200 | |
184 void AshKeyboardControllerProxy::SetUpdateInputType(ui::TextInputType type) { | 201 void AshKeyboardControllerProxy::SetUpdateInputType(ui::TextInputType type) { |
185 // TODO(bshe): Need to check the affected window's profile once multi-profile | 202 // TODO(bshe): Need to check the affected window's profile once multi-profile |
186 // is supported. | 203 // is supported. |
187 extensions::EventRouter* router = | 204 extensions::EventRouter* router = |
188 extensions::EventRouter::Get(browser_context()); | 205 extensions::EventRouter::Get(browser_context()); |
189 | 206 |
190 if (!router->HasEventListener( | 207 if (!router->HasEventListener( |
191 virtual_keyboard_private::OnTextInputBoxFocused::kEventName)) { | 208 virtual_keyboard_private::OnTextInputBoxFocused::kEventName)) { |
192 return; | 209 return; |
193 } | 210 } |
194 | 211 |
195 scoped_ptr<base::ListValue> event_args(new base::ListValue()); | 212 scoped_ptr<base::ListValue> event_args(new base::ListValue()); |
196 scoped_ptr<base::DictionaryValue> input_context(new base::DictionaryValue()); | 213 scoped_ptr<base::DictionaryValue> input_context(new base::DictionaryValue()); |
197 input_context->SetString("type", | 214 input_context->SetString("type", |
198 virtual_keyboard_private::ToString( | 215 virtual_keyboard_private::ToString( |
199 TextInputTypeToGeneratedInputTypeEnum(type))); | 216 TextInputTypeToGeneratedInputTypeEnum(type))); |
200 event_args->Append(input_context.release()); | 217 event_args->Append(input_context.release()); |
201 | 218 |
202 scoped_ptr<extensions::Event> event(new extensions::Event( | 219 scoped_ptr<extensions::Event> event(new extensions::Event( |
203 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_TEXT_INPUT_BOX_FOCUSED, | 220 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_TEXT_INPUT_BOX_FOCUSED, |
204 virtual_keyboard_private::OnTextInputBoxFocused::kEventName, | 221 virtual_keyboard_private::OnTextInputBoxFocused::kEventName, |
205 event_args.Pass())); | 222 event_args.Pass())); |
206 event->restrict_to_browser_context = browser_context(); | 223 event->restrict_to_browser_context = browser_context(); |
207 router->DispatchEventToExtension(kVirtualKeyboardExtensionID, event.Pass()); | 224 router->DispatchEventToExtension(kVirtualKeyboardExtensionID, event.Pass()); |
208 } | 225 } |
OLD | NEW |