diff options
36 files changed, 328 insertions, 530 deletions
diff --git a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc index 1a85a1b..a98bf0d 100644 --- a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc +++ b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc @@ -8,7 +8,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/pref_service.h" -#include "chrome/common/render_messages_params.h" +#include "content/common/desktop_notification_messages.h" namespace chromeos { @@ -93,9 +93,9 @@ void DesktopNotificationsTest::TearDown() { profile_.reset(NULL); } -ViewHostMsg_ShowNotification_Params +DesktopNotificationHostMsg_Show_Params DesktopNotificationsTest::StandardTestNotification() { - ViewHostMsg_ShowNotification_Params params; + DesktopNotificationHostMsg_Show_Params params; params.notification_id = 0; params.origin = GURL("http://www.google.com"); params.is_html = false; @@ -107,7 +107,7 @@ DesktopNotificationsTest::StandardTestNotification() { } TEST_F(DesktopNotificationsTest, TestShow) { - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); params.notification_id = 1; EXPECT_TRUE(service_->ShowDesktopNotification( params, 0, 0, DesktopNotificationService::PageNotification)); @@ -115,7 +115,7 @@ TEST_F(DesktopNotificationsTest, TestShow) { MessageLoopForUI::current()->RunAllPending(); EXPECT_EQ(1, balloon_collection_->count()); - ViewHostMsg_ShowNotification_Params params2; + DesktopNotificationHostMsg_Show_Params params2; params2.origin = GURL("http://www.google.com"); params2.is_html = true; params2.contents_url = GURL("http://www.google.com/notification.html"); @@ -132,7 +132,7 @@ TEST_F(DesktopNotificationsTest, TestShow) { } TEST_F(DesktopNotificationsTest, TestClose) { - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); params.notification_id = 1; // Request a notification; should open a balloon. @@ -161,7 +161,7 @@ TEST_F(DesktopNotificationsTest, TestCancel) { int route_id = 0; int notification_id = 1; - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); params.notification_id = notification_id; // Request a notification; should open a balloon. @@ -192,7 +192,7 @@ TEST_F(DesktopNotificationsTest, TestManyNotifications) { const int kLotsOfToasts = 20; for (int id = 1; id <= kLotsOfToasts; ++id) { SCOPED_TRACE(base::StringPrintf("Creation loop: id=%d", id)); - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); params.notification_id = id; EXPECT_TRUE(service_->ShowDesktopNotification( params, process_id, route_id, @@ -253,7 +253,7 @@ TEST_F(DesktopNotificationsTest, TestEarlyDestruction) { TEST_F(DesktopNotificationsTest, TestUserInputEscaping) { // Create a test script with some HTML; assert that it doesn't get into the // data:// URL that's produced for the balloon. - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); params.title = ASCIIToUTF16("<script>window.alert('uh oh');</script>"); params.body = ASCIIToUTF16("<i>this text is in italics</i>"); params.notification_id = 1; diff --git a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.h b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.h index 86016cf..e5433cd 100644 --- a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.h +++ b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.h @@ -19,12 +19,13 @@ #include "chrome/browser/notifications/notification_test_util.h" #include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/notifications/notifications_prefs_cache.h" -#include "chrome/common/render_messages.h" #include "chrome/test/testing_pref_service.h" #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" +struct DesktopNotificationHostMsg_Show_Params; + namespace chromeos { class DesktopNotificationsTest; @@ -84,7 +85,7 @@ class DesktopNotificationsTest : public testing::Test { } // Constructs a notification parameter structure for use in tests. - ViewHostMsg_ShowNotification_Params StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params StandardTestNotification(); // Create a message loop to allow notifications code to post tasks, // and a thread so that notifications code runs on the expected thread. diff --git a/chrome/browser/desktop_notification_handler.cc b/chrome/browser/desktop_notification_handler.cc index 22f0eb9..b5a904c 100644 --- a/chrome/browser/desktop_notification_handler.cc +++ b/chrome/browser/desktop_notification_handler.cc @@ -7,10 +7,9 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/notifications/desktop_notification_service.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/desktop_notification_messages.h" DesktopNotificationHandler::DesktopNotificationHandler( TabContents* tab, RenderProcessHost* process) @@ -23,21 +22,19 @@ bool DesktopNotificationHandler::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP(DesktopNotificationHandler, message) - IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDesktopNotification, - OnShowDesktopNotification) - IPC_MESSAGE_HANDLER(ViewHostMsg_CancelDesktopNotification, - OnCancelDesktopNotification) - IPC_MESSAGE_HANDLER(ViewHostMsg_RequestNotificationPermission, - OnRequestNotificationPermission) + IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Show, OnShow) + IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_Cancel, OnCancel) + IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_RequestPermission, + OnRequestPermission) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; } -void DesktopNotificationHandler::OnShowDesktopNotification( +void DesktopNotificationHandler::OnShow( const IPC::Message& message, - const ViewHostMsg_ShowNotification_Params& params) { + const DesktopNotificationHostMsg_Show_Params& params) { RenderProcessHost* process = GetRenderProcessHost(); DesktopNotificationService* service = process->profile()->GetDesktopNotificationService(); @@ -49,8 +46,8 @@ void DesktopNotificationHandler::OnShowDesktopNotification( DesktopNotificationService::PageNotification); } -void DesktopNotificationHandler::OnCancelDesktopNotification( - const IPC::Message& message, int notification_id) { +void DesktopNotificationHandler::OnCancel(const IPC::Message& message, + int notification_id) { RenderProcessHost* process = GetRenderProcessHost(); DesktopNotificationService* service = process->profile()->GetDesktopNotificationService(); @@ -61,7 +58,7 @@ void DesktopNotificationHandler::OnCancelDesktopNotification( notification_id); } -void DesktopNotificationHandler::OnRequestNotificationPermission( +void DesktopNotificationHandler::OnRequestPermission( const IPC::Message& message, const GURL& source_origin, int callback_context) { RenderProcessHost* process = GetRenderProcessHost(); diff --git a/chrome/browser/desktop_notification_handler.h b/chrome/browser/desktop_notification_handler.h index e6b4666..1fac9c5 100644 --- a/chrome/browser/desktop_notification_handler.h +++ b/chrome/browser/desktop_notification_handler.h @@ -8,7 +8,7 @@ #include "content/browser/tab_contents/tab_contents_observer.h" -struct ViewHostMsg_ShowNotification_Params; +struct DesktopNotificationHostMsg_Show_Params; class RenderProcessHost; // Per-tab Desktop notification handler. Handles desktop notification IPCs @@ -27,14 +27,12 @@ class DesktopNotificationHandler { private: // IPC handlers. - void OnShowDesktopNotification( - const IPC::Message& message, - const ViewHostMsg_ShowNotification_Params& params); - void OnCancelDesktopNotification(const IPC::Message& message, - int notification_id); - void OnRequestNotificationPermission(const IPC::Message& message, - const GURL& origin, - int callback_id); + void OnShow(const IPC::Message& message, + const DesktopNotificationHostMsg_Show_Params& params); + void OnCancel(const IPC::Message& message, int notification_id); + void OnRequestPermission(const IPC::Message& message, + const GURL& origin, + int callback_id); private: TabContents* tab_; diff --git a/chrome/browser/geolocation/geolocation_permission_context.cc b/chrome/browser/geolocation/geolocation_permission_context.cc index e1a2c95..3a44e50 100644 --- a/chrome/browser/geolocation/geolocation_permission_context.cc +++ b/chrome/browser/geolocation/geolocation_permission_context.cc @@ -18,12 +18,12 @@ #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" -#include "chrome/common/render_messages.h" #include "content/browser/browser_thread.h" #include "content/browser/geolocation/geolocation_provider.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/geolocation_messages.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" #include "content/common/notification_type.h" @@ -596,7 +596,7 @@ void GeolocationPermissionContext::NotifyPermissionSet( RenderViewHost* r = RenderViewHost::FromID(render_process_id, render_view_id); if (r) { - r->Send(new ViewMsg_Geolocation_PermissionSet( + r->Send(new GeolocationMsg_PermissionSet( render_view_id, bridge_id, allowed)); } diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc index c80b50a..dde8dc6 100644 --- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc +++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc @@ -5,7 +5,6 @@ #include "base/scoped_vector.h" #include "chrome/browser/geolocation/geolocation_content_settings_map.h" #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" -#include "chrome/common/render_messages.h" #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" #include "content/browser/geolocation/arbitrator_dependency_factories_for_test.h" @@ -16,6 +15,7 @@ #include "content/browser/renderer_host/mock_render_process_host.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/tab_contents/test_tab_contents.h" +#include "content/common/geolocation_messages.h" #include "content/common/notification_details.h" #include "content/common/notification_type.h" #include "testing/gtest/include/gtest/gtest.h" @@ -138,10 +138,10 @@ void GeolocationPermissionContextTests::CheckPermissionMessageSentInternal( MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); MessageLoop::current()->Run(); const IPC::Message* message = process->sink().GetFirstMessageMatching( - ViewMsg_Geolocation_PermissionSet::ID); + GeolocationMsg_PermissionSet::ID); ASSERT_TRUE(message); - ViewMsg_Geolocation_PermissionSet::Param param; - ViewMsg_Geolocation_PermissionSet::Read(message, ¶m); + GeolocationMsg_PermissionSet::Param param; + GeolocationMsg_PermissionSet::Read(message, ¶m); EXPECT_EQ(bridge_id, param.a); EXPECT_EQ(allowed, param.b); process->sink().ClearMessages(); diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index 6628e0e..e372055 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -18,8 +18,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" #include "chrome/common/pref_names.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" #include "content/browser/browser_child_process_host.h" #include "content/browser/browser_thread.h" @@ -28,6 +26,7 @@ #include "content/browser/site_instance.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/worker_host/worker_process_host.h" +#include "content/common/desktop_notification_messages.h" #include "content/common/notification_service.h" #include "content/common/notification_type.h" #include "grit/browser_resources.h" @@ -156,8 +155,10 @@ void NotificationPermissionInfoBarDelegate::InfoBarClosed() { UMA_HISTOGRAM_COUNTS("NotificationPermissionRequest.Ignored", 1); RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_); - if (host) - host->Send(new ViewMsg_PermissionRequestDone(route_id_, callback_context_)); + if (host) { + host->Send(new DesktopNotificationMsg_PermissionRequestDone( + route_id_, callback_context_)); + } delete this; } @@ -516,8 +517,10 @@ void DesktopNotificationService::RequestPermission( } else { // Notify renderer immediately. RenderViewHost* host = RenderViewHost::FromID(process_id, route_id); - if (host) - host->Send(new ViewMsg_PermissionRequestDone(route_id, callback_context)); + if (host) { + host->Send(new DesktopNotificationMsg_PermissionRequestDone( + route_id, callback_context)); + } } } @@ -536,7 +539,7 @@ bool DesktopNotificationService::CancelDesktopNotification( bool DesktopNotificationService::ShowDesktopNotification( - const ViewHostMsg_ShowNotification_Params& params, + const DesktopNotificationHostMsg_Show_Params& params, int process_id, int route_id, DesktopNotificationSource source) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); const GURL& origin = params.origin; diff --git a/chrome/browser/notifications/desktop_notification_service.h b/chrome/browser/notifications/desktop_notification_service.h index 9b97f0d..f29ff43 100644 --- a/chrome/browser/notifications/desktop_notification_service.h +++ b/chrome/browser/notifications/desktop_notification_service.h @@ -28,7 +28,7 @@ class NotificationsPrefsCache; class PrefService; class Profile; class TabContents; -struct ViewHostMsg_ShowNotification_Params; +struct DesktopNotificationHostMsg_Show_Params; // The DesktopNotificationService is an object, owned by the Profile, // which provides the creation of desktop "toasts" to web pages and workers. @@ -57,7 +57,7 @@ class DesktopNotificationService : public NotificationObserver { // whether the script is in a worker or page. |params| contains all the // other parameters supplied by the worker or page. bool ShowDesktopNotification( - const ViewHostMsg_ShowNotification_Params& params, + const DesktopNotificationHostMsg_Show_Params& params, int process_id, int route_id, DesktopNotificationSource source); // Cancels a notification. If it has already been shown, it will be diff --git a/chrome/browser/notifications/desktop_notifications_unittest.cc b/chrome/browser/notifications/desktop_notifications_unittest.cc index ef93bda..b3d72ff 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.cc +++ b/chrome/browser/notifications/desktop_notifications_unittest.cc @@ -8,9 +8,8 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/common/pref_names.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" #include "chrome/test/testing_pref_service.h" +#include "content/common/desktop_notification_messages.h" // static const int MockBalloonCollection::kMockBalloonSpace = 5; @@ -99,9 +98,9 @@ void DesktopNotificationsTest::TearDown() { profile_.reset(NULL); } -ViewHostMsg_ShowNotification_Params +DesktopNotificationHostMsg_Show_Params DesktopNotificationsTest::StandardTestNotification() { - ViewHostMsg_ShowNotification_Params params; + DesktopNotificationHostMsg_Show_Params params; params.notification_id = 0; params.origin = GURL("http://www.google.com"); params.is_html = false; @@ -113,7 +112,7 @@ DesktopNotificationsTest::StandardTestNotification() { } TEST_F(DesktopNotificationsTest, TestShow) { - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); params.notification_id = 1; EXPECT_TRUE(service_->ShowDesktopNotification( @@ -121,7 +120,7 @@ TEST_F(DesktopNotificationsTest, TestShow) { MessageLoopForUI::current()->RunAllPending(); EXPECT_EQ(1, balloon_collection_->count()); - ViewHostMsg_ShowNotification_Params params2; + DesktopNotificationHostMsg_Show_Params params2; params2.origin = GURL("http://www.google.com"); params2.is_html = true; params2.contents_url = GURL("http://www.google.com/notification.html"); @@ -138,7 +137,7 @@ TEST_F(DesktopNotificationsTest, TestShow) { } TEST_F(DesktopNotificationsTest, TestClose) { - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); params.notification_id = 1; // Request a notification; should open a balloon. @@ -162,7 +161,7 @@ TEST_F(DesktopNotificationsTest, TestCancel) { int route_id = 0; int notification_id = 1; - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); params.notification_id = notification_id; // Request a notification; should open a balloon. @@ -187,7 +186,7 @@ TEST_F(DesktopNotificationsTest, TestCancel) { #if defined(OS_WIN) || defined(TOOLKIT_VIEWS) TEST_F(DesktopNotificationsTest, TestPositioning) { - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); std::string expected_log; // Create some toasts. After each but the first, make sure there // is a minimum separation between the toasts. @@ -207,7 +206,7 @@ TEST_F(DesktopNotificationsTest, TestPositioning) { } TEST_F(DesktopNotificationsTest, TestVariableSize) { - ViewHostMsg_ShowNotification_Params params; + DesktopNotificationHostMsg_Show_Params params; params.origin = GURL("http://long.google.com"); params.is_html = false; params.icon_url = GURL("/icon.png"); @@ -254,7 +253,7 @@ TEST_F(DesktopNotificationsTest, TestQueueing) { int route_id = 0; // Request lots of identical notifications. - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); const int kLotsOfToasts = 20; for (int id = 1; id <= kLotsOfToasts; ++id) { params.notification_id = id; @@ -308,7 +307,7 @@ TEST_F(DesktopNotificationsTest, TestQueueing) { TEST_F(DesktopNotificationsTest, TestEarlyDestruction) { // Create some toasts and then prematurely delete the notification service, // just to make sure nothing crashes/leaks. - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); for (int id = 0; id <= 3; ++id) { params.notification_id = id; EXPECT_TRUE(service_->ShowDesktopNotification( @@ -320,7 +319,7 @@ TEST_F(DesktopNotificationsTest, TestEarlyDestruction) { TEST_F(DesktopNotificationsTest, TestUserInputEscaping) { // Create a test script with some HTML; assert that it doesn't get into the // data:// URL that's produced for the balloon. - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); params.title = ASCIIToUTF16("<script>window.alert('uh oh');</script>"); params.body = ASCIIToUTF16("<i>this text is in italics</i>"); params.notification_id = 1; @@ -340,7 +339,7 @@ TEST_F(DesktopNotificationsTest, TestUserInputEscaping) { TEST_F(DesktopNotificationsTest, TestBoundingBox) { // Create some notifications. - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); for (int id = 0; id <= 3; ++id) { params.notification_id = id; EXPECT_TRUE(service_->ShowDesktopNotification( @@ -377,7 +376,7 @@ TEST_F(DesktopNotificationsTest, TestPositionPreference) { BalloonCollection::LOWER_RIGHT); // Create some notifications. - ViewHostMsg_ShowNotification_Params params = StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); for (int id = 0; id <= 3; ++id) { params.notification_id = id; EXPECT_TRUE(service_->ShowDesktopNotification( diff --git a/chrome/browser/notifications/desktop_notifications_unittest.h b/chrome/browser/notifications/desktop_notifications_unittest.h index 8175588..e633310 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.h +++ b/chrome/browser/notifications/desktop_notifications_unittest.h @@ -96,7 +96,7 @@ class DesktopNotificationsTest : public testing::Test { } // Constructs a notification parameter structure for use in tests. - ViewHostMsg_ShowNotification_Params StandardTestNotification(); + DesktopNotificationHostMsg_Show_Params StandardTestNotification(); // Create a message loop to allow notifications code to post tasks, // and a thread so that notifications code runs on the expected thread. diff --git a/chrome/browser/notifications/notification_object_proxy.cc b/chrome/browser/notifications/notification_object_proxy.cc index ac90cc8..cabcac71 100644 --- a/chrome/browser/notifications/notification_object_proxy.cc +++ b/chrome/browser/notifications/notification_object_proxy.cc @@ -6,9 +6,9 @@ #include "base/message_loop.h" #include "base/string16.h" -#include "chrome/common/render_messages.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/common/desktop_notification_messages.h" NotificationObjectProxy::NotificationObjectProxy(int process_id, int route_id, int notification_id, bool worker) @@ -19,22 +19,21 @@ NotificationObjectProxy::NotificationObjectProxy(int process_id, int route_id, } void NotificationObjectProxy::Display() { - Send(new ViewMsg_PostDisplayToNotificationObject( - route_id_, notification_id_)); + Send(new DesktopNotificationMsg_PostDisplay(route_id_, notification_id_)); } void NotificationObjectProxy::Error() { - Send(new ViewMsg_PostErrorToNotificationObject( + Send(new DesktopNotificationMsg_PostError( route_id_, notification_id_, string16())); } void NotificationObjectProxy::Close(bool by_user) { - Send(new ViewMsg_PostCloseToNotificationObject( + Send(new DesktopNotificationMsg_PostClose( route_id_, notification_id_, by_user)); } void NotificationObjectProxy::Click() { - Send(new ViewMsg_PostClickToNotificationObject(route_id_, notification_id_)); + Send(new DesktopNotificationMsg_PostClick(route_id_, notification_id_)); } std::string NotificationObjectProxy::id() const { diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc index 7bc5cfe..d9a07fc 100644 --- a/chrome/common/common_param_traits.cc +++ b/chrome/common/common_param_traits.cc @@ -10,7 +10,6 @@ #include "chrome/common/thumbnail_score.h" #include "chrome/common/web_apps.h" #include "content/common/common_param_traits.h" -#include "content/common/geoposition.h" #include "googleurl/src/gurl.h" #include "printing/backend/print_backend.h" #include "printing/native_metafile.h" @@ -233,67 +232,6 @@ void ParamTraits<ThumbnailScore>::Log(const param_type& p, std::string* l) { p.boring_score, p.good_clipping, p.at_top)); } -template <> -struct ParamTraits<Geoposition::ErrorCode> { - typedef Geoposition::ErrorCode param_type; - static void Write(Message* m, const param_type& p) { - int error_code = p; - WriteParam(m, error_code); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int error_code_param = 0; - bool ret = ReadParam(m, iter, &error_code_param); - *p = static_cast<Geoposition::ErrorCode>(error_code_param); - return ret; - } - static void Log(const param_type& p, std::string* l) { - int error_code = p; - l->append(base::StringPrintf("<Geoposition::ErrorCode>%d", error_code)); - } -}; - -void ParamTraits<Geoposition>::Write(Message* m, const Geoposition& p) { - WriteParam(m, p.latitude); - WriteParam(m, p.longitude); - WriteParam(m, p.accuracy); - WriteParam(m, p.altitude); - WriteParam(m, p.altitude_accuracy); - WriteParam(m, p.speed); - WriteParam(m, p.heading); - WriteParam(m, p.timestamp); - WriteParam(m, p.error_code); - WriteParam(m, p.error_message); -} - -bool ParamTraits<Geoposition>::Read( - const Message* m, void** iter, Geoposition* p) { - bool ret = ReadParam(m, iter, &p->latitude); - ret = ret && ReadParam(m, iter, &p->longitude); - ret = ret && ReadParam(m, iter, &p->accuracy); - ret = ret && ReadParam(m, iter, &p->altitude); - ret = ret && ReadParam(m, iter, &p->altitude_accuracy); - ret = ret && ReadParam(m, iter, &p->speed); - ret = ret && ReadParam(m, iter, &p->heading); - ret = ret && ReadParam(m, iter, &p->timestamp); - ret = ret && ReadParam(m, iter, &p->error_code); - ret = ret && ReadParam(m, iter, &p->error_message); - return ret; -} - -void ParamTraits<Geoposition>::Log(const Geoposition& p, std::string* l) { - l->append( - base::StringPrintf( - "<Geoposition>" - "%.6f %.6f %.6f %.6f " - "%.6f %.6f %.6f ", - p.latitude, p.longitude, p.accuracy, p.altitude, - p.altitude_accuracy, p.speed, p.heading)); - LogParam(p.timestamp, l); - l->append(" "); - l->append(p.error_message); - LogParam(p.error_code, l); -} - void ParamTraits<webkit_glue::PasswordForm>::Write(Message* m, const param_type& p) { WriteParam(m, p.signon_realm); diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h index d25ce76..6cda0ec 100644 --- a/chrome/common/common_param_traits.h +++ b/chrome/common/common_param_traits.h @@ -29,7 +29,6 @@ #include "webkit/glue/window_open_disposition.h" // Forward declarations. -struct Geoposition; class SkBitmap; class DictionaryValue; class ListValue; @@ -149,14 +148,6 @@ struct ParamTraits<ThumbnailScore> { }; template <> -struct ParamTraits<Geoposition> { - typedef Geoposition 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<webkit_glue::PasswordForm> { typedef webkit_glue::PasswordForm param_type; static void Write(Message* m, const param_type& p); diff --git a/chrome/common/common_param_traits_unittest.cc b/chrome/common/common_param_traits_unittest.cc index d19695c..c227921 100644 --- a/chrome/common/common_param_traits_unittest.cc +++ b/chrome/common/common_param_traits_unittest.cc @@ -9,7 +9,6 @@ #include "base/values.h" #include "chrome/common/common_param_traits.h" #include "content/common/common_param_traits.h" -#include "content/common/geoposition.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message.h" #include "ipc/ipc_message_utils.h" @@ -178,45 +177,6 @@ TEST(IPCMessageTest, DictionaryValue) { EXPECT_FALSE(IPC::ReadParam(&bad_msg, &iter, &output)); } -TEST(IPCMessageTest, Geoposition) { - Geoposition input; - input.latitude = 0.1; - input.longitude = 51.3; - input.accuracy = 13.7; - input.altitude = 42.24; - input.altitude_accuracy = 9.3; - input.speed = 55; - input.heading = 120; - input.timestamp = base::Time::FromInternalValue(1977); - input.error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; - input.error_message = "unittest error message for geoposition"; - - IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); - IPC::WriteParam(&msg, input); - - Geoposition output; - void* iter = NULL; - EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); - EXPECT_EQ(input.altitude, output.altitude); - EXPECT_EQ(input.altitude_accuracy, output.altitude_accuracy); - EXPECT_EQ(input.latitude, output.latitude); - EXPECT_EQ(input.longitude, output.longitude); - EXPECT_EQ(input.accuracy, output.accuracy); - EXPECT_EQ(input.heading, output.heading); - EXPECT_EQ(input.speed, output.speed); - EXPECT_EQ(input.error_code, output.error_code); - EXPECT_EQ(input.error_message, output.error_message); - - std::string log_message; - IPC::LogParam(output, &log_message); - EXPECT_STREQ("<Geoposition>" - "0.100000 51.300000 13.700000 42.240000 " - "9.300000 55.000000 120.000000 " - "1977 unittest error message for geoposition" - "<Geoposition::ErrorCode>2", - log_message.c_str()); -} - // Tests printing::PageRange serialization TEST(IPCMessageTest, PageRange) { printing::PageRange input; diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 343b29b..a2e82b5 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -38,7 +38,6 @@ #include "chrome/common/webkit_param_traits.h" #include "chrome/common/window_container_type.h" #include "content/common/common_param_traits.h" -#include "content/common/geoposition.h" #include "content/common/notification_type.h" #include "content/common/page_transition_types.h" #include "content/common/page_zoom.h" @@ -992,30 +991,6 @@ IPC_MESSAGE_ROUTED4(ViewMsg_DetermineIfPageSupportsInstant, IPC_MESSAGE_ROUTED1(ViewMsg_DisableScrollbarsForSmallWindows, gfx::Size /* disable_scrollbar_size_limit */) -// Used to inform the renderer that the browser has displayed its -// requested notification. -IPC_MESSAGE_ROUTED1(ViewMsg_PostDisplayToNotificationObject, - int /* notification_id */) - -// Used to inform the renderer that the browser has encountered an error -// trying to display a notification. -IPC_MESSAGE_ROUTED2(ViewMsg_PostErrorToNotificationObject, - int /* notification_id */, - string16 /* message */) - -// Informs the renderer that the one if its notifications has closed. -IPC_MESSAGE_ROUTED2(ViewMsg_PostCloseToNotificationObject, - int /* notification_id */, - bool /* by_user */) - -// Informs the renderer that one of its notifications was clicked on. -IPC_MESSAGE_ROUTED1(ViewMsg_PostClickToNotificationObject, - int /* notification_id */) - -// Informs the renderer that the one if its notifications has closed. -IPC_MESSAGE_ROUTED1(ViewMsg_PermissionRequestDone, - int /* request_id */) - // Activate/deactivate the RenderView (i.e., set its controls' tint // accordingly, etc.). IPC_MESSAGE_ROUTED1(ViewMsg_SetActive, @@ -1093,17 +1068,6 @@ IPC_MESSAGE_ROUTED4(ViewMsg_TranslatePage, IPC_MESSAGE_ROUTED1(ViewMsg_RevertTranslation, int /* page id */) -// Reply in response to ViewHostMsg_Geolocation_RequestPermission. -IPC_MESSAGE_ROUTED2(ViewMsg_Geolocation_PermissionSet, - int /* bridge_id */, - bool /* is_allowed */) - -// Sent after ViewHostMsg_Geolocation_StartUpdating iff the user has granted -// permission and we have a position available or an error occurs (such as -// permission denied, position unavailable, etc.) -IPC_MESSAGE_ROUTED1(ViewMsg_Geolocation_PositionUpdated, - Geoposition /* geoposition */) - // Sent on process startup to indicate whether this process is running in // incognito mode. IPC_MESSAGE_CONTROL1(ViewMsg_SetIsIncognitoProcess, @@ -1125,10 +1089,6 @@ IPC_MESSAGE_ROUTED1(ViewMsg_AccessibilityDoDefaultAction, // message was processed and it can send addition notifications. IPC_MESSAGE_ROUTED0(ViewMsg_AccessibilityNotifications_ACK) -// Notification that the device's orientation has changed. -IPC_MESSAGE_ROUTED1(ViewMsg_DeviceOrientationUpdated, - ViewMsg_DeviceOrientationUpdated_Params) - // The response to ViewHostMsg_AsyncOpenFile. IPC_MESSAGE_ROUTED3(ViewMsg_AsyncOpenFile_ACK, base::PlatformFileError /* error_code */, @@ -2112,19 +2072,6 @@ IPC_SYNC_MESSAGE_CONTROL1_3(ViewHostMsg_LookupSharedWorker, IPC_MESSAGE_CONTROL1(ViewHostMsg_DocumentDetached, uint64 /* document_id */) -// A message sent to the browser on behalf of a renderer which wants to show -// a desktop notification. -IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowDesktopNotification, - ViewHostMsg_ShowNotification_Params) -IPC_MESSAGE_ROUTED1(ViewHostMsg_CancelDesktopNotification, - int /* notification_id */) -IPC_MESSAGE_ROUTED2(ViewHostMsg_RequestNotificationPermission, - GURL /* origin */, - int /* callback_context */) -IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_CheckNotificationPermission, - GURL /* source page */, - int /* permission_result */) - // Sent if the worker object has sent a ViewHostMsg_CreateDedicatedWorker // message and not received a ViewMsg_WorkerCreated reply, but in the // mean time it's destroyed. This tells the browser to not create the queued @@ -2266,39 +2213,6 @@ IPC_MESSAGE_CONTROL4(ViewHostMsg_SpellChecker_PlatformRequestTextCheck, int /* document tag */, string16 /* sentence */) -//--------------------------------------------------------------------------- -// Geolocation services messages - -// The |render_view_id| and |bridge_id| representing |host| is requesting -// permission to access geolocation position. -// This will be replied by ViewMsg_Geolocation_PermissionSet. -IPC_MESSAGE_CONTROL3(ViewHostMsg_Geolocation_RequestPermission, - int /* render_view_id */, - int /* bridge_id */, - GURL /* GURL of the frame requesting geolocation */) - -// The |render_view_id| and |bridge_id| representing |GURL| is cancelling its -// previous permission request to access geolocation position. -IPC_MESSAGE_CONTROL3(ViewHostMsg_Geolocation_CancelPermissionRequest, - int /* render_view_id */, - int /* bridge_id */, - GURL /* GURL of the frame */) - -// The |render_view_id| requests Geolocation service to start updating. -// This is an asynchronous call, and the browser process may eventually reply -// with the updated geoposition, or an error (access denied, location -// unavailable, etc.) -IPC_MESSAGE_CONTROL3(ViewHostMsg_Geolocation_StartUpdating, - int /* render_view_id */, - GURL /* GURL of the frame requesting geolocation */, - bool /* enable_high_accuracy */) - -// The |render_view_id| requests Geolocation service to stop updating. -// Note that the geolocation service may continue to fetch geolocation data -// for other origins. -IPC_MESSAGE_CONTROL1(ViewHostMsg_Geolocation_StopUpdating, - int /* render_view_id */) - // 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 @@ -2308,17 +2222,6 @@ IPC_MESSAGE_ROUTED3(ViewHostMsg_UpdateZoomLimits, int /* maximum_percent */, bool /* remember */) -//--------------------------------------------------------------------------- -// Device orientation services messages: - -// A RenderView requests to start receiving device orientation updates. -IPC_MESSAGE_CONTROL1(ViewHostMsg_DeviceOrientation_StartUpdating, - int /* render_view_id */) - -// A RenderView requests to stop receiving device orientation updates. -IPC_MESSAGE_CONTROL1(ViewHostMsg_DeviceOrientation_StopUpdating, - int /* render_view_id */) - // Suggest results ----------------------------------------------------------- IPC_MESSAGE_ROUTED3(ViewHostMsg_SetSuggestions, diff --git a/chrome/common/render_messages_params.cc b/chrome/common/render_messages_params.cc index f0fa5ea..e9a89c8 100644 --- a/chrome/common/render_messages_params.cc +++ b/chrome/common/render_messages_params.cc @@ -197,15 +197,6 @@ ViewHostMsg_CreateWorker_Params::ViewHostMsg_CreateWorker_Params() ViewHostMsg_CreateWorker_Params::~ViewHostMsg_CreateWorker_Params() { } -ViewHostMsg_ShowNotification_Params::ViewHostMsg_ShowNotification_Params() - : is_html(false), - direction(WebKit::WebTextDirectionDefault), - notification_id(0) { -} - -ViewHostMsg_ShowNotification_Params::~ViewHostMsg_ShowNotification_Params() { -} - ViewMsg_New_Params::ViewMsg_New_Params() : parent_window(0), view_id(0), @@ -233,20 +224,6 @@ ViewHostMsg_RunFileChooser_Params::ViewHostMsg_RunFileChooser_Params() ViewHostMsg_RunFileChooser_Params::~ViewHostMsg_RunFileChooser_Params() { } -ViewMsg_DeviceOrientationUpdated_Params:: - ViewMsg_DeviceOrientationUpdated_Params() - : can_provide_alpha(false), - alpha(0), - can_provide_beta(false), - beta(0), - can_provide_gamma(false), - gamma(0) { -} - -ViewMsg_DeviceOrientationUpdated_Params:: - ~ViewMsg_DeviceOrientationUpdated_Params() { -} - ViewHostMsg_DomMessage_Params::ViewHostMsg_DomMessage_Params() : request_id(0), has_callback(false), @@ -1191,60 +1168,6 @@ void ParamTraits<ViewHostMsg_CreateWorker_Params>::Log(const param_type& p, l->append(")"); } -void ParamTraits<ViewHostMsg_ShowNotification_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.origin); - WriteParam(m, p.is_html); - WriteParam(m, p.contents_url); - WriteParam(m, p.icon_url); - WriteParam(m, p.title); - WriteParam(m, p.body); - WriteParam(m, p.direction); - WriteParam(m, p.replace_id); - WriteParam(m, p.notification_id); -} - -bool ParamTraits<ViewHostMsg_ShowNotification_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->origin) && - ReadParam(m, iter, &p->is_html) && - ReadParam(m, iter, &p->contents_url) && - ReadParam(m, iter, &p->icon_url) && - ReadParam(m, iter, &p->title) && - ReadParam(m, iter, &p->body) && - ReadParam(m, iter, &p->direction) && - ReadParam(m, iter, &p->replace_id) && - ReadParam(m, iter, &p->notification_id); -} - -void ParamTraits<ViewHostMsg_ShowNotification_Params>::Log( - const param_type &p, - std::string* l) { - l->append("("); - LogParam(p.origin, l); - l->append(", "); - LogParam(p.is_html, l); - l->append(", "); - LogParam(p.contents_url, l); - l->append(", "); - LogParam(p.icon_url, l); - l->append(", "); - LogParam(p.title, l); - l->append(","); - LogParam(p.body, l); - l->append(","); - LogParam(p.direction, l); - l->append(","); - LogParam(p.replace_id, l); - l->append(","); - LogParam(p.notification_id, l); - l->append(")"); -} - void ParamTraits<ViewMsg_New_Params>::Write(Message* m, const param_type& p) { WriteParam(m, p.parent_window); WriteParam(m, p.renderer_preferences); @@ -1408,48 +1331,6 @@ void ParamTraits<ViewMsg_ExtensionLoaded_Params>::Log(const param_type& p, l->append(p.id); } -void ParamTraits<ViewMsg_DeviceOrientationUpdated_Params>::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.can_provide_alpha); - WriteParam(m, p.alpha); - WriteParam(m, p.can_provide_beta); - WriteParam(m, p.beta); - WriteParam(m, p.can_provide_gamma); - WriteParam(m, p.gamma); -} - -bool ParamTraits<ViewMsg_DeviceOrientationUpdated_Params>::Read( - const Message* m, - void** iter, - param_type* p) { - return - ReadParam(m, iter, &p->can_provide_alpha) && - ReadParam(m, iter, &p->alpha) && - ReadParam(m, iter, &p->can_provide_beta) && - ReadParam(m, iter, &p->beta) && - ReadParam(m, iter, &p->can_provide_gamma) && - ReadParam(m, iter, &p->gamma); -} - -void ParamTraits<ViewMsg_DeviceOrientationUpdated_Params>::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.can_provide_alpha, l); - l->append(", "); - LogParam(p.alpha, l); - l->append(", "); - LogParam(p.can_provide_beta, l); - l->append(", "); - LogParam(p.beta, l); - l->append(", "); - LogParam(p.can_provide_gamma, l); - l->append(", "); - LogParam(p.gamma, l); - l->append(")"); -} - void ParamTraits<ViewHostMsg_DomMessage_Params>::Write(Message* m, const param_type& p) { WriteParam(m, p.name); diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h index 2362d18..2736df5 100644 --- a/chrome/common/render_messages_params.h +++ b/chrome/common/render_messages_params.h @@ -28,7 +28,6 @@ #include "ipc/ipc_param_traits.h" #include "media/audio/audio_parameters.h" #include "net/base/host_port_pair.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" #include "webkit/glue/password_form.h" @@ -653,36 +652,6 @@ struct ViewHostMsg_CreateWorker_Params { int64 script_resource_appcache_id; }; -// Parameters for the message that creates a desktop notification. -struct ViewHostMsg_ShowNotification_Params { - ViewHostMsg_ShowNotification_Params(); - ~ViewHostMsg_ShowNotification_Params(); - - // URL which is the origin that created this notification. - GURL origin; - - // True if this is HTML - bool is_html; - - // URL which contains the HTML contents (if is_html is true), otherwise empty. - GURL contents_url; - - // Contents of the notification if is_html is false. - GURL icon_url; - string16 title; - string16 body; - - // Directionality of the notification. - WebKit::WebTextDirection direction; - - // ReplaceID if this notification should replace an existing one; may be - // empty if no replacement is called for. - string16 replace_id; - - // Notification ID for sending events back for this notification. - int notification_id; -}; - // Creates a new view via a control message since the view doesn't yet exist. struct ViewMsg_New_Params { ViewMsg_New_Params(); @@ -801,19 +770,6 @@ struct ViewMsg_ExtensionLoaded_Params { std::string id; }; -struct ViewMsg_DeviceOrientationUpdated_Params { - ViewMsg_DeviceOrientationUpdated_Params(); - ~ViewMsg_DeviceOrientationUpdated_Params(); - - // These fields have the same meaning as in device_orientation::Orientation. - bool can_provide_alpha; - double alpha; - bool can_provide_beta; - double beta; - bool can_provide_gamma; - double gamma; -}; - // Parameters structure for ViewHostMsg_ExtensionRequest. struct ViewHostMsg_DomMessage_Params { ViewHostMsg_DomMessage_Params(); @@ -1045,14 +1001,6 @@ struct ParamTraits<ViewHostMsg_CreateWorker_Params> { static void Log(const param_type& p, std::string* l); }; -template <> -struct ParamTraits<ViewHostMsg_ShowNotification_Params> { - typedef ViewHostMsg_ShowNotification_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<ViewMsg_New_Params> { typedef ViewMsg_New_Params param_type; @@ -1086,14 +1034,6 @@ struct ParamTraits<ViewMsg_ExtensionLoaded_Params> { }; template <> -struct ParamTraits<ViewMsg_DeviceOrientationUpdated_Params> { - typedef ViewMsg_DeviceOrientationUpdated_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_DomMessage_Params> { typedef ViewHostMsg_DomMessage_Params param_type; static void Write(Message* m, const param_type& p); diff --git a/chrome/common/webkit_param_traits.h b/chrome/common/webkit_param_traits.h index 8f7fb6b..6d66112 100644 --- a/chrome/common/webkit_param_traits.h +++ b/chrome/common/webkit_param_traits.h @@ -32,7 +32,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileError.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextInputType.h" namespace WebKit { @@ -153,11 +152,6 @@ struct ParamTraits<WebKit::WebCache::ResourceTypeStats> { }; template <> -struct SimilarTypeTraits<WebKit::WebTextDirection> { - typedef int Type; -}; - -template <> struct SimilarTypeTraits<WebKit::WebDragOperation> { typedef int Type; }; diff --git a/content/browser/device_orientation/message_filter.cc b/content/browser/device_orientation/message_filter.cc index 4cb7501..283fb31 100644 --- a/content/browser/device_orientation/message_filter.cc +++ b/content/browser/device_orientation/message_filter.cc @@ -5,13 +5,12 @@ #include "content/browser/device_orientation/message_filter.h" #include "base/scoped_ptr.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" #include "content/browser/browser_thread.h" #include "content/browser/device_orientation/orientation.h" #include "content/browser/device_orientation/provider.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_notification_task.h" +#include "content/common/device_orientation_messages.h" namespace device_orientation { @@ -60,7 +59,7 @@ MessageFilter::ObserverDelegate::~ObserverDelegate() { void MessageFilter::ObserverDelegate::OnOrientationUpdate( const Orientation& orientation) { - ViewMsg_DeviceOrientationUpdated_Params params; + DeviceOrientationMsg_Updated_Params params; params.can_provide_alpha = orientation.can_provide_alpha_; params.alpha = orientation.alpha_; params.can_provide_beta = orientation.can_provide_beta_; @@ -68,7 +67,7 @@ void MessageFilter::ObserverDelegate::OnOrientationUpdate( params.can_provide_gamma = orientation.can_provide_gamma_; params.gamma = orientation.gamma_; - sender_->Send(new ViewMsg_DeviceOrientationUpdated(render_view_id_, params)); + sender_->Send(new DeviceOrientationMsg_Updated(render_view_id_, params)); } bool MessageFilter::OnMessageReceived(const IPC::Message& message, @@ -76,10 +75,8 @@ bool MessageFilter::OnMessageReceived(const IPC::Message& message, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(MessageFilter, message, *message_was_ok) - IPC_MESSAGE_HANDLER(ViewHostMsg_DeviceOrientation_StartUpdating, - OnStartUpdating) - IPC_MESSAGE_HANDLER(ViewHostMsg_DeviceOrientation_StopUpdating, - OnStopUpdating) + IPC_MESSAGE_HANDLER(DeviceOrientationHostMsg_StartUpdating, OnStartUpdating) + IPC_MESSAGE_HANDLER(DeviceOrientationHostMsg_StopUpdating, OnStopUpdating) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; diff --git a/content/browser/geolocation/geolocation_dispatcher_host.cc b/content/browser/geolocation/geolocation_dispatcher_host.cc index 33193d3..4f28934 100644 --- a/content/browser/geolocation/geolocation_dispatcher_host.cc +++ b/content/browser/geolocation/geolocation_dispatcher_host.cc @@ -8,12 +8,12 @@ #include <set> #include <utility> -#include "chrome/common/render_messages.h" #include "content/browser/geolocation/geolocation_permission_context.h" #include "content/browser/geolocation/geolocation_provider.h" #include "content/browser/renderer_host/render_message_filter.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/common/geolocation_messages.h" #include "content/common/geoposition.h" namespace { @@ -85,14 +85,12 @@ bool GeolocationDispatcherHostImpl::OnMessageReceived( *msg_was_ok = true; bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(GeolocationDispatcherHostImpl, msg, *msg_was_ok) - IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_CancelPermissionRequest, + IPC_MESSAGE_HANDLER(GeolocationHostMsg_CancelPermissionRequest, OnCancelPermissionRequest) - IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_RequestPermission, + IPC_MESSAGE_HANDLER(GeolocationHostMsg_RequestPermission, OnRequestPermission) - IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_StartUpdating, - OnStartUpdating) - IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_StopUpdating, - OnStopUpdating) + IPC_MESSAGE_HANDLER(GeolocationHostMsg_StartUpdating, OnStartUpdating) + IPC_MESSAGE_HANDLER(GeolocationHostMsg_StopUpdating, OnStopUpdating) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -103,7 +101,7 @@ void GeolocationDispatcherHostImpl::OnLocationUpdate( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); for (std::set<int>::iterator it = geolocation_renderer_ids_.begin(); it != geolocation_renderer_ids_.end(); ++it) { - Send(new ViewMsg_Geolocation_PositionUpdated(*it, geoposition)); + Send(new GeolocationMsg_PositionUpdated(*it, geoposition)); } } diff --git a/content/browser/geolocation/geolocation_permission_context.h b/content/browser/geolocation/geolocation_permission_context.h index ed86c70..2507a69 100644 --- a/content/browser/geolocation/geolocation_permission_context.h +++ b/content/browser/geolocation/geolocation_permission_context.h @@ -21,14 +21,14 @@ class TabContents; // GeolocationPermissionContext manages Geolocation permissions flow, // and delegates UI handling via GeolocationInfoBarQueueController. // It always notifies the requesting render_view asynchronously via -// ViewMsg_Geolocation_PermissionSet. +// GeolocationMsg_PermissionSet. class GeolocationPermissionContext : public base::RefCountedThreadSafe<GeolocationPermissionContext> { public: explicit GeolocationPermissionContext(Profile* profile); // The render is requesting permission to use Geolocation. - // Response will be sent asynchronously as ViewMsg_Geolocation_PermissionSet. + // Response will be sent asynchronously as GeolocationMsg_PermissionSet. void RequestGeolocationPermission( int render_process_id, int render_view_id, int bridge_id, const GURL& requesting_frame); @@ -39,7 +39,7 @@ class GeolocationPermissionContext const GURL& requesting_frame); // Notifies whether or not the corresponding bridge is allowed to use - // geolocation via ViewMsg_Geolocation_PermissionSet. + // geolocation via GeolocationMsg_PermissionSet. void NotifyPermissionSet( int render_process_id, int render_view_id, int bridge_id, const GURL& requesting_frame, bool allowed); diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 7683d4f..05cbb2b 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -45,6 +45,7 @@ #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/renderer_host/render_view_host_notification_task.h" #include "content/browser/renderer_host/render_widget_helper.h" +#include "content/common/desktop_notification_messages.h" #include "content/common/notification_service.h" #include "ipc/ipc_channel_handle.h" #include "net/base/cookie_monster.h" @@ -364,7 +365,7 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message, IPC_MESSAGE_HANDLER(ViewHostMsg_RendererHistograms, OnRendererHistograms) IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_UpdateRect, render_widget_helper_->DidReceiveUpdateMsg(message)) - IPC_MESSAGE_HANDLER(ViewHostMsg_CheckNotificationPermission, + IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_CheckPermission, OnCheckNotificationPermission) IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateSharedMemoryBuffer, diff --git a/content/common/common_param_traits.h b/content/common/common_param_traits.h index 6559440..3f7d0b3 100644 --- a/content/common/common_param_traits.h +++ b/content/common/common_param_traits.h @@ -23,6 +23,7 @@ #include "net/base/ip_endpoint.h" #include "net/url_request/url_request_status.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" #include "ui/gfx/native_widget_types.h" #include "webkit/blob/blob_data.h" #include "webkit/glue/npruntime_util.h" @@ -378,6 +379,11 @@ struct ParamTraits<TransportDIB::Id> { }; #endif +template <> +struct SimilarTypeTraits<WebKit::WebTextDirection> { + typedef int Type; +}; + } // namespace IPC #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h index d6ac72f36..f244c90 100644 --- a/content/common/content_message_generator.h +++ b/content/common/content_message_generator.h @@ -8,9 +8,12 @@ #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" +#include "content/common/device_orientation_messages.h" #include "content/common/dom_storage_messages.h" #include "content/common/file_system_messages.h" #include "content/common/file_utilities_messages.h" +#include "content/common/geolocation_messages.h" #include "content/common/gpu_messages.h" #include "content/common/indexed_db_messages.h" #include "content/common/mime_registry_messages.h" diff --git a/content/common/desktop_notification_messages.h b/content/common/desktop_notification_messages.h new file mode 100644 index 0000000..c8642e9 --- /dev/null +++ b/content/common/desktop_notification_messages.h @@ -0,0 +1,80 @@ +// 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. + +// IPC messages for desktop notification. +// Multiply-included message file, hence no include guard. + +#include "ipc/ipc_message_macros.h" +#include "googleurl/src/gurl.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" + +#define IPC_MESSAGE_START DesktopNotificationMsgStart + +IPC_STRUCT_BEGIN(DesktopNotificationHostMsg_Show_Params) + // URL which is the origin that created this notification. + IPC_STRUCT_MEMBER(GURL, origin) + + // True if this is HTML + IPC_STRUCT_MEMBER(bool, is_html) + + // URL which contains the HTML contents (if is_html is true), otherwise empty. + IPC_STRUCT_MEMBER(GURL, contents_url) + + // Contents of the notification if is_html is false. + IPC_STRUCT_MEMBER(GURL, icon_url) + IPC_STRUCT_MEMBER(string16, title) + IPC_STRUCT_MEMBER(string16, body) + + // Directionality of the notification. + IPC_STRUCT_MEMBER(WebKit::WebTextDirection, direction) + + // ReplaceID if this notification should replace an existing one) may be + // empty if no replacement is called for. + IPC_STRUCT_MEMBER(string16, replace_id) + + // Notification ID for sending events back for this notification. + IPC_STRUCT_MEMBER(int, notification_id) +IPC_STRUCT_END() + +// Messages sent from the browser to the renderer. + +// Used to inform the renderer that the browser has displayed its +// requested notification. +IPC_MESSAGE_ROUTED1(DesktopNotificationMsg_PostDisplay, + int /* notification_id */) + +// Used to inform the renderer that the browser has encountered an error +// trying to display a notification. +IPC_MESSAGE_ROUTED2(DesktopNotificationMsg_PostError, + int /* notification_id */, + string16 /* message */) + +// Informs the renderer that the one if its notifications has closed. +IPC_MESSAGE_ROUTED2(DesktopNotificationMsg_PostClose, + int /* notification_id */, + bool /* by_user */) + +// Informs the renderer that one of its notifications was clicked on. +IPC_MESSAGE_ROUTED1(DesktopNotificationMsg_PostClick, + int /* notification_id */) + +// Informs the renderer that the one if its notifications has closed. +IPC_MESSAGE_ROUTED1(DesktopNotificationMsg_PermissionRequestDone, + int /* request_id */) + +// Messages sent from the renderer to the browser. + +IPC_MESSAGE_ROUTED1(DesktopNotificationHostMsg_Show, + DesktopNotificationHostMsg_Show_Params) + +IPC_MESSAGE_ROUTED1(DesktopNotificationHostMsg_Cancel, + int /* notification_id */) + +IPC_MESSAGE_ROUTED2(DesktopNotificationHostMsg_RequestPermission, + GURL /* origin */, + int /* callback_context */) + +IPC_SYNC_MESSAGE_ROUTED1_1(DesktopNotificationHostMsg_CheckPermission, + GURL /* source page */, + int /* permission_result */) diff --git a/content/common/device_orientation_messages.h b/content/common/device_orientation_messages.h new file mode 100644 index 0000000..acd9122 --- /dev/null +++ b/content/common/device_orientation_messages.h @@ -0,0 +1,36 @@ +// 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. + +// IPC messages for device orientation. +// Multiply-included message file, hence no include guard. + +#include "ipc/ipc_message_macros.h" + +#define IPC_MESSAGE_START DeviceOrientationMsgStart + +IPC_STRUCT_BEGIN(DeviceOrientationMsg_Updated_Params) + // These fields have the same meaning as in device_orientation::Orientation. + IPC_STRUCT_MEMBER(bool, can_provide_alpha) + IPC_STRUCT_MEMBER(double, alpha) + IPC_STRUCT_MEMBER(bool, can_provide_beta) + IPC_STRUCT_MEMBER(double, beta) + IPC_STRUCT_MEMBER(bool, can_provide_gamma) + IPC_STRUCT_MEMBER(double, gamma) +IPC_STRUCT_END() + +// Messages sent from the browser to the renderer. + +// Notification that the device's orientation has changed. +IPC_MESSAGE_ROUTED1(DeviceOrientationMsg_Updated, + DeviceOrientationMsg_Updated_Params) + +// Messages sent from the renderer to the browser. + +// A RenderView requests to start receiving device orientation updates. +IPC_MESSAGE_CONTROL1(DeviceOrientationHostMsg_StartUpdating, + int /* render_view_id */) + +// A RenderView requests to stop receiving device orientation updates. +IPC_MESSAGE_CONTROL1(DeviceOrientationHostMsg_StopUpdating, + int /* render_view_id */) diff --git a/content/common/geolocation_messages.h b/content/common/geolocation_messages.h new file mode 100644 index 0000000..b945de5 --- /dev/null +++ b/content/common/geolocation_messages.h @@ -0,0 +1,72 @@ +// 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. + +// IPC messages for geolocation. +// Multiply-included message file, hence no include guard. + +#include "content/common/geoposition.h" +#include "googleurl/src/gurl.h" +#include "ipc/ipc_message_macros.h" + +#define IPC_MESSAGE_START GeolocationMsgStart + +IPC_ENUM_TRAITS(Geoposition::ErrorCode) + +IPC_STRUCT_TRAITS_BEGIN(Geoposition) + IPC_STRUCT_TRAITS_MEMBER(latitude) + IPC_STRUCT_TRAITS_MEMBER(longitude) + IPC_STRUCT_TRAITS_MEMBER(altitude) + IPC_STRUCT_TRAITS_MEMBER(accuracy) + IPC_STRUCT_TRAITS_MEMBER(altitude_accuracy) + IPC_STRUCT_TRAITS_MEMBER(heading) + IPC_STRUCT_TRAITS_MEMBER(speed) + IPC_STRUCT_TRAITS_MEMBER(timestamp) + IPC_STRUCT_TRAITS_MEMBER(error_code) + IPC_STRUCT_TRAITS_MEMBER(error_message) +IPC_STRUCT_TRAITS_END() + +// Messages sent from the browser to the renderer. + +// Reply in response to GeolocationHostMsg_RequestPermission. +IPC_MESSAGE_ROUTED2(GeolocationMsg_PermissionSet, + int /* bridge_id */, + bool /* is_allowed */) + +// Sent after GeolocationHostMsg_StartUpdating iff the user has granted +// permission and we have a position available or an error occurs (such as +// permission denied, position unavailable, etc.) +IPC_MESSAGE_ROUTED1(GeolocationMsg_PositionUpdated, + Geoposition /* geoposition */) + +// Messages sent from the renderer to the browser. + +// The |render_view_id| and |bridge_id| representing |host| is requesting +// permission to access geolocation position. +// This will be replied by GeolocationMsg_PermissionSet. +IPC_MESSAGE_CONTROL3(GeolocationHostMsg_RequestPermission, + int /* render_view_id */, + int /* bridge_id */, + GURL /* GURL of the frame requesting geolocation */) + +// The |render_view_id| and |bridge_id| representing |GURL| is cancelling its +// previous permission request to access geolocation position. +IPC_MESSAGE_CONTROL3(GeolocationHostMsg_CancelPermissionRequest, + int /* render_view_id */, + int /* bridge_id */, + GURL /* GURL of the frame */) + +// The |render_view_id| requests Geolocation service to start updating. +// This is an asynchronous call, and the browser process may eventually reply +// with the updated geoposition, or an error (access denied, location +// unavailable, etc.) +IPC_MESSAGE_CONTROL3(GeolocationHostMsg_StartUpdating, + int /* render_view_id */, + GURL /* GURL of the frame requesting geolocation */, + bool /* enable_high_accuracy */) + +// The |render_view_id| requests Geolocation service to stop updating. +// Note that the geolocation service may continue to fetch geolocation data +// for other origins. +IPC_MESSAGE_CONTROL1(GeolocationHostMsg_StopUpdating, + int /* render_view_id */) diff --git a/content/content_common.gypi b/content/content_common.gypi index 45ea981..89dcf5f 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -60,6 +60,8 @@ 'common/db_message_filter.h', 'common/debug_flags.cc', 'common/debug_flags.h', + 'common/desktop_notification_messages.h', + 'common/device_orientation_messages.h', 'common/dom_storage_common.h', 'common/dom_storage_messages.h', 'common/dx_diag_node.cc', @@ -87,6 +89,7 @@ 'common/font_loader_mac.mm', 'common/gpu_feature_flags.cc', 'common/gpu_feature_flags.h', + 'common/geolocation_messages.h', 'common/geoposition.cc', 'common/geoposition.h', 'common/gpu_info.cc', diff --git a/content/renderer/content_renderer_client.cc b/content/renderer/content_renderer_client.cc index b06acad..96a53f6 100644 --- a/content/renderer/content_renderer_client.cc +++ b/content/renderer/content_renderer_client.cc @@ -4,6 +4,8 @@ #include "content/renderer/content_renderer_client.h" +#include "content/renderer/render_view.h" + namespace content { SkBitmap* ContentRendererClient::GetSadPluginBitmap() { @@ -18,7 +20,7 @@ WebKit::WebPlugin* ContentRendererClient::CreatePlugin( RenderView* render_view, WebKit::WebFrame* frame, const WebKit::WebPluginParams& params) { - return NULL; + return render_view->CreatePluginNoCheck(frame, params); } std::string ContentRendererClient::GetNavigationErrorHtml( diff --git a/content/renderer/device_orientation_dispatcher.cc b/content/renderer/device_orientation_dispatcher.cc index 309a3e8..0ffe827 100644 --- a/content/renderer/device_orientation_dispatcher.cc +++ b/content/renderer/device_orientation_dispatcher.cc @@ -4,8 +4,7 @@ #include "content/renderer/device_orientation_dispatcher.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" +#include "content/common/device_orientation_messages.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientation.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientationController.h" @@ -24,7 +23,7 @@ DeviceOrientationDispatcher::~DeviceOrientationDispatcher() { bool DeviceOrientationDispatcher::OnMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(DeviceOrientationDispatcher, msg) - IPC_MESSAGE_HANDLER(ViewMsg_DeviceOrientationUpdated, + IPC_MESSAGE_HANDLER(DeviceOrientationMsg_Updated, OnDeviceOrientationUpdated) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -37,12 +36,12 @@ void DeviceOrientationDispatcher::setController( } void DeviceOrientationDispatcher::startUpdating() { - Send(new ViewHostMsg_DeviceOrientation_StartUpdating(routing_id())); + Send(new DeviceOrientationHostMsg_StartUpdating(routing_id())); started_ = true; } void DeviceOrientationDispatcher::stopUpdating() { - Send(new ViewHostMsg_DeviceOrientation_StopUpdating(routing_id())); + Send(new DeviceOrientationHostMsg_StopUpdating(routing_id())); started_ = false; } @@ -55,7 +54,7 @@ WebKit::WebDeviceOrientation DeviceOrientationDispatcher::lastOrientation() } namespace { -bool OrientationsEqual(const ViewMsg_DeviceOrientationUpdated_Params& a, +bool OrientationsEqual(const DeviceOrientationMsg_Updated_Params& a, WebKit::WebDeviceOrientation* b) { if (a.can_provide_alpha != b->canProvideAlpha()) return false; @@ -75,8 +74,7 @@ bool OrientationsEqual(const ViewMsg_DeviceOrientationUpdated_Params& a, } // namespace void DeviceOrientationDispatcher::OnDeviceOrientationUpdated( - const ViewMsg_DeviceOrientationUpdated_Params& p) { - + const DeviceOrientationMsg_Updated_Params& p) { if (last_orientation_.get() && OrientationsEqual(p, last_orientation_.get())) return; diff --git a/content/renderer/device_orientation_dispatcher.h b/content/renderer/device_orientation_dispatcher.h index 9421b41..44b4b62 100644 --- a/content/renderer/device_orientation_dispatcher.h +++ b/content/renderer/device_orientation_dispatcher.h @@ -10,9 +10,11 @@ #include "base/scoped_ptr.h" #include "content/renderer/render_view_observer.h" -namespace WebKit { class WebDeviceOrientation; } +namespace WebKit { +class WebDeviceOrientation; +} -struct ViewMsg_DeviceOrientationUpdated_Params; +struct DeviceOrientationMsg_Updated_Params; class DeviceOrientationDispatcher : public RenderViewObserver, public WebKit::WebDeviceOrientationClient { @@ -32,7 +34,7 @@ class DeviceOrientationDispatcher : public RenderViewObserver, virtual WebKit::WebDeviceOrientation lastOrientation() const; void OnDeviceOrientationUpdated( - const ViewMsg_DeviceOrientationUpdated_Params& p); + const DeviceOrientationMsg_Updated_Params& p); scoped_ptr<WebKit::WebDeviceOrientationController> controller_; scoped_ptr<WebKit::WebDeviceOrientation> last_orientation_; diff --git a/content/renderer/geolocation_dispatcher.cc b/content/renderer/geolocation_dispatcher.cc index 0934aad..bcacbab 100644 --- a/content/renderer/geolocation_dispatcher.cc +++ b/content/renderer/geolocation_dispatcher.cc @@ -4,13 +4,14 @@ #include "content/renderer/geolocation_dispatcher.h" -#include "chrome/common/render_messages.h" +#include "content/common/geolocation_messages.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationPermissionRequest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationPermissionRequestManager.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationPosition.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationError.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" using namespace WebKit; @@ -26,10 +27,8 @@ GeolocationDispatcher::~GeolocationDispatcher() {} bool GeolocationDispatcher::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(GeolocationDispatcher, message) - IPC_MESSAGE_HANDLER(ViewMsg_Geolocation_PermissionSet, - OnGeolocationPermissionSet) - IPC_MESSAGE_HANDLER(ViewMsg_Geolocation_PositionUpdated, - OnGeolocationPositionUpdated) + IPC_MESSAGE_HANDLER(GeolocationMsg_PermissionSet, OnPermissionSet) + IPC_MESSAGE_HANDLER(GeolocationMsg_PositionUpdated, OnPositionUpdated) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -42,13 +41,13 @@ void GeolocationDispatcher::geolocationDestroyed() { void GeolocationDispatcher::startUpdating() { GURL url; - Send(new ViewHostMsg_Geolocation_StartUpdating( + Send(new GeolocationHostMsg_StartUpdating( routing_id(), url, enable_high_accuracy_)); updating_ = true; } void GeolocationDispatcher::stopUpdating() { - Send(new ViewHostMsg_Geolocation_StopUpdating(routing_id())); + Send(new GeolocationHostMsg_StopUpdating(routing_id())); updating_ = false; } @@ -83,7 +82,7 @@ void GeolocationDispatcher::requestPermission( const WebGeolocationPermissionRequest& permissionRequest) { int bridge_id = pending_permissions_->add(permissionRequest); string16 origin = permissionRequest.securityOrigin().toString(); - Send(new ViewHostMsg_Geolocation_RequestPermission( + Send(new GeolocationHostMsg_RequestPermission( routing_id(), bridge_id, GURL(origin))); } @@ -95,13 +94,12 @@ void GeolocationDispatcher::cancelPermissionRequest( if (!pending_permissions_->remove(permissionRequest, bridge_id)) return; string16 origin = permissionRequest.securityOrigin().toString(); - Send(new ViewHostMsg_Geolocation_CancelPermissionRequest( + Send(new GeolocationHostMsg_CancelPermissionRequest( routing_id(), bridge_id, GURL(origin))); } // Permission for using geolocation has been set. -void GeolocationDispatcher::OnGeolocationPermissionSet( - int bridge_id, bool is_allowed) { +void GeolocationDispatcher::OnPermissionSet(int bridge_id, bool is_allowed) { WebGeolocationPermissionRequest permissionRequest; if (!pending_permissions_->remove(bridge_id, permissionRequest)) return; @@ -109,8 +107,7 @@ void GeolocationDispatcher::OnGeolocationPermissionSet( } // We have an updated geolocation position or error code. -void GeolocationDispatcher::OnGeolocationPositionUpdated( - const Geoposition& geoposition) { +void GeolocationDispatcher::OnPositionUpdated(const Geoposition& geoposition) { // It is possible for the browser process to have queued an update message // before receiving the stop updating message. if (!updating_) diff --git a/content/renderer/geolocation_dispatcher.h b/content/renderer/geolocation_dispatcher.h index 3f70853..27731f6 100644 --- a/content/renderer/geolocation_dispatcher.h +++ b/content/renderer/geolocation_dispatcher.h @@ -47,10 +47,10 @@ class GeolocationDispatcher : public RenderViewObserver, const WebKit::WebGeolocationPermissionRequest& permissionRequest); // Permission for using geolocation has been set. - void OnGeolocationPermissionSet(int bridge_id, bool is_allowed); + void OnPermissionSet(int bridge_id, bool is_allowed); // We have an updated geolocation position or error code. - void OnGeolocationPositionUpdated(const Geoposition& geoposition); + void OnPositionUpdated(const Geoposition& geoposition); // The controller_ is valid for the lifetime of the underlying // WebCore::GeolocationController. geolocationDestroyed() is diff --git a/content/renderer/notification_provider.cc b/content/renderer/notification_provider.cc index 816f4ca..5beb8e1 100644 --- a/content/renderer/notification_provider.cc +++ b/content/renderer/notification_provider.cc @@ -6,10 +6,10 @@ #include "base/string_util.h" #include "base/task.h" -#include "chrome/common/render_messages.h" -#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" +#include "chrome/common/render_messages.h" #include "chrome/renderer/render_thread.h" +#include "content/common/desktop_notification_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/WebFrame.h" @@ -46,7 +46,7 @@ void NotificationProvider::cancel(const WebNotification& notification) { bool id_found = manager_.GetId(notification, id); // Won't be found if the notification has already been closed by the user. if (id_found) - Send(new ViewHostMsg_CancelDesktopNotification(routing_id(), id)); + Send(new DesktopNotificationHostMsg_Cancel(routing_id(), id)); } void NotificationProvider::objectDestroyed( @@ -61,7 +61,7 @@ void NotificationProvider::objectDestroyed( WebNotificationPresenter::Permission NotificationProvider::checkPermission( const WebURL& url) { int permission; - Send(new ViewHostMsg_CheckNotificationPermission( + Send(new DesktopNotificationHostMsg_CheckPermission( routing_id(), url, &permission)); @@ -77,19 +77,18 @@ void NotificationProvider::requestPermission( int id = manager_.RegisterPermissionRequest(callback); - Send(new ViewHostMsg_RequestNotificationPermission(routing_id(), - GURL(origin.toString()), - id)); + Send(new DesktopNotificationHostMsg_RequestPermission( + routing_id(), GURL(origin.toString()), id)); } bool NotificationProvider::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(NotificationProvider, message) - IPC_MESSAGE_HANDLER(ViewMsg_PostDisplayToNotificationObject, OnDisplay); - IPC_MESSAGE_HANDLER(ViewMsg_PostErrorToNotificationObject, OnError); - IPC_MESSAGE_HANDLER(ViewMsg_PostCloseToNotificationObject, OnClose); - IPC_MESSAGE_HANDLER(ViewMsg_PostClickToNotificationObject, OnClick); - IPC_MESSAGE_HANDLER(ViewMsg_PermissionRequestDone, + IPC_MESSAGE_HANDLER(DesktopNotificationMsg_PostDisplay, OnDisplay); + IPC_MESSAGE_HANDLER(DesktopNotificationMsg_PostError, OnError); + IPC_MESSAGE_HANDLER(DesktopNotificationMsg_PostClose, OnClose); + IPC_MESSAGE_HANDLER(DesktopNotificationMsg_PostClick, OnClick); + IPC_MESSAGE_HANDLER(DesktopNotificationMsg_PermissionRequestDone, OnPermissionRequestComplete); IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -112,20 +111,20 @@ bool NotificationProvider::ShowHTML(const WebNotification& notification, return false; DCHECK(notification.isHTML()); - ViewHostMsg_ShowNotification_Params params; + DesktopNotificationHostMsg_Show_Params params; params.origin = GURL(render_view()->webview()->mainFrame()->url()).GetOrigin(); params.is_html = true; params.contents_url = notification.url(); params.notification_id = id; params.replace_id = notification.replaceId(); - return Send(new ViewHostMsg_ShowDesktopNotification(routing_id(), params)); + return Send(new DesktopNotificationHostMsg_Show(routing_id(), params)); } bool NotificationProvider::ShowText(const WebNotification& notification, int id) { DCHECK(!notification.isHTML()); - ViewHostMsg_ShowNotification_Params params; + DesktopNotificationHostMsg_Show_Params params; params.is_html = false; params.origin = GURL( render_view()->webview()->mainFrame()->url()).GetOrigin(); @@ -135,7 +134,7 @@ bool NotificationProvider::ShowText(const WebNotification& notification, params.direction = notification.direction(); params.notification_id = id; params.replace_id = notification.replaceId(); - return Send(new ViewHostMsg_ShowDesktopNotification(routing_id(), params)); + return Send(new DesktopNotificationHostMsg_Show(routing_id(), params)); } void NotificationProvider::OnDisplay(int id) { diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index 612693b..73b97d9 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -2629,11 +2629,8 @@ void RenderView::runModal() { WebPlugin* RenderView::createPlugin(WebFrame* frame, const WebPluginParams& params) { - WebPlugin* plugin = content::GetContentClient()->renderer()->CreatePlugin( + return content::GetContentClient()->renderer()->CreatePlugin( this, frame, params); - if (!plugin) - plugin = CreatePluginNoCheck(frame, params); - return plugin; } WebWorker* RenderView::createWorker(WebFrame* frame, WebWorkerClient* client) { diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 16c51cb..5b06486 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -77,6 +77,9 @@ enum IPCMessageStart { ClipboardMsgStart, BlobMsgStart, AppCacheMsgStart, + DeviceOrientationMsgStart, + DesktopNotificationMsgStart, + GeolocationMsgStart, LastIPCMsgStart // Must come last. }; |