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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 pos.y() - parent_host_view->GetViewBounds().y()); | 159 pos.y() - parent_host_view->GetViewBounds().y()); |
| 160 views::View::SetBounds(p.x(), p.y(), pos.width(), pos.height()); | 160 views::View::SetBounds(p.x(), p.y(), pos.width(), pos.height()); |
| 161 Show(); | 161 Show(); |
| 162 | 162 |
| 163 if (NeedsInputGrab()) { | 163 if (NeedsInputGrab()) { |
| 164 set_focusable(true); | 164 set_focusable(true); |
| 165 RequestFocus(); | 165 RequestFocus(); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 void RenderWidgetHostViewViews::InitAsFullscreen( | |
|
Hironori Bono
2011/10/26 02:39:37
nit: I'm wondering why this change deletes this fu
Peng
2011/10/26 16:20:16
Done.
| |
| 170 RenderWidgetHostView* /*reference_host_view*/) { | |
| 171 NOTIMPLEMENTED(); | |
| 172 } | |
| 173 | |
| 174 RenderWidgetHost* RenderWidgetHostViewViews::GetRenderWidgetHost() const { | 169 RenderWidgetHost* RenderWidgetHostViewViews::GetRenderWidgetHost() const { |
| 175 return host_; | 170 return host_; |
| 176 } | 171 } |
| 177 | 172 |
| 178 void RenderWidgetHostViewViews::DidBecomeSelected() { | 173 void RenderWidgetHostViewViews::DidBecomeSelected() { |
| 179 if (!is_hidden_) | 174 if (!is_hidden_) |
| 180 return; | 175 return; |
| 181 | 176 |
| 182 if (tab_switch_paint_time_.is_null()) | 177 if (tab_switch_paint_time_.is_null()) |
| 183 tab_switch_paint_time_ = base::TimeTicks::Now(); | 178 tab_switch_paint_time_ = base::TimeTicks::Now(); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 377 // Clamp the tooltip length to kMaxTooltipLength so that we don't | 372 // Clamp the tooltip length to kMaxTooltipLength so that we don't |
| 378 // accidentally DOS the user with a mega tooltip. | 373 // accidentally DOS the user with a mega tooltip. |
| 379 tooltip_text_ = ui::TruncateString(tip, kMaxTooltipLength); | 374 tooltip_text_ = ui::TruncateString(tip, kMaxTooltipLength); |
| 380 if (GetWidget()) | 375 if (GetWidget()) |
| 381 GetWidget()->TooltipTextChanged(this); | 376 GetWidget()->TooltipTextChanged(this); |
| 382 } | 377 } |
| 383 | 378 |
| 384 void RenderWidgetHostViewViews::SelectionChanged(const string16& text, | 379 void RenderWidgetHostViewViews::SelectionChanged(const string16& text, |
| 385 size_t offset, | 380 size_t offset, |
| 386 const ui::Range& range) { | 381 const ui::Range& range) { |
| 387 selection_text_ = text; | 382 RenderWidgetHostView::SelectionChanged(text, offset, range); |
| 388 selection_text_offset_ = offset; | |
| 389 selection_range_ = range; | |
| 390 | |
| 391 // TODO(anicolao): deal with the clipboard without GTK | 383 // TODO(anicolao): deal with the clipboard without GTK |
| 392 NOTIMPLEMENTED(); | 384 NOTIMPLEMENTED(); |
| 393 } | 385 } |
| 394 | 386 |
| 395 void RenderWidgetHostViewViews::SelectionBoundsChanged( | 387 void RenderWidgetHostViewViews::SelectionBoundsChanged( |
| 396 const gfx::Rect& start_rect, | 388 const gfx::Rect& start_rect, |
| 397 const gfx::Rect& end_rect) { | 389 const gfx::Rect& end_rect) { |
| 398 views::InputMethod* input_method = GetInputMethod(); | 390 views::InputMethod* input_method = GetInputMethod(); |
| 399 | 391 |
| 400 if (selection_start_rect_ == start_rect && selection_end_rect_ == end_rect) | 392 if (selection_start_rect_ == start_rect && selection_end_rect_ == end_rect) |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 | 737 |
| 746 gfx::Rect RenderWidgetHostViewViews::GetCaretBounds() { | 738 gfx::Rect RenderWidgetHostViewViews::GetCaretBounds() { |
| 747 return selection_start_rect_.Union(selection_end_rect_); | 739 return selection_start_rect_.Union(selection_end_rect_); |
| 748 } | 740 } |
| 749 | 741 |
| 750 bool RenderWidgetHostViewViews::HasCompositionText() { | 742 bool RenderWidgetHostViewViews::HasCompositionText() { |
| 751 return has_composition_text_; | 743 return has_composition_text_; |
| 752 } | 744 } |
| 753 | 745 |
| 754 bool RenderWidgetHostViewViews::GetTextRange(ui::Range* range) { | 746 bool RenderWidgetHostViewViews::GetTextRange(ui::Range* range) { |
| 755 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 747 *range = ui::Range(selection_text_offset_, |
| 756 NOTIMPLEMENTED(); | 748 selection_text_offset_ + selection_text_.length()); |
| 757 return false; | 749 return true; |
| 758 } | 750 } |
| 759 | 751 |
| 760 bool RenderWidgetHostViewViews::GetCompositionTextRange(ui::Range* range) { | 752 bool RenderWidgetHostViewViews::GetCompositionTextRange(ui::Range* range) { |
| 761 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 753 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 762 NOTIMPLEMENTED(); | 754 NOTIMPLEMENTED(); |
| 763 return false; | 755 return false; |
| 764 } | 756 } |
| 765 | 757 |
| 766 bool RenderWidgetHostViewViews::GetSelectionRange(ui::Range* range) { | 758 bool RenderWidgetHostViewViews::GetSelectionRange(ui::Range* range) { |
| 767 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 759 *range = selection_range_; |
| 768 NOTIMPLEMENTED(); | 760 return true; |
| 769 return false; | |
| 770 } | 761 } |
| 771 | 762 |
| 772 bool RenderWidgetHostViewViews::SetSelectionRange(const ui::Range& range) { | 763 bool RenderWidgetHostViewViews::SetSelectionRange(const ui::Range& range) { |
| 773 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 764 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 774 NOTIMPLEMENTED(); | 765 NOTIMPLEMENTED(); |
| 775 return false; | 766 return false; |
| 776 } | 767 } |
| 777 | 768 |
| 778 bool RenderWidgetHostViewViews::DeleteRange(const ui::Range& range) { | 769 bool RenderWidgetHostViewViews::DeleteRange(const ui::Range& range) { |
| 779 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 770 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 780 NOTIMPLEMENTED(); | 771 NOTIMPLEMENTED(); |
| 781 return false; | 772 return false; |
| 782 } | 773 } |
| 783 | 774 |
| 784 bool RenderWidgetHostViewViews::GetTextFromRange( | 775 bool RenderWidgetHostViewViews::GetTextFromRange( |
| 785 const ui::Range& range, | 776 const ui::Range& range, |
| 786 const base::Callback<void(const string16&)>& callback) { | 777 string16* text, |
| 787 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 778 ui::Range* actual_range) { |
| 788 NOTIMPLEMENTED(); | 779 ui::Range selection_text_range( |
| 789 return false; | 780 selection_text_offset_, |
| 781 selection_text_offset_ + selection_text_.length()); | |
| 782 *actual_range = selection_text_range.Intersect(range); | |
| 783 | |
| 784 if (!actual_range->IsValid() || actual_range->is_empty()) { | |
| 785 text->clear(); | |
| 786 } else { | |
| 787 *text = selection_text_.substr( | |
| 788 actual_range->GetMin() - selection_text_offset_, | |
| 789 actual_range->length()); | |
| 790 } | |
| 791 | |
| 792 return true; | |
| 790 } | 793 } |
| 791 | 794 |
| 792 void RenderWidgetHostViewViews::OnInputMethodChanged() { | 795 void RenderWidgetHostViewViews::OnInputMethodChanged() { |
| 793 if (!host_) | 796 if (!host_) |
| 794 return; | 797 return; |
| 795 | 798 |
| 796 DCHECK(GetInputMethod()); | 799 DCHECK(GetInputMethod()); |
| 797 host_->SetInputMethodActive(GetInputMethod()->IsActive()); | 800 host_->SetInputMethodActive(GetInputMethod()->IsActive()); |
| 798 | 801 |
| 799 // TODO(suzhe): implement the newly added “locale” property of HTML DOM | 802 // 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 | 1162 for (std::vector< base::Callback<void(void)> >::const_iterator |
| 1160 it = on_compositing_ended_callbacks_.begin(); | 1163 it = on_compositing_ended_callbacks_.begin(); |
| 1161 it != on_compositing_ended_callbacks_.end(); ++it) { | 1164 it != on_compositing_ended_callbacks_.end(); ++it) { |
| 1162 it->Run(); | 1165 it->Run(); |
| 1163 } | 1166 } |
| 1164 on_compositing_ended_callbacks_.clear(); | 1167 on_compositing_ended_callbacks_.clear(); |
| 1165 compositor->RemoveObserver(this); | 1168 compositor->RemoveObserver(this); |
| 1166 } | 1169 } |
| 1167 | 1170 |
| 1168 #endif | 1171 #endif |
| OLD | NEW |