diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-24 01:34:35 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-24 01:34:35 +0000 |
commit | fffaf977dfde05c9d227bfd6951c7e7c65894154 (patch) | |
tree | 8c89b3dd78b35ea27ad43de6381b74b3a24e1f67 | |
parent | fe641c8aa8e5471c85fccac181c8db3b9dfef2b5 (diff) | |
download | chromium_src-fffaf977dfde05c9d227bfd6951c7e7c65894154.zip chromium_src-fffaf977dfde05c9d227bfd6951c7e7c65894154.tar.gz chromium_src-fffaf977dfde05c9d227bfd6951c7e7c65894154.tar.bz2 |
Move the rest of the renderer->browser messages that belong in content. Also do a bunch of cleanup:
-move safe browsing messages together
-get rid of webkit_param_traits and common_param_trait since they're no longer needed
-remove the multiple include of IPC files from places that don't need it
TBR=tsepez
Review URL: http://codereview.chromium.org/6713084
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79235 0039d316-1c4b-4281-b951-d872f2087c98
59 files changed, 655 insertions, 1582 deletions
diff --git a/chrome/browser/accessibility/browser_accessibility_manager.cc b/chrome/browser/accessibility/browser_accessibility_manager.cc index daba26f..3a12164 100644 --- a/chrome/browser/accessibility/browser_accessibility_manager.cc +++ b/chrome/browser/accessibility/browser_accessibility_manager.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "chrome/browser/accessibility/browser_accessibility.h" -#include "chrome/common/render_messages_params.h" +#include "content/common/view_messages.h" using webkit_glue::WebAccessibility; @@ -97,27 +97,27 @@ void BrowserAccessibilityManager::OnAccessibilityNotifications( const ViewHostMsg_AccessibilityNotification_Params& param = params[index]; switch (param.notification_type) { - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHECK_STATE_CHANGED: OnAccessibilityObjectStateChange(param.acc_obj); break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHILDREN_CHANGED: OnAccessibilityObjectChildrenChange(param.acc_obj); break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_FOCUS_CHANGED: OnAccessibilityObjectFocusChange(param.acc_obj); break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_LOAD_COMPLETE: OnAccessibilityObjectLoadComplete(param.acc_obj); break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_VALUE_CHANGED: OnAccessibilityObjectValueChange(param.acc_obj); break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_SELECTED_TEXT_CHANGED: OnAccessibilityObjectTextChange(param.acc_obj); break; @@ -135,7 +135,7 @@ void BrowserAccessibilityManager::OnAccessibilityObjectStateChange( return; NotifyAccessibilityEvent( - ViewHostMsg_AccessibilityNotification_Params:: + ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHECK_STATE_CHANGED, new_browser_acc); } @@ -147,7 +147,7 @@ void BrowserAccessibilityManager::OnAccessibilityObjectChildrenChange( return; NotifyAccessibilityEvent( - ViewHostMsg_AccessibilityNotification_Params:: + ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHILDREN_CHANGED, new_browser_acc); } @@ -164,7 +164,7 @@ void BrowserAccessibilityManager::OnAccessibilityObjectFocusChange( } else if (!delegate_) { // Mac currently does not have a BrowserAccessibilityDelegate. NotifyAccessibilityEvent( - ViewHostMsg_AccessibilityNotification_Params:: + ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_FOCUS_CHANGED, focus_); } @@ -180,7 +180,7 @@ void BrowserAccessibilityManager::OnAccessibilityObjectLoadComplete( SetFocus(root_, false); NotifyAccessibilityEvent( - ViewHostMsg_AccessibilityNotification_Params:: + ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_LOAD_COMPLETE, root_); if (delegate_ && delegate_->HasFocus()) @@ -194,7 +194,7 @@ void BrowserAccessibilityManager::OnAccessibilityObjectValueChange( return; NotifyAccessibilityEvent( - ViewHostMsg_AccessibilityNotification_Params:: + ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_VALUE_CHANGED, new_browser_acc); } @@ -206,7 +206,7 @@ void BrowserAccessibilityManager::OnAccessibilityObjectTextChange( return; NotifyAccessibilityEvent( - ViewHostMsg_AccessibilityNotification_Params:: + ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_SELECTED_TEXT_CHANGED, new_browser_acc); } @@ -217,7 +217,7 @@ void BrowserAccessibilityManager::GotFocus() { return; NotifyAccessibilityEvent( - ViewHostMsg_AccessibilityNotification_Params:: + ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_FOCUS_CHANGED, focus_); } diff --git a/chrome/browser/accessibility/browser_accessibility_manager_mac.mm b/chrome/browser/accessibility/browser_accessibility_manager_mac.mm index 3aebc6e..5c876e3 100644 --- a/chrome/browser/accessibility/browser_accessibility_manager_mac.mm +++ b/chrome/browser/accessibility/browser_accessibility_manager_mac.mm @@ -6,7 +6,7 @@ #import "base/logging.h" #import "chrome/browser/accessibility/browser_accessibility_cocoa.h" -#include "chrome/common/render_messages_params.h" +#include "content/common/view_messages.h" // static BrowserAccessibilityManager* BrowserAccessibilityManager::Create( @@ -32,27 +32,27 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( // Refer to AXObjectCache.mm (webkit). NSString* event_id = @""; switch (type) { - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHECK_STATE_CHANGED: // Does not exist on Mac. return; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHILDREN_CHANGED: // TODO(dtseng): no clear equivalent on Mac. return; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_FOCUS_CHANGED: event_id = NSAccessibilityFocusedUIElementChangedNotification; break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_LOAD_COMPLETE: event_id = @"AXLoadComplete"; break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_VALUE_CHANGED: event_id = NSAccessibilityValueChangedNotification; break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_SELECTED_TEXT_CHANGED: event_id = NSAccessibilitySelectedTextChangedNotification; break; diff --git a/chrome/browser/accessibility/browser_accessibility_manager_unittest.cc b/chrome/browser/accessibility/browser_accessibility_manager_unittest.cc index 0ac6e5e..1b6aa1a 100644 --- a/chrome/browser/accessibility/browser_accessibility_manager_unittest.cc +++ b/chrome/browser/accessibility/browser_accessibility_manager_unittest.cc @@ -6,7 +6,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/accessibility/browser_accessibility.h" #include "chrome/browser/accessibility/browser_accessibility_manager.h" -#include "chrome/common/render_messages_params.h" +#include "content/common/view_messages.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/webaccessibility.h" @@ -230,7 +230,7 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects) { std::vector<ViewHostMsg_AccessibilityNotification_Params> params; params.push_back(ViewHostMsg_AccessibilityNotification_Params()); ViewHostMsg_AccessibilityNotification_Params* msg = ¶ms[0]; - msg->notification_type = ViewHostMsg_AccessibilityNotification_Params:: + msg->notification_type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHILDREN_CHANGED; msg->acc_obj = tree2_root; manager->OnAccessibilityNotifications(params); @@ -435,7 +435,7 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects2) { std::vector<ViewHostMsg_AccessibilityNotification_Params> params; params.push_back(ViewHostMsg_AccessibilityNotification_Params()); ViewHostMsg_AccessibilityNotification_Params* msg = ¶ms[0]; - msg->notification_type = ViewHostMsg_AccessibilityNotification_Params:: + msg->notification_type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHILDREN_CHANGED; msg->acc_obj = tree2_container; manager->OnAccessibilityNotifications(params); @@ -535,7 +535,7 @@ TEST(BrowserAccessibilityManagerTest, TestMoveChildUp) { std::vector<ViewHostMsg_AccessibilityNotification_Params> params; params.push_back(ViewHostMsg_AccessibilityNotification_Params()); ViewHostMsg_AccessibilityNotification_Params* msg = ¶ms[0]; - msg->notification_type = ViewHostMsg_AccessibilityNotification_Params:: + msg->notification_type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHILDREN_CHANGED; msg->acc_obj = tree2_1; manager->OnAccessibilityNotifications(params); diff --git a/chrome/browser/accessibility/browser_accessibility_manager_win.cc b/chrome/browser/accessibility/browser_accessibility_manager_win.cc index bb3105e..f867b9b 100644 --- a/chrome/browser/accessibility/browser_accessibility_manager_win.cc +++ b/chrome/browser/accessibility/browser_accessibility_manager_win.cc @@ -5,7 +5,7 @@ #include "chrome/browser/accessibility/browser_accessibility_manager_win.h" #include "chrome/browser/accessibility/browser_accessibility_win.h" -#include "chrome/common/render_messages_params.h" +#include "content/common/view_messages.h" using webkit_glue::WebAccessibility; @@ -57,27 +57,27 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( BrowserAccessibility* node) { LONG event_id; switch (type) { - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHECK_STATE_CHANGED: event_id = EVENT_OBJECT_STATECHANGE; break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHILDREN_CHANGED: event_id = EVENT_OBJECT_REORDER; break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_FOCUS_CHANGED: event_id = EVENT_OBJECT_FOCUS; break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_LOAD_COMPLETE: event_id = IA2_EVENT_DOCUMENT_LOAD_COMPLETE; break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_VALUE_CHANGED: event_id = EVENT_OBJECT_VALUECHANGE; break; - case ViewHostMsg_AccessibilityNotification_Params:: + case ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_SELECTED_TEXT_CHANGED: event_id = IA2_EVENT_TEXT_CARET_MOVED; } diff --git a/chrome/browser/accessibility/browser_accessibility_win_unittest.cc b/chrome/browser/accessibility/browser_accessibility_win_unittest.cc index 7c8595d..ec7fa3a 100644 --- a/chrome/browser/accessibility/browser_accessibility_win_unittest.cc +++ b/chrome/browser/accessibility/browser_accessibility_win_unittest.cc @@ -6,7 +6,7 @@ #include "base/scoped_comptr_win.h" #include "chrome/browser/accessibility/browser_accessibility_manager.h" #include "chrome/browser/accessibility/browser_accessibility_win.h" -#include "chrome/common/render_messages_params.h" +#include "content/common/view_messages.h" #include "testing/gtest/include/gtest/gtest.h" using webkit_glue::WebAccessibility; @@ -193,7 +193,7 @@ TEST_F(BrowserAccessibilityTest, TestChildrenChange) { text.name = L"new text"; ViewHostMsg_AccessibilityNotification_Params param; param.notification_type = - ViewHostMsg_AccessibilityNotification_Params:: + ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHILDREN_CHANGED; param.acc_obj = text; std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; @@ -265,7 +265,7 @@ TEST_F(BrowserAccessibilityTest, TestChildrenChangeNoLeaks) { root.children.clear(); ViewHostMsg_AccessibilityNotification_Params param; param.notification_type = - ViewHostMsg_AccessibilityNotification_Params:: + ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHILDREN_CHANGED; param.acc_obj = root; std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; diff --git a/chrome/browser/importer/importer_messages.h b/chrome/browser/importer/importer_messages.h index 4a89d4d..16dba0e 100644 --- a/chrome/browser/importer/importer_messages.h +++ b/chrome/browser/importer/importer_messages.h @@ -12,7 +12,6 @@ #include "chrome/browser/importer/importer_data_types.h" #include "chrome/browser/importer/profile_writer.h" #include "chrome/browser/search_engines/template_url.h" -#include "chrome/common/common_param_traits.h" #include "content/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc index 1832b56..1303720 100644 --- a/chrome/browser/plugin_observer.cc +++ b/chrome/browser/plugin_observer.cc @@ -16,6 +16,7 @@ #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/view_messages.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc index 95b776f..3ccf491 100644 --- a/chrome/browser/printing/printing_message_filter.cc +++ b/chrome/browser/printing/printing_message_filter.cc @@ -9,7 +9,7 @@ #include "chrome/browser/printing/printer_query.h" #include "chrome/browser/printing/print_job_manager.h" #include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" +#include "content/common/view_messages.h" #if defined(OS_CHROMEOS) #include <fcntl.h> diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 50fa748..ddb20f8 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -56,6 +56,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" +#include "chrome/common/safebrowsing_messages.h" #include "chrome/renderer/render_process_impl.h" #include "chrome/renderer/render_thread.h" #include "content/browser/appcache/appcache_dispatcher_host.h" @@ -1306,6 +1307,6 @@ void BrowserRenderProcessHost::OpenPhishingModelDone( ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, false, DUPLICATE_SAME_ACCESS); #endif - Send(new ViewMsg_SetPhishingModel(file)); + Send(new SafeBrowsingMsg_SetPhishingModel(file)); } } diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc index 884b0a9..bef0392 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host.cc @@ -16,7 +16,6 @@ #include "chrome/browser/safe_browsing/client_side_detection_service.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/render_messages.h" #include "chrome/common/safebrowsing_messages.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_process_host.h" @@ -194,7 +193,7 @@ class ClientSideDetectionHost::ShouldClassifyUrlRequest // |tab_contents_| is safe to call as we will be destructed // before it is. RenderViewHost* rvh = tab_contents_->render_view_host(); - rvh->Send(new ViewMsg_StartPhishingDetection( + rvh->Send(new SafeBrowsingMsg_StartPhishingDetection( rvh->routing_id(), params_.url)); } @@ -261,7 +260,7 @@ ClientSideDetectionHost::~ClientSideDetectionHost() { bool ClientSideDetectionHost::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(ClientSideDetectionHost, message) - IPC_MESSAGE_HANDLER(SafeBrowsingDetectionHostMsg_DetectedPhishingSite, + IPC_MESSAGE_HANDLER(SafeBrowsingHostMsg_DetectedPhishingSite, OnDetectedPhishingSite) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc index 5b33489..a2d07ff 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc @@ -12,7 +12,7 @@ #include "chrome/browser/safe_browsing/client_side_detection_service.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/safebrowsing_messages.h" #include "chrome/test/testing_profile.h" #include "chrome/test/ui_test_utils.h" #include "content/browser/browser_thread.h" @@ -414,10 +414,10 @@ TEST_F(ClientSideDetectionHostTest, ShouldClassifyUrl) { WaitAndCheckPreClassificationChecks(); const IPC::Message* msg = process()->sink().GetFirstMessageMatching( - ViewMsg_StartPhishingDetection::ID); + SafeBrowsingMsg_StartPhishingDetection::ID); ASSERT_TRUE(msg); Tuple1<GURL> actual_url; - ViewMsg_StartPhishingDetection::Read(msg, &actual_url); + SafeBrowsingMsg_StartPhishingDetection::Read(msg, &actual_url); EXPECT_EQ(url, actual_url.a); EXPECT_EQ(rvh()->routing_id(), msg->routing_id()); process()->sink().ClearMessages(); @@ -430,7 +430,7 @@ TEST_F(ClientSideDetectionHostTest, ShouldClassifyUrl) { WaitAndCheckPreClassificationChecks(); msg = process()->sink().GetFirstMessageMatching( - ViewMsg_StartPhishingDetection::ID); + SafeBrowsingMsg_StartPhishingDetection::ID); ASSERT_FALSE(msg); // Navigate to a new host, which should cause another IPC. @@ -440,9 +440,9 @@ TEST_F(ClientSideDetectionHostTest, ShouldClassifyUrl) { NavigateAndCommit(url); WaitAndCheckPreClassificationChecks(); msg = process()->sink().GetFirstMessageMatching( - ViewMsg_StartPhishingDetection::ID); + SafeBrowsingMsg_StartPhishingDetection::ID); ASSERT_TRUE(msg); - ViewMsg_StartPhishingDetection::Read(msg, &actual_url); + SafeBrowsingMsg_StartPhishingDetection::Read(msg, &actual_url); EXPECT_EQ(url, actual_url.a); EXPECT_EQ(rvh()->routing_id(), msg->routing_id()); process()->sink().ClearMessages(); @@ -453,7 +453,7 @@ TEST_F(ClientSideDetectionHostTest, ShouldClassifyUrl) { NavigateAndCommit(url); WaitAndCheckPreClassificationChecks(); msg = process()->sink().GetFirstMessageMatching( - ViewMsg_StartPhishingDetection::ID); + SafeBrowsingMsg_StartPhishingDetection::ID); ASSERT_FALSE(msg); // If the connection is proxied, no IPC should be triggered. @@ -466,7 +466,7 @@ TEST_F(ClientSideDetectionHostTest, ShouldClassifyUrl) { NavigateAndCommit(url); WaitAndCheckPreClassificationChecks(); msg = process()->sink().GetFirstMessageMatching( - ViewMsg_StartPhishingDetection::ID); + SafeBrowsingMsg_StartPhishingDetection::ID); ASSERT_FALSE(msg); // If the tab is off-the-record there should be no IPC. Also, we shouldn't @@ -476,7 +476,7 @@ TEST_F(ClientSideDetectionHostTest, ShouldClassifyUrl) { NavigateAndCommit(url); WaitAndCheckPreClassificationChecks(); msg = process()->sink().GetFirstMessageMatching( - ViewMsg_StartPhishingDetection::ID); + SafeBrowsingMsg_StartPhishingDetection::ID); ASSERT_FALSE(msg); // If the URL is on the csd whitelist, no IPC should be triggered. @@ -486,7 +486,7 @@ TEST_F(ClientSideDetectionHostTest, ShouldClassifyUrl) { NavigateAndCommit(url); WaitAndCheckPreClassificationChecks(); msg = process()->sink().GetFirstMessageMatching( - ViewMsg_StartPhishingDetection::ID); + SafeBrowsingMsg_StartPhishingDetection::ID); ASSERT_FALSE(msg); // If item is in the cache but it isn't valid, we will classify regardless @@ -497,9 +497,9 @@ TEST_F(ClientSideDetectionHostTest, ShouldClassifyUrl) { NavigateAndCommit(url); WaitAndCheckPreClassificationChecks(); msg = process()->sink().GetFirstMessageMatching( - ViewMsg_StartPhishingDetection::ID); + SafeBrowsingMsg_StartPhishingDetection::ID); ASSERT_TRUE(msg); - ViewMsg_StartPhishingDetection::Read(msg, &actual_url); + SafeBrowsingMsg_StartPhishingDetection::Read(msg, &actual_url); EXPECT_EQ(url, actual_url.a); EXPECT_EQ(rvh()->routing_id(), msg->routing_id()); process()->sink().ClearMessages(); @@ -512,7 +512,7 @@ TEST_F(ClientSideDetectionHostTest, ShouldClassifyUrl) { NavigateAndCommit(url); WaitAndCheckPreClassificationChecks(); msg = process()->sink().GetFirstMessageMatching( - ViewMsg_StartPhishingDetection::ID); + SafeBrowsingMsg_StartPhishingDetection::ID); ASSERT_FALSE(msg); // If result is cached, we will try and display the blocking page directly @@ -537,7 +537,7 @@ TEST_F(ClientSideDetectionHostTest, ShouldClassifyUrl) { EXPECT_TRUE(Mock::VerifyAndClear(csd_service_.get())); EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get())); msg = process()->sink().GetFirstMessageMatching( - ViewMsg_StartPhishingDetection::ID); + SafeBrowsingMsg_StartPhishingDetection::ID); ASSERT_FALSE(msg); } diff --git a/chrome/browser/safe_browsing/client_side_detection_service.h b/chrome/browser/safe_browsing/client_side_detection_service.h index c4bb1b9..cdd8965 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service.h +++ b/chrome/browser/safe_browsing/client_side_detection_service.h @@ -94,7 +94,7 @@ class ClientSideDetectionService : public URLFetcher::Delegate { // (unroutable) network block. Pages which are hosted on these IP addresses // are exempt from client-side phishing detection. This is called by the // ClientSideDetectionHost prior to sending the renderer a - // ViewMsg_StartPhishingDetection IPC. + // SafeBrowsingMsg_StartPhishingDetection IPC. // // ip_address should be a dotted IPv4 address, or an unbracketed IPv6 // address. diff --git a/chrome/browser/safe_browsing/malware_details.cc b/chrome/browser/safe_browsing/malware_details.cc index f291284..9a72adf 100644 --- a/chrome/browser/safe_browsing/malware_details.cc +++ b/chrome/browser/safe_browsing/malware_details.cc @@ -9,8 +9,7 @@ #include "base/lazy_instance.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/safe_browsing/report.pb.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" +#include "chrome/common/safebrowsing_messages.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_entry.h" @@ -73,7 +72,7 @@ MalwareDetails::~MalwareDetails() {} bool MalwareDetails::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(MalwareDetails, message) - IPC_MESSAGE_HANDLER(ViewHostMsg_MalwareDOMDetails, + IPC_MESSAGE_HANDLER(SafeBrowsingHostMsg_MalwareDOMDetails, OnReceivedMalwareDOMDetails) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -196,7 +195,7 @@ void MalwareDetails::StartCollection() { // When the renderer is done, this is called. void MalwareDetails::OnReceivedMalwareDOMDetails( - const ViewHostMsg_MalwareDOMDetails_Params& params) { + const std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>& params) { // Schedule this in IO thread, so it doesn't conflict with future users // of our data structures (eg GetSerializedReport). BrowserThread::PostTask( @@ -206,13 +205,13 @@ void MalwareDetails::OnReceivedMalwareDOMDetails( } void MalwareDetails::AddDOMDetails( - const ViewHostMsg_MalwareDOMDetails_Params& params) { + const std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>& params) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // Add the urls from the DOM to |resources_|. The renderer could be // sending bogus messages, so limit the number of nodes we accept. - DVLOG(1) << "Nodes from the DOM: " << params.nodes.size(); - for (uint32 i = 0; i < params.nodes.size() && i < kMaxDomNodes; ++i) { - ViewHostMsg_MalwareDOMDetails_Node node = params.nodes[i]; + DVLOG(1) << "Nodes from the DOM: " << params.size(); + for (uint32 i = 0; i < params.size() && i < kMaxDomNodes; ++i) { + SafeBrowsingHostMsg_MalwareDOMDetails_Node node = params[i]; DVLOG(1) << node.url << ", " << node.tag_name << ", " << node.parent; AddUrl(node.url, node.parent, node.tag_name, &(node.children)); } diff --git a/chrome/browser/safe_browsing/malware_details.h b/chrome/browser/safe_browsing/malware_details.h index 815f45b..2ee37e5 100644 --- a/chrome/browser/safe_browsing/malware_details.h +++ b/chrome/browser/safe_browsing/malware_details.h @@ -24,7 +24,7 @@ #include "content/browser/tab_contents/tab_contents_observer.h" class TabContents; -struct ViewHostMsg_MalwareDOMDetails_Params; +struct SafeBrowsingHostMsg_MalwareDOMDetails_Node; class MalwareDetailsFactory; @@ -57,7 +57,7 @@ class MalwareDetails : public base::RefCountedThreadSafe<MalwareDetails>, // Called on the IO thread with the DOM details. virtual void AddDOMDetails( - const ViewHostMsg_MalwareDOMDetails_Params& params); + const std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>& params); virtual ~MalwareDetails(); @@ -91,7 +91,7 @@ class MalwareDetails : public base::RefCountedThreadSafe<MalwareDetails>, // Message handler. void OnReceivedMalwareDOMDetails( - const ViewHostMsg_MalwareDOMDetails_Params& params); + const std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>& params); const SafeBrowsingService::UnsafeResource resource_; diff --git a/chrome/browser/safe_browsing/malware_details_unittest.cc b/chrome/browser/safe_browsing/malware_details_unittest.cc index 1ad936a..3ec7f32 100644 --- a/chrome/browser/safe_browsing/malware_details_unittest.cc +++ b/chrome/browser/safe_browsing/malware_details_unittest.cc @@ -6,8 +6,7 @@ #include "chrome/browser/safe_browsing/malware_details.h" #include "chrome/browser/safe_browsing/report.pb.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" +#include "chrome/common/safebrowsing_messages.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/tab_contents/navigation_entry.h" @@ -174,16 +173,16 @@ TEST_F(MalwareDetailsTest, MalwareDOMDetails) { contents(), resource); // Send a message from the DOM, with 2 nodes, a parent and a child. - ViewHostMsg_MalwareDOMDetails_Params params; - ViewHostMsg_MalwareDOMDetails_Node child_node; + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node> params; + SafeBrowsingHostMsg_MalwareDOMDetails_Node child_node; child_node.url = GURL(kDOMChildURL); child_node.tag_name = "iframe"; child_node.parent = GURL(kDOMParentURL); - params.nodes.push_back(child_node); - ViewHostMsg_MalwareDOMDetails_Node parent_node; + params.push_back(child_node); + SafeBrowsingHostMsg_MalwareDOMDetails_Node parent_node; parent_node.url = GURL(kDOMParentURL); parent_node.children.push_back(GURL(kDOMChildURL)); - params.nodes.push_back(parent_node); + params.push_back(parent_node); report->OnReceivedMalwareDOMDetails(params); MessageLoop::current()->RunAllPending(); diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index fcbf9a9..3d3f5d3 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc @@ -103,7 +103,7 @@ class FakeMalwareDetails : public MalwareDetails { virtual ~FakeMalwareDetails() {} virtual void AddDOMDetails( - const ViewHostMsg_MalwareDOMDetails_Params& params) { + const std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>& params) { EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); MalwareDetails::AddDOMDetails(params); diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index f735954..d17f87c 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -40,17 +40,12 @@ 'common/chrome_counters.h', 'common/chrome_version_info.cc', 'common/chrome_version_info.h', - 'common/common_message_generator.cc', - 'common/common_message_generator.h', - 'common/common_param_traits.cc', - 'common/common_param_traits.h', 'common/content_restriction.h', 'common/content_settings.cc', 'common/content_settings.h', 'common/content_settings_helper.cc', 'common/content_settings_helper.h', 'common/content_settings_types.h', - 'common/devtools_messages.cc', 'common/devtools_messages.h', 'common/gfx_resource_provider.cc', 'common/gfx_resource_provider.h', @@ -150,6 +145,8 @@ 'common/chrome_content_plugin_client.cc', 'common/chrome_content_plugin_client.h', 'common/common_glue.cc', + 'common/common_message_generator.cc', + 'common/common_message_generator.h', 'common/default_plugin.cc', 'common/default_plugin.h', 'common/deprecated/event_sys-inl.h', @@ -241,8 +238,6 @@ 'common/web_apps.h', 'common/web_resource/web_resource_unpacker.cc', 'common/web_resource/web_resource_unpacker.h', - 'common/webkit_param_traits.cc', - 'common/webkit_param_traits.h', 'common/worker_thread_ticker.cc', 'common/worker_thread_ticker.h', 'common/zip.cc', # Requires zlib directly. diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi index c76a040..04a5eb0 100644 --- a/chrome/chrome_dll.gypi +++ b/chrome/chrome_dll.gypi @@ -601,6 +601,7 @@ '../content/common/child_process.cc', '../content/common/child_thread.cc', '../content/common/content_client.cc', + '../content/common/content_message_generator.cc', '../content/common/content_paths.cc', '../content/common/content_switches.cc', '../content/common/debug_flags.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 7ee7890..950b5bb 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1741,7 +1741,6 @@ 'common/net/gaia/gaia_oauth_client_unittest.cc', 'common/net/gaia/google_service_auth_error_unittest.cc', 'common/net/url_fetcher_unittest.cc', - 'common/render_messages_unittest.cc', 'common/service_process_util_unittest.cc', 'common/switch_utils_unittest.cc', 'common/thumbnail_score_unittest.cc', diff --git a/chrome/common/autofill_messages.h b/chrome/common/autofill_messages.h index c893aaa..519c4929 100644 --- a/chrome/common/autofill_messages.h +++ b/chrome/common/autofill_messages.h @@ -6,7 +6,6 @@ #include <string> -#include "chrome/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #include "webkit/glue/form_data.h" #include "webkit/glue/form_field.h" diff --git a/chrome/common/automation_messages.cc b/chrome/common/automation_messages.cc index 20ba20b..12736eb 100644 --- a/chrome/common/automation_messages.cc +++ b/chrome/common/automation_messages.cc @@ -677,4 +677,21 @@ void ParamTraits<AttachExternalTabParams>::Log(const param_type& p, l->append(")"); } +// The traits for these are defined in render_messages.h +template <> +struct ParamTraits<ContentSetting> { + typedef ContentSetting param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<ContentSettingsType> { + typedef ContentSettingsType param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + } // namespace IPC diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h index 2ae5214..663012b 100644 --- a/chrome/common/automation_messages.h +++ b/chrome/common/automation_messages.h @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "chrome/common/automation_constants.h" -#include "chrome/common/common_param_traits.h" +#include "chrome/common/content_settings.h" #include "chrome/common/security_style.h" #include "content/common/common_param_traits.h" #include "content/common/page_type.h" diff --git a/chrome/common/common_message_generator.cc b/chrome/common/common_message_generator.cc index 6b822ec..72e755e 100644 --- a/chrome/common/common_message_generator.cc +++ b/chrome/common/common_message_generator.cc @@ -5,7 +5,6 @@ // Get basic type definitions. #define IPC_MESSAGE_IMPL #include "chrome/common/common_message_generator.h" -#include "chrome/common/common_param_traits.h" // Generate constructors. #include "ipc/struct_constructor_macros.h" diff --git a/chrome/common/common_message_generator.h b/chrome/common/common_message_generator.h index 9eb5014..6c7083e 100644 --- a/chrome/common/common_message_generator.h +++ b/chrome/common/common_message_generator.h @@ -5,6 +5,8 @@ // Multiply-included file, hence no include guard. #include "chrome/common/autofill_messages.h" +#include "chrome/common/devtools_messages.h" +#include "chrome/common/render_messages.h" #include "chrome/common/safebrowsing_messages.h" #include "chrome/common/service_messages.h" #include "chrome/common/utility_messages.h" diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc deleted file mode 100644 index 415ff73..0000000 --- a/chrome/common/common_param_traits.cc +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/common_param_traits.h" - -#include "base/time.h" -#include "chrome/common/chrome_constants.h" -#include "chrome/common/content_settings.h" -#include "chrome/common/thumbnail_score.h" -#include "chrome/common/web_apps.h" -#include "content/common/common_param_traits.h" -#include "googleurl/src/gurl.h" -#include "printing/backend/print_backend.h" -#include "printing/native_metafile.h" -#include "printing/page_range.h" - -namespace IPC { - -void ParamTraits<ContentSetting>::Write(Message* m, const param_type& p) { - WriteParam(m, static_cast<int>(p)); -} - -bool ParamTraits<ContentSetting>::Read(const Message* m, void** iter, - param_type* r) { - int value; - if (!ReadParam(m, iter, &value)) - return false; - if (value < 0 || value >= static_cast<int>(CONTENT_SETTING_NUM_SETTINGS)) - return false; - *r = static_cast<param_type>(value); - return true; -} - -void ParamTraits<ContentSetting>::Log(const param_type& p, std::string* l) { - LogParam(static_cast<int>(p), l); -} - -void ParamTraits<ContentSettings>::Write( - Message* m, const ContentSettings& settings) { - for (size_t i = 0; i < arraysize(settings.settings); ++i) - WriteParam(m, settings.settings[i]); -} - -bool ParamTraits<ContentSettings>::Read( - const Message* m, void** iter, ContentSettings* r) { - for (size_t i = 0; i < arraysize(r->settings); ++i) { - if (!ReadParam(m, iter, &r->settings[i])) - return false; - } - return true; -} - -void ParamTraits<ContentSettings>::Log( - const ContentSettings& p, std::string* l) { - l->append("<ContentSettings>"); -} - -void ParamTraits<WebApplicationInfo>::Write(Message* m, - const WebApplicationInfo& p) { - WriteParam(m, p.title); - WriteParam(m, p.description); - WriteParam(m, p.app_url); - WriteParam(m, p.launch_container); - WriteParam(m, p.icons.size()); - WriteParam(m, p.permissions.size()); - - for (size_t i = 0; i < p.icons.size(); ++i) { - WriteParam(m, p.icons[i].url); - WriteParam(m, p.icons[i].width); - WriteParam(m, p.icons[i].height); - WriteParam(m, p.icons[i].data); - } - - for (size_t i = 0; i < p.permissions.size(); ++i) - WriteParam(m, p.permissions[i]); -} - -bool ParamTraits<WebApplicationInfo>::Read( - const Message* m, void** iter, WebApplicationInfo* r) { - size_t icon_count = 0; - size_t permissions_count = 0; - - bool result = - ReadParam(m, iter, &r->title) && - ReadParam(m, iter, &r->description) && - ReadParam(m, iter, &r->app_url) && - ReadParam(m, iter, &r->launch_container) && - ReadParam(m, iter, &icon_count) && - ReadParam(m, iter, &permissions_count); - if (!result) - return false; - - for (size_t i = 0; i < icon_count; ++i) { - param_type::IconInfo icon_info; - result = - ReadParam(m, iter, &icon_info.url) && - ReadParam(m, iter, &icon_info.width) && - ReadParam(m, iter, &icon_info.height) && - ReadParam(m, iter, &icon_info.data); - if (!result) - return false; - r->icons.push_back(icon_info); - } - - for (size_t i = 0; i < permissions_count; ++i) { - std::string permission; - if (!ReadParam(m, iter, &permission)) - return false; - r->permissions.push_back(permission); - } - - return true; -} - -void ParamTraits<WebApplicationInfo>::Log(const WebApplicationInfo& p, - std::string* l) { - l->append("<WebApplicationInfo>"); -} - -void ParamTraits<ThumbnailScore>::Write(Message* m, const param_type& p) { - IPC::ParamTraits<double>::Write(m, p.boring_score); - IPC::ParamTraits<bool>::Write(m, p.good_clipping); - IPC::ParamTraits<bool>::Write(m, p.at_top); - IPC::ParamTraits<base::Time>::Write(m, p.time_at_snapshot); -} - -bool ParamTraits<ThumbnailScore>::Read(const Message* m, void** iter, - param_type* r) { - double boring_score; - bool good_clipping, at_top; - base::Time time_at_snapshot; - if (!IPC::ParamTraits<double>::Read(m, iter, &boring_score) || - !IPC::ParamTraits<bool>::Read(m, iter, &good_clipping) || - !IPC::ParamTraits<bool>::Read(m, iter, &at_top) || - !IPC::ParamTraits<base::Time>::Read(m, iter, &time_at_snapshot)) - return false; - - r->boring_score = boring_score; - r->good_clipping = good_clipping; - r->at_top = at_top; - r->time_at_snapshot = time_at_snapshot; - return true; -} - -void ParamTraits<ThumbnailScore>::Log(const param_type& p, std::string* l) { - l->append(base::StringPrintf("(%f, %d, %d)", - p.boring_score, p.good_clipping, p.at_top)); -} - -void ParamTraits<printing::PageRange>::Write(Message* m, const param_type& p) { - WriteParam(m, p.from); - WriteParam(m, p.to); -} - -bool ParamTraits<printing::PageRange>::Read( - const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->from) && - ReadParam(m, iter, &p->to); -} - -void ParamTraits<printing::PageRange>::Log( - const param_type& p, std::string* l) { - l->append("("); - LogParam(p.to, l); - l->append(", "); - LogParam(p.from, l); - l->append(")"); -} - -void ParamTraits<printing::NativeMetafile>::Write( - Message* m, const param_type& p) { - std::vector<uint8> buffer; - uint32 size = p.GetDataSize(); - if (size) { - buffer.resize(size); - p.GetData(&buffer.front(), size); - } - WriteParam(m, buffer); -} - -bool ParamTraits<printing::NativeMetafile>::Read( - const Message* m, void** iter, param_type* p) { - std::vector<uint8> buffer; - return ReadParam(m, iter, &buffer) && - p->InitFromData(&buffer.front(), static_cast<uint32>(buffer.size())); -} - -void ParamTraits<printing::NativeMetafile>::Log( - const param_type& p, std::string* l) { - l->append("<printing::NativeMetafile>"); -} - -void ParamTraits<printing::PrinterCapsAndDefaults>::Write( - Message* m, const param_type& p) { - WriteParam(m, p.printer_capabilities); - WriteParam(m, p.caps_mime_type); - WriteParam(m, p.printer_defaults); - WriteParam(m, p.defaults_mime_type); -} - -bool ParamTraits<printing::PrinterCapsAndDefaults>::Read( - const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->printer_capabilities) && - ReadParam(m, iter, &p->caps_mime_type) && - ReadParam(m, iter, &p->printer_defaults) && - ReadParam(m, iter, &p->defaults_mime_type); -} - -void ParamTraits<printing::PrinterCapsAndDefaults>::Log( - const param_type& p, std::string* l) { - l->append("("); - LogParam(p.printer_capabilities, l); - l->append(","); - LogParam(p.caps_mime_type, l); - l->append(","); - LogParam(p.printer_defaults, l); - l->append(","); - LogParam(p.defaults_mime_type, l); - l->append(")"); -} - -} // namespace IPC diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h deleted file mode 100644 index 1468a52..0000000 --- a/chrome/common/common_param_traits.h +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file is used to define IPC::ParamTraits<> specializations for a number -// of types so that they can be serialized over IPC. IPC::ParamTraits<> -// specializations for basic types (like int and std::string) and types in the -// 'base' project can be found in ipc/ipc_message_utils.h. This file contains -// specializations for types that are shared by more than one child process. - -#ifndef CHROME_COMMON_COMMON_PARAM_TRAITS_H_ -#define CHROME_COMMON_COMMON_PARAM_TRAITS_H_ -#pragma once - -#include "base/file_util.h" -#include "base/ref_counted.h" -#include "chrome/common/content_settings.h" -#include "ipc/ipc_message_utils.h" -#include "printing/native_metafile.h" - -// Forward declarations. -class DictionaryValue; -class ListValue; -struct ThumbnailScore; -struct WebApplicationInfo; - -namespace printing { -struct PageRange; -struct PrinterCapsAndDefaults; -} // namespace printing - -namespace IPC { - -template <> -struct ParamTraits<ContentSetting> { - typedef ContentSetting param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<ContentSettingsType> { - typedef ContentSettingsType param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, static_cast<int>(p)); - } - static bool Read(const Message* m, void** iter, param_type* r) { - int value; - if (!ReadParam(m, iter, &value)) - return false; - if (value < 0 || value >= static_cast<int>(CONTENT_SETTINGS_NUM_TYPES)) - return false; - *r = static_cast<param_type>(value); - return true; - } - static void Log(const param_type& p, std::string* l) { - LogParam(static_cast<int>(p), l); - } -}; - -template <> -struct ParamTraits<ContentSettings> { - typedef ContentSettings param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<WebApplicationInfo> { - typedef WebApplicationInfo param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template<> -struct ParamTraits<ThumbnailScore> { - typedef ThumbnailScore param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<printing::PageRange> { - typedef printing::PageRange param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<printing::NativeMetafile> { - typedef printing::NativeMetafile param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<printing::PrinterCapsAndDefaults> { - typedef printing::PrinterCapsAndDefaults param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -} // namespace IPC - -#endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ diff --git a/chrome/common/common_param_traits_unittest.cc b/chrome/common/common_param_traits_unittest.cc index f62bb6f..b6b3ca4 100644 --- a/chrome/common/common_param_traits_unittest.cc +++ b/chrome/common/common_param_traits_unittest.cc @@ -7,7 +7,6 @@ #include "base/scoped_ptr.h" #include "base/values.h" -#include "chrome/common/common_param_traits.h" #include "content/common/common_param_traits.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message.h" @@ -177,84 +176,6 @@ TEST(IPCMessageTest, DictionaryValue) { EXPECT_FALSE(IPC::ReadParam(&bad_msg, &iter, &output)); } -// Tests printing::PageRange serialization -TEST(IPCMessageTest, PageRange) { - printing::PageRange input; - input.from = 2; - input.to = 45; - IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); - IPC::ParamTraits<printing::PageRange>::Write(&msg, input); - - printing::PageRange output; - void* iter = NULL; - EXPECT_TRUE(IPC::ParamTraits<printing::PageRange>::Read( - &msg, &iter, &output)); - EXPECT_TRUE(input == output); -} - -// Tests printing::Emf serialization. -// TODO(sanjeevr): Make this test meaningful for non-Windows platforms. We -// need to initialize the metafile using alternate means on the other OSes. -#if defined(OS_WIN) -TEST(IPCMessageTest, Metafile) { - scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::Create()); - RECT test_rect = {0, 0, 100, 100}; - // Create a metafile using the screen DC as a reference. - metafile->Init(); - metafile->FinishDocument(); - - IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); - IPC::ParamTraits<printing::NativeMetafile>::Write(&msg, *metafile); - - scoped_ptr<printing::NativeMetafile> output( - printing::NativeMetafileFactory::Create()); - void* iter = NULL; - EXPECT_TRUE(IPC::ParamTraits<printing::NativeMetafile>::Read( - &msg, &iter, output.get())); - - EXPECT_EQ(metafile->GetDataSize(), output->GetDataSize()); - EXPECT_EQ(metafile->GetPageBounds(1), output->GetPageBounds(1)); - EXPECT_EQ(::GetDeviceCaps(metafile->context(), LOGPIXELSX), - ::GetDeviceCaps(output->context(), LOGPIXELSX)); - - // Also test the corrupt case. - IPC::Message bad_msg(1, 2, IPC::Message::PRIORITY_NORMAL); - // Write some bogus metafile data. - const size_t bogus_data_size = metafile->GetDataSize() * 2; - scoped_array<char> bogus_data(new char[bogus_data_size]); - memset(bogus_data.get(), 'B', bogus_data_size); - bad_msg.WriteData(bogus_data.get(), bogus_data_size); - // Make sure we don't read out the metafile! - scoped_ptr<printing::NativeMetafile> bad_output( - printing::NativeMetafileFactory::Create()); - iter = NULL; - EXPECT_FALSE(IPC::ParamTraits<printing::NativeMetafile>::Read( - &bad_msg, &iter, bad_output.get())); -} -#endif // defined(OS_WIN) - -// Tests printing::PrinterCapsAndDefaults serialization -TEST(IPCMessageTest, PrinterCapsAndDefaults) { - printing::PrinterCapsAndDefaults input; - input.printer_capabilities = "Test Capabilities"; - input.caps_mime_type = "text/plain"; - input.printer_defaults = "Test Defaults"; - input.defaults_mime_type = "text/plain"; - - IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); - IPC::ParamTraits<printing::PrinterCapsAndDefaults>::Write(&msg, input); - - printing::PrinterCapsAndDefaults output; - void* iter = NULL; - EXPECT_TRUE(IPC::ParamTraits<printing::PrinterCapsAndDefaults>::Read( - &msg, &iter, &output)); - EXPECT_TRUE(input.printer_capabilities == output.printer_capabilities); - EXPECT_TRUE(input.caps_mime_type == output.caps_mime_type); - EXPECT_TRUE(input.printer_defaults == output.printer_defaults); - EXPECT_TRUE(input.defaults_mime_type == output.defaults_mime_type); -} - // Tests net::HostPortPair serialization TEST(IPCMessageTest, HostPortPair) { net::HostPortPair input("host.com", 12345); diff --git a/chrome/common/devtools_messages.cc b/chrome/common/devtools_messages.cc deleted file mode 100644 index 31fc122..0000000 --- a/chrome/common/devtools_messages.cc +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Get basic type definitions. -#define IPC_MESSAGE_IMPL -#include "chrome/common/devtools_messages.h" -#include "chrome/common/common_param_traits.h" - -// Generate constructors. -#include "ipc/struct_constructor_macros.h" -#include "chrome/common/devtools_messages.h" - -// Generate destructors. -#include "ipc/struct_destructor_macros.h" -#include "chrome/common/devtools_messages.h" - -// Generate param traits write methods. -#include "ipc/param_traits_write_macros.h" -namespace IPC { -#include "chrome/common/devtools_messages.h" -} // namespace IPC - -// Generate param traits read methods. -#include "ipc/param_traits_read_macros.h" -namespace IPC { -#include "chrome/common/devtools_messages.h" -} // namespace IPC - -// Generate param traits log methods. -#include "ipc/param_traits_log_macros.h" -namespace IPC { -#include "chrome/common/devtools_messages.h" -} // namespace IPC - diff --git a/chrome/common/devtools_messages.h b/chrome/common/devtools_messages.h index 79eba01..04c98ca 100644 --- a/chrome/common/devtools_messages.h +++ b/chrome/common/devtools_messages.h @@ -44,7 +44,7 @@ #include "ipc/ipc_message_macros.h" -// Singly-included section not yet converted. +// Singly-included section. #ifndef CHROME_COMMON_DEVTOOLS_MESSAGES_H_ #define CHROME_COMMON_DEVTOOLS_MESSAGES_H_ @@ -100,4 +100,3 @@ IPC_MESSAGE_CONTROL2(DevToolsAgentMsg_InspectElement, // Enables/disables the apu agent. IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_SetApuAgentEnabled, bool /* enabled */) - diff --git a/chrome/common/nacl_messages.cc b/chrome/common/nacl_messages.cc index f1be9ae..66e4df2 100644 --- a/chrome/common/nacl_messages.cc +++ b/chrome/common/nacl_messages.cc @@ -5,7 +5,6 @@ // Get basic type definitions. #define IPC_MESSAGE_IMPL #include "chrome/common/nacl_messages.h" -#include "chrome/common/common_param_traits.h" // Generate constructors. #include "ipc/struct_constructor_macros.h" diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index 8076ea8..051e63f 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -2,38 +2,29 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Get basic type definitions. -#define IPC_MESSAGE_IMPL #include "chrome/common/render_messages.h" -#include "chrome/common/common_param_traits.h" -// Generate constructors. -#include "ipc/struct_constructor_macros.h" -#include "chrome/common/render_messages.h" - -// Generate destructors. -#include "ipc/struct_destructor_macros.h" -#include "chrome/common/render_messages.h" - -// Generate param traits write methods. -#include "ipc/param_traits_write_macros.h" namespace IPC { -#include "chrome/common/render_messages.h" -} // namespace IPC -// Generate param traits read methods. -#include "ipc/param_traits_read_macros.h" -namespace IPC { -#include "chrome/common/render_messages.h" -} // namespace IPC +void ParamTraits<ContentSettings>::Write( + Message* m, const ContentSettings& settings) { + for (size_t i = 0; i < arraysize(settings.settings); ++i) + WriteParam(m, settings.settings[i]); +} -// Generate param traits log methods. -#include "ipc/param_traits_log_macros.h" -namespace IPC { -#include "chrome/common/render_messages.h" -} // namespace IPC +bool ParamTraits<ContentSettings>::Read( + const Message* m, void** iter, ContentSettings* r) { + for (size_t i = 0; i < arraysize(r->settings); ++i) { + if (!ReadParam(m, iter, &r->settings[i])) + return false; + } + return true; +} -namespace IPC { +void ParamTraits<ContentSettings>::Log( + const ContentSettings& p, std::string* l) { + l->append("<ContentSettings>"); +} void ParamTraits<URLPattern>::Write(Message* m, const param_type& p) { WriteParam(m, p.valid_schemes()); @@ -77,67 +68,4 @@ void ParamTraits<ExtensionExtent>::Log(const param_type& p, std::string* l) { LogParam(p.patterns(), l); } -void ParamTraits<webkit_glue::WebAccessibility>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.id); - WriteParam(m, p.name); - WriteParam(m, p.value); - WriteParam(m, static_cast<int>(p.role)); - WriteParam(m, static_cast<int>(p.state)); - WriteParam(m, p.location); - WriteParam(m, p.attributes); - WriteParam(m, p.children); - WriteParam(m, p.indirect_child_ids); - WriteParam(m, p.html_attributes); -} - -bool ParamTraits<webkit_glue::WebAccessibility>::Read( - const Message* m, void** iter, param_type* p) { - bool ret = ReadParam(m, iter, &p->id); - ret = ret && ReadParam(m, iter, &p->name); - ret = ret && ReadParam(m, iter, &p->value); - int role = -1; - ret = ret && ReadParam(m, iter, &role); - if (role >= webkit_glue::WebAccessibility::ROLE_NONE && - role < webkit_glue::WebAccessibility::NUM_ROLES) { - p->role = static_cast<webkit_glue::WebAccessibility::Role>(role); - } else { - p->role = webkit_glue::WebAccessibility::ROLE_NONE; - } - int state = 0; - ret = ret && ReadParam(m, iter, &state); - p->state = static_cast<webkit_glue::WebAccessibility::State>(state); - ret = ret && ReadParam(m, iter, &p->location); - ret = ret && ReadParam(m, iter, &p->attributes); - ret = ret && ReadParam(m, iter, &p->children); - ret = ret && ReadParam(m, iter, &p->indirect_child_ids); - ret = ret && ReadParam(m, iter, &p->html_attributes); - return ret; -} - -void ParamTraits<webkit_glue::WebAccessibility>::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.id, l); - l->append(", "); - LogParam(p.name, l); - l->append(", "); - LogParam(p.value, l); - l->append(", "); - LogParam(static_cast<int>(p.role), l); - l->append(", "); - LogParam(static_cast<int>(p.state), l); - l->append(", "); - LogParam(p.location, l); - l->append(", "); - LogParam(p.attributes, l); - l->append(", "); - LogParam(p.children, l); - l->append(", "); - LogParam(p.html_attributes, l); - l->append(", "); - LogParam(p.indirect_child_ids, l); - l->append(")"); -} - } // namespace IPC diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 924b7cf..8b7ec51 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -21,7 +21,6 @@ #include "base/sync_socket.h" #include "base/values.h" #include "build/build_config.h" -#include "chrome/common/common_param_traits.h" #include "chrome/common/content_settings.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_extent.h" @@ -33,22 +32,24 @@ #include "chrome/common/translate_errors.h" #include "chrome/common/view_types.h" #include "chrome/common/web_apps.h" -#include "chrome/common/webkit_param_traits.h" #include "content/common/common_param_traits.h" #include "content/common/css_colors.h" #include "content/common/notification_type.h" #include "content/common/page_transition_types.h" #include "content/common/page_zoom.h" #include "content/common/resource_response.h" +#include "chrome/common/web_apps.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" -#include "ipc/ipc_platform_file.h" // ifdefed typedef. +#include "ipc/ipc_platform_file.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/rect.h" -#include "webkit/glue/webaccessibility.h" #include "webkit/glue/webcursor.h" #if defined(OS_POSIX) @@ -116,11 +117,13 @@ struct ParamTraits<gfx::NativeView> { #endif // defined(OS_POSIX) template <> -struct SimilarTypeTraits<ViewType::Type> { - typedef int Type; +struct ParamTraits<ContentSettings> { + typedef ContentSettings param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); }; -// Traits for URLPattern. template <> struct ParamTraits<URLPattern> { typedef URLPattern param_type; @@ -130,16 +133,6 @@ struct ParamTraits<URLPattern> { }; template <> -struct SimilarTypeTraits<TranslateErrors::Type> { - typedef int Type; -}; - -template <> -struct SimilarTypeTraits<InstantCompleteBehavior> { - typedef int Type; -}; - -template <> struct ParamTraits<ExtensionExtent> { typedef ExtensionExtent param_type; static void Write(Message* m, const param_type& p); @@ -147,20 +140,72 @@ struct ParamTraits<ExtensionExtent> { static void Log(const param_type& p, std::string* l); }; -template <> -struct ParamTraits<webkit_glue::WebAccessibility> { - typedef webkit_glue::WebAccessibility param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - } // namespace IPC #endif // CHROME_COMMON_RENDER_MESSAGES_H_ #define IPC_MESSAGE_START ChromeMsgStart +IPC_ENUM_TRAITS(ContentSetting) +IPC_ENUM_TRAITS(ContentSettingsType) +IPC_ENUM_TRAITS(InstantCompleteBehavior) +IPC_ENUM_TRAITS(TranslateErrors::Type) +IPC_ENUM_TRAITS(ViewType::Type) +IPC_ENUM_TRAITS(WebKit::WebConsoleMessage::Level) +IPC_ENUM_TRAITS(WebKit::WebTextCheckingResult::Error) + +IPC_STRUCT_TRAITS_BEGIN(ThumbnailScore) + IPC_STRUCT_TRAITS_MEMBER(boring_score) + IPC_STRUCT_TRAITS_MEMBER(good_clipping) + IPC_STRUCT_TRAITS_MEMBER(at_top) + IPC_STRUCT_TRAITS_MEMBER(time_at_snapshot) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(WebApplicationInfo::IconInfo) + IPC_STRUCT_TRAITS_MEMBER(url) + IPC_STRUCT_TRAITS_MEMBER(width) + IPC_STRUCT_TRAITS_MEMBER(height) + IPC_STRUCT_TRAITS_MEMBER(data) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(WebApplicationInfo) + IPC_STRUCT_TRAITS_MEMBER(title) + IPC_STRUCT_TRAITS_MEMBER(description) + IPC_STRUCT_TRAITS_MEMBER(app_url) + IPC_STRUCT_TRAITS_MEMBER(icons) + IPC_STRUCT_TRAITS_MEMBER(permissions) + IPC_STRUCT_TRAITS_MEMBER(launch_container) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(WebKit::WebCache::ResourceTypeStat) + IPC_STRUCT_TRAITS_MEMBER(count) + IPC_STRUCT_TRAITS_MEMBER(size) + IPC_STRUCT_TRAITS_MEMBER(liveSize) + IPC_STRUCT_TRAITS_MEMBER(decodedSize) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(WebKit::WebCache::ResourceTypeStats) + IPC_STRUCT_TRAITS_MEMBER(images) + IPC_STRUCT_TRAITS_MEMBER(cssStyleSheets) + IPC_STRUCT_TRAITS_MEMBER(scripts) + IPC_STRUCT_TRAITS_MEMBER(xslStyleSheets) + IPC_STRUCT_TRAITS_MEMBER(fonts) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(WebKit::WebCache::UsageStats) + IPC_STRUCT_TRAITS_MEMBER(minDeadCapacity) + IPC_STRUCT_TRAITS_MEMBER(maxDeadCapacity) + IPC_STRUCT_TRAITS_MEMBER(capacity) + IPC_STRUCT_TRAITS_MEMBER(liveSize) + IPC_STRUCT_TRAITS_MEMBER(deadSize) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(WebKit::WebTextCheckingResult) + IPC_STRUCT_TRAITS_MEMBER(error) + IPC_STRUCT_TRAITS_MEMBER(position) + IPC_STRUCT_TRAITS_MEMBER(length) +IPC_STRUCT_TRAITS_END() + //----------------------------------------------------------------------------- // RenderView messages // These are messages sent from the browser to the renderer process. @@ -472,35 +517,6 @@ IPC_MESSAGE_ROUTED1(ViewMsg_RevertTranslation, IPC_MESSAGE_CONTROL1(ViewMsg_SetIsIncognitoProcess, bool /* is_incognito_processs */) -// Enable accessibility in the renderer process. -IPC_MESSAGE_ROUTED0(ViewMsg_EnableAccessibility) - -// Relay a request from assistive technology to set focus to a given node. -IPC_MESSAGE_ROUTED1(ViewMsg_SetAccessibilityFocus, - int /* object id */) - -// Relay a request from assistive technology to perform the default action -// on a given node. -IPC_MESSAGE_ROUTED1(ViewMsg_AccessibilityDoDefaultAction, - int /* object id */) - -// Tells the render view that a ViewHostMsg_AccessibilityNotifications -// message was processed and it can send addition notifications. -IPC_MESSAGE_ROUTED0(ViewMsg_AccessibilityNotifications_ACK) - -// A classification model for client-side phishing detection. -// The given file contains an encoded safe_browsing::ClientSideModel -// protocol buffer. -IPC_MESSAGE_CONTROL1(ViewMsg_SetPhishingModel, - IPC::PlatformFileForTransit /* model_file */) - -// Request a DOM tree when a malware interstitial is shown. -IPC_MESSAGE_ROUTED0(ViewMsg_GetMalwareDOMDetails) - -// Tells the renderer to begin phishing detection for the given toplevel URL -// which it has started loading. -IPC_MESSAGE_ROUTED1(ViewMsg_StartPhishingDetection, GURL) - //----------------------------------------------------------------------------- // TabContents messages // These are messages sent from the renderer to the browser process. @@ -533,6 +549,27 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowSpellingPanel, IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateSpellingPanelWithMisspelledWord, string16 /* the word to update the panel with */) +// The renderer has tried to spell check a word, but couldn't because no +// dictionary was available to load. Request that the browser find an +// appropriate dictionary and return it. +IPC_MESSAGE_CONTROL0(ViewHostMsg_SpellChecker_RequestDictionary) + +IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_SpellChecker_PlatformCheckSpelling, + string16 /* word */, + int /* document tag */, + bool /* correct */) + +IPC_SYNC_MESSAGE_CONTROL1_1( + ViewHostMsg_SpellChecker_PlatformFillSuggestionList, + string16 /* word */, + std::vector<string16> /* suggestions */) + +IPC_MESSAGE_CONTROL4(ViewHostMsg_SpellChecker_PlatformRequestTextCheck, + int /* route_id for response */, + int /* request identifier given by WebKit */, + int /* document tag */, + string16 /* sentence */) + // Tells the browser that content in the current page was blocked due to the // user's content settings. IPC_MESSAGE_ROUTED2(ViewHostMsg_ContentBlocked, @@ -601,14 +638,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1( GURL /* inquiry url */, ViewHostMsg_GetSearchProviderInstallState_Params /* install */) -// Required for updating text input state. -IPC_MESSAGE_ROUTED2(ViewHostMsg_ImeUpdateTextInputState, - WebKit::WebTextInputType, /* text_input_type */ - gfx::Rect /* caret_rect */) - -// Required for cancelling an ongoing input method composition. -IPC_MESSAGE_ROUTED0(ViewHostMsg_ImeCancelComposition) - // Tells the browser that the renderer is done calculating the number of // rendered pages according to the specified settings. IPC_MESSAGE_ROUTED2(ViewHostMsg_DidGetPrintedPagesCount, @@ -641,12 +670,21 @@ IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_ScriptedPrint, ViewMsg_PrintPages_Params /* settings chosen by the user*/) -// WebKit and JavaScript error messages to log to the console -// or debugger UI. -IPC_MESSAGE_ROUTED3(ViewHostMsg_AddMessageToConsole, - std::wstring, /* msg */ - int32, /* line number */ - std::wstring /* source id */) +#if defined(USE_X11) +// Asks the browser to create a temporary file for the renderer to fill +// in resulting NativeMetafile in printing. +IPC_SYNC_MESSAGE_CONTROL0_2(ViewHostMsg_AllocateTempFileForPrinting, + base::FileDescriptor /* temp file fd */, + int /* fd in browser*/) +IPC_MESSAGE_CONTROL1(ViewHostMsg_TempFileForPrintingWritten, + int /* fd in browser */) +#endif + +// Asks the browser to do print preview for the node under the context menu. +IPC_MESSAGE_ROUTED0(ViewHostMsg_PrintPreviewNodeUnderContextMenu) + +// Asks the browser to do print preview for window.print(). +IPC_MESSAGE_ROUTED0(ViewHostMsg_ScriptInitiatedPrintPreview) // Stores new inspector setting in the profile. IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateInspectorSetting, @@ -711,11 +749,6 @@ IPC_MESSAGE_CONTROL1(ViewHostMsg_DnsPrefetch, IPC_MESSAGE_ROUTED1(ViewHostMsg_MissingPluginStatus, int /* status */) -// Sent by the renderer process to indicate that a plugin instance has -// crashed. -IPC_MESSAGE_ROUTED1(ViewHostMsg_CrashedPlugin, - FilePath /* plugin_path */) - // Notifies when a plugin couldn't be loaded because it's outdated. IPC_MESSAGE_ROUTED2(ViewHostMsg_BlockedOutdatedPlugin, string16, /* name */ @@ -724,15 +757,6 @@ IPC_MESSAGE_ROUTED2(ViewHostMsg_BlockedOutdatedPlugin, // Displays a JavaScript out-of-memory message in the infobar. IPC_MESSAGE_ROUTED0(ViewHostMsg_JSOutOfMemory) -// Displays a box to confirm that the user wants to navigate away from the -// page. Replies true if yes, false otherwise, the reply string is ignored, -// but is included so that we can use OnJavaScriptMessageBoxClosed. -IPC_SYNC_MESSAGE_ROUTED2_2(ViewHostMsg_RunBeforeUnloadConfirm, - GURL, /* in - originating frame URL */ - std::wstring /* in - alert message */, - bool /* out - success */, - std::wstring /* out - This is ignored.*/) - IPC_MESSAGE_ROUTED3(ViewHostMsg_SendCurrentPageAllSavableResourceLinks, std::vector<GURL> /* all savable resource links */, std::vector<GURL> /* all referrers of resource links */, @@ -757,69 +781,11 @@ IPC_MESSAGE_ROUTED4(ViewHostMsg_DidDownloadFavicon, bool /* true if there was a network error */, SkBitmap /* image_data */) -// Sent when the renderer process is done processing a DataReceived -// message. -IPC_MESSAGE_ROUTED1(ViewHostMsg_DataReceived_ACK, - int /* request_id */) - -IPC_MESSAGE_CONTROL1(ViewHostMsg_RevealFolderInOS, - FilePath /* path */) - -// Sent when a provisional load on the main frame redirects. -IPC_MESSAGE_ROUTED3(ViewHostMsg_DidRedirectProvisionalLoad, - int /* page_id */, - GURL /* last url */, - GURL /* url redirected to */) - -// Sent when the renderer changes the zoom level for a particular url, so the -// browser can update its records. If remember is true, then url is used to -// update the zoom level for all pages in that site. Otherwise, the render -// view's id is used so that only the menu is updated. -IPC_MESSAGE_ROUTED3(ViewHostMsg_DidZoomURL, - double /* zoom_level */, - bool /* remember */, - GURL /* url */) - -#if defined(OS_WIN) -// Duplicates a shared memory handle from the renderer to the browser. Then -// the renderer can flush the handle. -IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_DuplicateSection, - base::SharedMemoryHandle /* renderer handle */, - base::SharedMemoryHandle /* browser handle */) -#endif - -#if defined(USE_X11) -// Asks the browser to create a temporary file for the renderer to fill -// in resulting NativeMetafile in printing. -IPC_SYNC_MESSAGE_CONTROL0_2(ViewHostMsg_AllocateTempFileForPrinting, - base::FileDescriptor /* temp file fd */, - int /* fd in browser*/) -IPC_MESSAGE_CONTROL1(ViewHostMsg_TempFileForPrintingWritten, - int /* fd in browser */) -#endif - -// Asks the browser to do print preview for the node under the context menu. -IPC_MESSAGE_ROUTED0(ViewHostMsg_PrintPreviewNodeUnderContextMenu) - -// Asks the browser to do print preview for window.print(). -IPC_MESSAGE_ROUTED0(ViewHostMsg_ScriptInitiatedPrintPreview) - -// Asks the browser to create a block of shared memory for the renderer to -// fill in and pass back to the browser. -IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_AllocateSharedMemoryBuffer, - uint32 /* buffer size */, - base::SharedMemoryHandle /* browser handle */) - // Provide the browser process with information about the WebCore resource // cache. IPC_MESSAGE_CONTROL1(ViewHostMsg_ResourceTypeStats, WebKit::WebCache::ResourceTypeStats) -// Notify the browser that this render process can or can't be suddenly -// terminated. -IPC_MESSAGE_CONTROL1(ViewHostMsg_SuddenTerminationChanged, - bool /* enabled */) - // A renderer sends this message when an extension process starts an API // request. The browser will always respond with a ViewMsg_ExtensionResponse. IPC_MESSAGE_ROUTED1(ViewHostMsg_ExtensionRequest, @@ -844,88 +810,6 @@ IPC_MESSAGE_ROUTED3(ViewHostMsg_CommandStateChanged, bool /* is_enabled */, int /* checked_state */) -#if defined(OS_MACOSX) -// On OSX, we cannot allocated shared memory from within the sandbox, so -// this call exists for the renderer to ask the browser to allocate memory -// on its behalf. We return a file descriptor to the POSIX shared memory. -// If the |cache_in_browser| flag is |true|, then a copy of the shmem is kept -// by the browser, and it is the caller's repsonsibility to send a -// ViewHostMsg_FreeTransportDIB message in order to release the cached shmem. -// In all cases, the caller is responsible for deleting the resulting -// TransportDIB. -IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_AllocTransportDIB, - size_t, /* bytes requested */ - bool, /* cache in the browser */ - TransportDIB::Handle /* DIB */) - -// Since the browser keeps handles to the allocated transport DIBs, this -// message is sent to tell the browser that it may release them when the -// renderer is finished with them. -IPC_MESSAGE_CONTROL1(ViewHostMsg_FreeTransportDIB, - TransportDIB::Id /* DIB id */) - -// Informs the browser that a plugin has gained or lost focus. -IPC_MESSAGE_ROUTED2(ViewHostMsg_PluginFocusChanged, - bool, /* focused */ - int /* plugin_id */) - -// Instructs the browser to start plugin IME. -IPC_MESSAGE_ROUTED0(ViewHostMsg_StartPluginIme) - -//--------------------------------------------------------------------------- -// Messages related to accelerated plugins - -// This is sent from the renderer to the browser to allocate a fake -// PluginWindowHandle on the browser side which is used to identify -// the plugin to the browser later when backing store is allocated -// or reallocated. |opaque| indicates whether the plugin's output is -// considered to be opaque, as opposed to translucent. This message -// is reused for rendering the accelerated compositor's output. -// |root| indicates whether the output is supposed to cover the -// entire window. -IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_AllocateFakePluginWindowHandle, - bool /* opaque */, - bool /* root */, - gfx::PluginWindowHandle /* id */) - -// Destroys a fake window handle previously allocated using -// AllocateFakePluginWindowHandle. -IPC_MESSAGE_ROUTED1(ViewHostMsg_DestroyFakePluginWindowHandle, - gfx::PluginWindowHandle /* id */) - -// This message, used on Mac OS X 10.5 and earlier (no IOSurface support), -// is sent from the renderer to the browser on behalf of the plug-in -// to indicate that a new backing store was allocated for that plug-in -// instance. -IPC_MESSAGE_ROUTED4(ViewHostMsg_AcceleratedSurfaceSetTransportDIB, - gfx::PluginWindowHandle /* window */, - int32 /* width */, - int32 /* height */, - TransportDIB::Handle /* handle for the DIB */) - -// This message, used on Mac OS X 10.6 and later (where IOSurface is -// supported), is sent from the renderer to the browser on behalf of the -// plug-in to indicate that a new backing store was allocated for that -// plug-in instance. -// -// NOTE: the original intent was to pass a mach port as the IOSurface -// identifier but it looks like that will be a lot of work. For now we pass an -// ID from IOSurfaceGetID. -IPC_MESSAGE_ROUTED4(ViewHostMsg_AcceleratedSurfaceSetIOSurface, - gfx::PluginWindowHandle /* window */, - int32 /* width */, - int32 /* height */, - uint64 /* surface_id */) - -// This message notifies the browser process that the plug-in -// swapped the buffers associated with the given "window", which -// should cause the browser to redraw the various plug-ins' -// contents. -IPC_MESSAGE_ROUTED2(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, - gfx::PluginWindowHandle /* window */, - uint64 /* surface_id */) -#endif - // Open a channel to all listening contexts owned by the extension with // the given ID. This always returns a valid port ID which can be used for // sending messages. If an error occurred, the opener will be notified @@ -957,16 +841,6 @@ IPC_MESSAGE_ROUTED2(ViewHostMsg_ExtensionPostMessage, IPC_MESSAGE_CONTROL1(ViewHostMsg_ExtensionCloseChannel, int /* port_id */) -// Sent to notify the browser about renderer accessibility notifications. -// The browser responds with a ViewMsg_AccessibilityNotifications_ACK. -IPC_MESSAGE_ROUTED1( - ViewHostMsg_AccessibilityNotifications, - std::vector<ViewHostMsg_AccessibilityNotification_Params>) - -// Send part of the DOM to the browser, to be used in a malware report. -IPC_MESSAGE_ROUTED1(ViewHostMsg_MalwareDOMDetails, - ViewHostMsg_MalwareDOMDetails_Params) - // Message sent from the renderer to the browser to request that the browser // close all sockets. Used for debugging/testing. IPC_MESSAGE_CONTROL0(ViewHostMsg_CloseCurrentConnections) @@ -997,13 +871,6 @@ IPC_MESSAGE_CONTROL3(ViewHostMsg_DidGenerateCacheableMetadata, double /* expected_response_time */, std::vector<char> /* data */) -// Opens a file asynchronously. The response returns a file descriptor -// and an error code from base/platform_file.h. -IPC_MESSAGE_ROUTED3(ViewHostMsg_AsyncOpenFile, - FilePath /* file path */, - int /* flags */, - int /* message_id */) - // Sent by the renderer process to acknowledge receipt of a // ViewMsg_CSSInsertRequest message and css has been inserted into the frame. IPC_MESSAGE_ROUTED0(ViewHostMsg_OnCSSInserted) @@ -1020,50 +887,6 @@ IPC_MESSAGE_ROUTED4(ViewHostMsg_PageTranslated, std::string /* the translated language */, TranslateErrors::Type /* the error type if available */) -//--------------------------------------------------------------------------- -// Request for cryptographic operation messages: -// These are messages from the renderer to the browser to perform a -// cryptographic operation. - -// Asks the browser process to generate a keypair for grabbing a client -// certificate from a CA (<keygen> tag), and returns the signed public -// key and challenge string. -IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_Keygen, - uint32 /* key size index */, - std::string /* challenge string */, - GURL /* URL of requestor */, - std::string /* signed public key and challenge */) - -// The renderer has tried to spell check a word, but couldn't because no -// dictionary was available to load. Request that the browser find an -// appropriate dictionary and return it. -IPC_MESSAGE_CONTROL0(ViewHostMsg_SpellChecker_RequestDictionary) - -IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_SpellChecker_PlatformCheckSpelling, - string16 /* word */, - int /* document tag */, - bool /* correct */) - -IPC_SYNC_MESSAGE_CONTROL1_1( - ViewHostMsg_SpellChecker_PlatformFillSuggestionList, - string16 /* word */, - std::vector<string16> /* suggestions */) - -IPC_MESSAGE_CONTROL4(ViewHostMsg_SpellChecker_PlatformRequestTextCheck, - int /* route_id for response */, - int /* request identifier given by WebKit */, - int /* document tag */, - string16 /* sentence */) - -// Updates the minimum/maximum allowed zoom percent for this tab from the -// default values. If |remember| is true, then the zoom setting is applied to -// other pages in the site and is saved, otherwise it only applies to this -// tab. -IPC_MESSAGE_ROUTED3(ViewHostMsg_UpdateZoomLimits, - int /* minimum_percent */, - int /* maximum_percent */, - bool /* remember */) - // Suggest results ----------------------------------------------------------- IPC_MESSAGE_ROUTED3(ViewHostMsg_SetSuggestions, diff --git a/chrome/common/render_messages_params.cc b/chrome/common/render_messages_params.cc index eb5d8a0..caf263e 100644 --- a/chrome/common/render_messages_params.cc +++ b/chrome/common/render_messages_params.cc @@ -4,7 +4,6 @@ #include "chrome/common/render_messages_params.h" -#include "chrome/common/common_param_traits.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/render_messages.h" #include "net/base/upload_data.h" @@ -130,18 +129,6 @@ ViewHostMsg_DomMessage_Params::ViewHostMsg_DomMessage_Params() ViewHostMsg_DomMessage_Params::~ViewHostMsg_DomMessage_Params() { } -ViewHostMsg_MalwareDOMDetails_Node::ViewHostMsg_MalwareDOMDetails_Node() { -} - -ViewHostMsg_MalwareDOMDetails_Node::~ViewHostMsg_MalwareDOMDetails_Node() { -} - -ViewHostMsg_MalwareDOMDetails_Params::ViewHostMsg_MalwareDOMDetails_Params() { -} - -ViewHostMsg_MalwareDOMDetails_Params::~ViewHostMsg_MalwareDOMDetails_Params() { -} - ViewMsg_ExtensionLoaded_Params::ViewMsg_ExtensionLoaded_Params() : location(Extension::INVALID) { } @@ -224,30 +211,6 @@ struct ParamTraits<Extension::Location> { } }; -template <> -struct ParamTraits - <ViewHostMsg_AccessibilityNotification_Params::NotificationType> { - typedef ViewHostMsg_AccessibilityNotification_Params params; - typedef params::NotificationType param_type; - static void Write(Message* m, const param_type& p) { - int val = static_cast<int>(p); - WriteParam(m, val); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int val = 0; - if (!ReadParam(m, iter, &val) || - val < params::NOTIFICATION_TYPE_CHECK_STATE_CHANGED || - val > params::NOTIFICATION_TYPE_SELECTED_TEXT_CHANGED) { - return false; - } - *p = static_cast<param_type>(val); - return true; - } - static void Log(const param_type& p, std::string* l) { - ParamTraits<int>::Log(static_cast<int>(p), l); - } -}; - void ParamTraits<ViewHostMsg_PageHasOSDD_Type>::Write(Message* m, const param_type& p) { m->WriteInt(p.type); @@ -572,85 +535,4 @@ void ParamTraits<ViewHostMsg_DomMessage_Params>::Log(const param_type& p, l->append(")"); } -void ParamTraits<ViewHostMsg_AccessibilityNotification_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.notification_type); - WriteParam(m, p.acc_obj); -} - -bool ParamTraits<ViewHostMsg_AccessibilityNotification_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->notification_type) && - ReadParam(m, iter, &p->acc_obj); -} - -void ParamTraits<ViewHostMsg_AccessibilityNotification_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.notification_type, l); - l->append(", "); - LogParam(p.acc_obj, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_MalwareDOMDetails_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.nodes); -} - -bool ParamTraits<ViewHostMsg_MalwareDOMDetails_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return ReadParam(m, iter, &p->nodes); -} - -void ParamTraits<ViewHostMsg_MalwareDOMDetails_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.nodes, l); - l->append(")"); -} - -void ParamTraits<ViewHostMsg_MalwareDOMDetails_Node>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.url); - WriteParam(m, p.tag_name); - WriteParam(m, p.parent); - WriteParam(m, p.children); -} - -bool ParamTraits<ViewHostMsg_MalwareDOMDetails_Node>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->tag_name) && - ReadParam(m, iter, &p->parent) && - ReadParam(m, iter, &p->children); -} - -void ParamTraits<ViewHostMsg_MalwareDOMDetails_Node>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.url, l); - l->append(", "); - LogParam(p.tag_name, l); - l->append(", "); - LogParam(p.parent, l); - l->append(", "); - LogParam(p.children, l); - l->append(")"); -} - } // namespace IPC diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h index 03d67a1..31f261f 100644 --- a/chrome/common/render_messages_params.h +++ b/chrome/common/render_messages_params.h @@ -330,64 +330,6 @@ struct ViewHostMsg_DomMessage_Params { bool user_gesture; }; -struct ViewHostMsg_AccessibilityNotification_Params { - enum NotificationType { - // The node checked state has changed. - NOTIFICATION_TYPE_CHECK_STATE_CHANGED, - - // The node tree structure has changed. - NOTIFICATION_TYPE_CHILDREN_CHANGED, - - // The node in focus has changed. - NOTIFICATION_TYPE_FOCUS_CHANGED, - - // The document node has loaded. - NOTIFICATION_TYPE_LOAD_COMPLETE, - - // The node value has changed. - NOTIFICATION_TYPE_VALUE_CHANGED, - - // The text cursor or selection changed. - NOTIFICATION_TYPE_SELECTED_TEXT_CHANGED, - }; - - // Type of notification. - NotificationType notification_type; - - // The accessibility node tree. - webkit_glue::WebAccessibility acc_obj; -}; - -// A node is essentially a frame. -struct ViewHostMsg_MalwareDOMDetails_Node { - ViewHostMsg_MalwareDOMDetails_Node(); - ~ViewHostMsg_MalwareDOMDetails_Node(); - - // URL of this resource. Can be empty. - GURL url; - - // If this resource was in the "src" attribute of a tag, this is the tagname - // (eg "IFRAME"). Can be empty. - std::string tag_name; - - // URL of the parent node. Can be empty. - GURL parent; - - // children of this node. Can be emtpy. - std::vector<GURL> children; -}; - -// Parameters to describe interesting details from a rendered page that lead -// to a malware warning. -struct ViewHostMsg_MalwareDOMDetails_Params { - ViewHostMsg_MalwareDOMDetails_Params(); - ~ViewHostMsg_MalwareDOMDetails_Params(); - - // All the nodes we extracted. - std::vector<ViewHostMsg_MalwareDOMDetails_Node> nodes; -}; - - namespace IPC { class Message; @@ -480,30 +422,6 @@ struct ParamTraits<ViewHostMsg_DomMessage_Params> { static void Log(const param_type& p, std::string* l); }; -template <> -struct ParamTraits<ViewHostMsg_AccessibilityNotification_Params> { - typedef ViewHostMsg_AccessibilityNotification_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<ViewHostMsg_MalwareDOMDetails_Params> { - typedef ViewHostMsg_MalwareDOMDetails_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<ViewHostMsg_MalwareDOMDetails_Node> { - typedef ViewHostMsg_MalwareDOMDetails_Node param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - } // namespace IPC #endif // CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ diff --git a/chrome/common/render_messages_unittest.cc b/chrome/common/render_messages_unittest.cc deleted file mode 100644 index dea3146..0000000 --- a/chrome/common/render_messages_unittest.cc +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/scoped_ptr.h" -#include "base/string16.h" -#include "base/utf_string_conversions.h" -#include "chrome/common/render_messages.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "webkit/glue/web_io_operators.h" -#include "webkit/glue/webaccessibility.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" - -TEST(RenderMessagesUnittest, WebAccessibility) { - // Test a simple case. - webkit_glue::WebAccessibility input; - input.id = 123; - input.name = ASCIIToUTF16("name"); - input.value = ASCIIToUTF16("value"); - string16 help = ASCIIToUTF16("help"); - input.attributes[webkit_glue::WebAccessibility::ATTR_HELP] = help; - input.role = webkit_glue::WebAccessibility::ROLE_CHECKBOX; - input.state = - (1 << webkit_glue::WebAccessibility::STATE_CHECKED) | - (1 << webkit_glue::WebAccessibility::STATE_FOCUSED); - input.location = WebKit::WebRect(11, 22, 333, 444); - input.html_attributes.push_back( - std::pair<string16, string16>(ASCIIToUTF16("id"), ASCIIToUTF16("a"))); - input.html_attributes.push_back( - std::pair<string16, string16>(ASCIIToUTF16("class"), ASCIIToUTF16("b"))); - - IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); - IPC::WriteParam(&msg, input); - - webkit_glue::WebAccessibility output; - void* iter = NULL; - EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); - EXPECT_EQ(input.id, output.id); - EXPECT_EQ(input.name, output.name); - EXPECT_EQ(input.value, output.value); - EXPECT_EQ(static_cast<size_t>(1), input.attributes.size()); - EXPECT_EQ(help, input.attributes[webkit_glue::WebAccessibility::ATTR_HELP]); - EXPECT_EQ(input.role, output.role); - EXPECT_EQ(input.state, output.state); - EXPECT_EQ(input.location, output.location); - EXPECT_EQ(input.children.size(), output.children.size()); - EXPECT_EQ(input.html_attributes.size(), output.html_attributes.size()); - EXPECT_EQ(input.html_attributes[0].first, - output.html_attributes[0].first); - EXPECT_EQ(input.html_attributes[0].second, - output.html_attributes[0].second); - EXPECT_EQ(input.html_attributes[1].first, - output.html_attributes[1].first); - EXPECT_EQ(input.html_attributes[1].second, - output.html_attributes[1].second); - - // Test a corrupt case. - IPC::Message bad_msg(1, 2, IPC::Message::PRIORITY_NORMAL); - bad_msg.WriteInt(99); - iter = NULL; - EXPECT_FALSE(IPC::ReadParam(&bad_msg, &iter, &output)); - - // Test a recursive case. - webkit_glue::WebAccessibility outer; - outer.id = 1000; - outer.name = ASCIIToUTF16("outer_name"); - outer.role = webkit_glue::WebAccessibility::ROLE_GROUP; - outer.state = 0; - outer.location = WebKit::WebRect(0, 0, 1000, 1000); - webkit_glue::WebAccessibility inner1; - inner1.id = 1001; - inner1.name = ASCIIToUTF16("inner1_name"); - inner1.role = webkit_glue::WebAccessibility::ROLE_RADIO_BUTTON; - inner1.state = - (1 << webkit_glue::WebAccessibility::STATE_CHECKED) | - (1 << webkit_glue::WebAccessibility::STATE_FOCUSED); - inner1.location = WebKit::WebRect(10, 10, 900, 400); - outer.children.push_back(inner1); - webkit_glue::WebAccessibility inner2; - inner2.id = 1002; - inner2.name = ASCIIToUTF16("inner2_name"); - inner2.role = webkit_glue::WebAccessibility::ROLE_RADIO_BUTTON; - inner2.state = (1 << webkit_glue::WebAccessibility::STATE_CHECKED); - inner2.location = WebKit::WebRect(10, 500, 900, 400); - outer.children.push_back(inner2); - - IPC::Message msg2(1, 2, IPC::Message::PRIORITY_NORMAL); - IPC::WriteParam(&msg2, outer); - - void* iter2 = NULL; - EXPECT_TRUE(IPC::ReadParam(&msg2, &iter2, &output)); - EXPECT_EQ(outer.id, output.id); - EXPECT_EQ(outer.name, output.name); - EXPECT_EQ(outer.role, output.role); - EXPECT_EQ(outer.state, output.state); - EXPECT_EQ(outer.location, output.location); - EXPECT_EQ(outer.children.size(), output.children.size()); - EXPECT_EQ(inner1.id, output.children[0].id); - EXPECT_EQ(inner1.name, output.children[0].name); - EXPECT_EQ(inner1.role, output.children[0].role); - EXPECT_EQ(inner1.state, output.children[0].state); - EXPECT_EQ(inner1.location, output.children[0].location); - EXPECT_EQ(inner2.id, output.children[1].id); - EXPECT_EQ(inner2.name, output.children[1].name); - EXPECT_EQ(inner2.role, output.children[1].role); - EXPECT_EQ(inner2.state, output.children[1].state); - EXPECT_EQ(inner2.location, output.children[1].location); -} diff --git a/chrome/common/safebrowsing_messages.h b/chrome/common/safebrowsing_messages.h index 71877ad..a0fc7f9 100644 --- a/chrome/common/safebrowsing_messages.h +++ b/chrome/common/safebrowsing_messages.h @@ -4,21 +4,54 @@ // Multiply-included message file, so no include guard. -#include "chrome/common/common_param_traits.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message_macros.h" +#include "ipc/ipc_platform_file.h" #define IPC_MESSAGE_START SafeBrowsingMsgStart +// A node is essentially a frame. +IPC_STRUCT_BEGIN(SafeBrowsingHostMsg_MalwareDOMDetails_Node) + // URL of this resource. Can be empty. + IPC_STRUCT_MEMBER(GURL, url) + + // If this resource was in the "src" attribute of a tag, this is the tagname + // (eg "IFRAME"). Can be empty. + IPC_STRUCT_MEMBER(std::string, tag_name) + + // URL of the parent node. Can be empty. + IPC_STRUCT_MEMBER(GURL, parent) + + // children of this node. Can be emtpy. + IPC_STRUCT_MEMBER(std::vector<GURL>, children) +IPC_STRUCT_END() + // SafeBrowsing client-side detection messages sent from the renderer to the // browser. // Inform the browser that the current URL is phishing according to the // client-side phishing detector. -IPC_MESSAGE_ROUTED2(SafeBrowsingDetectionHostMsg_DetectedPhishingSite, +IPC_MESSAGE_ROUTED2(SafeBrowsingHostMsg_DetectedPhishingSite, GURL /* phishing_url */, double /* phishing_score */) +// Send part of the DOM to the browser, to be used in a malware report. +IPC_MESSAGE_ROUTED1(SafeBrowsingHostMsg_MalwareDOMDetails, + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>) + // SafeBrowsing client-side detection messages sent from the browser to the -// renderer. TODO(noelutz): move other IPC messages here. +// renderer. + +// A classification model for client-side phishing detection. +// The given file contains an encoded safe_browsing::ClientSideModel +// protocol buffer. +IPC_MESSAGE_CONTROL1(SafeBrowsingMsg_SetPhishingModel, + IPC::PlatformFileForTransit /* model_file */) + +// Request a DOM tree when a malware interstitial is shown. +IPC_MESSAGE_ROUTED0(SafeBrowsingMsg_GetMalwareDOMDetails) +// Tells the renderer to begin phishing detection for the given toplevel URL +// which it has started loading. +IPC_MESSAGE_ROUTED1(SafeBrowsingMsg_StartPhishingDetection, + GURL) diff --git a/chrome/common/utility_messages.h b/chrome/common/utility_messages.h index 27bd44e..9dc4952 100644 --- a/chrome/common/utility_messages.h +++ b/chrome/common/utility_messages.h @@ -11,7 +11,6 @@ #include "base/file_path.h" #include "base/platform_file.h" #include "base/values.h" -#include "chrome/common/common_param_traits.h" #include "chrome/common/extensions/update_manifest.h" #include "content/common/common_param_traits.h" #include "content/common/indexed_db_key.h" @@ -26,18 +25,18 @@ #define IPC_MESSAGE_START UtilityMsgStart -// Singly-included secton, not yet converted -#ifndef CHROME_COMMON_UTILITY_MESSAGES_H_ -#define CHROME_COMMON_UTILITY_MESSAGES_H_ - -class FilePath; -class IndexedDBKey; -class SerializedScriptValue; -class SkBitmap; +IPC_STRUCT_TRAITS_BEGIN(printing::PageRange) + IPC_STRUCT_TRAITS_MEMBER(from) + IPC_STRUCT_TRAITS_MEMBER(to) +IPC_STRUCT_TRAITS_END() -#endif // CHROME_COMMON_UTILITY_MESSAGES_H_ +IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults) + IPC_STRUCT_TRAITS_MEMBER(printer_capabilities) + IPC_STRUCT_TRAITS_MEMBER(caps_mime_type) + IPC_STRUCT_TRAITS_MEMBER(printer_defaults) + IPC_STRUCT_TRAITS_MEMBER(defaults_mime_type) +IPC_STRUCT_TRAITS_END() -// Traits for UpdateManifest::Result. IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Result) IPC_STRUCT_TRAITS_MEMBER(extension_id) IPC_STRUCT_TRAITS_MEMBER(version) @@ -46,7 +45,6 @@ IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Result) IPC_STRUCT_TRAITS_MEMBER(crx_url) IPC_STRUCT_TRAITS_END() -// Traits for UpdateManifest::Results IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Results) IPC_STRUCT_TRAITS_MEMBER(list) IPC_STRUCT_TRAITS_MEMBER(daystart_elapsed_seconds) diff --git a/chrome/common/webkit_param_traits.cc b/chrome/common/webkit_param_traits.cc deleted file mode 100644 index 666679f..0000000 --- a/chrome/common/webkit_param_traits.cc +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/webkit_param_traits.h" - -#include "base/format_macros.h" - -namespace IPC { - -void ParamTraits<WebKit::WebCache::ResourceTypeStat>::Log( - const param_type& p, std::string* l) { - l->append(base::StringPrintf("%" PRIuS " %" PRIuS " %" PRIuS " %" PRIuS, - p.count, p.size, p.liveSize, p.decodedSize)); -} - -void ParamTraits<WebKit::WebTextCheckingResult>::Write(Message* m, - const param_type& p) { - WriteParam(m, static_cast<int>(p.error)); - WriteParam(m, p.position); - WriteParam(m, p.length); -} - -bool ParamTraits<WebKit::WebTextCheckingResult>::Read(const Message* m, - void** iter, - param_type* p) { - int error = 0; - if (!ReadParam(m, iter, &error)) - return false; - if (error != WebKit::WebTextCheckingResult::ErrorSpelling && - error != WebKit::WebTextCheckingResult::ErrorGrammar) - return false; - int position = 0; - if (!ReadParam(m, iter, &position)) - return false; - int length = 0; - if (!ReadParam(m, iter, &length)) - return false; - - *p = WebKit::WebTextCheckingResult( - static_cast<WebKit::WebTextCheckingResult::Error>(error), - position, - length); - return true; -} - -void ParamTraits<WebKit::WebTextCheckingResult>::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(static_cast<int>(p.error), l); - l->append(", "); - LogParam(p.position, l); - l->append(", "); - LogParam(p.length, l); - l->append(")"); -} - -} // namespace IPC diff --git a/chrome/common/webkit_param_traits.h b/chrome/common/webkit_param_traits.h deleted file mode 100644 index e640f79..0000000 --- a/chrome/common/webkit_param_traits.h +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file contains ParamTraits templates to support serialization of WebKit -// data types over IPC. -// -// NOTE: IT IS IMPORTANT THAT ONLY POD (plain old data) TYPES ARE SERIALIZED. -// -// There are several reasons for this restrictions: -// -// o We don't want inclusion of this file to imply linking to WebKit code. -// -// o Many WebKit structures are not thread-safe. WebString, for example, -// contains a reference counted buffer, which does not use thread-safe -// reference counting. If we allowed serializing WebString, then we may -// run the risk of introducing subtle thread-safety bugs if people passed a -// WebString across threads via PostTask(NewRunnableMethod(...)). -// -// o The WebKit API has redundant types for strings, and we should avoid -// using those beyond code that interfaces with the WebKit API. - -#ifndef CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ -#define CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ -#pragma once - -#include "ipc/ipc_message_utils.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileError.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextInputType.h" - -namespace WebKit { -struct WebRect; -} - -namespace IPC { - -template <> -struct SimilarTypeTraits<WebKit::WebConsoleMessage::Level> { - typedef int Type; -}; - -template <> -struct ParamTraits<WebKit::WebCache::UsageStats> { - typedef WebKit::WebCache::UsageStats param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.minDeadCapacity); - WriteParam(m, p.maxDeadCapacity); - WriteParam(m, p.capacity); - WriteParam(m, p.liveSize); - WriteParam(m, p.deadSize); - } - static bool Read(const Message* m, void** iter, param_type* r) { - return - ReadParam(m, iter, &r->minDeadCapacity) && - ReadParam(m, iter, &r->maxDeadCapacity) && - ReadParam(m, iter, &r->capacity) && - ReadParam(m, iter, &r->liveSize) && - ReadParam(m, iter, &r->deadSize); - } - static void Log(const param_type& p, std::string* l) { - l->append("<WebCache::UsageStats>"); - } -}; - -template <> -struct ParamTraits<WebKit::WebCache::ResourceTypeStat> { - typedef WebKit::WebCache::ResourceTypeStat param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.count); - WriteParam(m, p.size); - WriteParam(m, p.liveSize); - WriteParam(m, p.decodedSize); - } - static bool Read(const Message* m, void** iter, param_type* r) { - bool result = - ReadParam(m, iter, &r->count) && - ReadParam(m, iter, &r->size) && - ReadParam(m, iter, &r->liveSize) && - ReadParam(m, iter, &r->decodedSize); - return result; - } - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<WebKit::WebCache::ResourceTypeStats> { - typedef WebKit::WebCache::ResourceTypeStats param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.images); - WriteParam(m, p.cssStyleSheets); - WriteParam(m, p.scripts); - WriteParam(m, p.xslStyleSheets); - WriteParam(m, p.fonts); - } - static bool Read(const Message* m, void** iter, param_type* r) { - bool result = - ReadParam(m, iter, &r->images) && - ReadParam(m, iter, &r->cssStyleSheets) && - ReadParam(m, iter, &r->scripts) && - ReadParam(m, iter, &r->xslStyleSheets) && - ReadParam(m, iter, &r->fonts); - return result; - } - static void Log(const param_type& p, std::string* l) { - l->append("<WebCoreStats>"); - LogParam(p.images, l); - LogParam(p.cssStyleSheets, l); - LogParam(p.scripts, l); - LogParam(p.xslStyleSheets, l); - LogParam(p.fonts, l); - l->append("</WebCoreStats>"); - } -}; - -template <> -struct ParamTraits<WebKit::WebTextInputType> { - typedef WebKit::WebTextInputType param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast<param_type>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case WebKit::WebTextInputTypeNone: - control = "WebKit::WebTextInputTypeNone"; - break; - case WebKit::WebTextInputTypeText: - control = "WebKit::WebTextInputTypeText"; - break; - case WebKit::WebTextInputTypePassword: - control = "WebKit::WebTextInputTypePassword"; - break; - default: - NOTIMPLEMENTED(); - control = "UNKNOWN"; - break; - } - LogParam(control, l); - } -}; - -template <> -struct SimilarTypeTraits<WebKit::WebFileError> { - typedef int Type; -}; - -template <> -struct ParamTraits<WebKit::WebTextCheckingResult> { - typedef WebKit::WebTextCheckingResult param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -} // namespace IPC - -#endif // CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc index 251e46b..43afd70 100644 --- a/chrome/renderer/print_web_view_helper.cc +++ b/chrome/renderer/print_web_view_helper.cc @@ -12,7 +12,7 @@ #include "base/utf_string_conversions.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" +#include "content/common/view_messages.h" #include "content/renderer/render_view.h" #include "grit/generated_resources.h" #include "printing/units.h" diff --git a/chrome/renderer/print_web_view_helper_linux.cc b/chrome/renderer/print_web_view_helper_linux.cc index 555f419..a989880 100644 --- a/chrome/renderer/print_web_view_helper_linux.cc +++ b/chrome/renderer/print_web_view_helper_linux.cc @@ -8,7 +8,7 @@ #include "base/logging.h" #include "base/scoped_ptr.h" #include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" +#include "content/common/view_messages.h" #include "printing/native_metafile_factory.h" #include "printing/native_metafile.h" #include "skia/ext/vector_canvas.h" diff --git a/chrome/renderer/print_web_view_helper_win.cc b/chrome/renderer/print_web_view_helper_win.cc index 941aac7..616c5b0 100644 --- a/chrome/renderer/print_web_view_helper_win.cc +++ b/chrome/renderer/print_web_view_helper_win.cc @@ -7,7 +7,7 @@ #include "base/logging.h" #include "base/process_util.h" #include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" +#include "content/common/view_messages.h" #include "printing/native_metafile_factory.h" #include "printing/native_metafile.h" #include "printing/units.h" diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 48fd6e2..b66da67 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -29,6 +29,7 @@ #include "chrome/common/extensions/extension_set.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" +#include "chrome/common/safebrowsing_messages.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/automation/dom_automation_v8_extension.h" #include "chrome/renderer/devtools_agent_filter.h" @@ -697,7 +698,7 @@ bool RenderThread::OnControlMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect, OnSpellCheckEnableAutoSpellCorrect) IPC_MESSAGE_HANDLER(GpuMsg_GpuChannelEstablished, OnGpuChannelEstablished) - IPC_MESSAGE_HANDLER(ViewMsg_SetPhishingModel, OnSetPhishingModel) + IPC_MESSAGE_HANDLER(SafeBrowsingMsg_SetPhishingModel, OnSetPhishingModel) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; diff --git a/chrome/renderer/safe_browsing/malware_dom_details.cc b/chrome/renderer/safe_browsing/malware_dom_details.cc index 79624dd..6a03295 100644 --- a/chrome/renderer/safe_browsing/malware_dom_details.cc +++ b/chrome/renderer/safe_browsing/malware_dom_details.cc @@ -6,8 +6,7 @@ #include "base/compiler_specific.h" #include "chrome/common/chrome_constants.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" +#include "chrome/common/safebrowsing_messages.h" #include "content/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" @@ -32,22 +31,22 @@ MalwareDOMDetails::~MalwareDOMDetails() { bool MalwareDOMDetails::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(MalwareDOMDetails, message) - IPC_MESSAGE_HANDLER(ViewMsg_GetMalwareDOMDetails, OnGetMalwareDOMDetails) + IPC_MESSAGE_HANDLER(SafeBrowsingMsg_GetMalwareDOMDetails, OnGetMalwareDOMDetails) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; } void MalwareDOMDetails::OnGetMalwareDOMDetails() { - ViewHostMsg_MalwareDOMDetails_Params resources; + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node> resources; ExtractResources(&resources); // Notify the browser. - render_view()->Send(new ViewHostMsg_MalwareDOMDetails( + render_view()->Send(new SafeBrowsingHostMsg_MalwareDOMDetails( render_view()->routing_id(), resources)); } void MalwareDOMDetails::ExtractResources( - ViewHostMsg_MalwareDOMDetails_Params* resources) { + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>* resources) { WebKit::WebView* web_view = render_view_->webview(); if (!web_view) { NOTREACHED(); @@ -57,12 +56,12 @@ void MalwareDOMDetails::ExtractResources( for (; cur_frame; cur_frame = cur_frame->traverseNext(false /* don't wrap around */)) { DCHECK(cur_frame); - ViewHostMsg_MalwareDOMDetails_Node frame_node; + SafeBrowsingHostMsg_MalwareDOMDetails_Node frame_node; frame_node.url = GURL(cur_frame->url()); WebKit::WebDocument doc = cur_frame->document(); if (doc.isNull()) { // Nothing in this frame, move on to the next one. - resources->nodes.push_back(frame_node); + resources->push_back(frame_node); continue; } @@ -76,22 +75,22 @@ void MalwareDOMDetails::ExtractResources( if (element.hasTagName("iframe") || element.hasTagName("frame") || element.hasTagName("embed") || element.hasTagName("script")) { HandleElement(element, &frame_node, resources); - if (resources->nodes.size() >= kMaxNodes) { + if (resources->size() >= kMaxNodes) { // We have reached kMaxNodes, exit early. - resources->nodes.push_back(frame_node); + resources->push_back(frame_node); return; } } } - resources->nodes.push_back(frame_node); + resources->push_back(frame_node); } } void MalwareDOMDetails::HandleElement( const WebKit::WebElement& element, - ViewHostMsg_MalwareDOMDetails_Node* parent_node, - ViewHostMsg_MalwareDOMDetails_Params* resources) { + SafeBrowsingHostMsg_MalwareDOMDetails_Node* parent_node, + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>* resources) { if (!element.hasAttribute("src")) { return; } @@ -106,11 +105,11 @@ void MalwareDOMDetails::HandleElement( parent_node->children.push_back(child_url); // Create the child node. - ViewHostMsg_MalwareDOMDetails_Node child_node; + SafeBrowsingHostMsg_MalwareDOMDetails_Node child_node; child_node.url = child_url; child_node.tag_name = element.tagName().utf8(); child_node.parent = parent_node->url; - resources->nodes.push_back(child_node); + resources->push_back(child_node); } } // namespace safe_browsing diff --git a/chrome/renderer/safe_browsing/malware_dom_details.h b/chrome/renderer/safe_browsing/malware_dom_details.h index b042cba..58f7b10 100644 --- a/chrome/renderer/safe_browsing/malware_dom_details.h +++ b/chrome/renderer/safe_browsing/malware_dom_details.h @@ -26,8 +26,7 @@ class WebElement; class WebFrame; } -struct ViewHostMsg_MalwareDOMDetails_Params; -struct ViewHostMsg_MalwareDOMDetails_Node; +struct SafeBrowsingHostMsg_MalwareDOMDetails_Node; namespace safe_browsing { @@ -45,7 +44,8 @@ class MalwareDOMDetails : public RenderViewObserver { // Begins extracting resource urls for the page currently loaded in // this object's RenderView. - void ExtractResources(ViewHostMsg_MalwareDOMDetails_Params* resources); + void ExtractResources( + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>* resources); private: // RenderViewObserver implementation. @@ -54,9 +54,10 @@ class MalwareDOMDetails : public RenderViewObserver { void OnGetMalwareDOMDetails(); // Handler for the various HTML elements that we extract URLs from. - void HandleElement(const WebKit::WebElement& element, - ViewHostMsg_MalwareDOMDetails_Node* parent_node, - ViewHostMsg_MalwareDOMDetails_Params* resources); + void HandleElement( + const WebKit::WebElement& element, + SafeBrowsingHostMsg_MalwareDOMDetails_Node* parent_node, + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>* resources); // Non-owned pointer to the view that we will extract features from. RenderView* render_view_; diff --git a/chrome/renderer/safe_browsing/malware_dom_details_browsertest.cc b/chrome/renderer/safe_browsing/malware_dom_details_browsertest.cc index ea05f91..dc7d6ef 100644 --- a/chrome/renderer/safe_browsing/malware_dom_details_browsertest.cc +++ b/chrome/renderer/safe_browsing/malware_dom_details_browsertest.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/renderer/safe_browsing/malware_dom_details.h" -#include "chrome/common/render_messages_params.h" #include "base/stringprintf.h" +#include "chrome/common/safebrowsing_messages.h" +#include "chrome/renderer/safe_browsing/malware_dom_details.h" #include "chrome/test/render_view_test.h" #include "net/base/escape.h" @@ -22,10 +22,10 @@ TEST_F(MalwareDOMDetailsTest, Everything) { { // An page with an internal script std::string html = "<html><head><script></script></head></html>"; LoadHTML(html.c_str()); - ViewHostMsg_MalwareDOMDetails_Params params; + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node> params; details.ExtractResources(¶ms); - ASSERT_EQ(1u, params.nodes.size()); - EXPECT_EQ(GURL(urlprefix + html), params.nodes[0].url); + ASSERT_EQ(1u, params.size()); + EXPECT_EQ(GURL(urlprefix + html), params[0].url); } { // A page with 2 external scripts. @@ -39,14 +39,14 @@ TEST_F(MalwareDOMDetailsTest, Everything) { GURL url(urlprefix + html); LoadHTML(html.c_str()); - ViewHostMsg_MalwareDOMDetails_Params params; + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node> params; details.ExtractResources(¶ms); - ASSERT_EQ(3u, params.nodes.size()); - EXPECT_EQ(script1_url, params.nodes[0].url); - EXPECT_EQ("SCRIPT", params.nodes[0].tag_name); - EXPECT_EQ(script2_url, params.nodes[1].url); - EXPECT_EQ("SCRIPT", params.nodes[0].tag_name); - EXPECT_EQ(url, params.nodes[2].url); + ASSERT_EQ(3u, params.size()); + EXPECT_EQ(script1_url, params[0].url); + EXPECT_EQ("SCRIPT", params[0].tag_name); + EXPECT_EQ(script2_url, params[1].url); + EXPECT_EQ("SCRIPT", params[0].tag_name); + EXPECT_EQ(url, params[2].url); } { // A page with an iframe which in turn contains an iframe. @@ -63,36 +63,36 @@ TEST_F(MalwareDOMDetailsTest, Everything) { GURL url(urlprefix + html); LoadHTML(html.c_str()); - ViewHostMsg_MalwareDOMDetails_Params params; + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node> params; details.ExtractResources(¶ms); - ASSERT_EQ(5u, params.nodes.size()); + ASSERT_EQ(5u, params.size()); - EXPECT_EQ(iframe1_url, params.nodes[0].url); - EXPECT_EQ(url, params.nodes[0].parent); - EXPECT_EQ(0u, params.nodes[0].children.size()); - EXPECT_EQ("IFRAME", params.nodes[0].tag_name); + EXPECT_EQ(iframe1_url, params[0].url); + EXPECT_EQ(url, params[0].parent); + EXPECT_EQ(0u, params[0].children.size()); + EXPECT_EQ("IFRAME", params[0].tag_name); - EXPECT_EQ(url, params.nodes[1].url); - EXPECT_EQ(GURL(), params.nodes[1].parent); - EXPECT_EQ(1u, params.nodes[1].children.size()); - EXPECT_EQ(iframe1_url, params.nodes[1].children[0]); + EXPECT_EQ(url, params[1].url); + EXPECT_EQ(GURL(), params[1].parent); + EXPECT_EQ(1u, params[1].children.size()); + EXPECT_EQ(iframe1_url, params[1].children[0]); - EXPECT_EQ(iframe2_url, params.nodes[2].url); - EXPECT_EQ(iframe1_url, params.nodes[2].parent); - EXPECT_EQ(0u, params.nodes[2].children.size()); - EXPECT_EQ("IFRAME", params.nodes[2].tag_name); + EXPECT_EQ(iframe2_url, params[2].url); + EXPECT_EQ(iframe1_url, params[2].parent); + EXPECT_EQ(0u, params[2].children.size()); + EXPECT_EQ("IFRAME", params[2].tag_name); // The frames are added twice, once with the correct parent and tagname // and once with the correct children. The caller in the browser // is responsible for merging. - EXPECT_EQ(iframe1_url, params.nodes[3].url); - EXPECT_EQ(GURL(), params.nodes[3].parent); - EXPECT_EQ(1u, params.nodes[3].children.size()); - EXPECT_EQ(iframe2_url, params.nodes[3].children[0]); - - EXPECT_EQ(iframe2_url, params.nodes[4].url); - EXPECT_EQ(GURL(), params.nodes[4].parent); - EXPECT_EQ(0u, params.nodes[4].children.size()); + EXPECT_EQ(iframe1_url, params[3].url); + EXPECT_EQ(GURL(), params[3].parent); + EXPECT_EQ(1u, params[3].children.size()); + EXPECT_EQ(iframe2_url, params[3].children[0]); + + EXPECT_EQ(iframe2_url, params[4].url); + EXPECT_EQ(GURL(), params[4].parent); + EXPECT_EQ(0u, params[4].children.size()); } { // >50 subframes, to verify kMaxNodes. @@ -106,9 +106,9 @@ TEST_F(MalwareDOMDetailsTest, Everything) { GURL url(urlprefix + html); LoadHTML(html.c_str()); - ViewHostMsg_MalwareDOMDetails_Params params; + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node> params; details.ExtractResources(¶ms); - ASSERT_EQ(51u, params.nodes.size()); + ASSERT_EQ(51u, params.size()); } { // A page with >50 scripts, to verify kMaxNodes. @@ -122,9 +122,9 @@ TEST_F(MalwareDOMDetailsTest, Everything) { GURL url(urlprefix + html); LoadHTML(html.c_str()); - ViewHostMsg_MalwareDOMDetails_Params params; + std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node> params; details.ExtractResources(¶ms); - ASSERT_EQ(51u, params.nodes.size()); + ASSERT_EQ(51u, params.size()); } } diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc b/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc index e47e422..fd7a33a 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc @@ -10,7 +10,6 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/scoped_callback_factory.h" -#include "chrome/common/render_messages.h" #include "chrome/common/safebrowsing_messages.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/safe_browsing/feature_extractor_clock.h" @@ -151,7 +150,7 @@ bool PhishingClassifierDelegate::OnMessageReceived( const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PhishingClassifierDelegate, message) - IPC_MESSAGE_HANDLER(ViewMsg_StartPhishingDetection, + IPC_MESSAGE_HANDLER(SafeBrowsingMsg_StartPhishingDetection, OnStartPhishingDetection) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -167,7 +166,7 @@ void PhishingClassifierDelegate::ClassificationDone(bool is_phishy, return; } - Send(new SafeBrowsingDetectionHostMsg_DetectedPhishingSite( + Send(new SafeBrowsingHostMsg_DetectedPhishingSite( routing_id(), last_url_sent_to_classifier_, phishy_score)); diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc index 241078e..d9891ca 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc @@ -61,7 +61,7 @@ class PhishingClassifierDelegateTest : public RenderViewFakeResourcesTest { bool OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PhishingClassifierDelegateTest, message) - IPC_MESSAGE_HANDLER(SafeBrowsingDetectionHostMsg_DetectedPhishingSite, + IPC_MESSAGE_HANDLER(SafeBrowsingHostMsg_DetectedPhishingSite, OnDetectedPhishingSite) IPC_MESSAGE_UNHANDLED( handled = RenderViewFakeResourcesTest::OnMessageReceived(message)) diff --git a/chrome/tools/ipclist/all_messages.h b/chrome/tools/ipclist/all_messages.h index e1ea9eb..d10c2f9 100644 --- a/chrome/tools/ipclist/all_messages.h +++ b/chrome/tools/ipclist/all_messages.h @@ -9,8 +9,6 @@ #include "chrome/browser/importer/importer_messages.h" #include "chrome/common/common_message_generator.h" #include "chrome/common/automation_messages.h" -#include "chrome/common/devtools_messages.h" #include "chrome/common/nacl_messages.h" -#include "chrome/common/render_messages.h" #include "content/common/content_message_generator.h" #include "ppapi/proxy/ppapi_messages.h" diff --git a/chrome_frame/cfproxy_support.cc b/chrome_frame/cfproxy_support.cc index 1451650..f6147a2 100644 --- a/chrome_frame/cfproxy_support.cc +++ b/chrome_frame/cfproxy_support.cc @@ -8,6 +8,7 @@ #include "base/atomic_sequence_num.h" #include "base/command_line.h" #include "base/process_util.h" +#include "base/scoped_ptr.h" #include "chrome/common/automation_messages.h" #include "chrome/common/chrome_switches.h" #include "chrome_frame/chrome_launcher_utils.h" diff --git a/chrome_frame/cfproxy_test.cc b/chrome_frame/cfproxy_test.cc index b618b3e..1f81a0b 100644 --- a/chrome_frame/cfproxy_test.cc +++ b/chrome_frame/cfproxy_test.cc @@ -4,6 +4,7 @@ #include <string> #include "base/file_path.h" +#include "base/scoped_ptr.h" #include "base/synchronization/waitable_event.h" #include "chrome/common/automation_messages.h" #include "chrome_frame/cfproxy_private.h" diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index d5c4747..b5143ae 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -27,6 +27,7 @@ #include "chrome/common/net/url_request_context_getter.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" +#include "chrome/common/safebrowsing_messages.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/translate_errors.h" #include "chrome/common/url_constants.h" @@ -1318,7 +1319,7 @@ void RenderViewHost::OnUserGesture() { } void RenderViewHost::GetMalwareDOMDetails() { - Send(new ViewMsg_GetMalwareDOMDetails(routing_id())); + Send(new SafeBrowsingMsg_GetMalwareDOMDetails(routing_id())); } void RenderViewHost::GetAllSavableResourceLinksForCurrentPage( @@ -1576,7 +1577,7 @@ void RenderViewHost::OnAccessibilityNotifications( const ViewHostMsg_AccessibilityNotification_Params& param = params[i]; if (param.notification_type == - ViewHostMsg_AccessibilityNotification_Params:: + ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_LOAD_COMPLETE) { // TODO(ctguil): Remove when mac processes OnAccessibilityNotifications. if (view()) diff --git a/content/common/child_process_messages.h b/content/common/child_process_messages.h index ac26b18..6850da2 100644 --- a/content/common/child_process_messages.h +++ b/content/common/child_process_messages.h @@ -43,9 +43,13 @@ IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_EndTracingAck) IPC_MESSAGE_CONTROL1(ChildProcessHostMsg_TraceDataCollected, std::string /*json trace data*/) +// NaCl's 64 bit Windows build only links with a bare-minimum number of +// libraries, and GURL isn't one of them. +#if !defined(NACL_WIN64) // Get the list of proxies to use for |url|, as a semicolon delimited list // of "<TYPE> <HOST>:<PORT>" | "DIRECT". IPC_SYNC_MESSAGE_CONTROL1_2(ChildProcessHostMsg_ResolveProxy, GURL /* url */, int /* network error */, std::string /* proxy list */) +#endif diff --git a/content/common/child_thread.cc b/content/common/child_thread.cc index 4d49324..574b43b 100644 --- a/content/common/child_thread.cc +++ b/content/common/child_thread.cc @@ -59,9 +59,8 @@ void ChildThread::Init() { channel_->AddFilter(sync_message_filter_.get()); #if !defined(NACL_WIN64) - // Currently, the NaCl 64 DLL build requires a lot of extra dependencies to - // support IPC messages with parameters, so until there's a need for trace in - // NaCl, this is reserved for non-NaCl builds. + // This brings in a depenency on gpu, which isn't linked in with NaCl's win64 + // build. channel_->AddFilter(new ChildTraceMessageFilter()); #endif diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h index 3aea66c..6a29d6c 100644 --- a/content/common/content_message_generator.h +++ b/content/common/content_message_generator.h @@ -4,9 +4,13 @@ // Multiply-included file, hence no include guard. +#include "content/common/child_process_messages.h" + +// NaCl's 64 bit Windows build only links with a bare-minimum number of +// libraries. +#if !defined(NACL_WIN64) #include "content/common/appcache_messages.h" #include "content/common/audio_messages.h" -#include "content/common/child_process_messages.h" #include "content/common/clipboard_messages.h" #include "content/common/database_messages.h" #include "content/common/desktop_notification_messages.h" @@ -28,3 +32,4 @@ #include "content/common/view_messages.h" #include "content/common/webblob_messages.h" #include "content/common/worker_messages.h" +#endif diff --git a/content/common/view_messages.h b/content/common/view_messages.h index a6be921..e867ca2 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -6,6 +6,7 @@ // Multiply-included message file, hence no include guard. #include "base/process.h" +#include "base/shared_memory.h" #include "content/common/common_param_traits.h" #include "content/common/css_colors.h" #include "content/common/edit_command.h" @@ -22,12 +23,14 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextInputType.h" #include "ui/gfx/rect.h" #include "webkit/glue/context_menu.h" #include "webkit/glue/password_form.h" #include "webkit/glue/webcookie.h" #include "webkit/glue/webmenuitem.h" #include "webkit/glue/webpreferences.h" +#include "webkit/glue/webaccessibility.h" #include "webkit/plugins/npapi/webplugin.h" #include "webkit/plugins/npapi/webplugininfo.h" @@ -39,6 +42,28 @@ #ifndef CONTENT_COMMON_VIEW_MESSAGES_H_ #define CONTENT_COMMON_VIEW_MESSAGES_H_ +struct ViewHostMsg_AccessibilityNotification_Type { + enum Value { + // The node checked state has changed. + NOTIFICATION_TYPE_CHECK_STATE_CHANGED, + + // The node tree structure has changed. + NOTIFICATION_TYPE_CHILDREN_CHANGED, + + // The node in focus has changed. + NOTIFICATION_TYPE_FOCUS_CHANGED, + + // The document node has loaded. + NOTIFICATION_TYPE_LOAD_COMPLETE, + + // The node value has changed. + NOTIFICATION_TYPE_VALUE_CHANGED, + + // The text cursor or selection changed. + NOTIFICATION_TYPE_SELECTED_TEXT_CHANGED, + }; +}; + struct ViewHostMsg_RunFileChooser_Mode { public: enum Value { @@ -124,14 +149,18 @@ IPC_ENUM_TRAITS(NavigationGesture) IPC_ENUM_TRAITS(PageZoom::Function) IPC_ENUM_TRAITS(RendererPreferencesHintingEnum) IPC_ENUM_TRAITS(RendererPreferencesSubpixelRenderingEnum) +IPC_ENUM_TRAITS(ViewHostMsg_AccessibilityNotification_Type::Value) IPC_ENUM_TRAITS(ViewHostMsg_RunFileChooser_Mode::Value) IPC_ENUM_TRAITS(ViewMsg_Navigate_Type::Value) IPC_ENUM_TRAITS(ViewMsg_StopFinding_Params::Action) IPC_ENUM_TRAITS(WebKit::WebContextMenuData::MediaType) IPC_ENUM_TRAITS(WebKit::WebMediaPlayerAction::Type) IPC_ENUM_TRAITS(WebKit::WebPopupType) +IPC_ENUM_TRAITS(WebKit::WebTextInputType) IPC_ENUM_TRAITS(WebMenuItem::Type) IPC_ENUM_TRAITS(WindowContainerType) +IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::Role) +IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::State) IPC_STRUCT_TRAITS_BEGIN(ContextMenuParams) IPC_STRUCT_TRAITS_MEMBER(media_type) @@ -303,6 +332,19 @@ IPC_STRUCT_TRAITS_BEGIN(webkit_glue::CustomContextMenuContext) IPC_STRUCT_TRAITS_MEMBER(request_id) IPC_STRUCT_TRAITS_END() +IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebAccessibility) + IPC_STRUCT_TRAITS_MEMBER(id) + IPC_STRUCT_TRAITS_MEMBER(name) + IPC_STRUCT_TRAITS_MEMBER(value) + IPC_STRUCT_TRAITS_MEMBER(role) + IPC_STRUCT_TRAITS_MEMBER(state) + IPC_STRUCT_TRAITS_MEMBER(location) + IPC_STRUCT_TRAITS_MEMBER(attributes) + IPC_STRUCT_TRAITS_MEMBER(children) + IPC_STRUCT_TRAITS_MEMBER(indirect_child_ids) + IPC_STRUCT_TRAITS_MEMBER(html_attributes) +IPC_STRUCT_TRAITS_END() + IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebCookie) IPC_STRUCT_TRAITS_MEMBER(name) IPC_STRUCT_TRAITS_MEMBER(value) @@ -470,47 +512,16 @@ IPC_STRUCT_BEGIN(ViewHostMsg_FrameNavigate_Params) IPC_STRUCT_MEMBER(std::string, content_state) IPC_STRUCT_END() -IPC_STRUCT_BEGIN(ViewMsg_Navigate_Params) - // The page_id for this navigation, or -1 if it is a new navigation. Back, - // Forward, and Reload navigations should have a valid page_id. If the load - // succeeds, then this page_id will be reflected in the resultant - // ViewHostMsg_FrameNavigate message. - IPC_STRUCT_MEMBER(int32, page_id) - - // If page_id is -1, then pending_history_list_offset will also be -1. - // Otherwise, it contains the offset into the history list corresponding to - // the current navigation. - IPC_STRUCT_MEMBER(int, pending_history_list_offset) - - // Informs the RenderView of where its current page contents reside in - // session history and the total size of the session history list. - IPC_STRUCT_MEMBER(int, current_history_list_offset) - IPC_STRUCT_MEMBER(int, current_history_list_length) - - // The URL to load. - IPC_STRUCT_MEMBER(GURL, url) - - // The URL to send in the "Referer" header field. Can be empty if there is - // no referrer. - // TODO: consider folding this into extra_headers. - IPC_STRUCT_MEMBER(GURL, referrer) - - // The type of transition. - IPC_STRUCT_MEMBER(PageTransition::Type, transition) - - // Opaque history state (received by ViewHostMsg_UpdateState). - IPC_STRUCT_MEMBER(std::string, state) - - // Type of navigation. - IPC_STRUCT_MEMBER(ViewMsg_Navigate_Type::Value, navigation_type) - - // The time the request was created - IPC_STRUCT_MEMBER(base::Time, request_time) +IPC_STRUCT_BEGIN(ViewHostMsg_AccessibilityNotification_Params) + // Type of notification. + IPC_STRUCT_MEMBER(ViewHostMsg_AccessibilityNotification_Type::Value, + notification_type) - // Extra headers (separated by \n) to send during the request. - IPC_STRUCT_MEMBER(std::string, extra_headers) + // The accessibility node tree. + IPC_STRUCT_MEMBER(webkit_glue::WebAccessibility, acc_obj) IPC_STRUCT_END() + IPC_STRUCT_BEGIN(ViewHostMsg_RunFileChooser_Params) IPC_STRUCT_MEMBER(ViewHostMsg_RunFileChooser_Mode::Value, mode) @@ -639,6 +650,47 @@ IPC_STRUCT_BEGIN(ViewMsg_ClosePage_Params) IPC_STRUCT_MEMBER(int, new_request_id) IPC_STRUCT_END() +IPC_STRUCT_BEGIN(ViewMsg_Navigate_Params) + // The page_id for this navigation, or -1 if it is a new navigation. Back, + // Forward, and Reload navigations should have a valid page_id. If the load + // succeeds, then this page_id will be reflected in the resultant + // ViewHostMsg_FrameNavigate message. + IPC_STRUCT_MEMBER(int32, page_id) + + // If page_id is -1, then pending_history_list_offset will also be -1. + // Otherwise, it contains the offset into the history list corresponding to + // the current navigation. + IPC_STRUCT_MEMBER(int, pending_history_list_offset) + + // Informs the RenderView of where its current page contents reside in + // session history and the total size of the session history list. + IPC_STRUCT_MEMBER(int, current_history_list_offset) + IPC_STRUCT_MEMBER(int, current_history_list_length) + + // The URL to load. + IPC_STRUCT_MEMBER(GURL, url) + + // The URL to send in the "Referer" header field. Can be empty if there is + // no referrer. + // TODO: consider folding this into extra_headers. + IPC_STRUCT_MEMBER(GURL, referrer) + + // The type of transition. + IPC_STRUCT_MEMBER(PageTransition::Type, transition) + + // Opaque history state (received by ViewHostMsg_UpdateState). + IPC_STRUCT_MEMBER(std::string, state) + + // Type of navigation. + IPC_STRUCT_MEMBER(ViewMsg_Navigate_Type::Value, navigation_type) + + // The time the request was created + IPC_STRUCT_MEMBER(base::Time, request_time) + + // Extra headers (separated by \n) to send during the request. + IPC_STRUCT_MEMBER(std::string, extra_headers) +IPC_STRUCT_END() + IPC_STRUCT_BEGIN(ViewMsg_New_Params) // The parent window's id. IPC_STRUCT_MEMBER(gfx::NativeViewId, parent_window) @@ -1070,6 +1122,22 @@ IPC_MESSAGE_ROUTED3(ViewMsg_AsyncOpenFile_ACK, IPC_MESSAGE_ROUTED1(ViewMsg_NetworkStateChanged, bool /* online */) +// Enable accessibility in the renderer process. +IPC_MESSAGE_ROUTED0(ViewMsg_EnableAccessibility) + +// Relay a request from assistive technology to set focus to a given node. +IPC_MESSAGE_ROUTED1(ViewMsg_SetAccessibilityFocus, + int /* object id */) + +// Relay a request from assistive technology to perform the default action +// on a given node. +IPC_MESSAGE_ROUTED1(ViewMsg_AccessibilityDoDefaultAction, + int /* object id */) + +// Tells the render view that a ViewHostMsg_AccessibilityNotifications +// message was processed and it can send addition notifications. +IPC_MESSAGE_ROUTED0(ViewMsg_AccessibilityNotifications_ACK) + // Messages sent from the renderer to the browser. @@ -1579,3 +1647,192 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_TakeFocus, IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetRootWindowRect, gfx::NativeViewId /* window */, gfx::Rect /* Out: Window location */) + +// Required for updating text input state. +IPC_MESSAGE_ROUTED2(ViewHostMsg_ImeUpdateTextInputState, + WebKit::WebTextInputType, /* text_input_type */ + gfx::Rect /* caret_rect */) + +// Required for cancelling an ongoing input method composition. +IPC_MESSAGE_ROUTED0(ViewHostMsg_ImeCancelComposition) + +// WebKit and JavaScript error messages to log to the console +// or debugger UI. +IPC_MESSAGE_ROUTED3(ViewHostMsg_AddMessageToConsole, + std::wstring, /* msg */ + int32, /* line number */ + std::wstring /* source id */) + +// Sent by the renderer process to indicate that a plugin instance has +// crashed. +IPC_MESSAGE_ROUTED1(ViewHostMsg_CrashedPlugin, + FilePath /* plugin_path */) + +// Displays a box to confirm that the user wants to navigate away from the +// page. Replies true if yes, false otherwise, the reply string is ignored, +// but is included so that we can use OnJavaScriptMessageBoxClosed. +IPC_SYNC_MESSAGE_ROUTED2_2(ViewHostMsg_RunBeforeUnloadConfirm, + GURL, /* in - originating frame URL */ + std::wstring /* in - alert message */, + bool /* out - success */, + std::wstring /* out - This is ignored.*/) + +// Sent when the renderer process is done processing a DataReceived +// message. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DataReceived_ACK, + int /* request_id */) + +IPC_MESSAGE_CONTROL1(ViewHostMsg_RevealFolderInOS, + FilePath /* path */) + +// Sent when a provisional load on the main frame redirects. +IPC_MESSAGE_ROUTED3(ViewHostMsg_DidRedirectProvisionalLoad, + int /* page_id */, + GURL /* last url */, + GURL /* url redirected to */) + +// Sent when the renderer changes the zoom level for a particular url, so the +// browser can update its records. If remember is true, then url is used to +// update the zoom level for all pages in that site. Otherwise, the render +// view's id is used so that only the menu is updated. +IPC_MESSAGE_ROUTED3(ViewHostMsg_DidZoomURL, + double /* zoom_level */, + bool /* remember */, + GURL /* url */) + +// Updates the minimum/maximum allowed zoom percent for this tab from the +// default values. If |remember| is true, then the zoom setting is applied to +// other pages in the site and is saved, otherwise it only applies to this +// tab. +IPC_MESSAGE_ROUTED3(ViewHostMsg_UpdateZoomLimits, + int /* minimum_percent */, + int /* maximum_percent */, + bool /* remember */) + +#if defined(OS_WIN) +// Duplicates a shared memory handle from the renderer to the browser. Then +// the renderer can flush the handle. +IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_DuplicateSection, + base::SharedMemoryHandle /* renderer handle */, + base::SharedMemoryHandle /* browser handle */) +#endif + +// Asks the browser to create a block of shared memory for the renderer to +// fill in and pass back to the browser. +IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_AllocateSharedMemoryBuffer, + uint32 /* buffer size */, + base::SharedMemoryHandle /* browser handle */) + +// Notify the browser that this render process can or can't be suddenly +// terminated. +IPC_MESSAGE_CONTROL1(ViewHostMsg_SuddenTerminationChanged, + bool /* enabled */) + +#if defined(OS_MACOSX) +// On OSX, we cannot allocated shared memory from within the sandbox, so +// this call exists for the renderer to ask the browser to allocate memory +// on its behalf. We return a file descriptor to the POSIX shared memory. +// If the |cache_in_browser| flag is |true|, then a copy of the shmem is kept +// by the browser, and it is the caller's repsonsibility to send a +// ViewHostMsg_FreeTransportDIB message in order to release the cached shmem. +// In all cases, the caller is responsible for deleting the resulting +// TransportDIB. +IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_AllocTransportDIB, + size_t, /* bytes requested */ + bool, /* cache in the browser */ + TransportDIB::Handle /* DIB */) + +// Since the browser keeps handles to the allocated transport DIBs, this +// message is sent to tell the browser that it may release them when the +// renderer is finished with them. +IPC_MESSAGE_CONTROL1(ViewHostMsg_FreeTransportDIB, + TransportDIB::Id /* DIB id */) + +// Informs the browser that a plugin has gained or lost focus. +IPC_MESSAGE_ROUTED2(ViewHostMsg_PluginFocusChanged, + bool, /* focused */ + int /* plugin_id */) + +// Instructs the browser to start plugin IME. +IPC_MESSAGE_ROUTED0(ViewHostMsg_StartPluginIme) + +//--------------------------------------------------------------------------- +// Messages related to accelerated plugins + +// This is sent from the renderer to the browser to allocate a fake +// PluginWindowHandle on the browser side which is used to identify +// the plugin to the browser later when backing store is allocated +// or reallocated. |opaque| indicates whether the plugin's output is +// considered to be opaque, as opposed to translucent. This message +// is reused for rendering the accelerated compositor's output. +// |root| indicates whether the output is supposed to cover the +// entire window. +IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_AllocateFakePluginWindowHandle, + bool /* opaque */, + bool /* root */, + gfx::PluginWindowHandle /* id */) + +// Destroys a fake window handle previously allocated using +// AllocateFakePluginWindowHandle. +IPC_MESSAGE_ROUTED1(ViewHostMsg_DestroyFakePluginWindowHandle, + gfx::PluginWindowHandle /* id */) + +// This message, used on Mac OS X 10.5 and earlier (no IOSurface support), +// is sent from the renderer to the browser on behalf of the plug-in +// to indicate that a new backing store was allocated for that plug-in +// instance. +IPC_MESSAGE_ROUTED4(ViewHostMsg_AcceleratedSurfaceSetTransportDIB, + gfx::PluginWindowHandle /* window */, + int32 /* width */, + int32 /* height */, + TransportDIB::Handle /* handle for the DIB */) + +// This message, used on Mac OS X 10.6 and later (where IOSurface is +// supported), is sent from the renderer to the browser on behalf of the +// plug-in to indicate that a new backing store was allocated for that +// plug-in instance. +// +// NOTE: the original intent was to pass a mach port as the IOSurface +// identifier but it looks like that will be a lot of work. For now we pass an +// ID from IOSurfaceGetID. +IPC_MESSAGE_ROUTED4(ViewHostMsg_AcceleratedSurfaceSetIOSurface, + gfx::PluginWindowHandle /* window */, + int32 /* width */, + int32 /* height */, + uint64 /* surface_id */) + +// This message notifies the browser process that the plug-in +// swapped the buffers associated with the given "window", which +// should cause the browser to redraw the various plug-ins' +// contents. +IPC_MESSAGE_ROUTED2(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, + gfx::PluginWindowHandle /* window */, + uint64 /* surface_id */) +#endif + +// Sent to notify the browser about renderer accessibility notifications. +// The browser responds with a ViewMsg_AccessibilityNotifications_ACK. +IPC_MESSAGE_ROUTED1( + ViewHostMsg_AccessibilityNotifications, + std::vector<ViewHostMsg_AccessibilityNotification_Params>) + +// Opens a file asynchronously. The response returns a file descriptor +// and an error code from base/platform_file.h. +IPC_MESSAGE_ROUTED3(ViewHostMsg_AsyncOpenFile, + FilePath /* file path */, + int /* flags */, + int /* message_id */) + +//--------------------------------------------------------------------------- +// Request for cryptographic operation messages: +// These are messages from the renderer to the browser to perform a +// cryptographic operation. + +// Asks the browser process to generate a keypair for grabbing a client +// certificate from a CA (<keygen> tag), and returns the signed public +// key and challenge string. +IPC_SYNC_MESSAGE_CONTROL3_1(ViewHostMsg_Keygen, + uint32 /* key size index */, + std::string /* challenge string */, + GURL /* URL of requestor */, + std::string /* signed public key and challenge */) diff --git a/content/renderer/command_buffer_proxy.cc b/content/renderer/command_buffer_proxy.cc index 7a5cc74..865f90f 100644 --- a/content/renderer/command_buffer_proxy.cc +++ b/content/renderer/command_buffer_proxy.cc @@ -8,10 +8,10 @@ #include "base/process_util.h" #include "base/shared_memory.h" #include "base/task.h" -#include "chrome/common/render_messages.h" #include "chrome/renderer/render_thread.h" #include "content/common/gpu_messages.h" #include "content/common/plugin_messages.h" +#include "content/common/view_messages.h" #include "content/renderer/plugin_channel_host.h" #include "gpu/command_buffer/common/cmd_buffer_common.h" #include "ui/gfx/size.h" diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index e8446a6..d0debe7 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -431,30 +431,30 @@ static bool IsEditableNode(const WebNode& node) { static bool WebAccessibilityNotificationToViewHostMsg( WebAccessibilityNotification notification, - ViewHostMsg_AccessibilityNotification_Params::NotificationType* type) { + ViewHostMsg_AccessibilityNotification_Type::Value* type) { switch (notification) { case WebKit::WebAccessibilityNotificationCheckedStateChanged: - *type = ViewHostMsg_AccessibilityNotification_Params:: + *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHECK_STATE_CHANGED; break; case WebKit::WebAccessibilityNotificationChildrenChanged: - *type = ViewHostMsg_AccessibilityNotification_Params:: + *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHILDREN_CHANGED; break; case WebKit::WebAccessibilityNotificationFocusedUIElementChanged: - *type = ViewHostMsg_AccessibilityNotification_Params:: + *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_FOCUS_CHANGED; break; case WebKit::WebAccessibilityNotificationLoadComplete: - *type = ViewHostMsg_AccessibilityNotification_Params:: + *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_LOAD_COMPLETE; break; case WebKit::WebAccessibilityNotificationValueChanged: - *type = ViewHostMsg_AccessibilityNotification_Params:: + *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_VALUE_CHANGED; break; case WebKit::WebAccessibilityNotificationSelectedTextChanged: - *type = ViewHostMsg_AccessibilityNotification_Params:: + *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_SELECTED_TEXT_CHANGED; break; default: @@ -4949,7 +4949,7 @@ void RenderView::postAccessibilityNotification( if (acc_notification.id < 0) return; - ViewHostMsg_AccessibilityNotification_Params::NotificationType temp; + ViewHostMsg_AccessibilityNotification_Type::Value temp; if (!WebAccessibilityNotificationToViewHostMsg(notification, &temp)) return; diff --git a/content/renderer/renderer_webkitclient_impl.cc b/content/renderer/renderer_webkitclient_impl.cc index 48850d2..c904137 100644 --- a/content/renderer/renderer_webkitclient_impl.cc +++ b/content/renderer/renderer_webkitclient_impl.cc @@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/file_path.h" +#include "base/file_util.h" #include "base/platform_file.h" #include "base/shared_memory.h" #include "base/utf_string_conversions.h" |