OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/renderer_host/render_widget_host_view_views.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 264 } |
265 | 265 |
266 void RenderWidgetHostViewViews::ImeUpdateTextInputState( | 266 void RenderWidgetHostViewViews::ImeUpdateTextInputState( |
267 ui::TextInputType type, | 267 ui::TextInputType type, |
268 bool can_compose_inline, | 268 bool can_compose_inline, |
269 const gfx::Rect& caret_rect) { | 269 const gfx::Rect& caret_rect) { |
270 // TODO(kinaba): currently, can_compose_inline is ignored and always treated | 270 // TODO(kinaba): currently, can_compose_inline is ignored and always treated |
271 // as true. We need to support "can_compose_inline=false" for PPAPI plugins | 271 // as true. We need to support "can_compose_inline=false" for PPAPI plugins |
272 // that may want to avoid drawing composition-text by themselves and pass | 272 // that may want to avoid drawing composition-text by themselves and pass |
273 // the responsibility to the browser. | 273 // the responsibility to the browser. |
274 DCHECK(GetInputMethod()); | 274 |
| 275 // This is async message and by the time the ipc arrived, |
| 276 // RWHVV may be detached from Top level widget, in which case |
| 277 // GetInputMethod may return NULL; |
| 278 views::InputMethod* input_method = GetInputMethod(); |
| 279 |
275 if (text_input_type_ != type) { | 280 if (text_input_type_ != type) { |
276 text_input_type_ = type; | 281 text_input_type_ = type; |
277 GetInputMethod()->OnTextInputTypeChanged(this); | 282 if (input_method) |
| 283 input_method->OnTextInputTypeChanged(this); |
278 } | 284 } |
279 if (caret_bounds_ != caret_rect) { | 285 if (caret_bounds_ != caret_rect) { |
280 caret_bounds_ = caret_rect; | 286 caret_bounds_ = caret_rect; |
281 GetInputMethod()->OnCaretBoundsChanged(this); | 287 if (input_method) |
| 288 input_method->OnCaretBoundsChanged(this); |
282 } | 289 } |
283 } | 290 } |
284 | 291 |
285 void RenderWidgetHostViewViews::ImeCancelComposition() { | 292 void RenderWidgetHostViewViews::ImeCancelComposition() { |
286 DCHECK(GetInputMethod()); | 293 DCHECK(GetInputMethod()); |
287 GetInputMethod()->CancelComposition(this); | 294 GetInputMethod()->CancelComposition(this); |
288 has_composition_text_ = false; | 295 has_composition_text_ = false; |
289 } | 296 } |
290 | 297 |
291 void RenderWidgetHostViewViews::DidUpdateBackingStore( | 298 void RenderWidgetHostViewViews::DidUpdateBackingStore( |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 } | 1019 } |
1013 #endif | 1020 #endif |
1014 | 1021 |
1015 #if defined(USE_AURA) | 1022 #if defined(USE_AURA) |
1016 // static | 1023 // static |
1017 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | 1024 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( |
1018 RenderWidgetHost* widget) { | 1025 RenderWidgetHost* widget) { |
1019 return new RenderWidgetHostViewViews(widget); | 1026 return new RenderWidgetHostViewViews(widget); |
1020 } | 1027 } |
1021 #endif | 1028 #endif |
OLD | NEW |