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 "content/browser/renderer_host/render_widget_host.h" | 5 #include "content/browser/renderer_host/render_widget_host.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/browser/user_metrics.h" | 21 #include "content/browser/user_metrics.h" |
22 #include "content/common/content_switches.h" | 22 #include "content/common/content_switches.h" |
23 #include "content/common/gpu/gpu_messages.h" | 23 #include "content/common/gpu/gpu_messages.h" |
24 #include "content/common/native_web_keyboard_event.h" | 24 #include "content/common/native_web_keyboard_event.h" |
25 #include "content/common/notification_service.h" | 25 #include "content/common/notification_service.h" |
26 #include "content/common/result_codes.h" | 26 #include "content/common/result_codes.h" |
27 #include "content/common/view_messages.h" | 27 #include "content/common/view_messages.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
29 #include "ui/base/keycodes/keyboard_codes.h" | 29 #include "ui/base/keycodes/keyboard_codes.h" |
30 #include "webkit/glue/webcursor.h" | 30 #include "webkit/glue/webcursor.h" |
| 31 #include "webkit/glue/webpreferences.h" |
31 #include "webkit/plugins/npapi/webplugin.h" | 32 #include "webkit/plugins/npapi/webplugin.h" |
32 | 33 |
33 using base::Time; | 34 using base::Time; |
34 using base::TimeDelta; | 35 using base::TimeDelta; |
35 using base::TimeTicks; | 36 using base::TimeTicks; |
36 | 37 |
37 using WebKit::WebGestureEvent; | 38 using WebKit::WebGestureEvent; |
38 using WebKit::WebInputEvent; | 39 using WebKit::WebInputEvent; |
39 using WebKit::WebKeyboardEvent; | 40 using WebKit::WebKeyboardEvent; |
40 using WebKit::WebMouseEvent; | 41 using WebKit::WebMouseEvent; |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 } | 1249 } |
1249 | 1250 |
1250 deferred_plugin_handles_.clear(); | 1251 deferred_plugin_handles_.clear(); |
1251 #endif | 1252 #endif |
1252 } | 1253 } |
1253 | 1254 |
1254 void RenderWidgetHost::StartUserGesture() { | 1255 void RenderWidgetHost::StartUserGesture() { |
1255 OnUserGesture(); | 1256 OnUserGesture(); |
1256 } | 1257 } |
1257 | 1258 |
1258 void RenderWidgetHost::Zoom(PageZoom::Function zoom_function) { | |
1259 Send(new ViewMsg_Zoom(routing_id(), zoom_function)); | |
1260 } | |
1261 | |
1262 void RenderWidgetHost::ReloadFrame() { | |
1263 Send(new ViewMsg_ReloadFrame(routing_id())); | |
1264 } | |
1265 | |
1266 void RenderWidgetHost::Find(int request_id, const string16& search_text, | |
1267 const WebKit::WebFindOptions& options) { | |
1268 Send(new ViewMsg_Find(routing_id(), request_id, search_text, options)); | |
1269 } | |
1270 | |
1271 void RenderWidgetHost::Stop() { | 1259 void RenderWidgetHost::Stop() { |
1272 Send(new ViewMsg_Stop(routing_id())); | 1260 Send(new ViewMsg_Stop(routing_id())); |
1273 } | 1261 } |
1274 | 1262 |
1275 void RenderWidgetHost::InsertCSS(const string16& frame_xpath, | 1263 void RenderWidgetHost::SetBackground(const SkBitmap& background) { |
1276 const std::string& css) { | 1264 Send(new ViewMsg_SetBackground(routing_id(), background)); |
1277 Send(new ViewMsg_CSSInsertRequest(routing_id(), frame_xpath, css)); | |
1278 } | 1265 } |
1279 | 1266 |
1280 void RenderWidgetHost::DisableScrollbarsForThreshold(const gfx::Size& size) { | 1267 void RenderWidgetHost::SetEditCommandsForNextKeyEvent( |
1281 Send(new ViewMsg_DisableScrollbarsForSmallWindows(routing_id(), size)); | 1268 const std::vector<EditCommand>& commands) { |
| 1269 Send(new ViewMsg_SetEditCommandsForNextKeyEvent(routing_id(), commands)); |
1282 } | 1270 } |
1283 | 1271 |
1284 void RenderWidgetHost::EnablePreferredSizeMode(int flags) { | 1272 void RenderWidgetHost::AccessibilityDoDefaultAction(int object_id) { |
1285 Send(new ViewMsg_EnablePreferredSizeChangedMode(routing_id(), flags)); | 1273 Send(new ViewMsg_AccessibilityDoDefaultAction(routing_id(), object_id)); |
1286 } | 1274 } |
1287 | 1275 |
| 1276 void RenderWidgetHost::AccessibilitySetFocus(int object_id) { |
| 1277 Send(new ViewMsg_SetAccessibilityFocus(routing_id(), object_id)); |
| 1278 } |
| 1279 |
| 1280 void RenderWidgetHost::ExecuteEditCommand(const std::string& command, |
| 1281 const std::string& value) { |
| 1282 Send(new ViewMsg_ExecuteEditCommand(routing_id(), command, value)); |
| 1283 } |
| 1284 |
| 1285 void RenderWidgetHost::ScrollFocusedEditableNodeIntoRect( |
| 1286 const gfx::Rect& rect) { |
| 1287 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(routing_id(), rect)); |
| 1288 } |
| 1289 |
| 1290 void RenderWidgetHost::SelectRange(const gfx::Point& start, |
| 1291 const gfx::Point& end) { |
| 1292 Send(new ViewMsg_SelectRange(routing_id(), start, end)); |
| 1293 } |
| 1294 |
| 1295 void RenderWidgetHost::Undo() { |
| 1296 Send(new ViewMsg_Undo(routing_id())); |
| 1297 UserMetrics::RecordAction(UserMetricsAction("Undo")); |
| 1298 } |
| 1299 |
| 1300 void RenderWidgetHost::Redo() { |
| 1301 Send(new ViewMsg_Redo(routing_id())); |
| 1302 UserMetrics::RecordAction(UserMetricsAction("Redo")); |
| 1303 } |
| 1304 |
| 1305 void RenderWidgetHost::Cut() { |
| 1306 Send(new ViewMsg_Cut(routing_id())); |
| 1307 UserMetrics::RecordAction(UserMetricsAction("Cut")); |
| 1308 } |
| 1309 |
| 1310 void RenderWidgetHost::Copy() { |
| 1311 Send(new ViewMsg_Copy(routing_id())); |
| 1312 UserMetrics::RecordAction(UserMetricsAction("Copy")); |
| 1313 } |
| 1314 |
| 1315 void RenderWidgetHost::CopyToFindPboard() { |
| 1316 #if defined(OS_MACOSX) |
| 1317 // Windows/Linux don't have the concept of a find pasteboard. |
| 1318 Send(new ViewMsg_CopyToFindPboard(routing_id())); |
| 1319 UserMetrics::RecordAction(UserMetricsAction("CopyToFindPboard")); |
| 1320 #endif |
| 1321 } |
| 1322 |
| 1323 void RenderWidgetHost::Paste() { |
| 1324 Send(new ViewMsg_Paste(routing_id())); |
| 1325 UserMetrics::RecordAction(UserMetricsAction("Paste")); |
| 1326 } |
| 1327 |
| 1328 void RenderWidgetHost::Delete() { |
| 1329 Send(new ViewMsg_Delete(routing_id())); |
| 1330 UserMetrics::RecordAction(UserMetricsAction("DeleteSelection")); |
| 1331 } |
| 1332 |
| 1333 void RenderWidgetHost::SelectAll() { |
| 1334 Send(new ViewMsg_SelectAll(routing_id())); |
| 1335 UserMetrics::RecordAction(UserMetricsAction("SelectAll")); |
| 1336 } |
| 1337 |
OLD | NEW |