| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ui/base/ime/remote_input_method_win.h" | 5 #include "ui/base/ime/remote_input_method_win.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" |
| 7 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/win/metro.h" | 10 #include "base/win/metro.h" |
| 10 #include "base/win/scoped_handle.h" | 11 #include "base/win/scoped_handle.h" |
| 11 #include "ui/base/ime/input_method.h" | 12 #include "ui/base/ime/input_method.h" |
| 12 #include "ui/base/ime/input_method_delegate.h" | 13 #include "ui/base/ime/input_method_delegate.h" |
| 13 #include "ui/base/ime/input_method_observer.h" | 14 #include "ui/base/ime/input_method_observer.h" |
| 14 #include "ui/base/ime/remote_input_method_delegate_win.h" | 15 #include "ui/base/ime/remote_input_method_delegate_win.h" |
| 15 #include "ui/base/ime/text_input_client.h" | 16 #include "ui/base/ime/text_input_client.h" |
| 16 #include "ui/base/ime/win/tsf_input_scope.h" | 17 #include "ui/base/ime/win/tsf_input_scope.h" |
| 18 #include "ui/base/ui_base_switches.h" |
| 17 #include "ui/events/event.h" | 19 #include "ui/events/event.h" |
| 18 #include "ui/events/event_utils.h" | 20 #include "ui/events/event_utils.h" |
| 19 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
| 20 | 22 |
| 21 namespace ui { | 23 namespace ui { |
| 22 namespace { | 24 namespace { |
| 23 | 25 |
| 24 const LANGID kFallbackLangID = | 26 const LANGID kFallbackLangID = |
| 25 MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT); | 27 MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT); |
| 26 | 28 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 } // namespace | 366 } // namespace |
| 365 | 367 |
| 366 bool IsRemoteInputMethodWinRequired(gfx::AcceleratedWidget widget) { | 368 bool IsRemoteInputMethodWinRequired(gfx::AcceleratedWidget widget) { |
| 367 DWORD process_id = 0; | 369 DWORD process_id = 0; |
| 368 if (GetWindowThreadProcessId(widget, &process_id) == 0) | 370 if (GetWindowThreadProcessId(widget, &process_id) == 0) |
| 369 return false; | 371 return false; |
| 370 base::win::ScopedHandle process_handle(::OpenProcess( | 372 base::win::ScopedHandle process_handle(::OpenProcess( |
| 371 PROCESS_QUERY_LIMITED_INFORMATION, FALSE, process_id)); | 373 PROCESS_QUERY_LIMITED_INFORMATION, FALSE, process_id)); |
| 372 if (!process_handle.IsValid()) | 374 if (!process_handle.IsValid()) |
| 373 return false; | 375 return false; |
| 374 return base::win::IsProcessImmersive(process_handle.Get()); | 376 return base::win::IsProcessImmersive(process_handle.Get()) || |
| 377 CommandLine::ForCurrentProcess()->HasSwitch( |
| 378 switches::kViewerConnect); |
| 375 } | 379 } |
| 376 | 380 |
| 377 RemoteInputMethodPrivateWin::RemoteInputMethodPrivateWin() {} | 381 RemoteInputMethodPrivateWin::RemoteInputMethodPrivateWin() {} |
| 378 | 382 |
| 379 scoped_ptr<InputMethod> CreateRemoteInputMethodWin( | 383 scoped_ptr<InputMethod> CreateRemoteInputMethodWin( |
| 380 internal::InputMethodDelegate* delegate) { | 384 internal::InputMethodDelegate* delegate) { |
| 381 return scoped_ptr<InputMethod>(new RemoteInputMethodWin(delegate)); | 385 return scoped_ptr<InputMethod>(new RemoteInputMethodWin(delegate)); |
| 382 } | 386 } |
| 383 | 387 |
| 384 // static | 388 // static |
| 385 RemoteInputMethodPrivateWin* RemoteInputMethodPrivateWin::Get( | 389 RemoteInputMethodPrivateWin* RemoteInputMethodPrivateWin::Get( |
| 386 InputMethod* input_method) { | 390 InputMethod* input_method) { |
| 387 return GetPrivate(input_method); | 391 return GetPrivate(input_method); |
| 388 } | 392 } |
| 389 | 393 |
| 390 } // namespace ui | 394 } // namespace ui |
| OLD | NEW |