| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_view_host.h" | 5 #include "chrome/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 "app/resource_bundle.h" | 11 #include "app/resource_bundle.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/stats_counters.h" | 14 #include "base/stats_counters.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "base/waitable_event.h" | 17 #include "base/waitable_event.h" |
| 18 #include "chrome/browser/blocked_plugin_manager.h" |
| 18 #include "chrome/browser/browser_list.h" | 19 #include "chrome/browser/browser_list.h" |
| 19 #include "chrome/browser/child_process_security_policy.h" | 20 #include "chrome/browser/child_process_security_policy.h" |
| 20 #include "chrome/browser/cross_site_request_manager.h" | 21 #include "chrome/browser/cross_site_request_manager.h" |
| 21 #include "chrome/browser/debugger/devtools_manager.h" | 22 #include "chrome/browser/debugger/devtools_manager.h" |
| 22 #include "chrome/browser/dom_operation_notification_details.h" | 23 #include "chrome/browser/dom_operation_notification_details.h" |
| 23 #include "chrome/browser/extensions/extension_message_service.h" | 24 #include "chrome/browser/extensions/extension_message_service.h" |
| 24 #include "chrome/browser/metrics/user_metrics.h" | 25 #include "chrome/browser/metrics/user_metrics.h" |
| 25 #include "chrome/browser/notifications/desktop_notification_service.h" | 26 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 26 #include "chrome/browser/profile.h" | 27 #include "chrome/browser/profile.h" |
| 27 #include "chrome/browser/renderer_host/render_process_host.h" | 28 #include "chrome/browser/renderer_host/render_process_host.h" |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 } | 646 } |
| 646 | 647 |
| 647 void RenderViewHost::UpdateWebPreferences(const WebPreferences& prefs) { | 648 void RenderViewHost::UpdateWebPreferences(const WebPreferences& prefs) { |
| 648 Send(new ViewMsg_UpdateWebPreferences(routing_id(), prefs)); | 649 Send(new ViewMsg_UpdateWebPreferences(routing_id(), prefs)); |
| 649 } | 650 } |
| 650 | 651 |
| 651 void RenderViewHost::InstallMissingPlugin() { | 652 void RenderViewHost::InstallMissingPlugin() { |
| 652 Send(new ViewMsg_InstallMissingPlugin(routing_id())); | 653 Send(new ViewMsg_InstallMissingPlugin(routing_id())); |
| 653 } | 654 } |
| 654 | 655 |
| 656 void RenderViewHost::LoadBlockedPlugins() { |
| 657 Send(new ViewMsg_LoadBlockedPlugins(routing_id())); |
| 658 } |
| 659 |
| 655 void RenderViewHost::FilesSelectedInChooser( | 660 void RenderViewHost::FilesSelectedInChooser( |
| 656 const std::vector<FilePath>& files) { | 661 const std::vector<FilePath>& files) { |
| 657 // Grant the security access requested to the given files. | 662 // Grant the security access requested to the given files. |
| 658 for (std::vector<FilePath>::const_iterator file = files.begin(); | 663 for (std::vector<FilePath>::const_iterator file = files.begin(); |
| 659 file != files.end(); ++file) { | 664 file != files.end(); ++file) { |
| 660 ChildProcessSecurityPolicy::GetInstance()->GrantUploadFile( | 665 ChildProcessSecurityPolicy::GetInstance()->GrantUploadFile( |
| 661 process()->id(), *file); | 666 process()->id(), *file); |
| 662 } | 667 } |
| 663 Send(new ViewMsg_RunFileChooserResponse(routing_id(), files)); | 668 Send(new ViewMsg_RunFileChooserResponse(routing_id(), files)); |
| 664 } | 669 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 OnCloseDevToolsWindow); | 792 OnCloseDevToolsWindow); |
| 788 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestDockDevToolsWindow, | 793 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestDockDevToolsWindow, |
| 789 OnRequestDockDevToolsWindow); | 794 OnRequestDockDevToolsWindow); |
| 790 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestUndockDevToolsWindow, | 795 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestUndockDevToolsWindow, |
| 791 OnRequestUndockDevToolsWindow); | 796 OnRequestUndockDevToolsWindow); |
| 792 IPC_MESSAGE_HANDLER(ViewHostMsg_DevToolsRuntimeFeatureStateChanged, | 797 IPC_MESSAGE_HANDLER(ViewHostMsg_DevToolsRuntimeFeatureStateChanged, |
| 793 OnDevToolsRuntimeFeatureStateChanged); | 798 OnDevToolsRuntimeFeatureStateChanged); |
| 794 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, | 799 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, |
| 795 OnUserMetricsRecordAction) | 800 OnUserMetricsRecordAction) |
| 796 IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus); | 801 IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus); |
| 802 IPC_MESSAGE_HANDLER(ViewHostMsg_NonSandboxedPluginBlocked, |
| 803 OnNonSandboxedPluginBlocked); |
| 804 IPC_MESSAGE_HANDLER(ViewHostMsg_BlockedPluginLoaded, |
| 805 OnBlockedPluginLoaded); |
| 797 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin); | 806 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin); |
| 807 IPC_MESSAGE_HANDLER(ViewHostMsg_DisabledOutdatedPlugin, |
| 808 OnDisabledOutdatedPlugin); |
| 798 IPC_MESSAGE_HANDLER(ViewHostMsg_SendCurrentPageAllSavableResourceLinks, | 809 IPC_MESSAGE_HANDLER(ViewHostMsg_SendCurrentPageAllSavableResourceLinks, |
| 799 OnReceivedSavableResourceLinksForCurrentPage); | 810 OnReceivedSavableResourceLinksForCurrentPage); |
| 800 IPC_MESSAGE_HANDLER(ViewHostMsg_SendSerializedHtmlData, | 811 IPC_MESSAGE_HANDLER(ViewHostMsg_SendSerializedHtmlData, |
| 801 OnReceivedSerializedHtmlData); | 812 OnReceivedSerializedHtmlData); |
| 802 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, | 813 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, |
| 803 OnDidGetApplicationInfo); | 814 OnDidGetApplicationInfo); |
| 804 IPC_MESSAGE_FORWARD(ViewHostMsg_JSOutOfMemory, delegate_, | 815 IPC_MESSAGE_FORWARD(ViewHostMsg_JSOutOfMemory, delegate_, |
| 805 RenderViewHostDelegate::OnJSOutOfMemory); | 816 RenderViewHostDelegate::OnJSOutOfMemory); |
| 806 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK); | 817 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK); |
| 807 IPC_MESSAGE_HANDLER(ViewHostMsg_QueryFormFieldAutoFill, | 818 IPC_MESSAGE_HANDLER(ViewHostMsg_QueryFormFieldAutoFill, |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 integration_delegate->OnUserGesture(); | 1529 integration_delegate->OnUserGesture(); |
| 1519 } | 1530 } |
| 1520 | 1531 |
| 1521 void RenderViewHost::OnMissingPluginStatus(int status) { | 1532 void RenderViewHost::OnMissingPluginStatus(int status) { |
| 1522 RenderViewHostDelegate::BrowserIntegration* integration_delegate = | 1533 RenderViewHostDelegate::BrowserIntegration* integration_delegate = |
| 1523 delegate_->GetBrowserIntegrationDelegate(); | 1534 delegate_->GetBrowserIntegrationDelegate(); |
| 1524 if (integration_delegate) | 1535 if (integration_delegate) |
| 1525 integration_delegate->OnMissingPluginStatus(status); | 1536 integration_delegate->OnMissingPluginStatus(status); |
| 1526 } | 1537 } |
| 1527 | 1538 |
| 1539 void RenderViewHost::OnNonSandboxedPluginBlocked(const string16& name) { |
| 1540 RenderViewHostDelegate::BlockedPlugin* blocked_plugin_delegate = |
| 1541 delegate_->GetBlockedPluginDelegate(); |
| 1542 if (blocked_plugin_delegate) { |
| 1543 blocked_plugin_delegate->OnNonSandboxedPluginBlocked(name); |
| 1544 } |
| 1545 } |
| 1546 |
| 1547 void RenderViewHost::OnBlockedPluginLoaded() { |
| 1548 RenderViewHostDelegate::BlockedPlugin* blocked_plugin_delegate = |
| 1549 delegate_->GetBlockedPluginDelegate(); |
| 1550 if (blocked_plugin_delegate) { |
| 1551 blocked_plugin_delegate->OnBlockedPluginLoaded(); |
| 1552 } |
| 1553 } |
| 1554 |
| 1528 void RenderViewHost::OnCrashedPlugin(const FilePath& plugin_path) { | 1555 void RenderViewHost::OnCrashedPlugin(const FilePath& plugin_path) { |
| 1529 RenderViewHostDelegate::BrowserIntegration* integration_delegate = | 1556 RenderViewHostDelegate::BrowserIntegration* integration_delegate = |
| 1530 delegate_->GetBrowserIntegrationDelegate(); | 1557 delegate_->GetBrowserIntegrationDelegate(); |
| 1531 if (integration_delegate) | 1558 if (integration_delegate) |
| 1532 integration_delegate->OnCrashedPlugin(plugin_path); | 1559 integration_delegate->OnCrashedPlugin(plugin_path); |
| 1533 } | 1560 } |
| 1534 | 1561 |
| 1562 void RenderViewHost::OnDisabledOutdatedPlugin(const string16& name, |
| 1563 const GURL& update_url) { |
| 1564 RenderViewHostDelegate::BrowserIntegration* integration_delegate = |
| 1565 delegate_->GetBrowserIntegrationDelegate(); |
| 1566 if (integration_delegate) |
| 1567 integration_delegate->OnDisabledOutdatedPlugin(name, update_url); |
| 1568 } |
| 1569 |
| 1535 void RenderViewHost::GetAllSavableResourceLinksForCurrentPage( | 1570 void RenderViewHost::GetAllSavableResourceLinksForCurrentPage( |
| 1536 const GURL& page_url) { | 1571 const GURL& page_url) { |
| 1537 Send(new ViewMsg_GetAllSavableResourceLinksForCurrentPage(routing_id(), | 1572 Send(new ViewMsg_GetAllSavableResourceLinksForCurrentPage(routing_id(), |
| 1538 page_url)); | 1573 page_url)); |
| 1539 } | 1574 } |
| 1540 | 1575 |
| 1541 void RenderViewHost::OnReceivedSavableResourceLinksForCurrentPage( | 1576 void RenderViewHost::OnReceivedSavableResourceLinksForCurrentPage( |
| 1542 const std::vector<GURL>& resources_list, | 1577 const std::vector<GURL>& resources_list, |
| 1543 const std::vector<GURL>& referrers_list, | 1578 const std::vector<GURL>& referrers_list, |
| 1544 const std::vector<GURL>& frames_list) { | 1579 const std::vector<GURL>& frames_list) { |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1947 const string16& name, | 1982 const string16& name, |
| 1948 const string16& display_name, | 1983 const string16& display_name, |
| 1949 unsigned long estimated_size, | 1984 unsigned long estimated_size, |
| 1950 bool blocked_by_policy) { | 1985 bool blocked_by_policy) { |
| 1951 RenderViewHostDelegate::ContentSettings* content_settings_delegate = | 1986 RenderViewHostDelegate::ContentSettings* content_settings_delegate = |
| 1952 delegate_->GetContentSettingsDelegate(); | 1987 delegate_->GetContentSettingsDelegate(); |
| 1953 if (content_settings_delegate) | 1988 if (content_settings_delegate) |
| 1954 content_settings_delegate->OnWebDatabaseAccessed( | 1989 content_settings_delegate->OnWebDatabaseAccessed( |
| 1955 url, name, display_name, estimated_size, blocked_by_policy); | 1990 url, name, display_name, estimated_size, blocked_by_policy); |
| 1956 } | 1991 } |
| OLD | NEW |