| OLD | NEW |
| 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 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <utility> |
| 12 |
| 11 #include "base/logging.h" | 13 #include "base/logging.h" |
| 12 #include "base/macros.h" | 14 #include "base/macros.h" |
| 13 #include "base/win/scoped_variant.h" | 15 #include "base/win/scoped_variant.h" |
| 14 #include "ui/metro_viewer/ime_types.h" | 16 #include "ui/metro_viewer/ime_types.h" |
| 15 #include "win8/metro_driver/ime/text_service_delegate.h" | 17 #include "win8/metro_driver/ime/text_service_delegate.h" |
| 16 #include "win8/metro_driver/ime/text_store.h" | 18 #include "win8/metro_driver/ime/text_store.h" |
| 17 #include "win8/metro_driver/ime/text_store_delegate.h" | 19 #include "win8/metro_driver/ime/text_store_delegate.h" |
| 18 | 20 |
| 19 // Architecture overview of input method support on Ash mode: | 21 // Architecture overview of input method support on Ash mode: |
| 20 // | 22 // |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 if (!text_edit_sink) { | 282 if (!text_edit_sink) { |
| 281 LOG(ERROR) << "CreateTextEditSink failed."; | 283 LOG(ERROR) << "CreateTextEditSink failed."; |
| 282 return scoped_ptr<DocumentBinding>(); | 284 return scoped_ptr<DocumentBinding>(); |
| 283 } | 285 } |
| 284 } | 286 } |
| 285 hr = document_manager->Push(context.get()); | 287 hr = document_manager->Push(context.get()); |
| 286 if (FAILED(hr)) { | 288 if (FAILED(hr)) { |
| 287 LOG(ERROR) << "ITfDocumentMgr::Push failed. hr = " << hr; | 289 LOG(ERROR) << "ITfDocumentMgr::Push failed. hr = " << hr; |
| 288 return scoped_ptr<DocumentBinding>(); | 290 return scoped_ptr<DocumentBinding>(); |
| 289 } | 291 } |
| 290 return scoped_ptr<DocumentBinding>( | 292 return scoped_ptr<DocumentBinding>(new DocumentBinding( |
| 291 new DocumentBinding(text_store, | 293 text_store, document_manager, std::move(text_edit_sink))); |
| 292 document_manager, | |
| 293 text_edit_sink.Pass())); | |
| 294 } | 294 } |
| 295 | 295 |
| 296 ITfDocumentMgr* document_manager() const { return document_manager_.get(); } | 296 ITfDocumentMgr* document_manager() const { return document_manager_.get(); } |
| 297 | 297 |
| 298 scoped_refptr<TextStore> text_store() const { | 298 scoped_refptr<TextStore> text_store() const { |
| 299 return text_store_; | 299 return text_store_; |
| 300 } | 300 } |
| 301 | 301 |
| 302 private: | 302 private: |
| 303 DocumentBinding(scoped_refptr<TextStore> text_store, | 303 DocumentBinding(scoped_refptr<TextStore> text_store, |
| 304 base::win::ScopedComPtr<ITfDocumentMgr> document_manager, | 304 base::win::ScopedComPtr<ITfDocumentMgr> document_manager, |
| 305 scoped_ptr<EventSink> text_edit_sink) | 305 scoped_ptr<EventSink> text_edit_sink) |
| 306 : text_store_(text_store), | 306 : text_store_(text_store), |
| 307 document_manager_(document_manager), | 307 document_manager_(document_manager), |
| 308 text_edit_sink_(text_edit_sink.Pass()) {} | 308 text_edit_sink_(std::move(text_edit_sink)) {} |
| 309 | 309 |
| 310 scoped_refptr<TextStore> text_store_; | 310 scoped_refptr<TextStore> text_store_; |
| 311 base::win::ScopedComPtr<ITfDocumentMgr> document_manager_; | 311 base::win::ScopedComPtr<ITfDocumentMgr> document_manager_; |
| 312 scoped_ptr<EventSink> text_edit_sink_; | 312 scoped_ptr<EventSink> text_edit_sink_; |
| 313 | 313 |
| 314 DISALLOW_COPY_AND_ASSIGN(DocumentBinding); | 314 DISALLOW_COPY_AND_ASSIGN(DocumentBinding); |
| 315 }; | 315 }; |
| 316 | 316 |
| 317 class TextServiceImpl : public TextService, | 317 class TextServiceImpl : public TextService, |
| 318 public TextStoreDelegate { | 318 public TextStoreDelegate { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 if (!InitializeSentenceMode(thread_manager.get(), client_id)) { | 481 if (!InitializeSentenceMode(thread_manager.get(), client_id)) { |
| 482 LOG(ERROR) << "InitializeSentenceMode failed."; | 482 LOG(ERROR) << "InitializeSentenceMode failed."; |
| 483 thread_manager->Deactivate(); | 483 thread_manager->Deactivate(); |
| 484 return scoped_ptr<TextService>(); | 484 return scoped_ptr<TextService>(); |
| 485 } | 485 } |
| 486 return scoped_ptr<TextService>(new TextServiceImpl( | 486 return scoped_ptr<TextService>(new TextServiceImpl( |
| 487 thread_manager.get(), client_id, window_handle, delegate)); | 487 thread_manager.get(), client_id, window_handle, delegate)); |
| 488 } | 488 } |
| 489 | 489 |
| 490 } // namespace metro_driver | 490 } // namespace metro_driver |
| OLD | NEW |