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

Side by Side Diff: ui/base/win/tsf_bridge.h

Issue 10912171: Introduce RenderWidgetHostViewWinTest for Tsf handling (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 8 years, 3 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
« no previous file with comments | « ui/base/win/mock_tsf_bridge.cc ('k') | ui/base/win/tsf_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef UI_BASE_WIN_TSF_BRIDGE_H_ 5 #ifndef UI_BASE_WIN_TSF_BRIDGE_H_
6 #define UI_BASE_WIN_TSF_BRIDGE_H_ 6 #define UI_BASE_WIN_TSF_BRIDGE_H_
7 7
8 #include <Windows.h> 8 #include <Windows.h>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "ui/base/ui_export.h" 10 #include "ui/base/ui_export.h"
11 11
12 namespace ui { 12 namespace ui {
13 class TextInputClient; 13 class TextInputClient;
14 14
15 // TsfBridge provides high level IME related operations on top of Text Services 15 // TsfBridge provides high level IME related operations on top of Text Services
16 // Framework (TSF). TsfBridge is managed by TLS because TSF related stuff is 16 // Framework (TSF). TsfBridge is managed by TLS because TSF related stuff is
17 // associated with each thread and not allowed to access across thread boundary. 17 // associated with each thread and not allowed to access across thread boundary.
18 // To be consistent with IMM32 behavior, TsfBridge is shared in the same thread. 18 // To be consistent with IMM32 behavior, TsfBridge is shared in the same thread.
19 // TsfBridge is used by the web content text inputting field, for example 19 // TsfBridge is used by the web content text inputting field, for example
20 // DisableIME() should be called if a password field is focused. 20 // DisableIME() should be called if a password field is focused.
21 // 21 //
22 // TsfBridge also manages connectivity between TsfTextStore which is the backend 22 // TsfBridge also manages connectivity between TsfTextStore which is the backend
23 // of text inputting and current focused TextInputClient. 23 // of text inputting and current focused TextInputClient.
24 // 24 //
25 // All methods in this class must be used in UI thread. 25 // All methods in this class must be used in UI thread.
26 class TsfBridge { 26 class UI_EXPORT TsfBridge {
27 public: 27 public:
28 virtual ~TsfBridge(); 28 virtual ~TsfBridge();
29 29
30 // Returns the thread local TsfBridge instance. Initialize() must be called 30 // Returns the thread local TsfBridge instance. Initialize() must be called
31 // first. Do not cache this pointer and use it after TsfBridge Shutdown(). 31 // first. Do not cache this pointer and use it after TsfBridge Shutdown().
32 static UI_EXPORT TsfBridge* GetInstance(); 32 static TsfBridge* GetInstance();
33 33
34 // Sets the thread local instance. Must be called before any calls to 34 // Sets the thread local instance. Must be called before any calls to
35 // GetInstance(). 35 // GetInstance().
36 static UI_EXPORT bool Initialize(); 36 static bool Initialize();
37
38 // Injects an alternative TsfBridge such as MockTsfBridge for testing. The
39 // injected object should be released by the caller. This function returns
40 // previous TsfBridge pointer with ownership.
41 static TsfBridge* ReplaceForTesting(TsfBridge* bridge);
37 42
38 // Destroys the thread local instance. 43 // Destroys the thread local instance.
39 virtual void Shutdown() = 0; 44 virtual void Shutdown() = 0;
40 45
41 // Handles TextInputTypeChanged event. RWHVW is responsible for calling this 46 // Handles TextInputTypeChanged event. RWHVW is responsible for calling this
42 // handler whenever renderer's input text type is changed. Does nothing 47 // handler whenever renderer's input text type is changed. Does nothing
43 // unless |client| is focused. 48 // unless |client| is focused.
44 virtual void OnTextInputTypeChanged(TextInputClient* client) = 0; 49 virtual void OnTextInputTypeChanged(TextInputClient* client) = 0;
45 50
46 // Cancels the ongoing composition if exists. 51 // Cancels the ongoing composition if exists.
(...skipping 13 matching lines...) Expand all
60 // Uses GetInstance() instead. 65 // Uses GetInstance() instead.
61 TsfBridge(); 66 TsfBridge();
62 67
63 private: 68 private:
64 DISALLOW_COPY_AND_ASSIGN(TsfBridge); 69 DISALLOW_COPY_AND_ASSIGN(TsfBridge);
65 }; 70 };
66 71
67 } // namespace ui 72 } // namespace ui
68 73
69 #endif // UI_BASE_WIN_TSF_BRIDGE_H_ 74 #endif // UI_BASE_WIN_TSF_BRIDGE_H_
OLDNEW
« no previous file with comments | « ui/base/win/mock_tsf_bridge.cc ('k') | ui/base/win/tsf_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698