Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_views.cc

Issue 8294026: Support IMM32 reconversion on Windows (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix return values Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 // Clamp the tooltip length to kMaxTooltipLength so that we don't 377 // Clamp the tooltip length to kMaxTooltipLength so that we don't
378 // accidentally DOS the user with a mega tooltip. 378 // accidentally DOS the user with a mega tooltip.
379 tooltip_text_ = ui::TruncateString(tip, kMaxTooltipLength); 379 tooltip_text_ = ui::TruncateString(tip, kMaxTooltipLength);
380 if (GetWidget()) 380 if (GetWidget())
381 GetWidget()->TooltipTextChanged(this); 381 GetWidget()->TooltipTextChanged(this);
382 } 382 }
383 383
384 void RenderWidgetHostViewViews::SelectionChanged(const string16& text, 384 void RenderWidgetHostViewViews::SelectionChanged(const string16& text,
385 size_t offset, 385 size_t offset,
386 const ui::Range& range) { 386 const ui::Range& range) {
387 selection_text_ = text; 387 RenderWidgetHostView::SelectionChanged(text, offset, range);
388 selection_text_offset_ = offset;
389 selection_range_ = range;
390
391 // TODO(anicolao): deal with the clipboard without GTK 388 // TODO(anicolao): deal with the clipboard without GTK
392 NOTIMPLEMENTED(); 389 NOTIMPLEMENTED();
393 } 390 }
394 391
395 void RenderWidgetHostViewViews::SelectionBoundsChanged( 392 void RenderWidgetHostViewViews::SelectionBoundsChanged(
396 const gfx::Rect& start_rect, 393 const gfx::Rect& start_rect,
397 const gfx::Rect& end_rect) { 394 const gfx::Rect& end_rect) {
398 views::InputMethod* input_method = GetInputMethod(); 395 views::InputMethod* input_method = GetInputMethod();
399 396
400 if (selection_start_rect_ == start_rect && selection_end_rect_ == end_rect) 397 if (selection_start_rect_ == start_rect && selection_end_rect_ == end_rect)
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 } 741 }
745 742
746 gfx::Rect RenderWidgetHostViewViews::GetCaretBounds() { 743 gfx::Rect RenderWidgetHostViewViews::GetCaretBounds() {
747 return selection_start_rect_.Union(selection_end_rect_); 744 return selection_start_rect_.Union(selection_end_rect_);
748 } 745 }
749 746
750 bool RenderWidgetHostViewViews::HasCompositionText() { 747 bool RenderWidgetHostViewViews::HasCompositionText() {
751 return has_composition_text_; 748 return has_composition_text_;
752 } 749 }
753 750
754 bool RenderWidgetHostViewViews::GetTextRange(ui::Range* range) { 751 bool RenderWidgetHostViewViews::GetTextRange(ui::Range* range) {
Hironori Bono 2011/10/27 06:17:47 nit: I prefer adding 'DCHECK(range)' here.
Peng 2011/10/27 16:12:24 I used those kind of DHCECK() for input arguments.
755 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 752 *range = ui::Range(selection_text_offset_,
Hironori Bono 2011/10/27 06:17:47 nit: can we use operator= for ui::Range? In genera
Peng 2011/10/27 16:12:24 Done.
Peng 2011/10/27 16:12:24 Done.
756 NOTIMPLEMENTED(); 753 selection_text_offset_ + selection_text_.length());
757 return false; 754 return true;
758 } 755 }
759 756
760 bool RenderWidgetHostViewViews::GetCompositionTextRange(ui::Range* range) { 757 bool RenderWidgetHostViewViews::GetCompositionTextRange(ui::Range* range) {
761 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 758 // TODO(suzhe): implement this method when fixing http://crbug.com/55130.
762 NOTIMPLEMENTED(); 759 NOTIMPLEMENTED();
763 return false; 760 return false;
764 } 761 }
765 762
766 bool RenderWidgetHostViewViews::GetSelectionRange(ui::Range* range) { 763 bool RenderWidgetHostViewViews::GetSelectionRange(ui::Range* range) {
Hironori Bono 2011/10/27 06:17:47 nit: I prefer adding 'DCHECK(range)' here.
Peng 2011/10/27 16:12:24 ditto
767 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 764 *range = selection_range_;
Hironori Bono 2011/10/27 06:17:47 nit: if ui::Range explicitly allows using copy con
Peng 2011/10/27 16:12:24 Done.
768 NOTIMPLEMENTED(); 765 return true;
769 return false;
770 } 766 }
771 767
772 bool RenderWidgetHostViewViews::SetSelectionRange(const ui::Range& range) { 768 bool RenderWidgetHostViewViews::SetSelectionRange(const ui::Range& range) {
773 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 769 // TODO(suzhe): implement this method when fixing http://crbug.com/55130.
774 NOTIMPLEMENTED(); 770 NOTIMPLEMENTED();
775 return false; 771 return false;
776 } 772 }
777 773
778 bool RenderWidgetHostViewViews::DeleteRange(const ui::Range& range) { 774 bool RenderWidgetHostViewViews::DeleteRange(const ui::Range& range) {
779 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 775 // TODO(suzhe): implement this method when fixing http://crbug.com/55130.
780 NOTIMPLEMENTED(); 776 NOTIMPLEMENTED();
781 return false; 777 return false;
782 } 778 }
783 779
784 bool RenderWidgetHostViewViews::GetTextFromRange( 780 bool RenderWidgetHostViewViews::GetTextFromRange(
785 const ui::Range& range, 781 const ui::Range& range,
786 const base::Callback<void(const string16&)>& callback) { 782 string16* text) {
Hironori Bono 2011/10/27 06:17:47 nit: I prefer adding 'DCHECK(text)' here.
Peng 2011/10/27 16:12:24 ditto
787 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. 783 ui::Range selection_text_range(selection_text_offset_,
788 NOTIMPLEMENTED(); 784 selection_text_offset_ + selection_text_.length());
789 return false; 785
786 if (!selection_text_range.Contains(range)) {
787 text->clear();
788 return false;
789 }
790
791 if (range.GetMin() == selection_text_range.start() &&
792 range.GetMax() == selection_text_range.end()) {
793 // Avoid calling substr which performance is low.
794 *text = selection_text_;
795 } else {
796 *text = selection_text_.substr(
797 range.GetMin() - selection_text_offset_,
798 range.length());
799 }
800 return true;
790 } 801 }
791 802
792 void RenderWidgetHostViewViews::OnInputMethodChanged() { 803 void RenderWidgetHostViewViews::OnInputMethodChanged() {
793 if (!host_) 804 if (!host_)
794 return; 805 return;
795 806
796 DCHECK(GetInputMethod()); 807 DCHECK(GetInputMethod());
797 host_->SetInputMethodActive(GetInputMethod()->IsActive()); 808 host_->SetInputMethodActive(GetInputMethod()->IsActive());
798 809
799 // TODO(suzhe): implement the newly added “locale” property of HTML DOM 810 // TODO(suzhe): implement the newly added “locale” property of HTML DOM
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 for (std::vector< base::Callback<void(void)> >::const_iterator 1169 for (std::vector< base::Callback<void(void)> >::const_iterator
1159 it = on_compositing_ended_callbacks_.begin(); 1170 it = on_compositing_ended_callbacks_.begin();
1160 it != on_compositing_ended_callbacks_.end(); ++it) { 1171 it != on_compositing_ended_callbacks_.end(); ++it) {
1161 it->Run(); 1172 it->Run();
1162 } 1173 }
1163 on_compositing_ended_callbacks_.clear(); 1174 on_compositing_ended_callbacks_.clear();
1164 compositor->RemoveObserver(this); 1175 compositor->RemoveObserver(this);
1165 } 1176 }
1166 1177
1167 #endif 1178 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698