OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #define INITGUID // required for GUID_PROP_INPUTSCOPE | 5 #define INITGUID // required for GUID_PROP_INPUTSCOPE |
6 #include "ui/base/ime/win/tsf_text_store.h" | 6 #include "ui/base/ime/win/tsf_text_store.h" |
7 | 7 |
8 #include <InputScope.h> | 8 #include <InputScope.h> |
9 #include <OleCtl.h> | 9 #include <OleCtl.h> |
10 | 10 |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 578 |
579 return S_OK; | 579 return S_OK; |
580 } | 580 } |
581 | 581 |
582 STDMETHODIMP TSFTextStore::RequestSupportedAttrs( | 582 STDMETHODIMP TSFTextStore::RequestSupportedAttrs( |
583 DWORD /* flags */, // Seems that we should ignore this. | 583 DWORD /* flags */, // Seems that we should ignore this. |
584 ULONG attribute_buffer_size, | 584 ULONG attribute_buffer_size, |
585 const TS_ATTRID* attribute_buffer) { | 585 const TS_ATTRID* attribute_buffer) { |
586 if (!attribute_buffer) | 586 if (!attribute_buffer) |
587 return E_INVALIDARG; | 587 return E_INVALIDARG; |
| 588 if (!text_input_client_) |
| 589 return E_FAIL; |
588 // We support only input scope attribute. | 590 // We support only input scope attribute. |
589 for (size_t i = 0; i < attribute_buffer_size; ++i) { | 591 for (size_t i = 0; i < attribute_buffer_size; ++i) { |
590 if (IsEqualGUID(GUID_PROP_INPUTSCOPE, attribute_buffer[i])) | 592 if (IsEqualGUID(GUID_PROP_INPUTSCOPE, attribute_buffer[i])) |
591 return S_OK; | 593 return S_OK; |
592 } | 594 } |
593 return E_FAIL; | 595 return E_FAIL; |
594 } | 596 } |
595 | 597 |
596 STDMETHODIMP TSFTextStore::RetrieveRequestedAttrs( | 598 STDMETHODIMP TSFTextStore::RetrieveRequestedAttrs( |
597 ULONG attribute_buffer_size, | 599 ULONG attribute_buffer_size, |
598 TS_ATTRVAL* attribute_buffer, | 600 TS_ATTRVAL* attribute_buffer, |
599 ULONG* attribute_buffer_copied) { | 601 ULONG* attribute_buffer_copied) { |
600 if (!attribute_buffer_copied) | 602 if (!attribute_buffer_copied) |
601 return E_INVALIDARG; | 603 return E_INVALIDARG; |
602 if (!attribute_buffer) | 604 if (!attribute_buffer) |
603 return E_INVALIDARG; | 605 return E_INVALIDARG; |
| 606 if (!text_input_client_) |
| 607 return E_UNEXPECTED; |
604 // We support only input scope attribute. | 608 // We support only input scope attribute. |
605 *attribute_buffer_copied = 0; | 609 *attribute_buffer_copied = 0; |
606 if (attribute_buffer_size == 0) | 610 if (attribute_buffer_size == 0) |
607 return S_OK; | 611 return S_OK; |
608 | 612 |
609 attribute_buffer[0].dwOverlapId = 0; | 613 attribute_buffer[0].dwOverlapId = 0; |
610 attribute_buffer[0].idAttr = GUID_PROP_INPUTSCOPE; | 614 attribute_buffer[0].idAttr = GUID_PROP_INPUTSCOPE; |
611 attribute_buffer[0].varValue.vt = VT_UNKNOWN; | 615 attribute_buffer[0].varValue.vt = VT_UNKNOWN; |
612 attribute_buffer[0].varValue.punkVal = tsf_inputscope::CreateInputScope( | 616 attribute_buffer[0].varValue.punkVal = tsf_inputscope::CreateInputScope( |
613 text_input_client_->GetTextInputType(), | 617 text_input_client_->GetTextInputType(), |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 | 913 |
910 bool TSFTextStore::HasReadLock() const { | 914 bool TSFTextStore::HasReadLock() const { |
911 return (current_lock_type_ & TS_LF_READ) == TS_LF_READ; | 915 return (current_lock_type_ & TS_LF_READ) == TS_LF_READ; |
912 } | 916 } |
913 | 917 |
914 bool TSFTextStore::HasReadWriteLock() const { | 918 bool TSFTextStore::HasReadWriteLock() const { |
915 return (current_lock_type_ & TS_LF_READWRITE) == TS_LF_READWRITE; | 919 return (current_lock_type_ & TS_LF_READWRITE) == TS_LF_READWRITE; |
916 } | 920 } |
917 | 921 |
918 } // namespace ui | 922 } // namespace ui |
OLD | NEW |