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

Unified Diff: ui/base/ime/win/tsf_input_scope.cc

Issue 21130010: change TSFInputScope to have multiple InputScopes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ima_inputscope3
Patch Set: update Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698