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 #include "content/browser/renderer_host/text_input_client_message_filter.h" | 5 #include "content/browser/renderer_host/text_input_client_message_filter.h" |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
9 #include "content/browser/renderer_host/text_input_client_mac.h" | 9 #include "content/browser/renderer_host/text_input_client_mac.h" |
10 #include "content/common/text_input_client_messages.h" | 10 #include "content/common/text_input_client_messages.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 service->SetCharacterIndexAndSignal(index); | 58 service->SetCharacterIndexAndSignal(index); |
59 } | 59 } |
60 | 60 |
61 void TextInputClientMessageFilter::OnGotFirstRectForRange( | 61 void TextInputClientMessageFilter::OnGotFirstRectForRange( |
62 const gfx::Rect& rect) { | 62 const gfx::Rect& rect) { |
63 TextInputClientMac* service = TextInputClientMac::GetInstance(); | 63 TextInputClientMac* service = TextInputClientMac::GetInstance(); |
64 service->SetFirstRectAndSignal(NSRectFromCGRect(rect.ToCGRect())); | 64 service->SetFirstRectAndSignal(NSRectFromCGRect(rect.ToCGRect())); |
65 } | 65 } |
66 | 66 |
67 void TextInputClientMessageFilter::OnGotStringFromRange( | 67 void TextInputClientMessageFilter::OnGotStringFromRange( |
68 const mac::AttributedStringCoder::EncodedString& encoded_string) { | 68 const mac::AttributedStringCoder::EncodedString& encoded_string, |
69 const gfx::Point& point) { | |
69 TextInputClientMac* service = TextInputClientMac::GetInstance(); | 70 TextInputClientMac* service = TextInputClientMac::GetInstance(); |
70 NSAttributedString* string = | 71 NSAttributedString* string = |
71 mac::AttributedStringCoder::Decode(&encoded_string); | 72 mac::AttributedStringCoder::Decode(&encoded_string); |
72 if (![string length]) | 73 if (![string length]) |
73 string = nil; | 74 string = nil; |
74 service->SetSubstringAndSignal(string); | 75 service->SetSubstringAndSignal(string); |
Alexei Svitkine (slow)
2015/09/21 15:47:56
Can this call be merged into GetStringFromRangeRep
Shu Chen
2015/09/22 05:46:08
Done.
| |
76 service->GetStringFromRangeReply( | |
77 string, NSPointFromCGPoint(point.ToCGPoint())); | |
Alexei Svitkine (slow)
2015/09/21 15:47:56
Does it make sense to not do this when string is e
Shu Chen
2015/09/22 05:46:08
This call is necessary when string is empty or nil
| |
75 } | 78 } |
76 | 79 |
77 } // namespace content | 80 } // namespace content |
OLD | NEW |