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

Side by Side Diff: win8/metro_driver/ime/text_service.cc

Issue 985853005: base: Remove operator& from ScopedVariant and ScopedPropVariant. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scoped-operator: prop-ptr Created 5 years, 9 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
OLDNEW
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 "win8/metro_driver/ime/text_service.h" 5 #include "win8/metro_driver/ime/text_service.h"
6 6
7 #include <msctf.h> 7 #include <msctf.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/win/scoped_variant.h" 10 #include "base/win/scoped_variant.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 hr = thread_compartment_manager->GetCompartment( 104 hr = thread_compartment_manager->GetCompartment(
105 GUID_COMPARTMENT_KEYBOARD_INPUTMODE_SENTENCE, 105 GUID_COMPARTMENT_KEYBOARD_INPUTMODE_SENTENCE,
106 sentence_compartment.Receive()); 106 sentence_compartment.Receive());
107 if (FAILED(hr)) { 107 if (FAILED(hr)) {
108 LOG(ERROR) << "ITfCompartment::GetCompartment failed. hr = " << hr; 108 LOG(ERROR) << "ITfCompartment::GetCompartment failed. hr = " << hr;
109 return false; 109 return false;
110 } 110 }
111 111
112 base::win::ScopedVariant sentence_variant; 112 base::win::ScopedVariant sentence_variant;
113 sentence_variant.Set(TF_SENTENCEMODE_PHRASEPREDICT); 113 sentence_variant.Set(TF_SENTENCEMODE_PHRASEPREDICT);
114 hr = sentence_compartment->SetValue(client_id, &sentence_variant); 114 hr = sentence_compartment->SetValue(client_id, sentence_variant.ptr());
115 if (FAILED(hr)) { 115 if (FAILED(hr)) {
116 LOG(ERROR) << "ITfCompartment::SetValue failed. hr = " << hr; 116 LOG(ERROR) << "ITfCompartment::SetValue failed. hr = " << hr;
117 return false; 117 return false;
118 } 118 }
119 return true; 119 return true;
120 } 120 }
121 121
122 // Initializes |context| as disabled context where IMEs will be disabled. 122 // Initializes |context| as disabled context where IMEs will be disabled.
123 bool InitializeDisabledContext(ITfContext* context, TfClientId client_id) { 123 bool InitializeDisabledContext(ITfContext* context, TfClientId client_id) {
124 base::win::ScopedComPtr<ITfCompartmentMgr> compartment_mgr; 124 base::win::ScopedComPtr<ITfCompartmentMgr> compartment_mgr;
125 HRESULT hr = compartment_mgr.QueryFrom(context); 125 HRESULT hr = compartment_mgr.QueryFrom(context);
126 if (FAILED(hr)) { 126 if (FAILED(hr)) {
127 LOG(ERROR) << "QueryFrom failed. hr = " << hr; 127 LOG(ERROR) << "QueryFrom failed. hr = " << hr;
128 return false; 128 return false;
129 } 129 }
130 130
131 base::win::ScopedComPtr<ITfCompartment> disabled_compartment; 131 base::win::ScopedComPtr<ITfCompartment> disabled_compartment;
132 hr = compartment_mgr->GetCompartment(GUID_COMPARTMENT_KEYBOARD_DISABLED, 132 hr = compartment_mgr->GetCompartment(GUID_COMPARTMENT_KEYBOARD_DISABLED,
133 disabled_compartment.Receive()); 133 disabled_compartment.Receive());
134 if (FAILED(hr)) { 134 if (FAILED(hr)) {
135 LOG(ERROR) << "ITfCompartment::GetCompartment failed. hr = " << hr; 135 LOG(ERROR) << "ITfCompartment::GetCompartment failed. hr = " << hr;
136 return false; 136 return false;
137 } 137 }
138 138
139 base::win::ScopedVariant variant; 139 base::win::ScopedVariant variant;
140 variant.Set(1); 140 variant.Set(1);
141 hr = disabled_compartment->SetValue(client_id, &variant); 141 hr = disabled_compartment->SetValue(client_id, variant.ptr());
142 if (FAILED(hr)) { 142 if (FAILED(hr)) {
143 LOG(ERROR) << "ITfCompartment::SetValue failed. hr = " << hr; 143 LOG(ERROR) << "ITfCompartment::SetValue failed. hr = " << hr;
144 return false; 144 return false;
145 } 145 }
146 146
147 base::win::ScopedComPtr<ITfCompartment> empty_context; 147 base::win::ScopedComPtr<ITfCompartment> empty_context;
148 hr = compartment_mgr->GetCompartment(GUID_COMPARTMENT_EMPTYCONTEXT, 148 hr = compartment_mgr->GetCompartment(GUID_COMPARTMENT_EMPTYCONTEXT,
149 empty_context.Receive()); 149 empty_context.Receive());
150 if (FAILED(hr)) { 150 if (FAILED(hr)) {
151 LOG(ERROR) << "ITfCompartment::GetCompartment failed. hr = " << hr; 151 LOG(ERROR) << "ITfCompartment::GetCompartment failed. hr = " << hr;
152 return false; 152 return false;
153 } 153 }
154 154
155 base::win::ScopedVariant empty_context_variant; 155 base::win::ScopedVariant empty_context_variant;
156 empty_context_variant.Set(static_cast<int32>(1)); 156 empty_context_variant.Set(static_cast<int32>(1));
157 hr = empty_context->SetValue(client_id, &empty_context_variant); 157 hr = empty_context->SetValue(client_id, empty_context_variant.ptr());
158 if (FAILED(hr)) { 158 if (FAILED(hr)) {
159 LOG(ERROR) << "ITfCompartment::SetValue failed. hr = " << hr; 159 LOG(ERROR) << "ITfCompartment::SetValue failed. hr = " << hr;
160 return false; 160 return false;
161 } 161 }
162 162
163 return true; 163 return true;
164 } 164 }
165 165
166 bool IsPasswordField(const std::vector<InputScope>& input_scopes) { 166 bool IsPasswordField(const std::vector<InputScope>& input_scopes) {
167 return std::find(input_scopes.begin(), input_scopes.end(), IS_PASSWORD) != 167 return std::find(input_scopes.begin(), input_scopes.end(), IS_PASSWORD) !=
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 if (!InitializeSentenceMode(thread_manager.get(), client_id)) { 480 if (!InitializeSentenceMode(thread_manager.get(), client_id)) {
481 LOG(ERROR) << "InitializeSentenceMode failed."; 481 LOG(ERROR) << "InitializeSentenceMode failed.";
482 thread_manager->Deactivate(); 482 thread_manager->Deactivate();
483 return scoped_ptr<TextService>(); 483 return scoped_ptr<TextService>();
484 } 484 }
485 return scoped_ptr<TextService>(new TextServiceImpl( 485 return scoped_ptr<TextService>(new TextServiceImpl(
486 thread_manager.get(), client_id, window_handle, delegate)); 486 thread_manager.get(), client_id, window_handle, delegate));
487 } 487 }
488 488
489 } // namespace metro_driver 489 } // namespace metro_driver
OLDNEW
« no previous file with comments | « ui/views/accessibility/native_view_accessibility_win_unittest.cc ('k') | win8/test/ui_automation_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698