| 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_view_host.h" | 5 #include "content/browser/renderer_host/render_view_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 13 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "chrome/browser/dom_operation_notification_details.h" | 18 #include "chrome/browser/dom_operation_notification_details.h" |
| 19 #include "chrome/browser/extensions/extension_message_service.h" | |
| 20 #include "chrome/browser/metrics/user_metrics.h" | 19 #include "chrome/browser/metrics/user_metrics.h" |
| 21 #include "chrome/browser/net/predictor_api.h" | 20 #include "chrome/browser/net/predictor_api.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/common/bindings_policy.h" | 22 #include "chrome/common/bindings_policy.h" |
| 24 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
| 25 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/extensions/extension_messages.h" | 25 #include "chrome/common/extensions/extension_messages.h" |
| 27 #include "chrome/common/print_messages.h" | 26 #include "chrome/common/print_messages.h" |
| 28 #include "chrome/common/render_messages.h" | 27 #include "chrome/common/render_messages.h" |
| 29 #include "chrome/common/safebrowsing_messages.h" | 28 #include "chrome/common/safebrowsing_messages.h" |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 OnMsgRunJavaScriptMessage) | 764 OnMsgRunJavaScriptMessage) |
| 766 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, | 765 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, |
| 767 OnMsgRunBeforeUnloadConfirm) | 766 OnMsgRunBeforeUnloadConfirm) |
| 768 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnMsgStartDragging) | 767 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnMsgStartDragging) |
| 769 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 768 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) |
| 770 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 769 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
| 771 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) | 770 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) |
| 772 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK) | 771 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK) |
| 773 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnExtensionRequest) | 772 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnExtensionRequest) |
| 774 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged) | 773 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged) |
| 775 IPC_MESSAGE_HANDLER(ExtensionHostMsg_PostMessage, OnExtensionPostMessage) | |
| 776 IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityNotifications, | 774 IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityNotifications, |
| 777 OnAccessibilityNotifications) | 775 OnAccessibilityNotifications) |
| 778 IPC_MESSAGE_HANDLER(ViewHostMsg_OnCSSInserted, OnCSSInserted) | 776 IPC_MESSAGE_HANDLER(ViewHostMsg_OnCSSInserted, OnCSSInserted) |
| 779 IPC_MESSAGE_HANDLER(ViewHostMsg_ContentBlocked, OnContentBlocked) | 777 IPC_MESSAGE_HANDLER(ViewHostMsg_ContentBlocked, OnContentBlocked) |
| 780 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 778 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
| 781 IPC_MESSAGE_HANDLER(ViewHostMsg_WebDatabaseAccessed, OnWebDatabaseAccessed) | 779 IPC_MESSAGE_HANDLER(ViewHostMsg_WebDatabaseAccessed, OnWebDatabaseAccessed) |
| 782 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnMsgFocusedNodeChanged) | 780 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnMsgFocusedNodeChanged) |
| 783 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) | 781 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
| 784 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) | 782 IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) |
| 785 #if defined(OS_MACOSX) | 783 #if defined(OS_MACOSX) |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 // later. | 1492 // later. |
| 1495 VLOG(1) << "Blocked URL " << url->spec(); | 1493 VLOG(1) << "Blocked URL " << url->spec(); |
| 1496 *url = GURL(); | 1494 *url = GURL(); |
| 1497 } | 1495 } |
| 1498 } | 1496 } |
| 1499 | 1497 |
| 1500 void RenderViewHost::JavaScriptStressTestControl(int cmd, int param) { | 1498 void RenderViewHost::JavaScriptStressTestControl(int cmd, int param) { |
| 1501 Send(new ViewMsg_JavaScriptStressTestControl(routing_id(), cmd, param)); | 1499 Send(new ViewMsg_JavaScriptStressTestControl(routing_id(), cmd, param)); |
| 1502 } | 1500 } |
| 1503 | 1501 |
| 1504 void RenderViewHost::OnExtensionPostMessage( | |
| 1505 int port_id, const std::string& message) { | |
| 1506 if (process()->profile()->GetExtensionMessageService()) { | |
| 1507 process()->profile()->GetExtensionMessageService()-> | |
| 1508 PostMessageFromRenderer(port_id, message); | |
| 1509 } | |
| 1510 } | |
| 1511 | |
| 1512 void RenderViewHost::OnAccessibilityNotifications( | 1502 void RenderViewHost::OnAccessibilityNotifications( |
| 1513 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { | 1503 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { |
| 1514 if (view()) | 1504 if (view()) |
| 1515 view()->OnAccessibilityNotifications(params); | 1505 view()->OnAccessibilityNotifications(params); |
| 1516 | 1506 |
| 1517 if (!params.empty()) { | 1507 if (!params.empty()) { |
| 1518 for (unsigned i = 0; i < params.size(); i++) { | 1508 for (unsigned i = 0; i < params.size(); i++) { |
| 1519 const ViewHostMsg_AccessibilityNotification_Params& param = params[i]; | 1509 const ViewHostMsg_AccessibilityNotification_Params& param = params[i]; |
| 1520 | 1510 |
| 1521 if (param.notification_type == | 1511 if (param.notification_type == |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 LOG(DFATAL) << "Invalid checked state " << checked_state; | 1611 LOG(DFATAL) << "Invalid checked state " << checked_state; |
| 1622 return; | 1612 return; |
| 1623 } | 1613 } |
| 1624 | 1614 |
| 1625 CommandState state; | 1615 CommandState state; |
| 1626 state.is_enabled = is_enabled; | 1616 state.is_enabled = is_enabled; |
| 1627 state.checked_state = | 1617 state.checked_state = |
| 1628 static_cast<RenderViewCommandCheckedState>(checked_state); | 1618 static_cast<RenderViewCommandCheckedState>(checked_state); |
| 1629 command_states_[static_cast<RenderViewCommand>(command)] = state; | 1619 command_states_[static_cast<RenderViewCommand>(command)] = state; |
| 1630 } | 1620 } |
| OLD | NEW |