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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "base/task.h" | 15 #include "base/task.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "chrome/common/render_messages.h" | 18 #include "chrome/common/render_messages.h" |
19 #include "content/browser/renderer_host/backing_store_skia.h" | 19 #include "content/browser/renderer_host/backing_store_skia.h" |
20 #include "content/browser/renderer_host/render_widget_host.h" | 20 #include "content/browser/renderer_host/render_widget_host.h" |
21 #include "content/common/native_web_keyboard_event.h" | 21 #include "content/common/native_web_keyboard_event.h" |
22 #include "content/common/result_codes.h" | 22 #include "content/common/result_codes.h" |
23 #include "content/common/view_messages.h" | 23 #include "content/common/view_messages.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact
ory.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact
ory.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/text/text_elider.h" |
27 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
28 #include "ui/gfx/canvas_skia.h" | 28 #include "ui/gfx/canvas_skia.h" |
29 #include "views/events/event.h" | 29 #include "views/events/event.h" |
30 #include "views/ime/input_method.h" | 30 #include "views/ime/input_method.h" |
31 #include "views/widget/tooltip_manager.h" | 31 #include "views/widget/tooltip_manager.h" |
32 #include "views/widget/widget.h" | 32 #include "views/widget/widget.h" |
33 | 33 |
34 #if defined(TOUCH_UI) | 34 #if defined(TOUCH_UI) |
35 #include "chrome/browser/renderer_host/accelerated_surface_container_touch.h" | 35 #include "chrome/browser/renderer_host/accelerated_surface_container_touch.h" |
36 #endif | 36 #endif |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 parent()->RemoveChildView(this); | 293 parent()->RemoveChildView(this); |
294 } | 294 } |
295 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 295 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
296 } | 296 } |
297 | 297 |
298 void RenderWidgetHostViewViews::SetTooltipText(const std::wstring& tip) { | 298 void RenderWidgetHostViewViews::SetTooltipText(const std::wstring& tip) { |
299 const int kMaxTooltipLength = 8 << 10; | 299 const int kMaxTooltipLength = 8 << 10; |
300 // Clamp the tooltip length to kMaxTooltipLength so that we don't | 300 // Clamp the tooltip length to kMaxTooltipLength so that we don't |
301 // accidentally DOS the user with a mega tooltip. | 301 // accidentally DOS the user with a mega tooltip. |
302 tooltip_text_ = | 302 tooltip_text_ = |
303 l10n_util::TruncateString(WideToUTF16Hack(tip), kMaxTooltipLength); | 303 ui::TruncateString(WideToUTF16Hack(tip), kMaxTooltipLength); |
304 if (GetWidget()) | 304 if (GetWidget()) |
305 GetWidget()->TooltipTextChanged(this); | 305 GetWidget()->TooltipTextChanged(this); |
306 } | 306 } |
307 | 307 |
308 void RenderWidgetHostViewViews::SelectionChanged(const std::string& text, | 308 void RenderWidgetHostViewViews::SelectionChanged(const std::string& text, |
309 const ui::Range& range, | 309 const ui::Range& range, |
310 const gfx::Point& start, | 310 const gfx::Point& start, |
311 const gfx::Point& end) { | 311 const gfx::Point& end) { |
312 // TODO(anicolao): deal with the clipboard without GTK | 312 // TODO(anicolao): deal with the clipboard without GTK |
313 NOTIMPLEMENTED(); | 313 NOTIMPLEMENTED(); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 | 776 |
777 void RenderWidgetHostViewViews::FinishImeCompositionSession() { | 777 void RenderWidgetHostViewViews::FinishImeCompositionSession() { |
778 if (!has_composition_text_) | 778 if (!has_composition_text_) |
779 return; | 779 return; |
780 if (host_) | 780 if (host_) |
781 host_->ImeConfirmComposition(); | 781 host_->ImeConfirmComposition(); |
782 DCHECK(GetInputMethod()); | 782 DCHECK(GetInputMethod()); |
783 GetInputMethod()->CancelComposition(this); | 783 GetInputMethod()->CancelComposition(this); |
784 has_composition_text_ = false; | 784 has_composition_text_ = false; |
785 } | 785 } |
OLD | NEW |