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/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 #if defined(OS_WIN) | 189 #if defined(OS_WIN) |
190 // TODO(port): these files are currently Windows only because they concern: | 190 // TODO(port): these files are currently Windows only because they concern: |
191 // * theming | 191 // * theming |
192 #include "gfx/native_theme_win.h" | 192 #include "gfx/native_theme_win.h" |
193 #elif defined(USE_X11) | 193 #elif defined(USE_X11) |
194 #include "gfx/native_theme_linux.h" | 194 #include "gfx/native_theme_linux.h" |
195 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebRenderTheme.
h" | 195 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebRenderTheme.
h" |
196 #elif defined(OS_MACOSX) | 196 #elif defined(OS_MACOSX) |
197 #include "skia/ext/skia_utils_mac.h" | 197 #include "skia/ext/skia_utils_mac.h" |
| 198 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebTextHelper.h" |
198 #endif | 199 #endif |
199 | 200 |
200 using WebKit::WebAccessibilityCache; | 201 using WebKit::WebAccessibilityCache; |
201 using WebKit::WebAccessibilityNotification; | 202 using WebKit::WebAccessibilityNotification; |
202 using WebKit::WebAccessibilityObject; | 203 using WebKit::WebAccessibilityObject; |
203 using WebKit::WebApplicationCacheHost; | 204 using WebKit::WebApplicationCacheHost; |
204 using WebKit::WebApplicationCacheHostClient; | 205 using WebKit::WebApplicationCacheHostClient; |
205 using WebKit::WebCString; | 206 using WebKit::WebCString; |
206 using WebKit::WebColor; | 207 using WebKit::WebColor; |
207 using WebKit::WebColorName; | 208 using WebKit::WebColorName; |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 OnUpdateBrowserWindowId) | 1064 OnUpdateBrowserWindowId) |
1064 IPC_MESSAGE_HANDLER(ViewMsg_NotifyRenderViewType, | 1065 IPC_MESSAGE_HANDLER(ViewMsg_NotifyRenderViewType, |
1065 OnNotifyRendererViewType) | 1066 OnNotifyRendererViewType) |
1066 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) | 1067 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) |
1067 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) | 1068 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) |
1068 #if defined(OS_MACOSX) | 1069 #if defined(OS_MACOSX) |
1069 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) | 1070 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) |
1070 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) | 1071 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) |
1071 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionConfirmed, | 1072 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionConfirmed, |
1072 OnPluginImeCompositionConfirmed) | 1073 OnPluginImeCompositionConfirmed) |
| 1074 IPC_MESSAGE_HANDLER(ViewMsg_CharacterIndexForPoint, |
| 1075 OnCharacterIndexForPoint) |
| 1076 IPC_MESSAGE_HANDLER(ViewMsg_FirstRectForCharacterRange, |
| 1077 OnFirstRectForCharacterRange) |
| 1078 IPC_MESSAGE_HANDLER(ViewMsg_StringForRange, OnStringForRange) |
1073 #endif | 1079 #endif |
1074 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, | 1080 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, |
1075 OnSetEditCommandsForNextKeyEvent) | 1081 OnSetEditCommandsForNextKeyEvent) |
1076 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCode, | 1082 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCode, |
1077 OnExecuteCode) | 1083 OnExecuteCode) |
1078 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, | 1084 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, |
1079 OnCustomContextMenuAction) | 1085 OnCustomContextMenuAction) |
1080 IPC_MESSAGE_HANDLER(ViewMsg_TranslatePage, OnTranslatePage) | 1086 IPC_MESSAGE_HANDLER(ViewMsg_TranslatePage, OnTranslatePage) |
1081 IPC_MESSAGE_HANDLER(ViewMsg_RevertTranslation, OnRevertTranslation) | 1087 IPC_MESSAGE_HANDLER(ViewMsg_RevertTranslation, OnRevertTranslation) |
1082 IPC_MESSAGE_HANDLER(ViewMsg_EnableAccessibility, OnEnableAccessibility) | 1088 IPC_MESSAGE_HANDLER(ViewMsg_EnableAccessibility, OnEnableAccessibility) |
(...skipping 4569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5652 // Crash reports from the field indicate that we can be notified with a | 5658 // Crash reports from the field indicate that we can be notified with a |
5653 // NULL external popup menu (we probably get notified twice). | 5659 // NULL external popup menu (we probably get notified twice). |
5654 // If you hit this please file a bug against jcivelli and include the page | 5660 // If you hit this please file a bug against jcivelli and include the page |
5655 // and steps to repro. | 5661 // and steps to repro. |
5656 NOTREACHED(); | 5662 NOTREACHED(); |
5657 return; | 5663 return; |
5658 } | 5664 } |
5659 external_popup_menu_->DidSelectItem(selected_index); | 5665 external_popup_menu_->DidSelectItem(selected_index); |
5660 external_popup_menu_.reset(); | 5666 external_popup_menu_.reset(); |
5661 } | 5667 } |
| 5668 |
| 5669 void RenderView::OnCharacterIndexForPoint(gfx::Point point) { |
| 5670 WebKit::WebTextHelper helper(webview()->mainFrame()); |
| 5671 uint index = helper.characterIndexForPoint(point.x(), point.y()); |
| 5672 Send(new ViewHostMsg_GotCharacterIndexForPoint(routing_id(), index)); |
| 5673 } |
| 5674 |
| 5675 void RenderView::OnFirstRectForCharacterRange(uint location, uint length) { |
| 5676 WebKit::WebTextHelper helper(webview()->mainFrame()); |
| 5677 gfx::Rect rect(helper.firstRectForRange(location, length)); |
| 5678 Send(new ViewHostMsg_GotFirstRectForRange(routing_id(), rect)); |
| 5679 } |
| 5680 |
| 5681 void RenderView::OnStringForRange(uint location, uint length) { |
| 5682 WebKit::WebTextHelper helper(webview()->mainFrame()); |
| 5683 WebKit::WebString webstring(helper.substringInRange(location, length)); |
| 5684 Send(new ViewHostMsg_GotStringForRange(routing_id(), webstring)); |
| 5685 } |
5662 #endif | 5686 #endif |
5663 | 5687 |
5664 void RenderView::AddErrorToRootConsole(const string16& message) { | 5688 void RenderView::AddErrorToRootConsole(const string16& message) { |
5665 if (webview() && webview()->mainFrame()) { | 5689 if (webview() && webview()->mainFrame()) { |
5666 webview()->mainFrame()->addMessageToConsole( | 5690 webview()->mainFrame()->addMessageToConsole( |
5667 WebConsoleMessage(WebConsoleMessage::LevelError, message)); | 5691 WebConsoleMessage(WebConsoleMessage::LevelError, message)); |
5668 } | 5692 } |
5669 } | 5693 } |
5670 | 5694 |
5671 #if defined(ENABLE_FLAPPER_HACKS) | 5695 #if defined(ENABLE_FLAPPER_HACKS) |
(...skipping 14 matching lines...) Expand all Loading... |
5686 if (cmd == kJavaScriptStressTestSetStressRunType) { | 5710 if (cmd == kJavaScriptStressTestSetStressRunType) { |
5687 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param)); | 5711 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param)); |
5688 } else if (cmd == kJavaScriptStressTestPrepareStressRun) { | 5712 } else if (cmd == kJavaScriptStressTestPrepareStressRun) { |
5689 v8::Testing::PrepareStressRun(param); | 5713 v8::Testing::PrepareStressRun(param); |
5690 } | 5714 } |
5691 } | 5715 } |
5692 | 5716 |
5693 void RenderView::OnContextMenuClosed() { | 5717 void RenderView::OnContextMenuClosed() { |
5694 context_menu_node_.reset(); | 5718 context_menu_node_.reset(); |
5695 } | 5719 } |
OLD | NEW |