| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_manager.h" | 5 #include "content/browser/renderer_host/text_input_manager.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/render_widget_host_impl.h" | 7 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 size_t TextInputManager::GetRegisteredViewsCountForTesting() { | 286 size_t TextInputManager::GetRegisteredViewsCountForTesting() { |
| 287 return text_input_state_map_.size(); | 287 return text_input_state_map_.size(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 ui::TextInputType TextInputManager::GetTextInputTypeForViewForTesting( | 290 ui::TextInputType TextInputManager::GetTextInputTypeForViewForTesting( |
| 291 RenderWidgetHostViewBase* view) { | 291 RenderWidgetHostViewBase* view) { |
| 292 DCHECK(IsRegistered(view)); | 292 DCHECK(IsRegistered(view)); |
| 293 return text_input_state_map_[view].type; | 293 return text_input_state_map_[view].type; |
| 294 } | 294 } |
| 295 | 295 |
| 296 const gfx::Range* TextInputManager::GetCompositionRangeForTesting() const { |
| 297 if (auto* info = GetCompositionRangeInfo()) |
| 298 return &info->range; |
| 299 return nullptr; |
| 300 } |
| 301 |
| 296 void TextInputManager::NotifyObserversAboutInputStateUpdate( | 302 void TextInputManager::NotifyObserversAboutInputStateUpdate( |
| 297 RenderWidgetHostViewBase* updated_view, | 303 RenderWidgetHostViewBase* updated_view, |
| 298 bool did_update_state) { | 304 bool did_update_state) { |
| 299 for (auto& observer : observer_list_) | 305 for (auto& observer : observer_list_) |
| 300 observer.OnUpdateTextInputStateCalled(this, updated_view, did_update_state); | 306 observer.OnUpdateTextInputStateCalled(this, updated_view, did_update_state); |
| 301 } | 307 } |
| 302 | 308 |
| 303 TextInputManager::SelectionRegion::SelectionRegion() {} | 309 TextInputManager::SelectionRegion::SelectionRegion() {} |
| 304 | 310 |
| 305 TextInputManager::SelectionRegion::SelectionRegion( | 311 TextInputManager::SelectionRegion::SelectionRegion( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 if (pos >= text.length()) { | 348 if (pos >= text.length()) { |
| 343 LOG(WARNING) << "The text cannot cover range (selection range's starting " | 349 LOG(WARNING) << "The text cannot cover range (selection range's starting " |
| 344 "point exceeds text length)."; | 350 "point exceeds text length)."; |
| 345 } else { | 351 } else { |
| 346 selected_text_.append(text.substr(pos, n)); | 352 selected_text_.append(text.substr(pos, n)); |
| 347 } | 353 } |
| 348 } | 354 } |
| 349 } | 355 } |
| 350 | 356 |
| 351 } // namespace content | 357 } // namespace content |
| OLD | NEW |