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

Unified Diff: win8/metro_driver/ime/text_store.h

Issue 83233002: Enable basic IME functionality under Ash on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix warnings (that are treated as an error) on 64-bit build Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « win8/metro_driver/ime/text_service_delegate.h ('k') | win8/metro_driver/ime/text_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win8/metro_driver/ime/text_store.h
diff --git a/ui/base/ime/win/tsf_text_store.h b/win8/metro_driver/ime/text_store.h
similarity index 86%
copy from ui/base/ime/win/tsf_text_store.h
copy to win8/metro_driver/ime/text_store.h
index 87cd6b42991ed09c07ef272d1781d9d01c37cd76..7d687c9c34da6d1139357953a3b42e9a52a619cd 100644
--- a/ui/base/ime/win/tsf_text_store.h
+++ b/win8/metro_driver/ime/text_store.h
@@ -2,22 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_BASE_IME_WIN_TSF_TEXT_STORE_H_
-#define UI_BASE_IME_WIN_TSF_TEXT_STORE_H_
+#ifndef WIN8_METRO_DRIVER_IME_TEXT_STORE_H_
+#define WIN8_METRO_DRIVER_IME_TEXT_STORE_H_
+#include <inputscope.h>
#include <msctf.h>
+
#include <deque>
+#include <vector>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
#include "base/win/scoped_comptr.h"
-#include "ui/base/ime/composition_underline.h"
-#include "ui/base/ui_export.h"
-#include "ui/gfx/range/range.h"
+#include "ui/metro_viewer/ime_types.h"
+
+namespace metro_driver {
-namespace ui {
-class TextInputClient;
+class TextStoreDelegate;
// TSFTextStore is used to interact with the input method via TSF manager.
// TSFTextStore have a string buffer which is manipulated by TSF manager through
@@ -81,11 +84,11 @@ class TextInputClient;
//
// More information about TSF can be found here:
// http://msdn.microsoft.com/en-us/library/ms629032
-class UI_EXPORT TSFTextStore : public ITextStoreACP,
- public ITfContextOwnerCompositionSink,
- public ITfTextEditSink {
+// TODO(yukawa): Rename TSFTextStore to TextStore.
+class TSFTextStore : public ITextStoreACP,
+ public ITfContextOwnerCompositionSink,
+ public ITfTextEditSink {
public:
- TSFTextStore();
virtual ~TSFTextStore();
// ITextStoreACP:
@@ -196,12 +199,6 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP,
STDMETHOD(OnEndEdit)(ITfContext* context, TfEditCookie read_only_edit_cookie,
ITfEditRecord* edit_record) OVERRIDE;
- // Sets currently focused TextInputClient.
- void SetFocusedTextInputClient(HWND focused_window,
- TextInputClient* text_input_client);
- // Removes currently focused TextInputClient.
- void RemoveFocusedTextInputClient(TextInputClient* text_input_client);
-
// Cancels the ongoing composition if exists.
bool CancelComposition();
@@ -211,9 +208,18 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP,
// Sends OnLayoutChange() via |text_store_acp_sink_|.
void SendOnLayoutChange();
+ // Creates an instance of TSFTextStore. Returns NULL if fails.
+ static scoped_refptr<TSFTextStore> Create(
+ HWND window_handle,
+ const std::vector<InputScope>& input_scopes,
+ TextStoreDelegate* delegate);
+
private:
- friend class TSFTextStoreTest;
- friend class TSFTextStoreTestCallback;
+ TSFTextStore(HWND window_handle,
+ ITfCategoryMgr* category_manager,
+ ITfDisplayAttributeMgr* display_attribute_manager,
+ ITfInputScope* input_scope,
+ TextStoreDelegate* delegate);
// Checks if the document has a read-only lock.
bool HasReadLock() const;
@@ -226,10 +232,11 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP,
TF_DISPLAYATTRIBUTE* attribute);
// Gets the committed string size and underline information of the context.
- bool GetCompositionStatus(ITfContext* context,
- const TfEditCookie read_only_edit_cookie,
- size_t* committed_size,
- CompositionUnderlines* undelines);
+ bool GetCompositionStatus(
+ ITfContext* context,
+ const TfEditCookie read_only_edit_cookie,
+ uint32* committed_size,
+ std::vector<metro_viewer::UnderlineInfo>* undelines);
// The refrence count of this instance.
volatile LONG ref_count_;
@@ -240,36 +247,37 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP,
// The current mask of |text_store_acp_sink_|.
DWORD text_store_acp_sink_mask_;
- // HWND of the current view window which is set in SetFocusedTextInputClient.
+ // HWND of the attached window.
HWND window_handle_;
- // Current TextInputClient which is set in SetFocusedTextInputClient.
- TextInputClient* text_input_client_;
+ // The delegate attached to this text store.
+ TextStoreDelegate* delegate_;
// |string_buffer_| contains committed string and composition string.
// Example: "aoi" is committed, and "umi" is under composition.
// |string_buffer_|: "aoiumi"
// |committed_size_|: 3
string16 string_buffer_;
- size_t committed_size_;
+ uint32 committed_size_;
// |selection_start_| and |selection_end_| indicates the selection range.
// Example: "iue" is selected
// |string_buffer_|: "aiueo"
- // |selection_.start()|: 1
- // |selection_.end()|: 4
- gfx::Range selection_;
+ // |selection_start_|: 1
+ // |selection_end_|: 4
+ uint32 selection_start_;
+ uint32 selection_end_;
// |start_offset| and |end_offset| of |composition_undelines_| indicates
// the offsets in |string_buffer_|.
// Example: "aoi" is committed. There are two underlines in "umi" and "no".
// |string_buffer_|: "aoiumino"
// |committed_size_|: 3
- // composition_undelines_.underlines[0].start_offset: 3
- // composition_undelines_.underlines[0].end_offset: 6
- // composition_undelines_.underlines[1].start_offset: 6
- // composition_undelines_.underlines[1].end_offset: 8
- CompositionUnderlines composition_undelines_;
+ // underlines_[0].start_offset: 3
+ // underlines_[0].end_offset: 6
+ // underlines_[1].start_offset: 6
+ // underlines_[1].end_offset: 8
+ std::vector<metro_viewer::UnderlineInfo> underlines_;
// |edit_flag_| indicates that the status is edited during
// ITextStoreACPSink::OnLockGranted().
@@ -289,9 +297,12 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP,
base::win::ScopedComPtr<ITfCategoryMgr> category_manager_;
base::win::ScopedComPtr<ITfDisplayAttributeMgr> display_attribute_manager_;
+ // Represents the context information of this text.
+ base::win::ScopedComPtr<ITfInputScope> input_scope_;
+
DISALLOW_COPY_AND_ASSIGN(TSFTextStore);
};
-} // namespace ui
+} // namespace metro_driver
-#endif // UI_BASE_IME_WIN_TSF_TEXT_STORE_H_
+#endif // WIN8_METRO_DRIVER_IME_TEXT_STORE_H_
« no previous file with comments | « win8/metro_driver/ime/text_service_delegate.h ('k') | win8/metro_driver/ime/text_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698