Chromium Code Reviews| 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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 | 745 |
| 746 gfx::Rect RenderWidgetHostViewViews::GetCaretBounds() { | 746 gfx::Rect RenderWidgetHostViewViews::GetCaretBounds() { |
| 747 return selection_start_rect_.Union(selection_end_rect_); | 747 return selection_start_rect_.Union(selection_end_rect_); |
| 748 } | 748 } |
| 749 | 749 |
| 750 bool RenderWidgetHostViewViews::HasCompositionText() { | 750 bool RenderWidgetHostViewViews::HasCompositionText() { |
| 751 return has_composition_text_; | 751 return has_composition_text_; |
| 752 } | 752 } |
| 753 | 753 |
| 754 bool RenderWidgetHostViewViews::GetTextRange(ui::Range* range) { | 754 bool RenderWidgetHostViewViews::GetTextRange(ui::Range* range) { |
| 755 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 755 DCHECK(range); |
|
jam
2011/10/25 00:32:13
nit: we avoid DCHECKING pointers before using them
Peng
2011/10/25 15:51:39
Done.
| |
| 756 NOTIMPLEMENTED(); | 756 *range = ui::Range(selection_text_offset_, |
| 757 return false; | 757 selection_text_offset_ + selection_text_.length()); |
| 758 return true; | |
| 758 } | 759 } |
| 759 | 760 |
| 760 bool RenderWidgetHostViewViews::GetCompositionTextRange(ui::Range* range) { | 761 bool RenderWidgetHostViewViews::GetCompositionTextRange(ui::Range* range) { |
| 761 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 762 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 762 NOTIMPLEMENTED(); | 763 NOTIMPLEMENTED(); |
| 763 return false; | 764 return false; |
| 764 } | 765 } |
| 765 | 766 |
| 766 bool RenderWidgetHostViewViews::GetSelectionRange(ui::Range* range) { | 767 bool RenderWidgetHostViewViews::GetSelectionRange(ui::Range* range) { |
| 767 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 768 DCHECK(range); |
| 768 NOTIMPLEMENTED(); | 769 *range = selection_range_; |
| 769 return false; | 770 return true; |
| 770 } | 771 } |
| 771 | 772 |
| 772 bool RenderWidgetHostViewViews::SetSelectionRange(const ui::Range& range) { | 773 bool RenderWidgetHostViewViews::SetSelectionRange(const ui::Range& range) { |
| 773 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 774 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 774 NOTIMPLEMENTED(); | 775 NOTIMPLEMENTED(); |
| 775 return false; | 776 return false; |
| 776 } | 777 } |
| 777 | 778 |
| 778 bool RenderWidgetHostViewViews::DeleteRange(const ui::Range& range) { | 779 bool RenderWidgetHostViewViews::DeleteRange(const ui::Range& range) { |
| 779 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 780 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 780 NOTIMPLEMENTED(); | 781 NOTIMPLEMENTED(); |
| 781 return false; | 782 return false; |
| 782 } | 783 } |
| 783 | 784 |
| 784 bool RenderWidgetHostViewViews::GetTextFromRange( | 785 bool RenderWidgetHostViewViews::GetTextFromRange( |
| 785 const ui::Range& range, | 786 const ui::Range& range, |
| 786 const base::Callback<void(const string16&)>& callback) { | 787 string16* text, |
| 787 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 788 ui::Range* actual_range) { |
| 788 NOTIMPLEMENTED(); | 789 ui::Range selection_text_range( |
| 789 return false; | 790 selection_text_offset_, |
| 791 selection_text_offset_ + selection_text_.length()); | |
| 792 *actual_range = selection_text_range.Intersect(range); | |
| 793 | |
| 794 if (!actual_range->IsValid() || actual_range->is_empty()) { | |
| 795 text->clear(); | |
| 796 } else { | |
| 797 *text = selection_text_.substr( | |
| 798 actual_range->GetMin() - selection_text_offset_, | |
| 799 actual_range->length()); | |
| 800 } | |
| 801 | |
| 802 return true; | |
| 790 } | 803 } |
| 791 | 804 |
| 792 void RenderWidgetHostViewViews::OnInputMethodChanged() { | 805 void RenderWidgetHostViewViews::OnInputMethodChanged() { |
| 793 if (!host_) | 806 if (!host_) |
| 794 return; | 807 return; |
| 795 | 808 |
| 796 DCHECK(GetInputMethod()); | 809 DCHECK(GetInputMethod()); |
| 797 host_->SetInputMethodActive(GetInputMethod()->IsActive()); | 810 host_->SetInputMethodActive(GetInputMethod()->IsActive()); |
| 798 | 811 |
| 799 // TODO(suzhe): implement the newly added “locale” property of HTML DOM | 812 // TODO(suzhe): implement the newly added “locale” property of HTML DOM |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1159 for (std::vector< base::Callback<void(void)> >::const_iterator | 1172 for (std::vector< base::Callback<void(void)> >::const_iterator |
| 1160 it = on_compositing_ended_callbacks_.begin(); | 1173 it = on_compositing_ended_callbacks_.begin(); |
| 1161 it != on_compositing_ended_callbacks_.end(); ++it) { | 1174 it != on_compositing_ended_callbacks_.end(); ++it) { |
| 1162 it->Run(); | 1175 it->Run(); |
| 1163 } | 1176 } |
| 1164 on_compositing_ended_callbacks_.clear(); | 1177 on_compositing_ended_callbacks_.clear(); |
| 1165 compositor->RemoveObserver(this); | 1178 compositor->RemoveObserver(this); |
| 1166 } | 1179 } |
| 1167 | 1180 |
| 1168 #endif | 1181 #endif |
| OLD | NEW |