Index: ui/base/ime/win/tsf_input_scope.cc |
diff --git a/ui/base/ime/win/tsf_input_scope.cc b/ui/base/ime/win/tsf_input_scope.cc |
index fb6bbdd9b03001fff43a382c80977924972d9f29..bbc43e7578f652349b7e5b3ee72c86cef197ec67 100644 |
--- a/ui/base/ime/win/tsf_input_scope.cc |
+++ b/ui/base/ime/win/tsf_input_scope.cc |
@@ -5,6 +5,7 @@ |
#include "ui/base/ime/win/tsf_input_scope.h" |
#include <InputScope.h> |
+#include <vector> |
#include "base/compiler_specific.h" |
#include "base/logging.h" |
@@ -16,9 +17,12 @@ namespace { |
class TSFInputScope : public ITfInputScope { |
public: |
- explicit TSFInputScope(InputScope input_scope) |
- : input_scope_(input_scope), |
- ref_count_(0) {} |
+ explicit TSFInputScope(InputScope* input_scope_list, size_t num_scopes) |
yukawa_g
2013/07/31 09:44:52
How about receiving std::vector<InputScope>?
|
+ : input_scope_list_(num_scopes), |
+ ref_count_(0) { |
+ for (size_t i = 0; i < num_scopes; i++) |
+ input_scope_list_.push_back(input_scope_list[i]); |
+ } |
// ITfInputScope: |
STDMETHOD_(ULONG, AddRef)() OVERRIDE { |
@@ -51,13 +55,15 @@ class TSFInputScope : public ITfInputScope { |
if (!count || !input_scopes) |
return E_INVALIDARG; |
*input_scopes = static_cast<InputScope*>(CoTaskMemAlloc( |
- sizeof(InputScope))); |
+ sizeof(InputScope) * input_scope_list_.size())); |
if (!input_scopes) { |
*count = 0; |
return E_OUTOFMEMORY; |
} |
- (*input_scopes)[0] = input_scope_; |
- *count = 1; |
+ |
+ for (size_t i = 0; i < input_scope_list_.size(); ++i) |
+ (*input_scopes)[i] = input_scope_list_[i]; |
+ *count = input_scope_list_.size(); |
return S_OK; |
} |
@@ -78,8 +84,8 @@ class TSFInputScope : public ITfInputScope { |
} |
private: |
- // The corresponding text input type. |
- InputScope input_scope_; |
+ // The corresponding text input types. |
+ std::vector<InputScope> input_scope_list_; |
// The refrence count of this instance. |
volatile LONG ref_count_; |
@@ -170,7 +176,10 @@ InputScope ConvertTextInputModeToInputScope(TextInputMode text_input_mode) { |
} // namespace |
ITfInputScope* CreateInputScope(TextInputType text_input_type) { |
- return new TSFInputScope(ConvertTextInputTypeToInputScope(text_input_type)); |
+ InputScope input_scopes[] = { |
+ ConvertTextInputTypeToInputScope(text_input_type), |
yukawa_g
2013/07/31 09:44:52
nit: indent.
|
+ }; |
+ return new TSFInputScope(input_scopes, 1); |
} |
void SetInputScopeForTsfUnawareWindow(HWND window_handle, |