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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 | 2098 |
2099 void RenderWidget::OnCandidateWindowUpdated() { | 2099 void RenderWidget::OnCandidateWindowUpdated() { |
2100 webwidget_->didUpdateCandidateWindow(); | 2100 webwidget_->didUpdateCandidateWindow(); |
2101 } | 2101 } |
2102 | 2102 |
2103 void RenderWidget::OnCandidateWindowHidden() { | 2103 void RenderWidget::OnCandidateWindowHidden() { |
2104 webwidget_->didHideCandidateWindow(); | 2104 webwidget_->didHideCandidateWindow(); |
2105 } | 2105 } |
2106 | 2106 |
2107 void RenderWidget::OnImeSetComposition( | 2107 void RenderWidget::OnImeSetComposition( |
2108 const string16& text, | 2108 const base::string16& text, |
2109 const std::vector<WebCompositionUnderline>& underlines, | 2109 const std::vector<WebCompositionUnderline>& underlines, |
2110 int selection_start, int selection_end) { | 2110 int selection_start, int selection_end) { |
2111 if (!ShouldHandleImeEvent()) | 2111 if (!ShouldHandleImeEvent()) |
2112 return; | 2112 return; |
2113 ImeEventGuard guard(this); | 2113 ImeEventGuard guard(this); |
2114 if (!webwidget_->setComposition( | 2114 if (!webwidget_->setComposition( |
2115 text, WebVector<WebCompositionUnderline>(underlines), | 2115 text, WebVector<WebCompositionUnderline>(underlines), |
2116 selection_start, selection_end)) { | 2116 selection_start, selection_end)) { |
2117 // If we failed to set the composition text, then we need to let the browser | 2117 // If we failed to set the composition text, then we need to let the browser |
2118 // process to cancel the input method's ongoing composition session, to make | 2118 // process to cancel the input method's ongoing composition session, to make |
2119 // sure we are in a consistent state. | 2119 // sure we are in a consistent state. |
2120 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); | 2120 Send(new ViewHostMsg_ImeCancelComposition(routing_id())); |
2121 } | 2121 } |
2122 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) | 2122 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) |
2123 UpdateCompositionInfo(true); | 2123 UpdateCompositionInfo(true); |
2124 #endif | 2124 #endif |
2125 } | 2125 } |
2126 | 2126 |
2127 void RenderWidget::OnImeConfirmComposition(const string16& text, | 2127 void RenderWidget::OnImeConfirmComposition(const base::string16& text, |
2128 const gfx::Range& replacement_range, | 2128 const gfx::Range& replacement_range, |
2129 bool keep_selection) { | 2129 bool keep_selection) { |
2130 if (!ShouldHandleImeEvent()) | 2130 if (!ShouldHandleImeEvent()) |
2131 return; | 2131 return; |
2132 ImeEventGuard guard(this); | 2132 ImeEventGuard guard(this); |
2133 handling_input_event_ = true; | 2133 handling_input_event_ = true; |
2134 if (text.length()) | 2134 if (text.length()) |
2135 webwidget_->confirmComposition(text); | 2135 webwidget_->confirmComposition(text); |
2136 else if (keep_selection) | 2136 else if (keep_selection) |
2137 webwidget_->confirmComposition(WebWidget::KeepSelection); | 2137 webwidget_->confirmComposition(WebWidget::KeepSelection); |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2839 GetURLForGraphicsContext3D(), | 2839 GetURLForGraphicsContext3D(), |
2840 gpu_channel_host.get(), | 2840 gpu_channel_host.get(), |
2841 use_echo_for_swap_ack, | 2841 use_echo_for_swap_ack, |
2842 attributes, | 2842 attributes, |
2843 false /* bind generates resources */, | 2843 false /* bind generates resources */, |
2844 limits)); | 2844 limits)); |
2845 return context.Pass(); | 2845 return context.Pass(); |
2846 } | 2846 } |
2847 | 2847 |
2848 } // namespace content | 2848 } // namespace content |
OLD | NEW |