diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 22:15:34 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 22:15:34 +0000 |
commit | f5494d49ab74e3d116540b14db3457558f54c88e (patch) | |
tree | beb367c01c187652d02091a5067a69d5bc0fa064 | |
parent | a9f39a313b7ecc11d98727d869e15094481f3a65 (diff) | |
download | chromium_src-f5494d49ab74e3d116540b14db3457558f54c88e.zip chromium_src-f5494d49ab74e3d116540b14db3457558f54c88e.tar.gz chromium_src-f5494d49ab74e3d116540b14db3457558f54c88e.tar.bz2 |
Clean up Automation and Chrome Frame IPC code.-only use routed messages when needed-use routing IDs to avoid manually unpacking messages-remove data structures from IPC namespace (that should only be used for IPC code, and param traits)Note that I temporarily commented out part of a test in external_tab_test.cc because I couldn't figure out how to get the updated gmock macros to compile.
Review URL: http://codereview.chromium.org/5998006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70105 0039d316-1c4b-4281-b951-d872f2087c98
58 files changed, 1855 insertions, 2144 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 0e3aa72..e4e1909 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -198,7 +198,7 @@ void AutomationProvider::SetExpectedTabCount(size_t expected_tabs) { void AutomationProvider::OnInitialLoadsComplete() { initial_loads_complete_ = true; if (is_connected_) - Send(new AutomationMsg_InitialLoadsComplete(0)); + Send(new AutomationMsg_InitialLoadsComplete()); } NotificationObserver* AutomationProvider::AddNavigationStatusListener( @@ -353,9 +353,9 @@ void AutomationProvider::OnChannelConnected(int pid) { // Send a hello message with our current automation protocol version. chrome::VersionInfo version_info; - channel_->Send(new AutomationMsg_Hello(0, version_info.Version())); + channel_->Send(new AutomationMsg_Hello(version_info.Version())); if (initial_loads_complete_) - Send(new AutomationMsg_InitialLoadsComplete(0)); + Send(new AutomationMsg_InitialLoadsComplete()); } void AutomationProvider::OnMessageReceived(const IPC::Message& message) { diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 797d8b08..40b9bce 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -34,13 +34,13 @@ #include "views/event.h" #endif // defined(OS_WIN) -struct AutomationMsg_Find_Params; class PopupMenuWaiter; class TabContents; - -namespace IPC { +struct AutomationMsg_Find_Params; struct Reposition_Params; struct ExternalTabSettings; + +namespace IPC { class ChannelProxy; } @@ -355,11 +355,11 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, bool restore_focus_to_view); void OnTabReposition(int tab_handle, - const IPC::Reposition_Params& params); + const Reposition_Params& params); void OnForwardContextMenuCommandToChrome(int tab_handle, int command); - void CreateExternalTab(const IPC::ExternalTabSettings& settings, + void CreateExternalTab(const ExternalTabSettings& settings, gfx::NativeWindow* tab_container_window, gfx::NativeWindow* tab_window, int* tab_handle, diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index 480a8ec..1b6973d 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -164,7 +164,7 @@ void NewTabUILoadObserver::Observe(NotificationType type, if (type == NotificationType::INITIAL_NEW_TAB_UI_LOAD) { Details<int> load_time(details); automation_->Send( - new AutomationMsg_InitialNewTabUILoadComplete(0, *load_time.ptr())); + new AutomationMsg_InitialNewTabUILoadComplete(*load_time.ptr())); } else { NOTREACHED(); } diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index 7ff2bff..0ad5400 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -230,7 +230,7 @@ void AutomationProvider::WindowSimulateDrag(int handle, } void AutomationProvider::CreateExternalTab( - const IPC::ExternalTabSettings& settings, + const ExternalTabSettings& settings, gfx::NativeWindow* tab_container_window, gfx::NativeWindow* tab_window, int* tab_handle, int* session_id) { TRACE_EVENT_BEGIN("AutomationProvider::CreateExternalTab", 0, ""); @@ -318,7 +318,7 @@ ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { } void AutomationProvider::OnTabReposition( - int tab_handle, const IPC::Reposition_Params& params) { + int tab_handle, const Reposition_Params& params) { if (!tab_tracker_->ContainsHandle(tab_handle)) return; diff --git a/chrome/browser/automation/automation_resource_message_filter.cc b/chrome/browser/automation/automation_resource_message_filter.cc index 500b62b..5d3ac14 100644 --- a/chrome/browser/automation/automation_resource_message_filter.cc +++ b/chrome/browser/automation/automation_resource_message_filter.cc @@ -407,7 +407,7 @@ bool AutomationResourceMessageFilter::SendDownloadRequestToHost( return false; } - return Send(new AutomationMsg_DownloadRequestInHost(0, tab_handle, + return Send(new AutomationMsg_DownloadRequestInHost(tab_handle, automation_request_id)); } @@ -459,7 +459,7 @@ bool AutomationResourceMessageFilter::GetCookiesForUrl( if (automation_details_iter->second.filter) { automation_details_iter->second.filter->Send( new AutomationMsg_GetCookiesFromHost( - 0, automation_details_iter->second.tab_handle, url, + automation_details_iter->second.tab_handle, url, completion_callback_id)); } return true; @@ -530,7 +530,7 @@ bool AutomationResourceMessageFilter::SetCookiesForUrl( if (automation_details_iter->second.filter) { automation_details_iter->second.filter->Send( new AutomationMsg_SetCookieAsync( - 0, automation_details_iter->second.tab_handle, url, cookie_line)); + automation_details_iter->second.tab_handle, url, cookie_line)); } return true; diff --git a/chrome/browser/automation/automation_resource_tracker.cc b/chrome/browser/automation/automation_resource_tracker.cc index 2cce41a..82c384a 100644 --- a/chrome/browser/automation/automation_resource_tracker.cc +++ b/chrome/browser/automation/automation_resource_tracker.cc @@ -78,7 +78,7 @@ void AutomationResourceTrackerImpl::HandleCloseNotification( return; sender_->Send( - new AutomationMsg_InvalidateHandle(0, resource_to_handle_[resource])); + new AutomationMsg_InvalidateHandle(resource_to_handle_[resource])); RemoveImpl(resource); } diff --git a/chrome/browser/automation/extension_port_container.cc b/chrome/browser/automation/extension_port_container.cc index d79900d..d1fb46f 100644 --- a/chrome/browser/automation/extension_port_container.cc +++ b/chrome/browser/automation/extension_port_container.cc @@ -40,7 +40,7 @@ bool ExtensionPortContainer::PostResponseToExternalPort( const std::string& message) { return automation_->Send( new AutomationMsg_ForwardMessageToExternalHost( - 0, tab_handle_, message, ext::kAutomationOrigin, + tab_handle_, message, ext::kAutomationOrigin, ext::kAutomationPortResponseTarget)); } @@ -48,7 +48,7 @@ bool ExtensionPortContainer::PostMessageToExternalPort( const std::string& message) { return automation_->Send( new AutomationMsg_ForwardMessageToExternalHost( - 0, tab_handle_, message, + tab_handle_, message, ext::kAutomationOrigin, ext::kAutomationPortRequestTarget)); } diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 9ecc0ef..78afce1 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -218,15 +218,12 @@ void TestingAutomationProvider::OnMessageReceived( IPC_MESSAGE_HANDLER(AutomationMsg_DeleteCookie, DeleteCookie) IPC_MESSAGE_HANDLER(AutomationMsg_ShowCollectedCookiesDialog, ShowCollectedCookiesDialog) - IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_NavigateToURL, NavigateToURL) IPC_MESSAGE_HANDLER_DELAY_REPLY( AutomationMsg_NavigateToURLBlockUntilNavigationsComplete, NavigateToURLBlockUntilNavigationsComplete) IPC_MESSAGE_HANDLER(AutomationMsg_NavigationAsync, NavigationAsync) IPC_MESSAGE_HANDLER(AutomationMsg_NavigationAsyncWithDisposition, NavigationAsyncWithDisposition) - IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_GoBack, GoBack) - IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_GoForward, GoForward) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_Reload, Reload) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_SetAuth, SetAuth) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CancelAuth, CancelAuth) @@ -281,7 +278,6 @@ void TestingAutomationProvider::OnMessageReceived( AutocompleteEditGetMatches) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForAutocompleteEditFocus, WaitForAutocompleteEditFocus) - IPC_MESSAGE_HANDLER(AutomationMsg_ApplyAccelerator, ApplyAccelerator) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_DomOperation, ExecuteJavascript) IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedWindowCount, @@ -298,8 +294,6 @@ void TestingAutomationProvider::OnMessageReceived( IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_InspectElement, HandleInspectElementRequest) IPC_MESSAGE_HANDLER(AutomationMsg_DownloadDirectory, GetDownloadDirectory) - IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_OpenNewBrowserWindow, - OpenNewBrowserWindow) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_OpenNewBrowserWindowOfType, OpenNewBrowserWindowOfType) IPC_MESSAGE_HANDLER(AutomationMsg_WindowForBrowser, GetWindowForBrowser) @@ -569,12 +563,6 @@ void TestingAutomationProvider::ShowCollectedCookiesDialog( } } -void TestingAutomationProvider::NavigateToURL(int handle, - const GURL& url, - IPC::Message* reply_message) { - NavigateToURLBlockUntilNavigationsComplete(handle, url, 1, reply_message); -} - void TestingAutomationProvider::NavigateToURLBlockUntilNavigationsComplete( int handle, const GURL& url, int number_of_navigations, IPC::Message* reply_message) { @@ -595,7 +583,7 @@ void TestingAutomationProvider::NavigateToURLBlockUntilNavigationsComplete( } } - AutomationMsg_NavigateToURL::WriteReplyParams( + AutomationMsg_NavigateToURLBlockUntilNavigationsComplete::WriteReplyParams( reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); Send(reply_message); } @@ -629,40 +617,6 @@ void TestingAutomationProvider::NavigationAsyncWithDisposition( } } -void TestingAutomationProvider::GoBack(int handle, - IPC::Message* reply_message) { - if (tab_tracker_->ContainsHandle(handle)) { - NavigationController* tab = tab_tracker_->GetResource(handle); - Browser* browser = FindAndActivateTab(tab); - if (browser && browser->command_updater()->IsCommandEnabled(IDC_BACK)) { - AddNavigationStatusListener(tab, reply_message, 1, false); - browser->GoBack(CURRENT_TAB); - return; - } - } - - AutomationMsg_GoBack::WriteReplyParams( - reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); - Send(reply_message); -} - -void TestingAutomationProvider::GoForward(int handle, - IPC::Message* reply_message) { - if (tab_tracker_->ContainsHandle(handle)) { - NavigationController* tab = tab_tracker_->GetResource(handle); - Browser* browser = FindAndActivateTab(tab); - if (browser && browser->command_updater()->IsCommandEnabled(IDC_FORWARD)) { - AddNavigationStatusListener(tab, reply_message, 1, false); - browser->GoForward(CURRENT_TAB); - return; - } - } - - AutomationMsg_GoForward::WriteReplyParams( - reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); - Send(reply_message); -} - void TestingAutomationProvider::Reload(int handle, IPC::Message* reply_message) { if (tab_tracker_->ContainsHandle(handle)) { @@ -1148,11 +1102,6 @@ void TestingAutomationProvider::AutocompleteEditIsQueryInProgress( } } -void TestingAutomationProvider::ApplyAccelerator(int handle, int id) { - LOG(ERROR) << "ApplyAccelerator has been deprecated. " - << "Please use ExecuteBrowserCommandAsync instead."; -} - void TestingAutomationProvider::ExecuteJavascript( int handle, const std::wstring& frame_xpath, @@ -1218,12 +1167,6 @@ void TestingAutomationProvider::GetDownloadDirectory( } } -void TestingAutomationProvider::OpenNewBrowserWindow( - bool show, IPC::Message* reply_message) { - OpenNewBrowserWindowOfType(static_cast<int>(Browser::TYPE_NORMAL), show, - reply_message); -} - void TestingAutomationProvider::OpenNewBrowserWindowOfType( int type, bool show, IPC::Message* reply_message) { new BrowserOpenedNotificationObserver(this, reply_message); diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index 8be1a11..57f9572 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -75,7 +75,6 @@ class TestingAutomationProvider : public AutomationProvider, void DeleteCookie(const GURL& url, const std::string& cookie_name, int handle, bool* success); void ShowCollectedCookiesDialog(int handle, bool* success); - void NavigateToURL(int handle, const GURL& url, IPC::Message* reply_message); void NavigateToURLBlockUntilNavigationsComplete(int handle, const GURL& url, int number_of_navigations, IPC::Message* reply_message); @@ -84,8 +83,6 @@ class TestingAutomationProvider : public AutomationProvider, const GURL& url, WindowOpenDisposition disposition, bool* status); - void GoBack(int handle, IPC::Message* reply_message); - void GoForward(int handle, IPC::Message* reply_message); void Reload(int handle, IPC::Message* reply_message); void SetAuth(int tab_handle, const std::wstring& username, const std::wstring& password, IPC::Message* reply_message); @@ -162,9 +159,6 @@ class TestingAutomationProvider : public AutomationProvider, void WaitForAutocompleteEditFocus(int autocomplete_edit_handle, IPC::Message* reply_message); - // Deprecated. - void ApplyAccelerator(int handle, int id); - void ExecuteJavascript(int handle, const std::wstring& frame_xpath, const std::wstring& script, @@ -197,7 +191,6 @@ class TestingAutomationProvider : public AutomationProvider, void GetDownloadDirectory(int handle, FilePath* download_directory); // If |show| is true, call Show() on the new window after creating it. - void OpenNewBrowserWindow(bool show, IPC::Message* reply_message); void OpenNewBrowserWindowOfType(int type, bool show, IPC::Message* reply_message); diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc index c120286..7e2bc57 100644 --- a/chrome/browser/automation/url_request_automation_job.cc +++ b/chrome/browser/automation/url_request_automation_job.cc @@ -148,7 +148,7 @@ void URLRequestAutomationJob::Start() { void URLRequestAutomationJob::Kill() { if (message_filter_.get()) { if (!is_pending()) { - message_filter_->Send(new AutomationMsg_RequestEnd(0, tab_, id_, + message_filter_->Send(new AutomationMsg_RequestEnd(tab_, id_, URLRequestStatus(URLRequestStatus::CANCELED, net::ERR_ABORTED))); } } @@ -168,8 +168,7 @@ bool URLRequestAutomationJob::ReadRawData( pending_buf_size_ = buf_size; if (message_filter_) { - message_filter_->Send(new AutomationMsg_RequestRead(0, tab_, id_, - buf_size)); + message_filter_->Send(new AutomationMsg_RequestRead(tab_, id_, buf_size)); SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); } else { MessageLoop::current()->PostTask( @@ -241,11 +240,8 @@ bool URLRequestAutomationJob::MayFilterMessage(const IPC::Message& message, case AutomationMsg_RequestData::ID: case AutomationMsg_RequestEnd::ID: { void* iter = NULL; - int tab = 0; - if (message.ReadInt(&iter, &tab) && - message.ReadInt(&iter, request_id)) { + if (message.ReadInt(&iter, request_id)) return true; - } break; } } @@ -268,8 +264,8 @@ void URLRequestAutomationJob::OnMessage(const IPC::Message& message) { IPC_END_MESSAGE_MAP() } -void URLRequestAutomationJob::OnRequestStarted(int tab, int id, - const IPC::AutomationURLResponse& response) { +void URLRequestAutomationJob::OnRequestStarted( + int id, const AutomationURLResponse& response) { DVLOG(1) << "URLRequestAutomationJob: " << request_->url().spec() << " - response started."; set_expected_content_size(response.content_length); @@ -289,7 +285,7 @@ void URLRequestAutomationJob::OnRequestStarted(int tab, int id, } void URLRequestAutomationJob::OnDataAvailable( - int tab, int id, const std::string& bytes) { + int id, const std::string& bytes) { DVLOG(1) << "URLRequestAutomationJob: " << request_->url().spec() << " - data available, Size: " << bytes.size(); DCHECK(!bytes.empty()); @@ -313,7 +309,7 @@ void URLRequestAutomationJob::OnDataAvailable( } void URLRequestAutomationJob::OnRequestEnd( - int tab, int id, const URLRequestStatus& status) { + int id, const URLRequestStatus& status) { #ifndef NDEBUG std::string url; if (request_) @@ -436,7 +432,7 @@ void URLRequestAutomationJob::StartAsync() { } // Ask automation to start this request. - IPC::AutomationURLRequest automation_request( + AutomationURLRequest automation_request( request_->url().spec(), request_->method(), referrer.spec(), @@ -446,8 +442,8 @@ void URLRequestAutomationJob::StartAsync() { request_->load_flags()); DCHECK(message_filter_); - message_filter_->Send(new AutomationMsg_RequestStart(0, tab_, id_, - automation_request)); + message_filter_->Send(new AutomationMsg_RequestStart( + tab_, id_, automation_request)); } void URLRequestAutomationJob::DisconnectFromMessageFilter() { diff --git a/chrome/browser/automation/url_request_automation_job.h b/chrome/browser/automation/url_request_automation_job.h index 0c930ba..9256a77 100644 --- a/chrome/browser/automation/url_request_automation_job.h +++ b/chrome/browser/automation/url_request_automation_job.h @@ -13,6 +13,7 @@ #include "net/url_request/url_request_job.h" class AutomationResourceMessageFilter; +struct AutomationURLResponse; namespace net { class HttpResponseHeaders; @@ -21,7 +22,6 @@ class HttpResponseInfo; namespace IPC { class Message; -struct AutomationURLResponse; } // net::URLRequestJob implementation that loads the resources using @@ -81,10 +81,9 @@ class URLRequestAutomationJob : public net::URLRequestJob { void DisconnectFromMessageFilter(); // IPC message handlers. - void OnRequestStarted(int tab, int id, - const IPC::AutomationURLResponse& response); - void OnDataAvailable(int tab, int id, const std::string& bytes); - void OnRequestEnd(int tab, int id, const URLRequestStatus& status); + void OnRequestStarted(int id, const AutomationURLResponse& response); + void OnDataAvailable(int id, const std::string& bytes); + void OnRequestEnd(int id, const URLRequestStatus& status); private: virtual ~URLRequestAutomationJob(); diff --git a/chrome/browser/extensions/extension_uitest.cc b/chrome/browser/extensions/extension_uitest.cc index bc25d75..9ead4ed 100644 --- a/chrome/browser/extensions/extension_uitest.cc +++ b/chrome/browser/extensions/extension_uitest.cc @@ -126,13 +126,13 @@ TEST_F(ExtensionTestSimpleApiCall, FLAKY_RunTest) { namespace keys = extension_automation_constants; ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(1); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(1); + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); std::string message_received; EXPECT_CALL(*mock_, OnForwardMessageToExternalHost( - _, _, keys::kAutomationOrigin, keys::kAutomationRequestTarget)) + _, keys::kAutomationOrigin, keys::kAutomationRequestTarget)) .WillOnce(DoAll( SaveArg<1>(&message_received), InvokeWithoutArgs( @@ -277,13 +277,13 @@ TEST_F(ExtensionTestRoundtripApiCall, FLAKY_RunTest) { namespace keys = extension_automation_constants; ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(1); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(1); + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); EXPECT_CALL(*mock_, OnForwardMessageToExternalHost( - _, _, keys::kAutomationOrigin, keys::kAutomationRequestTarget)) + _, keys::kAutomationOrigin, keys::kAutomationRequestTarget)) .Times(2) .WillRepeatedly(WithArgs<1>(Invoke( CreateFunctor(this, @@ -465,14 +465,14 @@ TEST_F(ExtensionTestBrowserEvents, FLAKY_RunTest) { namespace keys = extension_automation_constants; ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(1); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(1); + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); EXPECT_CALL(*mock_, OnForwardMessageToExternalHost( - _, _, keys::kAutomationOrigin, _)) - .WillRepeatedly(WithArgs<1, 3>(Invoke( + _, keys::kAutomationOrigin, _)) + .WillRepeatedly(WithArgs<1, 2>(Invoke( CreateFunctor(this, &ExtensionTestBrowserEvents::HandleMessageFromChrome)))); diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index f2f3e83..976d27d 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -344,7 +344,7 @@ void ExternalTabContainer::OpenURLFromTab(TabContents* source, case NEW_WINDOW: case SAVE_TO_DISK: if (automation_) { - automation_->Send(new AutomationMsg_OpenURL(0, tab_handle_, + automation_->Send(new AutomationMsg_OpenURL(tab_handle_, url, referrer, disposition)); // TODO(ananta) @@ -374,10 +374,10 @@ void ExternalTabContainer::OpenURLFromTab(TabContents* source, void ExternalTabContainer::NavigationStateChanged(const TabContents* source, unsigned changed_flags) { if (automation_) { - IPC::NavigationInfo nav_info; + NavigationInfo nav_info; if (InitNavigationInfo(&nav_info, NavigationType::NAV_IGNORE, 0)) automation_->Send(new AutomationMsg_NavigationStateChanged( - 0, tab_handle_, changed_flags, nav_info)); + tab_handle_, changed_flags, nav_info)); } } @@ -432,14 +432,14 @@ void ExternalTabContainer::AddNewContents(TabContents* source, uintptr_t cookie = reinterpret_cast<uintptr_t>(new_container.get()); pending_tabs_.Get()[cookie] = new_container; new_container->set_pending(true); - IPC::AttachExternalTabParams attach_params_; + AttachExternalTabParams attach_params_; attach_params_.cookie = static_cast<uint64>(cookie); attach_params_.dimensions = initial_pos; attach_params_.user_gesture = user_gesture; attach_params_.disposition = disposition; attach_params_.profile_name = WideToUTF8( tab_contents()->profile()->GetPath().DirName().BaseName().value()); - automation_->Send(new AutomationMsg_AttachExternalTab(0, + automation_->Send(new AutomationMsg_AttachExternalTab( tab_handle_, attach_params_)); } else { NOTREACHED(); @@ -479,7 +479,7 @@ void ExternalTabContainer::CloseContents(TabContents* source) { automation_->Send(unload_reply_message_); unload_reply_message_ = NULL; } else { - automation_->Send(new AutomationMsg_CloseExternalTab(0, tab_handle_)); + automation_->Send(new AutomationMsg_CloseExternalTab(tab_handle_)); } } @@ -496,7 +496,7 @@ void ExternalTabContainer::UpdateTargetURL(TabContents* source, if (automation_) { std::wstring url_string = CA2W(url.spec().c_str()); automation_->Send( - new AutomationMsg_UpdateTargetUrl(0, tab_handle_, url_string)); + new AutomationMsg_UpdateTargetUrl(tab_handle_, url_string)); } } @@ -511,9 +511,8 @@ void ExternalTabContainer::ForwardMessageToExternalHost( const std::string& message, const std::string& origin, const std::string& target) { if (automation_) { - automation_->Send( - new AutomationMsg_ForwardMessageToExternalHost(0, tab_handle_, - message, origin, target)); + automation_->Send(new AutomationMsg_ForwardMessageToExternalHost( + tab_handle_, message, origin, target)); } } @@ -527,7 +526,7 @@ gfx::NativeWindow ExternalTabContainer::GetFrameNativeWindow() { bool ExternalTabContainer::TakeFocus(bool reverse) { if (automation_) { - automation_->Send(new AutomationMsg_TabbedOut(0, tab_handle_, + automation_->Send(new AutomationMsg_TabbedOut(tab_handle_, win_util::IsShiftPressed())); } @@ -622,7 +621,7 @@ bool ExternalTabContainer::HandleContextMenu(const ContextMenuParams& params) { POINT screen_pt = { params.x, params.y }; MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1); - IPC::MiniContextMenuParams ipc_params( + MiniContextMenuParams ipc_params( screen_pt.x, screen_pt.y, params.link_url, @@ -633,7 +632,7 @@ bool ExternalTabContainer::HandleContextMenu(const ContextMenuParams& params) { bool rtl = base::i18n::IsRTL(); automation_->Send( - new AutomationMsg_ForwardContextMenuToExternalHost(0, tab_handle_, + new AutomationMsg_ForwardContextMenuToExternalHost(tab_handle_, external_context_menu_->GetMenuHandle(), rtl ? TPM_RIGHTALIGN : TPM_LEFTALIGN, ipc_params)); @@ -728,7 +727,7 @@ void ExternalTabContainer::Observe(NotificationType type, if (load != NULL && PageTransition::IsMainFrame(load->origin())) { TRACE_EVENT_END("ExternalTabContainer::Navigate", 0, load->url().spec()); - automation_->Send(new AutomationMsg_TabLoaded(0, tab_handle_, + automation_->Send(new AutomationMsg_TabLoaded(tab_handle_, load->url())); } break; @@ -745,18 +744,18 @@ void ExternalTabContainer::Observe(NotificationType type, if (commit->http_status_code >= kHttpClientErrorStart && commit->http_status_code <= kHttpServerErrorEnd) { automation_->Send(new AutomationMsg_NavigationFailed( - 0, tab_handle_, commit->http_status_code, commit->entry->url())); + tab_handle_, commit->http_status_code, commit->entry->url())); ignore_next_load_notification_ = true; } else { - IPC::NavigationInfo navigation_info; + NavigationInfo navigation_info; // When the previous entry index is invalid, it will be -1, which // will still make the computation come out right (navigating to the // 0th entry will be +1). if (InitNavigationInfo(&navigation_info, commit->type, commit->previous_entry_index - tab_contents_->controller().last_committed_entry_index())) - automation_->Send(new AutomationMsg_DidNavigate(0, tab_handle_, + automation_->Send(new AutomationMsg_DidNavigate(tab_handle_, navigation_info)); } break; @@ -765,7 +764,7 @@ void ExternalTabContainer::Observe(NotificationType type, const ProvisionalLoadDetails* load_details = Details<ProvisionalLoadDetails>(details).ptr(); automation_->Send(new AutomationMsg_NavigationFailed( - 0, tab_handle_, load_details->error_code(), load_details->url())); + tab_handle_, load_details->error_code(), load_details->url())); ignore_next_load_notification_ = true; break; @@ -860,11 +859,11 @@ bool ExternalTabContainer::ProcessUnhandledKeyStroke(HWND window, msg.message = message; msg.wParam = wparam; msg.lParam = lparam; - automation_->Send(new AutomationMsg_HandleAccelerator(0, tab_handle_, msg)); + automation_->Send(new AutomationMsg_HandleAccelerator(tab_handle_, msg)); return true; } -bool ExternalTabContainer::InitNavigationInfo(IPC::NavigationInfo* nav_info, +bool ExternalTabContainer::InitNavigationInfo(NavigationInfo* nav_info, NavigationType::Type nav_type, int relative_offset) { DCHECK(nav_info); @@ -990,7 +989,7 @@ void ExternalTabContainer::Navigate(const GURL& url, const GURL& referrer) { bool ExternalTabContainer::OnGoToEntryOffset(int offset) { if (load_requests_via_automation_) { automation_->Send(new AutomationMsg_RequestGoToHistoryEntryOffset( - 0, tab_handle_, offset)); + tab_handle_, offset)); return false; } diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h index 9821c4b..f08f364 100644 --- a/chrome/browser/external_tab_container_win.h +++ b/chrome/browser/external_tab_container_win.h @@ -29,15 +29,12 @@ class AutomationProvider; class Profile; class TabContentsContainer; class RenderViewContextMenuViews; +struct NavigationInfo; namespace app { class ViewProp; } -namespace IPC { -struct NavigationInfo; -} - // This class serves as the container window for an external tab. // An external tab is a Chrome tab that is meant to displayed in an // external process. This class provides the FocusManger needed by the @@ -225,7 +222,7 @@ class ExternalTabContainer : public TabContentsDelegate, virtual void OnDestroy(); virtual void OnFinalMessage(HWND window); - bool InitNavigationInfo(IPC::NavigationInfo* nav_info, + bool InitNavigationInfo(NavigationInfo* nav_info, NavigationType::Type nav_type, int relative_offset); void Navigate(const GURL& url, const GURL& referrer); diff --git a/chrome/common/automation_messages.cc b/chrome/common/automation_messages.cc index b472f13..8dcac0e 100644 --- a/chrome/common/automation_messages.cc +++ b/chrome/common/automation_messages.cc @@ -5,6 +5,167 @@ #define IPC_MESSAGE_IMPL #include "chrome/common/automation_messages.h" + +AutomationURLRequest::AutomationURLRequest() + : resource_type(0), + load_flags(0) { +} + +AutomationURLRequest::AutomationURLRequest( + const std::string& in_url, + const std::string& in_method, + const std::string& in_referrer, + const std::string& in_extra_request_headers, + scoped_refptr<net::UploadData> in_upload_data, + int in_resource_type, + int in_load_flags) + : url(in_url), + method(in_method), + referrer(in_referrer), + extra_request_headers(in_extra_request_headers), + upload_data(in_upload_data), + resource_type(in_resource_type), + load_flags(in_load_flags) { +} + +AutomationURLRequest::~AutomationURLRequest() {} + +AutomationURLResponse::AutomationURLResponse() + : content_length(0), + redirect_status(0) { +} + +AutomationURLResponse::AutomationURLResponse(const std::string& in_mime_type, + const std::string& in_headers, + int64 in_content_length, + const base::Time& in_last_modified, + const std::string& in_redirect_url, + int in_redirect_status) + : mime_type(in_mime_type), + headers(in_headers), + content_length(in_content_length), + last_modified(in_last_modified), + redirect_url(in_redirect_url), + redirect_status(in_redirect_status) { +} + + +AutomationURLResponse::~AutomationURLResponse() {} + +ExternalTabSettings::ExternalTabSettings() + : parent(NULL), + dimensions(), + style(0), + is_off_the_record(false), + load_requests_via_automation(false), + handle_top_level_requests(false), + initial_url(), + referrer(), + infobars_enabled(false), + route_all_top_level_navigations(false) { +} + +ExternalTabSettings::ExternalTabSettings( + gfx::NativeWindow in_parent, + const gfx::Rect& in_dimensions, + unsigned int in_style, + bool in_is_off_the_record, + bool in_load_requests_via_automation, + bool in_handle_top_level_requests, + const GURL& in_initial_url, + const GURL& in_referrer, + bool in_infobars_enabled, + bool in_route_all_top_level_navigations) + : parent(in_parent), + dimensions(in_dimensions), + style(in_style), + is_off_the_record(in_is_off_the_record), + load_requests_via_automation(in_load_requests_via_automation), + handle_top_level_requests(in_handle_top_level_requests), + initial_url(in_initial_url), + referrer(in_referrer), + infobars_enabled(in_infobars_enabled), + route_all_top_level_navigations(in_route_all_top_level_navigations) { +} + +ExternalTabSettings::~ExternalTabSettings() {} + +NavigationInfo::NavigationInfo() + : navigation_type(0), + relative_offset(0), + navigation_index(0), + displayed_insecure_content(0), + ran_insecure_content(0) { +} + +NavigationInfo::NavigationInfo(int in_navigation_type, + int in_relative_offset, + int in_navigation_index, + const std::wstring& in_title, + const GURL& in_url, + const GURL& in_referrer, + SecurityStyle in_security_style, + bool in_displayed_insecure_content, + bool in_ran_insecure_content) + : navigation_type(in_navigation_type), + relative_offset(in_relative_offset), + navigation_index(in_navigation_index), + title(in_title), + url(in_url), + referrer(in_referrer), + security_style(in_security_style), + displayed_insecure_content(in_displayed_insecure_content), + ran_insecure_content(in_ran_insecure_content) { +} + +NavigationInfo::~NavigationInfo() {} + +MiniContextMenuParams::MiniContextMenuParams() + : screen_x(0), + screen_y(0) { +} + +MiniContextMenuParams::MiniContextMenuParams(int in_screen_x, + int in_screen_y, + const GURL& in_link_url, + const GURL& in_unfiltered_link_url, + const GURL& in_src_url, + const GURL& in_page_url, + const GURL& in_frame_url) + : screen_x(in_screen_x), + screen_y(in_screen_y), + link_url(in_link_url), + unfiltered_link_url(in_unfiltered_link_url), + src_url(in_src_url), + page_url(in_page_url), + frame_url(in_frame_url) { +} + +MiniContextMenuParams::~MiniContextMenuParams() {} + +AttachExternalTabParams::AttachExternalTabParams() + : cookie(0), + disposition(0), + user_gesture(false) { +} + +AttachExternalTabParams::AttachExternalTabParams( + uint64 in_cookie, + const GURL& in_url, + const gfx::Rect& in_dimensions, + int in_disposition, + bool in_user_gesture, + const std::string& in_profile_name) + : cookie(in_cookie), + url(in_url), + dimensions(in_dimensions), + disposition(in_disposition), + user_gesture(in_user_gesture), + profile_name(in_profile_name) { +} + +AttachExternalTabParams::~AttachExternalTabParams() {} + namespace IPC { // static @@ -231,30 +392,6 @@ void ParamTraits<PageType>::Log(const param_type& p, std::string* l) { LogParam(control, l); } -AutomationURLRequest::AutomationURLRequest() - : resource_type(0), - load_flags(0) { -} - -AutomationURLRequest::AutomationURLRequest( - const std::string& in_url, - const std::string& in_method, - const std::string& in_referrer, - const std::string& in_extra_request_headers, - scoped_refptr<net::UploadData> in_upload_data, - int in_resource_type, - int in_load_flags) - : url(in_url), - method(in_method), - referrer(in_referrer), - extra_request_headers(in_extra_request_headers), - upload_data(in_upload_data), - resource_type(in_resource_type), - load_flags(in_load_flags) { -} - -AutomationURLRequest::~AutomationURLRequest() {} - // static void ParamTraits<AutomationURLRequest>::Write(Message* m, const param_type& p) { WriteParam(m, p.url); @@ -299,28 +436,6 @@ void ParamTraits<AutomationURLRequest>::Log(const param_type& p, l->append(")"); } -AutomationURLResponse::AutomationURLResponse() - : content_length(0), - redirect_status(0) { -} - -AutomationURLResponse::AutomationURLResponse(const std::string& in_mime_type, - const std::string& in_headers, - int64 in_content_length, - const base::Time& in_last_modified, - const std::string& in_redirect_url, - int in_redirect_status) - : mime_type(in_mime_type), - headers(in_headers), - content_length(in_content_length), - last_modified(in_last_modified), - redirect_url(in_redirect_url), - redirect_status(in_redirect_status) { -} - - -AutomationURLResponse::~AutomationURLResponse() {} - // static void ParamTraits<AutomationURLResponse>::Write(Message* m, const param_type& p) { @@ -362,44 +477,6 @@ void ParamTraits<AutomationURLResponse>::Log(const param_type& p, l->append(")"); } -ExternalTabSettings::ExternalTabSettings() - : parent(NULL), - dimensions(), - style(0), - is_off_the_record(false), - load_requests_via_automation(false), - handle_top_level_requests(false), - initial_url(), - referrer(), - infobars_enabled(false), - route_all_top_level_navigations(false) { -} - -ExternalTabSettings::ExternalTabSettings( - gfx::NativeWindow in_parent, - const gfx::Rect& in_dimensions, - unsigned int in_style, - bool in_is_off_the_record, - bool in_load_requests_via_automation, - bool in_handle_top_level_requests, - const GURL& in_initial_url, - const GURL& in_referrer, - bool in_infobars_enabled, - bool in_route_all_top_level_navigations) - : parent(in_parent), - dimensions(in_dimensions), - style(in_style), - is_off_the_record(in_is_off_the_record), - load_requests_via_automation(in_load_requests_via_automation), - handle_top_level_requests(in_handle_top_level_requests), - initial_url(in_initial_url), - referrer(in_referrer), - infobars_enabled(in_infobars_enabled), - route_all_top_level_navigations(in_route_all_top_level_navigations) { -} - -ExternalTabSettings::~ExternalTabSettings() {} - // static void ParamTraits<ExternalTabSettings>::Write(Message* m, const param_type& p) { @@ -457,36 +534,6 @@ void ParamTraits<ExternalTabSettings>::Log(const param_type& p, l->append(")"); } -NavigationInfo::NavigationInfo() - : navigation_type(0), - relative_offset(0), - navigation_index(0), - displayed_insecure_content(0), - ran_insecure_content(0) { -} - -NavigationInfo::NavigationInfo(int in_navigation_type, - int in_relative_offset, - int in_navigation_index, - const std::wstring& in_title, - const GURL& in_url, - const GURL& in_referrer, - SecurityStyle in_security_style, - bool in_displayed_insecure_content, - bool in_ran_insecure_content) - : navigation_type(in_navigation_type), - relative_offset(in_relative_offset), - navigation_index(in_navigation_index), - title(in_title), - url(in_url), - referrer(in_referrer), - security_style(in_security_style), - displayed_insecure_content(in_displayed_insecure_content), - ran_insecure_content(in_ran_insecure_content) { -} - -NavigationInfo::~NavigationInfo() {} - // static void ParamTraits<NavigationInfo>::Write(Message* m, const param_type& p) { WriteParam(m, p.navigation_type); @@ -538,29 +585,6 @@ void ParamTraits<NavigationInfo>::Log(const param_type& p, std::string* l) { l->append(")"); } -MiniContextMenuParams::MiniContextMenuParams() - : screen_x(0), - screen_y(0) { -} - -MiniContextMenuParams::MiniContextMenuParams(int in_screen_x, - int in_screen_y, - const GURL& in_link_url, - const GURL& in_unfiltered_link_url, - const GURL& in_src_url, - const GURL& in_page_url, - const GURL& in_frame_url) - : screen_x(in_screen_x), - screen_y(in_screen_y), - link_url(in_link_url), - unfiltered_link_url(in_unfiltered_link_url), - src_url(in_src_url), - page_url(in_page_url), - frame_url(in_frame_url) { -} - -MiniContextMenuParams::~MiniContextMenuParams() {} - // static void ParamTraits<MiniContextMenuParams>::Write(Message* m, const param_type& p) { @@ -606,29 +630,6 @@ void ParamTraits<MiniContextMenuParams>::Log(const param_type& p, l->append(")"); } -AttachExternalTabParams::AttachExternalTabParams() - : cookie(0), - disposition(0), - user_gesture(false) { -} - -AttachExternalTabParams::AttachExternalTabParams( - uint64 in_cookie, - const GURL& in_url, - const gfx::Rect& in_dimensions, - int in_disposition, - bool in_user_gesture, - const std::string& in_profile_name) - : cookie(in_cookie), - url(in_url), - dimensions(in_dimensions), - disposition(in_disposition), - user_gesture(in_user_gesture), - profile_name(in_profile_name) { -} - -AttachExternalTabParams::~AttachExternalTabParams() {} - // static void ParamTraits<AttachExternalTabParams>::Write(Message* m, const param_type& p) { diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h index ac3c4628..7a9ba91 100644 --- a/chrome/common/automation_messages.h +++ b/chrome/common/automation_messages.h @@ -34,6 +34,167 @@ struct AutomationMsg_Find_Params { bool find_next; }; +struct AutomationURLResponse { + AutomationURLResponse(); + AutomationURLResponse(const std::string& mime_type, + const std::string& headers, + int64 content_length, + const base::Time& last_modified, + const std::string& redirect_url, + int redirect_status); + ~AutomationURLResponse(); + + std::string mime_type; + std::string headers; + int64 content_length; + base::Time last_modified; + std::string redirect_url; + int redirect_status; +}; + +struct ExternalTabSettings { + ExternalTabSettings(); + ExternalTabSettings(gfx::NativeWindow parent, + const gfx::Rect& dimensions, + unsigned int style, + bool is_off_the_record, + bool load_requests_via_automation, + bool handle_top_level_requests, + const GURL& initial_url, + const GURL& referrer, + bool infobars_enabled, + bool route_all_top_level_navigations); + ~ExternalTabSettings(); + + gfx::NativeWindow parent; + gfx::Rect dimensions; + unsigned int style; + bool is_off_the_record; + bool load_requests_via_automation; + bool handle_top_level_requests; + GURL initial_url; + GURL referrer; + bool infobars_enabled; + bool route_all_top_level_navigations; +}; + +struct NavigationInfo { + NavigationInfo(); + NavigationInfo(int navigation_type, + int relative_offset, + int navigation_index, + const std::wstring& title, + const GURL& url, + const GURL& referrer, + SecurityStyle security_style, + bool displayed_insecure_content, + bool ran_insecure_content); + ~NavigationInfo(); + + int navigation_type; + int relative_offset; + int navigation_index; + std::wstring title; + GURL url; + GURL referrer; + SecurityStyle security_style; + bool displayed_insecure_content; + bool ran_insecure_content; +}; + +// A stripped down version of ContextMenuParams in webkit/glue/context_menu.h. +struct MiniContextMenuParams { + MiniContextMenuParams(); + MiniContextMenuParams(int screen_x, + int screen_y, + const GURL& link_url, + const GURL& unfiltered_link_url, + const GURL& src_url, + const GURL& page_url, + const GURL& frame_url); + ~MiniContextMenuParams(); + + // The x coordinate for displaying the menu. + int screen_x; + + // The y coordinate for displaying the menu. + int screen_y; + + // This is the URL of the link that encloses the node the context menu was + // invoked on. + GURL link_url; + + // The link URL to be used ONLY for "copy link address". We don't validate + // this field in the frontend process. + GURL unfiltered_link_url; + + // This is the source URL for the element that the context menu was + // invoked on. Example of elements with source URLs are img, audio, and + // video. + GURL src_url; + + // This is the URL of the top level page that the context menu was invoked + // on. + GURL page_url; + + // This is the URL of the subframe that the context menu was invoked on. + GURL frame_url; +}; + +struct AttachExternalTabParams { + AttachExternalTabParams(); + AttachExternalTabParams(uint64 cookie, + const GURL& url, + const gfx::Rect& dimensions, + int disposition, + bool user_gesture, + const std::string& profile_name); + ~AttachExternalTabParams(); + + uint64 cookie; + GURL url; + gfx::Rect dimensions; + int disposition; + bool user_gesture; + std::string profile_name; +}; + +#if defined(OS_WIN) + +struct Reposition_Params { + HWND window; + HWND window_insert_after; + int left; + int top; + int width; + int height; + int flags; + bool set_parent; + HWND parent_window; +}; + +#endif // defined(OS_WIN) + +struct AutomationURLRequest { + AutomationURLRequest(); + AutomationURLRequest(const std::string& url, + const std::string& method, + const std::string& referrer, + const std::string& extra_request_headers, + scoped_refptr<net::UploadData> upload_data, + int resource_type, + int load_flags); + ~AutomationURLRequest(); + + std::string url; + std::string method; + std::string referrer; + std::string extra_request_headers; + scoped_refptr<net::UploadData> upload_data; + int resource_type; // see webkit/glue/resource_type.h + int load_flags; // see net/base/load_flags.h +}; + namespace IPC { template <> @@ -85,17 +246,6 @@ struct ParamTraits<PageType> { }; #if defined(OS_WIN) -struct Reposition_Params { - HWND window; - HWND window_insert_after; - int left; - int top; - int width; - int height; - int flags; - bool set_parent; - HWND parent_window; -}; // Traits for SetWindowPos_Params structure to pack/unpack. template <> @@ -147,26 +297,6 @@ struct ParamTraits<Reposition_Params> { }; #endif // defined(OS_WIN) -struct AutomationURLRequest { - AutomationURLRequest(); - AutomationURLRequest(const std::string& url, - const std::string& method, - const std::string& referrer, - const std::string& extra_request_headers, - scoped_refptr<net::UploadData> upload_data, - int resource_type, - int load_flags); - ~AutomationURLRequest(); - - std::string url; - std::string method; - std::string referrer; - std::string extra_request_headers; - scoped_refptr<net::UploadData> upload_data; - int resource_type; // see webkit/glue/resource_type.h - int load_flags; // see net/base/load_flags.h -}; - // Traits for AutomationURLRequest structure to pack/unpack. template <> struct ParamTraits<AutomationURLRequest> { @@ -176,24 +306,6 @@ struct ParamTraits<AutomationURLRequest> { static void Log(const param_type& p, std::string* l); }; -struct AutomationURLResponse { - AutomationURLResponse(); - AutomationURLResponse(const std::string& mime_type, - const std::string& headers, - int64 content_length, - const base::Time& last_modified, - const std::string& redirect_url, - int redirect_status); - ~AutomationURLResponse(); - - std::string mime_type; - std::string headers; - int64 content_length; - base::Time last_modified; - std::string redirect_url; - int redirect_status; -}; - // Traits for AutomationURLResponse structure to pack/unpack. template <> struct ParamTraits<AutomationURLResponse> { @@ -203,32 +315,6 @@ struct ParamTraits<AutomationURLResponse> { static void Log(const param_type& p, std::string* l); }; -struct ExternalTabSettings { - ExternalTabSettings(); - ExternalTabSettings(gfx::NativeWindow parent, - const gfx::Rect& dimensions, - unsigned int style, - bool is_off_the_record, - bool load_requests_via_automation, - bool handle_top_level_requests, - const GURL& initial_url, - const GURL& referrer, - bool infobars_enabled, - bool route_all_top_level_navigations); - ~ExternalTabSettings(); - - gfx::NativeWindow parent; - gfx::Rect dimensions; - unsigned int style; - bool is_off_the_record; - bool load_requests_via_automation; - bool handle_top_level_requests; - GURL initial_url; - GURL referrer; - bool infobars_enabled; - bool route_all_top_level_navigations; -}; - // Traits for ExternalTabSettings structure to pack/unpack. template <> struct ParamTraits<ExternalTabSettings> { @@ -238,30 +324,6 @@ struct ParamTraits<ExternalTabSettings> { static void Log(const param_type& p, std::string* l); }; -struct NavigationInfo { - NavigationInfo(); - NavigationInfo(int navigation_type, - int relative_offset, - int navigation_index, - const std::wstring& title, - const GURL& url, - const GURL& referrer, - SecurityStyle security_style, - bool displayed_insecure_content, - bool ran_insecure_content); - ~NavigationInfo(); - - int navigation_type; - int relative_offset; - int navigation_index; - std::wstring title; - GURL url; - GURL referrer; - SecurityStyle security_style; - bool displayed_insecure_content; - bool ran_insecure_content; -}; - // Traits for NavigationInfo structure to pack/unpack. template <> struct ParamTraits<NavigationInfo> { @@ -271,45 +333,6 @@ struct ParamTraits<NavigationInfo> { static void Log(const param_type& p, std::string* l); }; -// A stripped down version of ContextMenuParams in webkit/glue/context_menu.h. -struct MiniContextMenuParams { - MiniContextMenuParams(); - MiniContextMenuParams(int screen_x, - int screen_y, - const GURL& link_url, - const GURL& unfiltered_link_url, - const GURL& src_url, - const GURL& page_url, - const GURL& frame_url); - ~MiniContextMenuParams(); - - // The x coordinate for displaying the menu. - int screen_x; - - // The y coordinate for displaying the menu. - int screen_y; - - // This is the URL of the link that encloses the node the context menu was - // invoked on. - GURL link_url; - - // The link URL to be used ONLY for "copy link address". We don't validate - // this field in the frontend process. - GURL unfiltered_link_url; - - // This is the source URL for the element that the context menu was - // invoked on. Example of elements with source URLs are img, audio, and - // video. - GURL src_url; - - // This is the URL of the top level page that the context menu was invoked - // on. - GURL page_url; - - // This is the URL of the subframe that the context menu was invoked on. - GURL frame_url; -}; - // Traits for MiniContextMenuParams structure to pack/unpack. template <> struct ParamTraits<MiniContextMenuParams> { @@ -319,24 +342,6 @@ struct ParamTraits<MiniContextMenuParams> { static void Log(const param_type& p, std::string* l); }; -struct AttachExternalTabParams { - AttachExternalTabParams(); - AttachExternalTabParams(uint64 cookie, - const GURL& url, - const gfx::Rect& dimensions, - int disposition, - bool user_gesture, - const std::string& profile_name); - ~AttachExternalTabParams(); - - uint64 cookie; - GURL url; - gfx::Rect dimensions; - int disposition; - bool user_gesture; - std::string profile_name; -}; - template <> struct ParamTraits<AttachExternalTabParams> { typedef AttachExternalTabParams param_type; diff --git a/chrome/common/automation_messages_internal.h b/chrome/common/automation_messages_internal.h index 1f6925c..a0a71ae 100644 --- a/chrome/common/automation_messages_internal.h +++ b/chrome/common/automation_messages_internal.h @@ -40,198 +40,178 @@ // chrome::VersionInfo::Version(). // The client can choose to use this version string to decide whether or not // it can talk to the provider. -IPC_MESSAGE_ROUTED1(AutomationMsg_Hello, std::string) +IPC_MESSAGE_CONTROL1(AutomationMsg_Hello, + std::string) // This message is fired when the initial tab(s) are finished loading. -IPC_MESSAGE_ROUTED0(AutomationMsg_InitialLoadsComplete) +IPC_MESSAGE_CONTROL0(AutomationMsg_InitialLoadsComplete) // This message notifies the AutomationProvider to append a new tab the // window with the given handle. The return value contains the index of // the new tab, or -1 if the request failed. // The second parameter is the url to be loaded in the new tab. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_AppendTab, int, GURL, int) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_AppendTab, + int, + GURL, + int) // This message requests the (zero-based) index for the currently // active tab in the window with the given handle. The return value contains // the index of the active tab, or -1 if the request failed. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ActiveTabIndex, int, int) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ActiveTabIndex, + int, + int) // This message notifies the AutomationProvider to active the tab. // The first parameter is the handle to window resource. // The second parameter is the (zero-based) index to be activated -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_ActivateTab, int, int, int) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_ActivateTab, + int, + int, + int) // This message requests the cookie value for given url in the // profile of the tab identified by the second parameter. The first // parameter is the URL string. The response contains the length of the // cookie value string. On failure, this length = -1. -IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_GetCookies, GURL, int, - int, std::string) +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_GetCookies, + GURL, + int, + int, + std::string) // This message notifies the AutomationProvider to set and broadcast a cookie // with given name and value for the given url in the profile of the tab // identified by the third parameter. The first parameter is the URL // string, and the second parameter is the cookie name and value to be set. // The return value is a non-negative value on success. -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetCookie, GURL, std::string, - int, int) - -// This message notifies the AutomationProvider to navigate to a specified -// url in the tab with given handle. The first parameter is the handle to -// the tab resource. The second parameter is the target url. The return -// value contains a status code which is nonnegative on success. -// See AutomationMsg_NavigationResponseValues for the return value. -// -// Deprecated in favor of -// AutomationMsg_NavigateToURLBlockUntilNavigationsComplete. -// TODO(phajdan.jr): Remove when the reference build gets updated. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_NavigateToURL, int, GURL, - AutomationMsg_NavigationResponseValues) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetCookie, + GURL, + std::string, + int, + int) // This message is used to implement the asynchronous version of // NavigateToURL. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_NavigationAsync, - int /* tab handle */, - GURL, - bool /* result */) - -// This message notifies the AutomationProvider to navigate back in session -// history in the tab with given handle. The first parameter is the handle -// to the tab resource. -// See AutomationMsg_NavigationResponseValues for the navigation response -// values. -// -// Deprecated in favor of AutomationMsg_GoBackBlockUntilNavigationsComplete. -// TODO(phajdan.jr): Remove when the reference build gets updated. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GoBack, int, - AutomationMsg_NavigationResponseValues) - -// This message notifies the AutomationProvider to navigate forward in session -// history in the tab with given handle. The first parameter is the handle -// to the tab resource. -// See AutomationMsg_NavigationResponseValues for the navigation response -// values. -// -// Deprecated in favor of -// AutomationMsg_GoForwardBlockUntilNavigationsComplete. -// TODO(phajdan.jr): Remove when the reference build gets updated. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GoForward, int, - AutomationMsg_NavigationResponseValues) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_NavigationAsync, + int /* tab handle */, + GURL, + bool /* result */) // This message requests the number of browser windows that the app currently // has open. The return value is the number of windows. -IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_BrowserWindowCount, int) +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_BrowserWindowCount, + int) // This message requests the handle (int64 app-unique identifier) of the // window with the given (zero-based) index. On error, the returned handle // value is 0. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_BrowserWindow, int, int) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BrowserWindow, + int, + int) // This message requests the number of tabs in the window with the given // handle. The return value contains the number of tabs, or -1 if the // request failed. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_TabCount, int, int) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabCount, + int, + int) // This message requests the handle of the tab with the given (zero-based) // index in the given app window. First parameter specifies the given window // handle, second specifies the given tab_index. On error, the returned handle // value is 0. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_Tab, int, int, int) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_Tab, + int, + int, + int) // This message requests the the title of the tab with the given handle. // The return value contains the size of the title string. On error, this // value should be -1 and empty string. Note that the title can be empty in // which case the size would be 0. -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_TabTitle, - int, - int, - std::wstring) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_TabTitle, + int, + int, + std::wstring) // This message requests the url of the tab with the given handle. // The return value contains a success flag and the URL string. The URL will // be empty on failure, and it still may be empty on success. -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_TabURL, - int /* tab handle */, - bool /* success flag */, - GURL) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_TabURL, + int /* tab handle */, + bool /* success flag */, + GURL) // This message notifies the AutomationProxy that a handle that it has // previously been given is now invalid. (For instance, if the handle // represented a window which has now been closed.) The parameter // value is the handle. -IPC_MESSAGE_ROUTED1(AutomationMsg_InvalidateHandle, int) +IPC_MESSAGE_CONTROL1(AutomationMsg_InvalidateHandle, + int) // This message notifies the AutomationProvider that a handle is no // longer being used, so it can stop paying attention to the // associated resource. The parameter value is the handle. -IPC_MESSAGE_ROUTED1(AutomationMsg_HandleUnused, int) +IPC_MESSAGE_CONTROL1(AutomationMsg_HandleUnused, + int) // This message tells the AutomationProvider to provide the given // authentication data to the specified tab, in response to an HTTP/FTP // authentication challenge. -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetAuth, - int, // tab handle - std::wstring, // username - std::wstring, // password - AutomationMsg_NavigationResponseValues) // status +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetAuth, + int /* tab handle */, + std::wstring /* username */, + std::wstring /* password */, + AutomationMsg_NavigationResponseValues /* status */) // This message tells the AutomationProvider to cancel the login in the // specified tab. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_CancelAuth, - int, // tab handle - AutomationMsg_NavigationResponseValues) // status +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_CancelAuth, + int /* tab handle */, + AutomationMsg_NavigationResponseValues /* status */) // Requests that the automation provider ask history for the most recent // chain of redirects coming from the given URL. The response must be // decoded by the caller manually; it contains an integer indicating the // number of URLs, followed by that many wstrings indicating a chain of // redirects. On failure, the count will be negative. -IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_RedirectsFrom, - int, // tab handle - GURL, // source URL - bool /* succeeded */, - std::vector<GURL> /* redirects */) +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_RedirectsFrom, + int /* tab handle */, + GURL /* source URL */, + bool /* succeeded */, + std::vector<GURL> /* redirects */) // This message asks the AutomationProvider whether a tab is waiting for // login info. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_NeedsAuth, - int, // tab handle - bool) // status - -// This message requests the AutomationProvider to apply a certain -// accelerator. It is completely asynchronous with the resulting accelerator -// action. -IPC_SYNC_MESSAGE_ROUTED2_0(AutomationMsg_ApplyAccelerator, - int, // window handle - int) // accelerator id like (IDC_BACK, - // IDC_FORWARD, etc) - // The list can be found at - // chrome/app/chrome_command_ids.h +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_NeedsAuth, + int /* tab handle */, + bool /* status */) // This message requests that the AutomationProvider executes a JavaScript, // which is sent embedded in a 'javascript:' URL. // The javascript is executed in context of child frame whose xpath // is passed as parameter (context_frame). The execution results in // a serialized JSON string response. -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_DomOperation, - int, // tab handle - std::wstring, // context_frame - std::wstring, // the javascript to be executed - std::string) // the serialized json string - // containing the result of a - // javascript execution +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_DomOperation, + int /* tab handle */, + std::wstring /* context_frame */, + std::wstring /* the javascript to be executed */, + std::string /* the serialized json string containg + the result of a javascript + execution */) // Is the Download Shelf visible for the specified browser? -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ShelfVisibility, - int /* browser_handle */, - bool /* is_visible */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ShelfVisibility, + int /* browser_handle */, + bool /* is_visible */) // This message requests the number of constrained windows in the tab with // the given handle. The return value contains the number of constrained // windows, or -1 if the request failed. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ConstrainedWindowCount, - int /* tab_handle */, - int /* constrained_window_count */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ConstrainedWindowCount, + int /* tab_handle */, + int /* constrained_window_count */) // This message requests the bounds of the specified View element in // window coordinates. @@ -243,8 +223,12 @@ IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ConstrainedWindowCount, // Response: // bool - true if the view was found // gfx::Rect - the bounds of the view, in window coordinates -IPC_SYNC_MESSAGE_ROUTED3_2(AutomationMsg_WindowViewBounds, int, int, - bool, bool, gfx::Rect) +IPC_SYNC_MESSAGE_CONTROL3_2(AutomationMsg_WindowViewBounds, + int, + int, + bool, + bool, + gfx::Rect) // This message sets the bounds of the window. // Request: @@ -252,10 +236,11 @@ IPC_SYNC_MESSAGE_ROUTED3_2(AutomationMsg_WindowViewBounds, int, int, // gfx::Rect - the bounds of the window // Response: // bool - true if the resize was successful -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_SetWindowBounds, int, gfx::Rect, - bool) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_SetWindowBounds, + int, + gfx::Rect, + bool) -#if defined(OS_WIN) // TODO(port): Port these messages. // // This message requests that a drag be performed in window coordinate space @@ -268,117 +253,101 @@ IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_SetWindowBounds, int, gfx::Rect, // defined in chrome/views/event.h // Response: // bool - true if the drag could be performed -IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_WindowDrag, - int, std::vector<gfx::Point>, int, bool, bool) -#endif // defined(OS_WIN) +IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_WindowDrag, + int, + std::vector<gfx::Point>, + int, + bool, + bool) // Similar to AutomationMsg_InitialLoadsComplete, this indicates that the // new tab ui has completed the initial load of its data. // Time is how many milliseconds the load took. -IPC_MESSAGE_ROUTED1(AutomationMsg_InitialNewTabUILoadComplete, +IPC_MESSAGE_CONTROL1(AutomationMsg_InitialNewTabUILoadComplete, int /* time */) -// This message starts a find within a tab corresponding to the supplied -// tab handle. The return value contains the number of matches found on the -// page within the tab specified. The parameter 'search_string' specifies -// what string to search for, 'forward' specifies whether to search in -// forward direction (1=forward, 0=back), 'match_case' specifies case -// sensitivity -// (1=case sensitive, 0=case insensitive). If an error occurs, matches_found -// will be -1. -// -// NOTE: This message has been deprecated, please use the new message -// AutomationMsg_Find below. -// -IPC_SYNC_MESSAGE_ROUTED4_2(AutomationMsg_FindInPage, // DEPRECATED. - int, /* tab_handle */ - std::wstring, /* find_request */ - int, /* forward */ - int /* match_case */, - int /* active_ordinal */, - int /* matches_found */) - // This message sends a inspect element request for a given tab. The response // contains the number of resources loaded by the inspector controller. -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_InspectElement, - int, /* tab_handle */ - int, /* x */ - int /* y */, - int) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_InspectElement, + int, /* tab_handle */ + int, /* x */ + int /* y */, + int) // This message requests the process ID of the tab that corresponds // to the given automation handle. // The return value has an integer corresponding to the PID of the tab's // renderer, 0 if the tab currently has no renderer process, or -1 on error. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_TabProcessID, - int /* tab_handle */, - int /* process ID */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabProcessID, + int /* tab_handle */, + int /* process ID */) // This tells the browser to enable or disable the filtered network layer. -IPC_MESSAGE_ROUTED1(AutomationMsg_SetFilteredInet, - bool /* enabled */) +IPC_MESSAGE_CONTROL1(AutomationMsg_SetFilteredInet, + bool /* enabled */) // Gets the directory that downloads will occur in for the active profile. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_DownloadDirectory, - int /* tab_handle */, - FilePath /* directory */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_DownloadDirectory, + int /* tab_handle */, + FilePath /* directory */) // This message requests the id of the view that has the focus in the // specified window. If no view is focused, -1 is returned. Note that the // window should either be a ViewWindow or a Browser. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GetFocusedViewID, - int /* view_handle */, - int /* focused_view_id */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetFocusedViewID, + int /* view_handle */, + int /* focused_view_id */) // This message shows/hides the window. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_SetWindowVisible, - int /* view_handle */, - bool /* visible */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_SetWindowVisible, + int /* view_handle */, + bool /* visible */, + bool /* success */) // Gets the active status of a window. -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_IsWindowActive, - int /* view_handle */, - bool /* success */, - bool /* active */) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_IsWindowActive, + int /* view_handle */, + bool /* success */, + bool /* active */) // Makes the specified window the active window. -IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_ActivateWindow, - int /* view_handle */) +IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_ActivateWindow, + int /* view_handle */) // Opens a new browser window. // TODO(sky): remove this and replace with OpenNewBrowserWindowOfType. // Doing this requires updating the reference build. -IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_OpenNewBrowserWindow, - bool /* show */ ) +IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_OpenNewBrowserWindow, + bool /* show */ ) // This message requests the handle (int64 app-unique identifier) of the // current active top window. On error, the returned handle value is 0. -IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_ActiveWindow, int) +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_ActiveWindow, + int) // This message requests the browser associated with the specified window // handle. // The return value contains a success flag and the handle of the browser. -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_BrowserForWindow, - int /* window handle */, - bool /* success flag */, - int /* browser handle */) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_BrowserForWindow, + int /* window handle */, + bool /* success flag */, + int /* browser handle */) // This message requests the window associated with the specified browser // handle. // The return value contains a success flag and the handle of the window. -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_WindowForBrowser, - int /* browser handle */, - bool /* success flag */, - int /* window handle */) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_WindowForBrowser, + int /* browser handle */, + bool /* success flag */, + int /* window handle */) // This message requests the AutocompleteEdit associated with the specified // browser handle. // The return value contains a success flag and the handle of the omnibox. -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_AutocompleteEditForBrowser, - int /* browser handle */, - bool /* success flag */, - int /* AutocompleteEdit handle */) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_AutocompleteEditForBrowser, + int /* browser handle */, + bool /* success flag */, + int /* AutocompleteEdit handle */) // This message requests that a mouse click be performed in window coordinate // space. @@ -387,7 +356,10 @@ IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_AutocompleteEditForBrowser, // gfx::Point - the point to click // int - the flags which identify the mouse button(s) for the click, as // defined in chrome/views/event.h -IPC_MESSAGE_ROUTED3(AutomationMsg_WindowClick, int, gfx::Point, int) +IPC_MESSAGE_CONTROL3(AutomationMsg_WindowClick, + int, + gfx::Point, + int) // This message requests that a key press be performed. // Request: @@ -395,18 +367,21 @@ IPC_MESSAGE_ROUTED3(AutomationMsg_WindowClick, int, gfx::Point, int) // int - the app::KeyboardCode of the key that was pressed. // int - the flags which identify the modifiers (shift, ctrl, alt) // associated for, as defined in chrome/views/event.h -IPC_MESSAGE_ROUTED3(AutomationMsg_WindowKeyPress, int, int, int) +IPC_MESSAGE_CONTROL3(AutomationMsg_WindowKeyPress, + int, + int, + int) // This message notifies the AutomationProvider to create a tab which is // hosted by an external process. // Request: // ExternalTabSettings - settings for external tab -IPC_SYNC_MESSAGE_ROUTED1_4(AutomationMsg_CreateExternalTab, - IPC::ExternalTabSettings /* settings*/, - gfx::NativeWindow /* Tab container window */, - gfx::NativeWindow /* Tab window */, - int /* Handle to the new tab */, - int /* Session Id of the new tab */) +IPC_SYNC_MESSAGE_CONTROL1_4(AutomationMsg_CreateExternalTab, + ExternalTabSettings /* settings*/, + gfx::NativeWindow /* Tab container window */, + gfx::NativeWindow /* Tab window */, + int /* Handle to the new tab */, + int /* Session Id of the new tab */) // This message notifies the AutomationProvider to navigate to a specified // url in the external tab with given handle. The first parameter is the @@ -414,11 +389,11 @@ IPC_SYNC_MESSAGE_ROUTED1_4(AutomationMsg_CreateExternalTab, // The third parameter is the referrer. // The return value contains a status code which is nonnegative on success. // see AutomationMsg_NavigationResponseValues for the navigation response. -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_NavigateInExternalTab, - int, - GURL, - GURL, - AutomationMsg_NavigationResponseValues) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_NavigateInExternalTab, + int, + GURL, + GURL, + AutomationMsg_NavigationResponseValues) // This message is an outgoing message from Chrome to an external host. // It is a notification that the NavigationState was changed @@ -427,44 +402,47 @@ IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_NavigateInExternalTab, // (see TabContents::InvalidateTypes) // Response: // None expected -IPC_MESSAGE_ROUTED3(AutomationMsg_NavigationStateChanged, - int, // tab handle +IPC_MESSAGE_ROUTED2(AutomationMsg_NavigationStateChanged, int, // TabContents::InvalidateTypes - IPC::NavigationInfo) // title, url etc. + NavigationInfo) // title, url etc. // This message is an outgoing message from Chrome to an external host. // It is a notification that the target URL has changed (the target URL // is the URL of the link that the user is hovering on) // Request: -// -int: The tab handle // -std::wstring: The new target URL // Response: // None expected -IPC_MESSAGE_ROUTED2(AutomationMsg_UpdateTargetUrl, int, std::wstring) +IPC_MESSAGE_ROUTED1(AutomationMsg_UpdateTargetUrl, + std::wstring) // This message notifies the AutomationProvider to show the specified html // text in an interstitial page in the tab with given handle. The first // parameter is the handle to the tab resource. The second parameter is the // html text to be displayed. // The return value contains a success flag. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_ShowInterstitialPage, - int, - std::string, - AutomationMsg_NavigationResponseValues) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_ShowInterstitialPage, + int, + std::string, + AutomationMsg_NavigationResponseValues) // This message notifies the AutomationProvider to hide the current // interstitial page in the tab with given handle. The parameter is the // handle to the tab resource. // The return value contains a success flag. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_HideInterstitialPage, int, - bool) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_HideInterstitialPage, + int, + bool) // This message requests that a tab be closed. // Request: // - int: handle of the tab to close // - bool: if true the proxy blocks until the tab has completely closed, // otherwise the proxy only blocks until it initiates the close. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_CloseTab, int, bool, bool) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_CloseTab, + int, + bool, + bool) // This message requests that the browser be closed. // Request: @@ -473,15 +451,13 @@ IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_CloseTab, int, bool, bool) // - bool: whether the operation was successfull. // - bool: whether the browser process will be terminated as a result (if // this was the last closed browser window). -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_CloseBrowser, int, bool, - bool) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_CloseBrowser, + int, + bool, + bool) -IPC_MESSAGE_ROUTED1(AutomationMsg_CloseBrowserRequestAsync, int) - -// Unused. -// Response: -// None expected -IPC_MESSAGE_ROUTED1(AutomationMsg_Unused, int) +IPC_MESSAGE_CONTROL1(AutomationMsg_CloseBrowserRequestAsync, + int) #if defined(OS_WIN) // TODO(port): Port these messages. @@ -489,13 +465,13 @@ IPC_MESSAGE_ROUTED1(AutomationMsg_Unused, int) // This message is an outgoing message from Chrome to an external host. // It is a request to process a keyboard accelerator. // Request: -// -int: Tab handle // -MSG: The keyboard message // Response: // None expected // TODO(sanjeevr): Ideally we need to add a response from the external // host saying whether it processed the accelerator -IPC_MESSAGE_ROUTED2(AutomationMsg_HandleAccelerator, int, MSG) +IPC_MESSAGE_ROUTED1(AutomationMsg_HandleAccelerator, + MSG) // This message is sent by the container of an externally hosted tab to // reflect any accelerator keys that it did not process. This gives the @@ -505,18 +481,20 @@ IPC_MESSAGE_ROUTED2(AutomationMsg_HandleAccelerator, int, MSG) // -MSG: The keyboard message that the container did not handle // Response: // None expected -IPC_MESSAGE_ROUTED2(AutomationMsg_ProcessUnhandledAccelerator, int, MSG) +IPC_MESSAGE_CONTROL2(AutomationMsg_ProcessUnhandledAccelerator, + int, + MSG) #endif // defined(OS_WIN) // Sent by the external tab to the host to notify that the user has tabbed // out of the tab. // Request: -// - int: Tab handle // - bool: |reverse| set to true when shift-tabbing out of the tab, false // otherwise. // Response: // None expected -IPC_MESSAGE_ROUTED2(AutomationMsg_TabbedOut, int, bool) +IPC_MESSAGE_ROUTED1(AutomationMsg_TabbedOut, + bool) // Sent by the external tab host to ask focus to be set to either the first // or last element on the page. @@ -530,19 +508,24 @@ IPC_MESSAGE_ROUTED2(AutomationMsg_TabbedOut, int, bool) // infomed that it is receiving focus. // Response: // None expected -IPC_MESSAGE_ROUTED3(AutomationMsg_SetInitialFocus, int, bool, bool) +IPC_MESSAGE_CONTROL3(AutomationMsg_SetInitialFocus, + int, + bool, + bool) // This message is an outgoing message from Chrome to an external host. // It is a request to open a url // Request: -// -int: Tab handle // -GURL: The URL to open // -GURL: The referrer // -int: The WindowOpenDisposition that specifies where the URL should // be opened (new tab, new window etc). // Response: // None expected -IPC_MESSAGE_ROUTED4(AutomationMsg_OpenURL, int, GURL, GURL, int) +IPC_MESSAGE_ROUTED3(AutomationMsg_OpenURL, + GURL, + GURL, + int) // This message requests the provider to wait until the specified tab has // finished restoring after session restore. @@ -550,16 +533,17 @@ IPC_MESSAGE_ROUTED4(AutomationMsg_OpenURL, int, GURL, GURL, int) // - int: handle of the tab // Response: // - bool: whether the operation was successful. -IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_WaitForTabToBeRestored, int) +IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_WaitForTabToBeRestored, + int) // This message is an outgoing message from Chrome to an external host. // It is a notification that a navigation happened // Request: -// -int: Tab handle // // Response: // None expected -IPC_MESSAGE_ROUTED2(AutomationMsg_DidNavigate, int, IPC::NavigationInfo) +IPC_MESSAGE_ROUTED1(AutomationMsg_DidNavigate, + NavigationInfo) // This message requests the different security states of the page displayed // in the specified tab. @@ -572,12 +556,12 @@ IPC_MESSAGE_ROUTED2(AutomationMsg_DidNavigate, int, IPC::NavigationInfo) // was used). // - int: the insecure content state, 0 means no insecure contents. -IPC_SYNC_MESSAGE_ROUTED1_4(AutomationMsg_GetSecurityState, - int, - bool, - SecurityStyle, - int, - int) +IPC_SYNC_MESSAGE_CONTROL1_4(AutomationMsg_GetSecurityState, + int, + bool, + SecurityStyle, + int, + int) // This message requests the page type of the page displayed in the specified // tab (normal, error or interstitial). @@ -586,7 +570,10 @@ IPC_SYNC_MESSAGE_ROUTED1_4(AutomationMsg_GetSecurityState, // Response: // - bool: whether the operation was successful. // - PageType: the type of the page currently displayed. -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_GetPageType, int, bool, PageType) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_GetPageType, + int, + bool, + PageType) // This message simulates the user action on the SSL blocking page showing in // the specified tab. This message is only effective if an interstitial page @@ -596,8 +583,10 @@ IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_GetPageType, int, bool, PageType) // - bool: whether to proceed or abort the navigation // Response: // - AutomationMsg_NavigationResponseValues: result of the operation. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_ActionOnSSLBlockingPage, int, bool, - AutomationMsg_NavigationResponseValues) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_ActionOnSSLBlockingPage, + int, + bool, + AutomationMsg_NavigationResponseValues) // Message to request that a browser window is brought to the front and // activated. @@ -605,7 +594,9 @@ IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_ActionOnSSLBlockingPage, int, bool, // - int: handle of the browser window. // Response: // - bool: True if the browser is brought to the front. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_BringBrowserToFront, int, bool) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BringBrowserToFront, + int, + bool) // Message to request whether a certain item is enabled of disabled in the // menu in the browser window @@ -615,26 +606,33 @@ IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_BringBrowserToFront, int, bool) // - int: IDC message identifier to query if enabled // Response: // - bool: True if the command is enabled on the menu -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_IsMenuCommandEnabled, int, int, bool) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_IsMenuCommandEnabled, + int, + int, + bool) // This message notifies the AutomationProvider to print the tab with given // handle. The first parameter is the handle to the tab resource. The // return value contains a bool which is true on success. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_PrintNow, int, bool) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_PrintNow, + int, + bool) // This message notifies the AutomationProvider to reload the current page in // the tab with given handle. The first parameter is the handle to the tab // resource. The return value contains a status code which is nonnegative on // success. // see AutomationMsg_NavigationResponseValues for the navigation response. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_Reload, int, - AutomationMsg_NavigationResponseValues) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_Reload, + int, + AutomationMsg_NavigationResponseValues) // This message requests the handle (int64 app-unique identifier) of the // last active browser window, or the browser at index 0 if there is no last // active browser, or it no longer exists. Returns 0 if no browser windows // exist. -IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_LastActiveBrowserWindow, int) +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_LastActiveBrowserWindow, + int) // This message notifies the AutomationProvider to save the page with given // handle. The first parameter is the handle to the tab resource. The second @@ -642,33 +640,37 @@ IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_LastActiveBrowserWindow, int) // for saving resources. The fourth parameter is the saving type: 0 for HTML // only; 1 for complete web page. // The return value contains a bool which is true on success. -IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_SavePage, int, FilePath, FilePath, - int, bool) +IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_SavePage, + int, + FilePath, + FilePath, + int, + bool) // This message requests the text currently being displayed in the // AutocompleteEdit. The parameter is the handle to the AutocompleteEdit. // The return value is a string indicating the text in the AutocompleteEdit. -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_AutocompleteEditGetText, - int /* autocomplete edit handle */, - bool /* the requested autocomplete edit exists */, - std::wstring /* omnibox text */) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_AutocompleteEditGetText, + int /* autocomplete edit handle */, + bool /* the requested autocomplete edit exists */, + std::wstring /* omnibox text */) // This message sets the text being displayed in the AutocompleteEdit. The // first parameter is the handle to the omnibox and the second parameter is // the text to be displayed in the AutocompleteEdit. // The return value has no parameters and is returned when the operation has // completed. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_AutocompleteEditSetText, - int /* autocomplete edit handle */, - std::wstring /* text to set */, - bool /* the requested autocomplete edit exists */) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_AutocompleteEditSetText, + int /* autocomplete edit handle */, + std::wstring /* text to set */, + bool /* the requested autocomplete edit exists */) // This message requests if a query to a autocomplete provider is still in // progress. The first parameter in the request is the handle to the // autocomplete edit. // The first return value indicates if the request succeeded. // The second return value indicates if a query is still in progress. -IPC_SYNC_MESSAGE_ROUTED1_2( \ +IPC_SYNC_MESSAGE_CONTROL1_2( \ AutomationMsg_AutocompleteEditIsQueryInProgress, int /* autocomplete edit handle*/, bool /* the requested autocomplete edit exists */, @@ -679,44 +681,43 @@ IPC_SYNC_MESSAGE_ROUTED1_2( \ // autocomplete edit. // The first return value indicates if the request was successful, while // while the second is the actual list of matches. -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_AutocompleteEditGetMatches, - int /* autocomplete edit handle*/, - bool /* the requested autocomplete edit exists */, - std::vector<AutocompleteMatchData> /* matches */) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_AutocompleteEditGetMatches, + int /* autocomplete edit handle*/, + bool /* the requested autocomplete edit exists */, + std::vector<AutocompleteMatchData> /* matches */) // This message requests the execution of a browser command in the browser // for which the handle is specified. // The return value contains a boolean, whether the command was dispatched. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WindowExecuteCommandAsync, - int /* automation handle */, - int /* browser command */, - bool /* success flag */) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WindowExecuteCommandAsync, + int /* automation handle */, + int /* browser command */, + bool /* success flag */) // This message requests the execution of a browser command in the browser // for which the handle is specified. // The return value contains a boolean, whether the command was dispatched // and successful executed. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WindowExecuteCommand, - int /* automation handle */, - int /* browser command */, - bool /* success flag */) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WindowExecuteCommand, + int /* automation handle */, + int /* browser command */, + bool /* success flag */) // This message opens the Find window within a tab corresponding to the // supplied tab handle. -IPC_MESSAGE_ROUTED1(AutomationMsg_OpenFindInPage, - int /* tab_handle */) +IPC_MESSAGE_CONTROL1(AutomationMsg_OpenFindInPage, + int /* tab_handle */) // Posts a message from external host to chrome renderer. -IPC_MESSAGE_ROUTED4(AutomationMsg_HandleMessageFromExternalHost, - int /* automation handle */, - std::string /* message */, - std::string /* origin */, - std::string /* target */) +IPC_MESSAGE_CONTROL4(AutomationMsg_HandleMessageFromExternalHost, + int /* automation handle */, + std::string /* message */, + std::string /* origin */, + std::string /* target */) // A message for an external host. -IPC_MESSAGE_ROUTED4(AutomationMsg_ForwardMessageToExternalHost, - int, /* handle */ +IPC_MESSAGE_ROUTED3(AutomationMsg_ForwardMessageToExternalHost, std::string /* message */, std::string /* origin */, std::string /* target */) @@ -725,282 +726,279 @@ IPC_MESSAGE_ROUTED4(AutomationMsg_ForwardMessageToExternalHost, // tab handle. The parameter |request| specifies what to search for. // If an error occurs, |matches_found| will be -1. // -IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_Find, - int /* tab_handle */, - AutomationMsg_Find_Params /* params */, - int /* active_ordinal */, - int /* matches_found */) +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_Find, + int /* tab_handle */, + AutomationMsg_Find_Params /* params */, + int /* active_ordinal */, + int /* matches_found */) // Is the Find window fully visible (and not animating) for the specified // tab? -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_FindWindowVisibility, - int /* tab_handle */, - bool /* is_visible */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_FindWindowVisibility, + int /* tab_handle */, + bool /* is_visible */) // Where is the Find window located. |x| and |y| will be -1, -1 on failure. -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_FindWindowLocation, - int /* tab_handle */, - int /* x */, - int /* y */) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_FindWindowLocation, + int /* tab_handle */, + int /* x */, + int /* y */) // Is the Bookmark bar visible? The return value will indicate whether it is // visible or not and whether it is being animated into (or out of its place). -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_BookmarkBarVisibility, - int /* browser_handle */, - bool, /* is_visible */ - bool /* still_animating */) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_BookmarkBarVisibility, + int /* browser_handle */, + bool, /* is_visible */ + bool /* still_animating */) // This message requests the number of related info bars opened. It // returns -1 if an error occurred. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GetInfoBarCount, - int /* tab_handle */, - int /* info bar count */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetInfoBarCount, + int /* tab_handle */, + int /* info bar count */) // This message triggers the action associated with the "accept" button in // the info-bar at the specified index. If |wait for navigation| is true, it // won't return until a navigation has occurred. -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_ClickInfoBarAccept, - int /* tab_handle */, - int /* info bar index */, - bool /* wait for navigation */, +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_ClickInfoBarAccept, + int /* tab_handle */, + int /* info bar index */, + bool /* wait for navigation */, - /* navigation result */ - AutomationMsg_NavigationResponseValues) + /* navigation result */ + AutomationMsg_NavigationResponseValues) // This message retrieves the last time a navigation occurred in the specified // tab. The value is intended to be used with WaitForNavigation. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GetLastNavigationTime, - int /* tab_handle */, - int64 /* last navigation time */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetLastNavigationTime, + int /* tab_handle */, + int64 /* last navigation time */) // This messages is used to block until a new navigation occurs (if there is // none more recent then the time specified). -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WaitForNavigation, - int /* tab_handle */, - int64 /* last navigation time */, +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WaitForNavigation, + int /* tab_handle */, + int64 /* last navigation time */, - /* navigation result */ - AutomationMsg_NavigationResponseValues) + /* navigation result */ + AutomationMsg_NavigationResponseValues) // This messages sets an int-value preference. -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetIntPreference, - int /* browser handle */, - std::string /* pref name */, - int /* value */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetIntPreference, + int /* browser handle */, + std::string /* pref name */, + int /* value */, + bool /* success */) // Queries whether an app modal dialog is currently being shown. (i.e. a // javascript alert) and which buttons it contains. -IPC_SYNC_MESSAGE_ROUTED0_2(AutomationMsg_ShowingAppModalDialog, - bool /* showing dialog */, - int /* view::DelegateDialog::DialogButton */) +IPC_SYNC_MESSAGE_CONTROL0_2(AutomationMsg_ShowingAppModalDialog, + bool /* showing dialog */, + int /* view::DelegateDialog::DialogButton */) // This message triggers the specified button for the currently showing // modal dialog. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ClickAppModalDialogButton, - int /* view::DelegateDialog::DialogButton */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ClickAppModalDialogButton, + int /* view::DelegateDialog::DialogButton */, + bool /* success */) // This messages sets a string-value preference. -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetStringPreference, - int /* browser handle */, - std::string /* pref name */, - std::string /* pref value */, - bool) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetStringPreference, + int /* browser handle */, + std::string /* pref name */, + std::string /* pref value */, + bool) // This messages gets a boolean-value preference. -IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_GetBooleanPreference, +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_GetBooleanPreference, int /* browser handle */, std::string /* pref name */, bool /* success */, bool /* pref value */) // This messages sets a boolean-value preference. -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetBooleanPreference, - int /* browser handle */, - std::string /* pref name */, - bool /* pref value */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetBooleanPreference, + int /* browser handle */, + std::string /* pref name */, + bool /* pref value */, + bool /* success */) // Queries the current used encoding name of the page in the specified // web content tab. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GetPageCurrentEncoding, - int /* tab handle */, - std::string /* current used encoding name */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetPageCurrentEncoding, + int /* tab handle */, + std::string /* current used encoding name */) // Uses the specified encoding to override the encoding of the page in the // specified web content tab. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_OverrideEncoding, - int /* tab handle */, - std::string /* overrided encoding name */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_OverrideEncoding, + int /* tab handle */, + std::string /* overrided encoding name */, + bool /* success */) // Used to disable the dialog box that prompts the user for a path when // saving a web page. -IPC_SYNC_MESSAGE_ROUTED1_0(AutomationMsg_SavePackageShouldPromptUser, - bool /* false if we want to not show the dialog */) +IPC_SYNC_MESSAGE_CONTROL1_0(AutomationMsg_SavePackageShouldPromptUser, + bool /* false if we want to not show the dialog */) // This message is an outgoing message from Chrome to an external host. // It is a notification that a navigation failed // Request: -// -int : Tab handle // -int : The status code. // -GURL: The URL we failed to navigate to. // Response: // None expected -IPC_MESSAGE_ROUTED3(AutomationMsg_NavigationFailed, int, int, GURL) +IPC_MESSAGE_ROUTED2(AutomationMsg_NavigationFailed, + int, + GURL) #if defined(OS_WIN) // This message is an outgoing message from an automation client to Chrome. // It is used to reposition a chrome tab window. -IPC_MESSAGE_ROUTED2(AutomationMsg_TabReposition, - int /* tab handle */, - IPC::Reposition_Params /* SetWindowPos params */) +IPC_MESSAGE_CONTROL2(AutomationMsg_TabReposition, + int /* tab handle */, + Reposition_Params /* SetWindowPos params */) #endif // defined(OS_WIN) // Gets the title of the top level browser window. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_WindowTitle, - int /* automation handle */, - string16 /* title text */ ) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WindowTitle, + int /* automation handle */, + string16 /* title text */ ) // Tab load complete -IPC_MESSAGE_ROUTED2(AutomationMsg_TabLoaded, - int, // tab handle +IPC_MESSAGE_ROUTED1(AutomationMsg_TabLoaded, GURL) // This message requests the tabstrip index of the tab with the given handle. // The return value contains the index, which will be -1 on failure. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_TabIndex, int, int) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TabIndex, + int, + int) // This message requests the handle (int64 app-unique identifier) of // a valid normal browser window, i.e. normal type and non-incognito mode. // On error, the returned handle value is 0. -IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_FindNormalBrowserWindow, int) +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_FindNormalBrowserWindow, + int) // This message requests the number of normal browser windows, i.e. normal // type and non-incognito mode that the app currently has open. The return // value is the number of windows. -IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_NormalBrowserWindowCount, int) +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_NormalBrowserWindowCount, + int) // Used to put the browser into "extension automation mode" for a given // set of Chrome Extensions API functions for the current profile, or turn // off automation mode. The specified tab is used as the conduit for all // automated API functions. It must be an external tab (as in // AutomationMsg_CreateExternalTab). -IPC_MESSAGE_ROUTED2(AutomationMsg_SetEnableExtensionAutomation, - // Tab handle. - int, - // Empty to disable automation, non-empty to enable - // automation of the specified API functions, single - // entry of "*" to enable automation of all API - // functions. - std::vector<std::string>) +IPC_MESSAGE_CONTROL2(AutomationMsg_SetEnableExtensionAutomation, + // Tab handle. + int, + // Empty to disable automation, non-empty to enable + // automation of the specified API functions, single + // entry of "*" to enable automation of all API + // functions. + std::vector<std::string>) // This message tells the browser to start using the new proxy configuration // represented by the given JSON string. The parameters used in the JSON // string are defined in automation_constants.h. -IPC_MESSAGE_ROUTED1(AutomationMsg_SetProxyConfig, - std::string /* proxy_config_json_string */) +IPC_MESSAGE_CONTROL1(AutomationMsg_SetProxyConfig, + std::string /* proxy_config_json_string */) // Sets Download Shelf visibility for the specified browser. -IPC_SYNC_MESSAGE_ROUTED2_0(AutomationMsg_SetShelfVisibility, - int /* browser_handle */, - bool /* is_visible */) +IPC_SYNC_MESSAGE_CONTROL2_0(AutomationMsg_SetShelfVisibility, + int /* browser_handle */, + bool /* is_visible */) // This message requests the number of blocked popups in a certain tab with // the given handle. The return value is the number of blocked popups, or -1 // if this request failed. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_BlockedPopupCount, - int /* tab_handle */, - int /* blocked_popup_count */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_BlockedPopupCount, + int /* tab_handle */, + int /* blocked_popup_count */) // This message retrieves the locale of the browser process. On success // |chrome_locale| will contain the locale as reported by ICU. On failure // |chrome_locale| is the empty string. -IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_GetBrowserLocale, - string16 /* chrome_locale */) +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetBrowserLocale, + string16 /* chrome_locale */) #if defined(OS_WIN) -IPC_MESSAGE_ROUTED4(AutomationMsg_ForwardContextMenuToExternalHost, - int /* tab_handle */, +IPC_MESSAGE_ROUTED3(AutomationMsg_ForwardContextMenuToExternalHost, HANDLE /* source menu handle */, int /* align flags */, - IPC::MiniContextMenuParams /* params */) + MiniContextMenuParams /* params */) -IPC_MESSAGE_ROUTED2(AutomationMsg_ForwardContextMenuCommandToChrome, - int /* tab_handle */, - int /* selected_command */) +IPC_MESSAGE_CONTROL2(AutomationMsg_ForwardContextMenuCommandToChrome, + int /* tab_handle */, + int /* selected_command */) #endif // OS_WIN // A URL request to be fetched via automation -IPC_MESSAGE_ROUTED3(AutomationMsg_RequestStart, - int /* tab_handle */, +IPC_MESSAGE_ROUTED2(AutomationMsg_RequestStart, int /* request_id */, - IPC::AutomationURLRequest /* request */) + AutomationURLRequest /* request */) // Read data from a URL request to be fetched via automation -IPC_MESSAGE_ROUTED3(AutomationMsg_RequestRead, - int /* tab_handle */, +IPC_MESSAGE_ROUTED2(AutomationMsg_RequestRead, int /* request_id */, int /* bytes_to_read */) // Response to a AutomationMsg_RequestStart message -IPC_MESSAGE_ROUTED3(AutomationMsg_RequestStarted, - int /* tab_handle */, +IPC_MESSAGE_ROUTED2(AutomationMsg_RequestStarted, int /* request_id */, - IPC::AutomationURLResponse /* response */) + AutomationURLResponse /* response */) // Data read via automation -IPC_MESSAGE_ROUTED3(AutomationMsg_RequestData, - int /* tab_handle */, +IPC_MESSAGE_ROUTED2(AutomationMsg_RequestData, int /* request_id */, std::string /* data */) -IPC_MESSAGE_ROUTED3(AutomationMsg_RequestEnd, - int /* tab_handle */, +IPC_MESSAGE_ROUTED2(AutomationMsg_RequestEnd, int /* request_id */, URLRequestStatus /* status */) -IPC_MESSAGE_ROUTED1(AutomationMsg_PrintAsync, - int /* tab_handle */) +IPC_MESSAGE_CONTROL1(AutomationMsg_PrintAsync, + int /* tab_handle */) -IPC_MESSAGE_ROUTED3(AutomationMsg_SetCookieAsync, - int /* tab_handle */, +IPC_MESSAGE_ROUTED2(AutomationMsg_SetCookieAsync, GURL /* url */, std::string /* cookie */) -IPC_MESSAGE_ROUTED1(AutomationMsg_SelectAll, +IPC_MESSAGE_CONTROL1(AutomationMsg_SelectAll, int /* tab handle */) -IPC_MESSAGE_ROUTED1(AutomationMsg_Cut, - int /* tab handle */) +IPC_MESSAGE_CONTROL1(AutomationMsg_Cut, + int /* tab handle */) -IPC_MESSAGE_ROUTED1(AutomationMsg_Copy, - int /* tab handle */) +IPC_MESSAGE_CONTROL1(AutomationMsg_Copy, + int /* tab handle */) -IPC_MESSAGE_ROUTED1(AutomationMsg_Paste, - int /* tab handle */) +IPC_MESSAGE_CONTROL1(AutomationMsg_Paste, + int /* tab handle */) -IPC_MESSAGE_ROUTED1(AutomationMsg_ReloadAsync, - int /* tab handle */) +IPC_MESSAGE_CONTROL1(AutomationMsg_ReloadAsync, + int /* tab handle */) -IPC_MESSAGE_ROUTED1(AutomationMsg_StopAsync, - int /* tab handle */) +IPC_MESSAGE_CONTROL1(AutomationMsg_StopAsync, + int /* tab handle */) // Returns the number of times a filter was used to service an URL request. // See AutomationMsg_SetFilteredInet. -IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_GetFilteredInetHitCount, - int /* hit_count */) +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetFilteredInetHitCount, + int /* hit_count */) // Is the browser in fullscreen mode? -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_IsFullscreen, - int /* browser_handle */, - bool /* is_fullscreen */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_IsFullscreen, + int /* browser_handle */, + bool /* is_fullscreen */) // Is the fullscreen bubble visible? -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_IsFullscreenBubbleVisible, - int /* browser_handle */, - bool /* is_visible */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_IsFullscreenBubbleVisible, + int /* browser_handle */, + bool /* is_visible */) // This message notifies the AutomationProvider to navigate to a specified // url in the tab with given handle. The first parameter is the handle to @@ -1008,8 +1006,11 @@ IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_IsFullscreenBubbleVisible, // parameter is the number of navigations that are required for a successful // return value. See AutomationMsg_NavigationResponseValues for the return // value. -IPC_SYNC_MESSAGE_ROUTED3_1( - AutomationMsg_NavigateToURLBlockUntilNavigationsComplete, int, GURL, int, +IPC_SYNC_MESSAGE_CONTROL3_1( + AutomationMsg_NavigateToURLBlockUntilNavigationsComplete, + int, + GURL, + int, AutomationMsg_NavigationResponseValues) // This message notifies the AutomationProvider to navigate to a specified @@ -1018,8 +1019,10 @@ IPC_SYNC_MESSAGE_ROUTED3_1( // index of navigation entry. // The return value contains a status code which is nonnegative on success. // see AutomationMsg_NavigationResponseValues for the navigation response. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_NavigateExternalTabAtIndex, int, int, - AutomationMsg_NavigationResponseValues) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_NavigateExternalTabAtIndex, + int, + int, + AutomationMsg_NavigationResponseValues) // This message requests the provider to wait until the window count // reached the specified value. @@ -1027,14 +1030,16 @@ IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_NavigateExternalTabAtIndex, int, int, // - int: target browser window count // Response: // - bool: whether the operation was successful. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_WaitForBrowserWindowCountToBecome, - int, bool) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForBrowserWindowCountToBecome, + int, + bool) // This message requests the provider to wait until an application modal // dialog is shown. // Response: // - bool: whether the operation was successful -IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_WaitForAppModalDialogToBeShown, bool) +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_WaitForAppModalDialogToBeShown, + bool) // This message notifies the AutomationProvider to navigate back in session // history in the tab with given handle. The first parameter is the handle @@ -1042,9 +1047,10 @@ IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_WaitForAppModalDialogToBeShown, bool) // provider will wait for. // See AutomationMsg_NavigationResponseValues for the navigation response // values. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_GoBackBlockUntilNavigationsComplete, - int, int, - AutomationMsg_NavigationResponseValues) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_GoBackBlockUntilNavigationsComplete, + int, + int, + AutomationMsg_NavigationResponseValues) // This message notifies the AutomationProvider to navigate forward in session // history in the tab with given handle. The first parameter is the handle @@ -1052,35 +1058,29 @@ IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_GoBackBlockUntilNavigationsComplete, // the provider will wait for. // See AutomationMsg_NavigationResponseValues for the navigation response // values. -IPC_SYNC_MESSAGE_ROUTED2_1( - AutomationMsg_GoForwardBlockUntilNavigationsComplete, int, int, +IPC_SYNC_MESSAGE_CONTROL2_1( + AutomationMsg_GoForwardBlockUntilNavigationsComplete, + int, + int, AutomationMsg_NavigationResponseValues) // This message is used by automation clients to upload histogram data to the // browser process. -IPC_MESSAGE_ROUTED1(AutomationMsg_RecordHistograms, - std::vector<std::string> /* histogram_list */) +IPC_MESSAGE_CONTROL1(AutomationMsg_RecordHistograms, + std::vector<std::string> /* histogram_list */) -IPC_MESSAGE_ROUTED2(AutomationMsg_AttachExternalTab, - int /* 'source' tab_handle */, - IPC::AttachExternalTabParams) +IPC_MESSAGE_ROUTED1(AutomationMsg_AttachExternalTab, + AttachExternalTabParams) // Sent when the automation client connects to an existing tab. -IPC_SYNC_MESSAGE_ROUTED3_4(AutomationMsg_ConnectExternalTab, - uint64 /* cookie */, - bool /* allow/block tab*/, - gfx::NativeWindow /* parent window */, - gfx::NativeWindow /* Tab container window */, - gfx::NativeWindow /* Tab window */, - int /* Handle to the new tab */, - int /* Session Id of the new tab */) - -#if defined(OS_POSIX) -// TODO(estade): this should be merged with the windows message of the same -// name. See comment for WindowClick. -IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_WindowDrag, - int, std::vector<gfx::Point>, int, bool, bool) -#endif // defined(OS_POSIX) +IPC_SYNC_MESSAGE_CONTROL3_4(AutomationMsg_ConnectExternalTab, + uint64 /* cookie */, + bool /* allow/block tab*/, + gfx::NativeWindow /* parent window */, + gfx::NativeWindow /* Tab container window */, + gfx::NativeWindow /* Tab window */, + int /* Handle to the new tab */, + int /* Session Id of the new tab */) // This message gets the bounds of the window. // Request: @@ -1088,8 +1088,10 @@ IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_WindowDrag, // Response: // gfx::Rect - the bounds of the window // bool - true if the query was successful -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_GetWindowBounds, int, gfx::Rect, - bool) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_GetWindowBounds, + int, + gfx::Rect, + bool) // Simulate an end of session. Normally this happens when the user // shuts down the machine or logs off. @@ -1097,7 +1099,9 @@ IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_GetWindowBounds, int, gfx::Rect, // int - the handle of the browser // Response: // bool - true if succesful -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_TerminateSession, int, bool) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_TerminateSession, + int, + bool) // Returns whether the window is maximized. // Request: @@ -1105,33 +1109,35 @@ IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_TerminateSession, int, bool) // Response: // bool - true if the window is maximized // bool - true if query is successful -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_IsWindowMaximized, int, bool, bool) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_IsWindowMaximized, + int, + bool, + bool) -IPC_MESSAGE_ROUTED2(AutomationMsg_SetPageFontSize, - int /* tab_handle */, - int /* The font size */) +IPC_MESSAGE_CONTROL2(AutomationMsg_SetPageFontSize, + int /* tab_handle */, + int /* The font size */) // Returns a metric event duration that was last recorded. Returns -1 if the // event hasn't occurred yet. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_GetMetricEventDuration, - std::string /* event_name */, - int /* duration ms */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_GetMetricEventDuration, + std::string /* event_name */, + int /* duration ms */) // Sent by automation provider - go to history entry via automation. -IPC_MESSAGE_ROUTED2(AutomationMsg_RequestGoToHistoryEntryOffset, - int, // tab handle - int) // numbers of entries (negative or positive) +IPC_MESSAGE_ROUTED1(AutomationMsg_RequestGoToHistoryEntryOffset, + int) // numbers of entries (negative or positive) // Silently install the extension in the given crx file. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_InstallExtension, - FilePath /* full path to crx file */, - AutomationMsg_ExtensionResponseValues) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_InstallExtension, + FilePath /* full path to crx file */, + AutomationMsg_ExtensionResponseValues) // Silently load the extension in the given directory. This expects an // extension expanded into the directory, not a crx file. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_LoadExpandedExtension, - FilePath /* root directory of extension */, - AutomationMsg_ExtensionResponseValues) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_LoadExpandedExtension, + FilePath /* root directory of extension */, + AutomationMsg_ExtensionResponseValues) // Retrieves a list of the root directories of all enabled extensions // that have been installed into Chrome by dropping a .crx file onto @@ -1139,191 +1145,194 @@ IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_LoadExpandedExtension, // Other types of extensions are not included on the list (e.g. "component", // "app" or "external" extensions) since since CEEE does not yet support them // (and it actually only support a single extension in its profile for now). -IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_GetEnabledExtensions, - std::vector<FilePath>) +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_GetEnabledExtensions, + std::vector<FilePath>) // This message requests the type of the window with the given handle. The // return value contains the type (Browser::Type), or -1 if the request // failed. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_Type, int, int) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_Type, + int, + int) // Opens a new browser window of a specific type. -IPC_SYNC_MESSAGE_ROUTED2_0(AutomationMsg_OpenNewBrowserWindowOfType, - int /* Type (Browser::Type) */, - bool /* show */ ) +IPC_SYNC_MESSAGE_CONTROL2_0(AutomationMsg_OpenNewBrowserWindowOfType, + int /* Type (Browser::Type) */, + bool /* show */ ) // This message requests that the mouse be moved to this location, in // window coordinate space. // Request: // int - the handle of the window that's the context for this click // gfx::Point - the location to move to -IPC_MESSAGE_ROUTED2(AutomationMsg_WindowMouseMove, int, gfx::Point) +IPC_MESSAGE_CONTROL2(AutomationMsg_WindowMouseMove, + int, + gfx::Point) // Called when requests should be downloaded using a host browser's // download mechanism when chrome is being embedded. -IPC_MESSAGE_ROUTED2(AutomationMsg_DownloadRequestInHost, - int /* tab_handle */, +IPC_MESSAGE_ROUTED1(AutomationMsg_DownloadRequestInHost, int /* request_id */) // Shuts down the session service for the browser identified by // |browser_handle|. On success |result| is set to true. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ShutdownSessionService, - int /* browser_handle */, - bool /* result */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ShutdownSessionService, + int /* browser_handle */, + bool /* result */) -IPC_MESSAGE_ROUTED1(AutomationMsg_SaveAsAsync, - int /* tab handle */) +IPC_MESSAGE_CONTROL1(AutomationMsg_SaveAsAsync, + int /* tab handle */) #if defined(OS_WIN) // An incoming message from an automation host to Chrome. Signals that // the browser containing |tab_handle| has moved. -IPC_MESSAGE_ROUTED1(AutomationMsg_BrowserMove, - int /* tab handle */) +IPC_MESSAGE_CONTROL1(AutomationMsg_BrowserMove, + int /* tab handle */) #endif // Used to get cookies for the given URL. -IPC_MESSAGE_ROUTED3(AutomationMsg_GetCookiesFromHost, - int /* tab_handle */, +IPC_MESSAGE_ROUTED2(AutomationMsg_GetCookiesFromHost, GURL /* url */, int /* opaque_cookie_id */) -IPC_MESSAGE_ROUTED5(AutomationMsg_GetCookiesHostResponse, - int /* tab_handle */, - bool /* success */, - GURL /* url */, - std::string /* cookies */, - int /* opaque_cookie_id */) +IPC_MESSAGE_CONTROL5(AutomationMsg_GetCookiesHostResponse, + int /* tab_handle */, + bool /* success */, + GURL /* url */, + std::string /* cookies */, + int /* opaque_cookie_id */) // If the given host is empty, then the default content settings are // modified. -IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_SetContentSetting, - int /* browser handle */, - std::string /* host */, - ContentSettingsType /* content type */, - ContentSetting /* setting */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_SetContentSetting, + int /* browser handle */, + std::string /* host */, + ContentSettingsType /* content type */, + ContentSetting /* setting */, + bool /* success */) #if defined(OS_CHROMEOS) // Logs in through the browser's login wizard if available. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_LoginWithUserAndPass, +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_LoginWithUserAndPass, std::string /* username*/, std::string /* password*/, bool /* Whether successful*/) #endif // Return the bookmarks encoded as a JSON string. -IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_GetBookmarksAsJSON, - int /* browser_handle */, - std::string /* bookmarks as a JSON string */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_GetBookmarksAsJSON, + int /* browser_handle */, + std::string /* bookmarks as a JSON string */, + bool /* success */) // Wait for the bookmark model to load. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_WaitForBookmarkModelToLoad, - int /* browser_handle */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForBookmarkModelToLoad, + int /* browser_handle */, + bool /* success */) // Bookmark addition, modification, and removal. // Bookmarks are indexed by their id. -IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_AddBookmarkGroup, - int /* browser_handle */, - int64 /* parent_id */, - int /* index */, - std::wstring /* title */, - bool /* success */) -IPC_SYNC_MESSAGE_ROUTED5_1(AutomationMsg_AddBookmarkURL, - int /* browser_handle */, - int64 /* parent_id */, - int /* index */, - std::wstring /* title */, - GURL /* url */, - bool /* success */) -IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_ReparentBookmark, - int /* browser_handle */, - int64 /* id */, - int64 /* new_parent_id */, - int /* index */, - bool /* success */) -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetBookmarkTitle, - int /* browser_handle */, - int64 /* id */, - std::wstring /* title */, - bool /* success */) -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_SetBookmarkURL, - int /* browser_handle */, - int64 /* id */, - GURL /* url */, - bool /* success */) -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_RemoveBookmark, - int /* browser_handle */, - int64 /* id */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_AddBookmarkGroup, + int /* browser_handle */, + int64 /* parent_id */, + int /* index */, + std::wstring /* title */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL5_1(AutomationMsg_AddBookmarkURL, + int /* browser_handle */, + int64 /* parent_id */, + int /* index */, + std::wstring /* title */, + GURL /* url */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_ReparentBookmark, + int /* browser_handle */, + int64 /* id */, + int64 /* new_parent_id */, + int /* index */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetBookmarkTitle, + int /* browser_handle */, + int64 /* id */, + std::wstring /* title */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetBookmarkURL, + int /* browser_handle */, + int64 /* id */, + GURL /* url */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_RemoveBookmark, + int /* browser_handle */, + int64 /* id */, + bool /* success */) // This message informs the browser process to remove the history entries // for the specified types across all time ranges. See // browsing_data_remover.h for a list of REMOVE_* types supported in the // remove_mask parameter. -IPC_MESSAGE_ROUTED1(AutomationMsg_RemoveBrowsingData, int) +IPC_MESSAGE_CONTROL1(AutomationMsg_RemoveBrowsingData, + int) // Block until the focused view id changes to something other than // |previous_view_id|. -IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_WaitForFocusedViewIDToChange, - int /* window handle */, - int /* previous_view_id */, - bool /* success */, - int /* new_view_id */) +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_WaitForFocusedViewIDToChange, + int /* window handle */, + int /* previous_view_id */, + bool /* success */, + int /* new_view_id */) // To avoid race conditions, waiting until a popup menu opens is a // three-step process: // 1. Call StartTrackingPopupMenus. // 2. Call an automation method that results in opening the popup menu. // 3. Call WaitForPopupMenuToOpen and check for success. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_StartTrackingPopupMenus, - int /* browser handle */, - bool /* success */) -IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_WaitForPopupMenuToOpen, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_StartTrackingPopupMenus, + int /* browser handle */, + bool /* success */) +IPC_SYNC_MESSAGE_CONTROL0_1(AutomationMsg_WaitForPopupMenuToOpen, + bool /* success */) // Generic pyauto pattern to help avoid future addition of // automation messages. -IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_SendJSONRequest, - int /* browser_handle */, - std::string /* JSON request */, - std::string /* JSON response */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_SendJSONRequest, + int /* browser_handle */, + std::string /* JSON request */, + std::string /* JSON response */, + bool /* success */) // Installs an extension from the crx file and returns its id. // On error, |extension handle| will be 0. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_InstallExtensionAndGetHandle, - FilePath /* full path to crx file */, - bool /* with UI */, - int /* extension handle */) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_InstallExtensionAndGetHandle, + FilePath /* full path to crx file */, + bool /* with UI */, + int /* extension handle */) // Waits for the next extension test result. Sets |test result| as the // received result and |message| as any accompanying message with the // result, which could be the empty string. -IPC_SYNC_MESSAGE_ROUTED0_2(AutomationMsg_WaitForExtensionTestResult, - bool /* test result */, - std::string /* message */) +IPC_SYNC_MESSAGE_CONTROL0_2(AutomationMsg_WaitForExtensionTestResult, + bool /* test result */, + std::string /* message */) // Uninstalls an extension. On success |success| is true. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_UninstallExtension, - int /* extension handle */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_UninstallExtension, + int /* extension handle */, + bool /* success */) // Enables an extension. On success |success| is true. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_EnableExtension, +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_EnableExtension, int /* extension handle */, bool /* success */) // Disables an extension. On success |success| is true. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_DisableExtension, - int /* extension handle */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_DisableExtension, + int /* extension handle */, + bool /* success */) // Executes the action associated with the given extension. This executes // the extension's page or browser action in the given browser, but does // not open popups. On success |success| is true. -IPC_SYNC_MESSAGE_ROUTED2_1( +IPC_SYNC_MESSAGE_CONTROL2_1( AutomationMsg_ExecuteExtensionActionInActiveTabAsync, int /* extension handle */, int /* browser handle */, @@ -1331,57 +1340,60 @@ IPC_SYNC_MESSAGE_ROUTED2_1( // Moves the browser action to the given index in the browser action toolbar. // On success |success| is true. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_MoveExtensionBrowserAction, - int /* extension handle */, - int /* index */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_MoveExtensionBrowserAction, + int /* extension handle */, + int /* index */, + bool /* success */) // Gets an extension property |property type|. On success |success| is true, // and |property value| is set. -IPC_SYNC_MESSAGE_ROUTED2_2(AutomationMsg_GetExtensionProperty, +IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_GetExtensionProperty, int /* extension handle */, AutomationMsg_ExtensionProperty /* property type */, bool /* success */, std::string /* property value */) // Resets to the default theme. -IPC_SYNC_MESSAGE_ROUTED0_0(AutomationMsg_ResetToDefaultTheme) +IPC_SYNC_MESSAGE_CONTROL0_0(AutomationMsg_ResetToDefaultTheme) // Navigates asynchronously to a URL with a certain disposition, // like in a new tab. -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_NavigationAsyncWithDisposition, - int /* tab handle */, - GURL, - WindowOpenDisposition, - bool /* result */) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_NavigationAsyncWithDisposition, + int /* tab handle */, + GURL, + WindowOpenDisposition, + bool /* result */) // This message requests the cookie be deleted for given url in the // profile of the tab identified by the first parameter. The second // parameter is the cookie name. -IPC_SYNC_MESSAGE_ROUTED3_1(AutomationMsg_DeleteCookie, GURL, std::string, - int /* tab handle */, - bool /* result */) +IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_DeleteCookie, + GURL, + std::string, + int /* tab handle */, + bool /* result */) // This message triggers the collected cookies dialog for a specific tab. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ShowCollectedCookiesDialog, - int /* tab handle */, - bool /* result */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_ShowCollectedCookiesDialog, + int /* tab handle */, + bool /* result */) // This message requests the external tab identified by the tab handle // passed in be closed. // Request: -// -int: Tab handle // Response: // None expected -IPC_MESSAGE_ROUTED1(AutomationMsg_CloseExternalTab, int) +IPC_MESSAGE_ROUTED0(AutomationMsg_CloseExternalTab) // This message requests that the external tab identified by the tab handle // runs unload handlers if any on the current page. // Request: // -int: Tab handle // -bool: result: true->unload, false->don't unload -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_RunUnloadHandlers, int, bool) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_RunUnloadHandlers, + int, + bool) // This message sets the current zoom level on the tab // Request: @@ -1389,29 +1401,31 @@ IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_RunUnloadHandlers, int, bool) // -int: Zoom level. Values ZOOM_OUT = -1, RESET = 0, ZOOM_IN = 1 // Response: // None expected -IPC_MESSAGE_ROUTED2(AutomationMsg_SetZoomLevel, int, int) +IPC_MESSAGE_CONTROL2(AutomationMsg_SetZoomLevel, + int, + int) // Waits for tab count to reach target value. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WaitForTabCountToBecome, - int /* browser handle */, - int /* target tab count */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WaitForTabCountToBecome, + int /* browser handle */, + int /* target tab count */, + bool /* success */) // Waits for the infobar count to reach given number. -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_WaitForInfoBarCount, - int /* tab handle */, - int /* target count */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_WaitForInfoBarCount, + int /* tab handle */, + int /* target count */, + bool /* success */) // Waits for the autocomplete edit to receive focus. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_WaitForAutocompleteEditFocus, - int /* autocomplete edit handle */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_WaitForAutocompleteEditFocus, + int /* autocomplete edit handle */, + bool /* success */) // Loads all blocked plug-ins on the page. -IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_LoadBlockedPlugins, - int /* tab handle */, - bool /* success */) +IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_LoadBlockedPlugins, + int /* tab handle */, + bool /* success */) // Captures the entire page for the tab, including those portions not in // view, and saves the image as a PNG in the given file location. @@ -1420,5 +1434,7 @@ IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_LoadBlockedPlugins, // -FilePath: Path to save the captured image to // Response: // -bool: Whether the method succeeded -IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_CaptureEntirePageAsPNG, int, - FilePath, bool) +IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_CaptureEntirePageAsPNG, + int, + FilePath, + bool) diff --git a/chrome/test/automation/autocomplete_edit_proxy.cc b/chrome/test/automation/autocomplete_edit_proxy.cc index 184239a..019326b 100644 --- a/chrome/test/automation/autocomplete_edit_proxy.cc +++ b/chrome/test/automation/autocomplete_edit_proxy.cc @@ -22,7 +22,7 @@ bool AutocompleteEditProxy::GetText(std::wstring* text) const { } bool result = false; sender_->Send(new AutomationMsg_AutocompleteEditGetText( - 0, handle_, &result, text)); + handle_, &result, text)); return result; } @@ -31,7 +31,7 @@ bool AutocompleteEditProxy::WaitForFocus() const { return false; bool edit_exists = false; sender_->Send(new AutomationMsg_WaitForAutocompleteEditFocus( - 0, handle_, &edit_exists)); + handle_, &edit_exists)); return edit_exists; } @@ -40,7 +40,7 @@ bool AutocompleteEditProxy::SetText(const std::wstring& text) { return false; bool result = false; sender_->Send(new AutomationMsg_AutocompleteEditSetText( - 0, handle_, text, &result)); + handle_, text, &result)); return result; } @@ -53,7 +53,7 @@ bool AutocompleteEditProxy::IsQueryInProgress(bool* query_in_progress) const { } bool edit_exists = false; sender_->Send(new AutomationMsg_AutocompleteEditIsQueryInProgress( - 0, handle_, &edit_exists, query_in_progress)); + handle_, &edit_exists, query_in_progress)); return edit_exists; } @@ -81,6 +81,6 @@ bool AutocompleteEditProxy::GetAutocompleteMatches(Matches* matches) const { } bool edit_exists = false; sender_->Send(new AutomationMsg_AutocompleteEditGetMatches( - 0, handle_, &edit_exists, matches)); + handle_, &edit_exists, matches)); return edit_exists; } diff --git a/chrome/test/automation/automation_handle_tracker.cc b/chrome/test/automation/automation_handle_tracker.cc index b5613a5..0ad7592 100644 --- a/chrome/test/automation/automation_handle_tracker.cc +++ b/chrome/test/automation/automation_handle_tracker.cc @@ -45,7 +45,7 @@ void AutomationHandleTracker::Remove(AutomationResourceProxy* proxy) { AutomationHandle proxy_handle = proxy->handle(); handle_to_object_.erase(iter); if (channel_) - channel_->Send(new AutomationMsg_HandleUnused(0, proxy_handle)); + channel_->Send(new AutomationMsg_HandleUnused(proxy_handle)); } } diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index cd5d9af..bf00ea6 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -227,13 +227,13 @@ void AutomationProxy::SignalNewTabUITab(int load_time) { } bool AutomationProxy::SavePackageShouldPromptUser(bool should_prompt) { - return Send(new AutomationMsg_SavePackageShouldPromptUser(0, should_prompt)); + return Send(new AutomationMsg_SavePackageShouldPromptUser(should_prompt)); } scoped_refptr<ExtensionProxy> AutomationProxy::InstallExtension( const FilePath& crx_file, bool with_ui) { int handle = 0; - if (!Send(new AutomationMsg_InstallExtensionAndGetHandle(0, crx_file, with_ui, + if (!Send(new AutomationMsg_InstallExtensionAndGetHandle(crx_file, with_ui, &handle))) return NULL; @@ -243,7 +243,7 @@ scoped_refptr<ExtensionProxy> AutomationProxy::InstallExtension( void AutomationProxy::EnsureExtensionTestResult() { bool result; std::string message; - if (!Send(new AutomationMsg_WaitForExtensionTestResult(0, &result, + if (!Send(new AutomationMsg_WaitForExtensionTestResult(&result, &message))) { FAIL() << "Could not send WaitForExtensionTestResult message"; return; @@ -253,8 +253,7 @@ void AutomationProxy::EnsureExtensionTestResult() { bool AutomationProxy::GetEnabledExtensions( std::vector<FilePath>* extension_directories) { - return Send(new AutomationMsg_GetEnabledExtensions( - 0, extension_directories)); + return Send(new AutomationMsg_GetEnabledExtensions(extension_directories)); } bool AutomationProxy::GetBrowserWindowCount(int* num_windows) { @@ -263,7 +262,7 @@ bool AutomationProxy::GetBrowserWindowCount(int* num_windows) { return false; } - return Send(new AutomationMsg_BrowserWindowCount(0, num_windows)); + return Send(new AutomationMsg_BrowserWindowCount(num_windows)); } bool AutomationProxy::GetNormalBrowserWindowCount(int* num_windows) { @@ -272,13 +271,13 @@ bool AutomationProxy::GetNormalBrowserWindowCount(int* num_windows) { return false; } - return Send(new AutomationMsg_NormalBrowserWindowCount(0, num_windows)); + return Send(new AutomationMsg_NormalBrowserWindowCount(num_windows)); } bool AutomationProxy::WaitForWindowCountToBecome(int count) { bool wait_success = false; if (!Send(new AutomationMsg_WaitForBrowserWindowCountToBecome( - 0, count, &wait_success))) { + count, &wait_success))) { return false; } return wait_success; @@ -295,7 +294,7 @@ bool AutomationProxy::GetShowingAppModalDialog( int button_int = 0; if (!Send(new AutomationMsg_ShowingAppModalDialog( - 0, showing_app_modal_dialog, &button_int))) { + showing_app_modal_dialog, &button_int))) { return false; } @@ -308,7 +307,7 @@ bool AutomationProxy::ClickAppModalDialogButton( bool succeeded = false; if (!Send(new AutomationMsg_ClickAppModalDialogButton( - 0, button, &succeeded))) { + button, &succeeded))) { return false; } @@ -317,7 +316,7 @@ bool AutomationProxy::ClickAppModalDialogButton( bool AutomationProxy::WaitForAppModalDialog() { bool wait_success = false; - if (!Send(new AutomationMsg_WaitForAppModalDialogToBeShown(0, &wait_success))) + if (!Send(new AutomationMsg_WaitForAppModalDialogToBeShown(&wait_success))) return false; return wait_success; } @@ -355,23 +354,23 @@ bool AutomationProxy::IsURLDisplayed(GURL url) { bool AutomationProxy::GetMetricEventDuration(const std::string& event_name, int* duration_ms) { - return Send(new AutomationMsg_GetMetricEventDuration(0, event_name, + return Send(new AutomationMsg_GetMetricEventDuration(event_name, duration_ms)); } bool AutomationProxy::SetFilteredInet(bool enabled) { - return Send(new AutomationMsg_SetFilteredInet(0, enabled)); + return Send(new AutomationMsg_SetFilteredInet(enabled)); } int AutomationProxy::GetFilteredInetHitCount() { int hit_count; - if (!Send(new AutomationMsg_GetFilteredInetHitCount(0, &hit_count))) + if (!Send(new AutomationMsg_GetFilteredInetHitCount(&hit_count))) return -1; return hit_count; } bool AutomationProxy::SendProxyConfig(const std::string& new_proxy_config) { - return Send(new AutomationMsg_SetProxyConfig(0, new_proxy_config)); + return Send(new AutomationMsg_SetProxyConfig(new_proxy_config)); } void AutomationProxy::Disconnect() { @@ -394,7 +393,7 @@ void AutomationProxy::OnChannelError() { scoped_refptr<WindowProxy> AutomationProxy::GetActiveWindow() { int handle = 0; - if (!Send(new AutomationMsg_ActiveWindow(0, &handle))) + if (!Send(new AutomationMsg_ActiveWindow(&handle))) return NULL; return ProxyObjectFromHandle<WindowProxy>(handle); @@ -403,7 +402,7 @@ scoped_refptr<WindowProxy> AutomationProxy::GetActiveWindow() { scoped_refptr<BrowserProxy> AutomationProxy::GetBrowserWindow( int window_index) { int handle = 0; - if (!Send(new AutomationMsg_BrowserWindow(0, window_index, &handle))) + if (!Send(new AutomationMsg_BrowserWindow(window_index, &handle))) return NULL; return ProxyObjectFromHandle<BrowserProxy>(handle); @@ -411,7 +410,7 @@ scoped_refptr<BrowserProxy> AutomationProxy::GetBrowserWindow( bool AutomationProxy::GetBrowserLocale(string16* locale) { DCHECK(locale != NULL); - if (!Send(new AutomationMsg_GetBrowserLocale(0, locale))) + if (!Send(new AutomationMsg_GetBrowserLocale(locale))) return false; return !locale->empty(); @@ -419,7 +418,7 @@ bool AutomationProxy::GetBrowserLocale(string16* locale) { scoped_refptr<BrowserProxy> AutomationProxy::FindNormalBrowserWindow() { int handle = 0; - if (!Send(new AutomationMsg_FindNormalBrowserWindow(0, &handle))) + if (!Send(new AutomationMsg_FindNormalBrowserWindow(&handle))) return NULL; return ProxyObjectFromHandle<BrowserProxy>(handle); @@ -427,7 +426,7 @@ scoped_refptr<BrowserProxy> AutomationProxy::FindNormalBrowserWindow() { scoped_refptr<BrowserProxy> AutomationProxy::GetLastActiveBrowserWindow() { int handle = 0; - if (!Send(new AutomationMsg_LastActiveBrowserWindow(0, &handle))) + if (!Send(new AutomationMsg_LastActiveBrowserWindow(&handle))) return NULL; return ProxyObjectFromHandle<BrowserProxy>(handle); @@ -475,21 +474,19 @@ void AutomationProxy::InvalidateHandle(const IPC::Message& message) { } bool AutomationProxy::OpenNewBrowserWindow(Browser::Type type, bool show) { - if (type == Browser::TYPE_NORMAL) - return Send(new AutomationMsg_OpenNewBrowserWindow(0, show)); return Send( - new AutomationMsg_OpenNewBrowserWindowOfType(0, static_cast<int>(type), + new AutomationMsg_OpenNewBrowserWindowOfType(static_cast<int>(type), show)); } scoped_refptr<TabProxy> AutomationProxy::CreateExternalTab( - const IPC::ExternalTabSettings& settings, + const ExternalTabSettings& settings, gfx::NativeWindow* external_tab_container, gfx::NativeWindow* tab) { int handle = 0; int session_id = 0; bool succeeded = - Send(new AutomationMsg_CreateExternalTab(0, settings, + Send(new AutomationMsg_CreateExternalTab(settings, external_tab_container, tab, &handle, @@ -539,7 +536,7 @@ void AutomationProxy::ResetChannel() { bool AutomationProxy::LoginWithUserAndPass(const std::string& username, const std::string& password) { bool success; - bool sent = Send(new AutomationMsg_LoginWithUserAndPass(0, username, + bool sent = Send(new AutomationMsg_LoginWithUserAndPass(username, password, &success)); // If message sending unsuccessful or test failed, return false. @@ -548,5 +545,5 @@ bool AutomationProxy::LoginWithUserAndPass(const std::string& username, #endif bool AutomationProxy::ResetToDefaultTheme() { - return Send(new AutomationMsg_ResetToDefaultTheme(0)); + return Send(new AutomationMsg_ResetToDefaultTheme()); } diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 7902ef0..b0cd74c 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -31,10 +31,7 @@ class BrowserProxy; class ExtensionProxy; class TabProxy; class WindowProxy; - -namespace IPC { struct ExternalTabSettings; -} // This is an interface that AutomationProxy-related objects can use to // access the message-sending abilities of the Proxy. @@ -235,7 +232,7 @@ class AutomationProxy : public IPC::Channel::Listener, // returns a TabProxy representing the tab as well as a window handle // that can be reparented in another process. scoped_refptr<TabProxy> CreateExternalTab( - const IPC::ExternalTabSettings& settings, + const ExternalTabSettings& settings, gfx::NativeWindow* external_tab_container, gfx::NativeWindow* tab); diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index d963f1d..9c36fe1 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -671,15 +671,15 @@ ExternalTabUITestMockClient::~ExternalTabUITestMockClient() { } void ExternalTabUITestMockClient::ReplyStarted( - const IPC::AutomationURLResponse* response, + const AutomationURLResponse* response, int tab_handle, int request_id) { - AutomationProxy::Send(new AutomationMsg_RequestStarted(0, tab_handle, + AutomationProxy::Send(new AutomationMsg_RequestStarted(tab_handle, request_id, *response)); } void ExternalTabUITestMockClient::ReplyData( const std::string* data, int tab_handle, int request_id) { - AutomationProxy::Send(new AutomationMsg_RequestData(0, tab_handle, + AutomationProxy::Send(new AutomationMsg_RequestData(tab_handle, request_id, *data)); } @@ -689,13 +689,13 @@ void ExternalTabUITestMockClient::ReplyEOF(int tab_handle, int request_id) { void ExternalTabUITestMockClient::ReplyEnd(const URLRequestStatus& status, int tab_handle, int request_id) { - AutomationProxy::Send(new AutomationMsg_RequestEnd(0, tab_handle, + AutomationProxy::Send(new AutomationMsg_RequestEnd(tab_handle, request_id, status)); } void ExternalTabUITestMockClient::Reply404(int tab_handle, int request_id) { - const IPC::AutomationURLResponse notfound("", "HTTP/1.1 404\r\n\r\n", 0, - base::Time(), "", 0); + const AutomationURLResponse notfound("", "HTTP/1.1 404\r\n\r\n", 0, + base::Time(), "", 0); ReplyStarted(¬found, tab_handle, request_id); ReplyEOF(tab_handle, request_id); } @@ -703,29 +703,29 @@ void ExternalTabUITestMockClient::Reply404(int tab_handle, int request_id) { void ExternalTabUITestMockClient::ServeHTMLData(int tab_handle, const GURL& url, const std::string& data) { - EXPECT_CALL(*this, OnRequestStart(tab_handle, _, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, url.spec()), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + EXPECT_CALL(*this, OnRequestStart(tab_handle, testing::AllOf( + testing::Field(&AutomationURLRequest::url, url.spec()), + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(this, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(this, &ExternalTabUITestMockClient::ReplyStarted, &http_200)))); - EXPECT_CALL(*this, OnRequestRead(tab_handle, _, testing::Gt(0))) + EXPECT_CALL(*this, OnRequestRead(tab_handle, testing::Gt(0))) .Times(2) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(this, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(this, &ExternalTabUITestMockClient::ReplyData, &data)))) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(this, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(this, &ExternalTabUITestMockClient::ReplyEOF)))); } void ExternalTabUITestMockClient::IgnoreFavIconNetworkRequest() { // Ignore favicon.ico - EXPECT_CALL(*this, OnRequestStart(_, _, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, + EXPECT_CALL(*this, OnRequestStart(_, testing::AllOf( + testing::Field(&AutomationURLRequest::url, testing::EndsWith("favicon.ico")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(testing::AnyNumber()) - .WillRepeatedly(testing::WithArgs<0, 1>(testing::Invoke( + .WillRepeatedly(testing::WithArgs<0, 0>(testing::Invoke( CreateFunctor(this, &ExternalTabUITestMockClient::ReplyEnd, URLRequestStatus(URLRequestStatus::FAILED, 0))))); } @@ -742,7 +742,7 @@ void ExternalTabUITestMockClient::InvalidateHandle( } // Most of the time we need external tab with these settings. -const IPC::ExternalTabSettings ExternalTabUITestMockClient::default_settings( +const ExternalTabSettings ExternalTabUITestMockClient::default_settings( NULL, gfx::Rect(), // will be replaced by CreateHostWindowAndTab WS_CHILD | WS_VISIBLE, false, // is_off_the_record @@ -754,7 +754,7 @@ const IPC::ExternalTabSettings ExternalTabUITestMockClient::default_settings( false); // route_all_top_level_navigations // static -const IPC::AutomationURLResponse ExternalTabUITestMockClient::http_200( +const AutomationURLResponse ExternalTabUITestMockClient::http_200( "", "HTTP/0.9 200\r\n\r\n", 0, @@ -775,12 +775,12 @@ void ExternalTabUITestMockClient::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab) IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, - OnNavigationStateChanged) + OnNavigationStateChanged) IPC_END_MESSAGE_MAP() } scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateHostWindowAndTab( - const IPC::ExternalTabSettings& settings) { + const ExternalTabSettings& settings) { EXPECT_THAT(settings.parent, testing::IsNull()); host_window_ = CreateWindowW(L"Button", NULL, host_window_style_, @@ -790,7 +790,7 @@ scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateHostWindowAndTab( RECT client_area = {0}; ::GetClientRect(host_window_, &client_area); - IPC::ExternalTabSettings s = settings; + ExternalTabSettings s = settings; s.parent = host_window_; s.dimensions = client_area; @@ -806,7 +806,7 @@ scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateHostWindowAndTab( scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateTabWithUrl( const GURL& initial_url) { - IPC::ExternalTabSettings settings = + ExternalTabSettings settings = ExternalTabUITestMockClient::default_settings; settings.initial_url = initial_url; return CreateHostWindowAndTab(settings); @@ -814,25 +814,25 @@ scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateTabWithUrl( void ExternalTabUITestMockClient::NavigateInExternalTab(int tab_handle, const GURL& url, const GURL& referrer /* = GURL()*/) { - channel_->ChannelProxy::Send(new AutomationMsg_NavigateInExternalTab(0, + channel_->ChannelProxy::Send(new AutomationMsg_NavigateInExternalTab( tab_handle, url, referrer, NULL)); } void ExternalTabUITestMockClient::ConnectToExternalTab(gfx::NativeWindow parent, - const IPC::AttachExternalTabParams& attach_params) { + const AttachExternalTabParams& attach_params) { gfx::NativeWindow tab_container = NULL; gfx::NativeWindow tab_window = NULL; int tab_handle = 0; int session_id = -1; - IPC::SyncMessage* message = new AutomationMsg_ConnectExternalTab(0, + IPC::SyncMessage* message = new AutomationMsg_ConnectExternalTab( attach_params.cookie, true, NULL, &tab_container, &tab_window, &tab_handle, &session_id); channel_->Send(message); RECT rect; ::GetClientRect(parent, &rect); - IPC::Reposition_Params params = {0}; + Reposition_Params params = {0}; params.window = tab_container; params.flags = SWP_NOZORDER | SWP_SHOWWINDOW; params.width = rect.right - rect.left; @@ -840,7 +840,7 @@ void ExternalTabUITestMockClient::ConnectToExternalTab(gfx::NativeWindow parent, params.set_parent = true; params.parent_window = parent; - channel_->Send(new AutomationMsg_TabReposition(0, tab_handle, params)); + channel_->Send(new AutomationMsg_TabReposition(tab_handle, params)); ::ShowWindow(parent, SW_SHOWNORMAL); } @@ -894,10 +894,10 @@ TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab1) { TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) + EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) .Times(1) .WillOnce(testing::InvokeWithoutArgs(mock_, &ExternalTabUITestMockClient::DestroyHostWindow)); @@ -917,10 +917,10 @@ TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab2) { TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) + EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) .Times(1) .WillOnce(testing::InvokeWithoutArgs(mock_, &ExternalTabUITestMockClient::DestroyHostWindow)); @@ -945,7 +945,7 @@ TEST_F(ExternalTabUITest, FLAKY_IncognitoMode) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); - IPC::ExternalTabSettings incognito = + ExternalTabSettings incognito = ExternalTabUITestMockClient::default_settings; incognito.is_off_the_record = true; // SetCookie is a sync call and deadlock can happen if window is visible, @@ -982,9 +982,9 @@ TEST_F(ExternalTabUITest, FLAKY_TabPostMessage) { TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); std::string content = "data:text/html,<html><head><script>" @@ -998,7 +998,7 @@ TEST_F(ExternalTabUITest, FLAKY_TabPostMessage) { "<body onload='onload()'>external tab test<br></div>" "</body></html>"; - EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) + EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) .Times(1) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor( ReceivePointer(tab), @@ -1006,7 +1006,7 @@ TEST_F(ExternalTabUITest, FLAKY_TabPostMessage) { std::string("Hello from gtest"), std::string("null"), std::string("*")))); - EXPECT_CALL(*mock_, OnForwardMessageToExternalHost(testing::_, + EXPECT_CALL(*mock_, OnForwardMessageToExternalHost( testing::StrEq("Hello from gtest"), testing::_, testing::_)) .Times(1) .WillOnce(testing::DoAll( @@ -1030,21 +1030,21 @@ TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { scoped_refptr<TabProxy> tab; TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); std::string kTestMessage("Hello from gtest"); std::string kTestOrigin("http://www.external.tab"); - EXPECT_CALL(*mock_, OnDidNavigate(1, testing::_)) + EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) .Times(1) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor( ReceivePointer(tab), &TabProxy::HandleMessageFromExternalHost, kTestMessage, kTestOrigin, std::string("http://localhost:1337/")))); - EXPECT_CALL(*mock_, OnForwardMessageToExternalHost(1, + EXPECT_CALL(*mock_, OnForwardMessageToExternalHost( testing::StrEq(kTestMessage), testing::_, testing::StrEq(GURL(kTestOrigin).GetOrigin().spec()))) @@ -1056,7 +1056,7 @@ TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); - IPC::ExternalTabSettings s = ExternalTabUITestMockClient::default_settings; + ExternalTabSettings s = ExternalTabUITestMockClient::default_settings; s.load_requests_via_automation = false; s.initial_url = GURL("http://localhost:1337/files/post_message.html"); tab = mock_->CreateHostWindowAndTab(s); @@ -1068,20 +1068,20 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStack) { scoped_refptr<TabProxy> tab; TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); std::string url = "http://placetogo.org"; testing::InSequence sequence; - EXPECT_CALL(*mock_, OnRequestStart(1, 2, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + EXPECT_CALL(*mock_, OnRequestStart(2, testing::AllOf( + testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) // We can simply do CreateFunctor(1, 2, &http_200) since we know the // tab handle and request id, but using WithArgs<> is much more fancy :) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyStarted, &ExternalTabUITestMockClient::http_200)))); @@ -1089,34 +1089,34 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStack) { const std::string data = "<!DOCTYPE html><title>Hello</title>" "<img src=\"logo.gif\">"; - EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) .Times(2) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyEOF)))); // Expect navigation is ok. - EXPECT_CALL(*mock_, OnDidNavigate(1, testing::Field(&IPC::NavigationInfo::url, - GURL(url)))) + EXPECT_CALL(*mock_, OnDidNavigate(testing::Field(&NavigationInfo::url, + GURL(url)))) .Times(1); // Expect GET request for logo.gif - EXPECT_CALL(*mock_, OnRequestStart(1, 3, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/logo.gif")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + EXPECT_CALL(*mock_, OnRequestStart(3, testing::AllOf( + testing::Field(&AutomationURLRequest::url, StrEq(url + "/logo.gif")), + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::Reply404, 1, 3))); - EXPECT_CALL(*mock_, OnRequestRead(1, 3, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(3, testing::Gt(0))) .Times(1); // Chrome makes a brave request for favicon.ico - EXPECT_CALL(*mock_, OnRequestStart(1, 4, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, + EXPECT_CALL(*mock_, OnRequestStart(4, testing::AllOf( + testing::Field(&AutomationURLRequest::url, StrEq(url + "/favicon.ico")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) .WillOnce(testing::DoAll( testing::InvokeWithoutArgs(CreateFunctor(mock_, @@ -1126,7 +1126,7 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStack) { EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); - EXPECT_CALL(*mock_, OnRequestRead(1, 4, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(4, testing::Gt(0))) .Times(1) .WillOnce(QUIT_LOOP_SOON(&loop, 300)); @@ -1139,36 +1139,36 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackAbortRequest) { scoped_refptr<TabProxy> tab; TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); std::string url = "http://placetogo.org"; testing::InSequence sequence; - EXPECT_CALL(*mock_, OnRequestStart(1, 2, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + EXPECT_CALL(*mock_, OnRequestStart(2, testing::AllOf( + testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) // We can simply do CreateFunctor(1, 2, &http_200) since we know the // tab handle and request id, but using WithArgs<> is much more fancy :) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyStarted, &ExternalTabUITestMockClient::http_200)))); // Return some trivial page, that have a link to a "logo.gif" image const std::string data = "<!DOCTYPE html><title>Hello"; - EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) .Times(2) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))) - .WillOnce(testing::WithArgs<0, 1>( + .WillOnce(testing::WithArgs<0, 0>( testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::DestroyHostWindow)))); EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); - EXPECT_CALL(*mock_, OnRequestEnd(1, 2, testing::_)) + EXPECT_CALL(*mock_, OnRequestEnd(2, testing::_)) .Times(1) .WillOnce(QUIT_LOOP_SOON(&loop, 300)); @@ -1181,24 +1181,24 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackUnresponsiveRenderer) { scoped_refptr<TabProxy> tab; TimedMessageLoopRunner loop(MessageLoop::current()); ASSERT_THAT(mock_, testing::NotNull()); - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); std::string url = "http://placetogo.org"; - EXPECT_CALL(*mock_, OnRequestStart(1, 3, testing::_)) + EXPECT_CALL(*mock_, OnRequestStart(3, testing::_)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(testing::AnyNumber()); testing::InSequence sequence; - EXPECT_CALL(*mock_, OnRequestStart(1, 2, testing::AllOf( - testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/")), - testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) + EXPECT_CALL(*mock_, OnRequestStart(2, testing::AllOf( + testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), + testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) .Times(1) // We can simply do CreateFunctor(1, 2, &http_200) since we know the // tab handle and request id, but using WithArgs<> is much more fancy :) - .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyStarted, &ExternalTabUITestMockClient::http_200)))); @@ -1221,17 +1221,17 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackUnresponsiveRenderer) { const std::string tail = "</body></html>"; - EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) .Times(1) .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyData, &head, 1, 2))); - EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) .Times(100) .WillRepeatedly(testing::InvokeWithoutArgs(CreateFunctor(mock_, &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))); - EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) + EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) .Times(testing::AnyNumber()) .WillOnce(testing::DoAll( testing::InvokeWithoutArgs(CreateFunctor(mock_, @@ -1270,9 +1270,9 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_WindowDotOpen) { ASSERT_THAT(mock_, testing::NotNull()); mock_->IgnoreFavIconNetworkRequest(); // Ignore navigation state changes. - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(testing::AnyNumber()); GURL main_url("http://placetogo.com/"); std::string main_html = @@ -1281,7 +1281,7 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_WindowDotOpen) { "height=320,width=300,left=1');" "</script></head><body>Main.</body></html>"; mock_->ServeHTMLData(1, main_url, main_html); - EXPECT_CALL(*mock_, OnLoad(1, _)).Times(1); + EXPECT_CALL(*mock_, OnLoad(_)).Times(1); GURL popup1_url("http://placetogo.com/popup1.html"); std::string popup1_html = @@ -1289,12 +1289,12 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_WindowDotOpen) { "window.open('popup2.html','','');" "</script></head><body>Popup1.</body></html>"; mock_->ServeHTMLData(2, popup1_url, popup1_html); - EXPECT_CALL(*mock_, OnLoad(2, _)).Times(1); + EXPECT_CALL(*mock_, OnLoad(_)).Times(1); GURL popup2_url("http://placetogo.com/popup2.html"); std::string popup2_html = "<html><body>Popup2.</body></html>"; mock_->ServeHTMLData(3, popup2_url, popup2_html); - EXPECT_CALL(*mock_, OnLoad(3, _)).Times(1) + EXPECT_CALL(*mock_, OnLoad(_)).Times(1) .WillOnce(QUIT_LOOP_SOON(&loop, 500)); DWORD style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; @@ -1306,14 +1306,14 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_WindowDotOpen) { CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL); - EXPECT_CALL(*mock_, OnAttachExternalTab(1, _)) + EXPECT_CALL(*mock_, OnAttachExternalTab(_)) .Times(1) - .WillOnce(testing::WithArgs<1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ConnectToExternalTab, popup1_host)))); - EXPECT_CALL(*mock_, OnAttachExternalTab(2, _)) + EXPECT_CALL(*mock_, OnAttachExternalTab(_)) .Times(1) - .WillOnce(testing::WithArgs<1>(testing::Invoke(CreateFunctor(mock_, + .WillOnce(testing::WithArgs<0>(testing::Invoke(CreateFunctor(mock_, &ExternalTabUITestMockClient::ConnectToExternalTab, popup2_host)))); mock_->CreateTabWithUrl(main_url); @@ -1335,9 +1335,9 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_UserGestureTargetBlank) { ASSERT_THAT(mock_, testing::NotNull()); mock_->IgnoreFavIconNetworkRequest(); // Ignore navigation state changes. - EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) + EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) .Times(testing::AnyNumber()); - EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(testing::AnyNumber()); GURL main_url("http://placetogo.com/"); std::string main_html = "<!DOCTYPE html><title>Hello</title>" @@ -1349,11 +1349,11 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_UserGestureTargetBlank) { CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL); testing::InSequence s; - EXPECT_CALL(*mock_, OnLoad(1, _)) + EXPECT_CALL(*mock_, OnLoad(_)) .WillOnce(testing::InvokeWithoutArgs(testing::CreateFunctor(mock_, &ExternalTabUITestMockClient::NavigateThroughUserGesture))); - EXPECT_CALL(*mock_, OnAttachExternalTab(1, _)) + EXPECT_CALL(*mock_, OnAttachExternalTab(_)) .Times(1) .WillOnce(QUIT_LOOP_SOON(&loop, 500)); diff --git a/chrome/test/automation/automation_proxy_uitest.h b/chrome/test/automation/automation_proxy_uitest.h index cda06c1..35de197 100644 --- a/chrome/test/automation/automation_proxy_uitest.h +++ b/chrome/test/automation/automation_proxy_uitest.h @@ -37,35 +37,34 @@ class ExternalTabUITestMockClient : public AutomationProxy { explicit ExternalTabUITestMockClient(int execution_timeout); virtual ~ExternalTabUITestMockClient(); - MOCK_METHOD2(OnDidNavigate, void(int tab_handle, - const IPC::NavigationInfo& nav_info)); - MOCK_METHOD4(OnForwardMessageToExternalHost, void(int handle, + MOCK_METHOD1(OnDidNavigate, void(const NavigationInfo& nav_info)); + MOCK_METHOD3(OnForwardMessageToExternalHost, void( const std::string& message, const std::string& origin, const std::string& target)); - MOCK_METHOD3(OnRequestStart, void(int tab_handle, int request_id, - const IPC::AutomationURLRequest& request)); - MOCK_METHOD3(OnRequestRead, void(int tab_handle, int request_id, + MOCK_METHOD2(OnRequestStart, void(int request_id, + const AutomationURLRequest& request)); + MOCK_METHOD2(OnRequestRead, void(int request_id, int bytes_to_read)); - MOCK_METHOD3(OnRequestEnd, void(int tab_handle, int request_id, + MOCK_METHOD2(OnRequestEnd, void(int request_id, const URLRequestStatus& status)); - MOCK_METHOD3(OnSetCookieAsync, void(int tab_handle, const GURL& url, + MOCK_METHOD2(OnSetCookieAsync, void(const GURL& url, const std::string& cookie)); MOCK_METHOD1(HandleClosed, void(int handle)); - MOCK_METHOD4(OnOpenURL, void(int tab_handle, const GURL& url, + MOCK_METHOD3(OnOpenURL, void(const GURL& url, const GURL& referrer, int open_disposition)); - MOCK_METHOD3(OnNavigationStateChanged, void(int tab_handle, int flags, - const IPC::NavigationInfo& nav_info)); - MOCK_METHOD2(OnAttachExternalTab, void(int tab_handle, - const IPC::AttachExternalTabParams& params)); - MOCK_METHOD2(OnLoad, void(int tab_handle, const GURL&url)); + MOCK_METHOD2(OnNavigationStateChanged, void(int flags, + const NavigationInfo& nav_info)); + MOCK_METHOD1(OnAttachExternalTab, void( + const AttachExternalTabParams& params)); + MOCK_METHOD1(OnLoad, void(const GURL&url)); // Action helpers for OnRequest* incoming messages. Create the message and // delegate sending to the base class. Apparently we do not have wrappers // in AutomationProxy for these messages. - void ReplyStarted(const IPC::AutomationURLResponse* response, + void ReplyStarted(const AutomationURLResponse* response, int tab_handle, int request_id); void ReplyData(const std::string* data, int tab_handle, int request_id); void ReplyEOF(int tab_handle, int request_id); @@ -74,7 +73,7 @@ class ExternalTabUITestMockClient : public AutomationProxy { // Test setup helpers scoped_refptr<TabProxy> CreateHostWindowAndTab( - const IPC::ExternalTabSettings& settings); + const ExternalTabSettings& settings); scoped_refptr<TabProxy> CreateTabWithUrl(const GURL& initial_url); void NavigateInExternalTab(int tab_handle, const GURL& url, const GURL& referrer = GURL()); @@ -84,7 +83,7 @@ class ExternalTabUITestMockClient : public AutomationProxy { void IgnoreFavIconNetworkRequest(); void ConnectToExternalTab(gfx::NativeWindow parent, - const IPC::AttachExternalTabParams& attach_params); + const AttachExternalTabParams& attach_params); // Helper for network requests. void ServeHTMLData(int tab_handle, const GURL& url, const std::string& data); // Destroys the host window. @@ -96,8 +95,8 @@ class ExternalTabUITestMockClient : public AutomationProxy { // very possible. unsigned long host_window_style_; - static const IPC::AutomationURLResponse http_200; - static const IPC::ExternalTabSettings default_settings; + static const AutomationURLResponse http_200; + static const ExternalTabSettings default_settings; protected: gfx::NativeWindow host_window_; diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index 3bcd101..ae18470 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -29,7 +29,7 @@ bool BrowserProxy::ActivateTab(int tab_index) { int activate_tab_response = -1; if (!sender_->Send(new AutomationMsg_ActivateTab( - 0, handle_, tab_index, &activate_tab_response))) { + handle_, tab_index, &activate_tab_response))) { return false; } @@ -46,7 +46,7 @@ bool BrowserProxy::BringToFront() { bool succeeded = false; if (!sender_->Send(new AutomationMsg_BringBrowserToFront( - 0, handle_, &succeeded))) { + handle_, &succeeded))) { return false; } @@ -57,7 +57,7 @@ bool BrowserProxy::IsMenuCommandEnabled(int id, bool* enabled) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_IsMenuCommandEnabled(0, handle_, id, + return sender_->Send(new AutomationMsg_IsMenuCommandEnabled(handle_, id, enabled)); } @@ -67,7 +67,7 @@ bool BrowserProxy::AppendTab(const GURL& tab_url) { int append_tab_response = -1; - sender_->Send(new AutomationMsg_AppendTab(0, handle_, tab_url, + sender_->Send(new AutomationMsg_AppendTab(handle_, tab_url, &append_tab_response)); return append_tab_response >= 0; } @@ -84,7 +84,7 @@ bool BrowserProxy::GetActiveTabIndex(int* active_tab_index) const { int active_tab_index_response = -1; if (!sender_->Send(new AutomationMsg_ActiveTabIndex( - 0, handle_, &active_tab_index_response))) { + handle_, &active_tab_index_response))) { return false; } @@ -102,7 +102,7 @@ scoped_refptr<TabProxy> BrowserProxy::GetTab(int tab_index) const { int tab_handle = 0; - sender_->Send(new AutomationMsg_Tab(0, handle_, tab_index, &tab_handle)); + sender_->Send(new AutomationMsg_Tab(handle_, tab_index, &tab_handle)); if (!tab_handle) return NULL; @@ -137,7 +137,7 @@ bool BrowserProxy::GetTabCount(int* num_tabs) const { int tab_count_response = -1; if (!sender_->Send(new AutomationMsg_TabCount( - 0, handle_, &tab_count_response))) { + handle_, &tab_count_response))) { return false; } @@ -159,7 +159,7 @@ bool BrowserProxy::GetType(Browser::Type* type) const { } int type_as_int; - if (!sender_->Send(new AutomationMsg_Type(0, handle_, &type_as_int))) + if (!sender_->Send(new AutomationMsg_Type(handle_, &type_as_int))) return false; *type = static_cast<Browser::Type>(type_as_int); @@ -184,7 +184,7 @@ bool BrowserProxy::SimulateDrag(const gfx::Point& start, bool result = false; if (!sender_->Send(new AutomationMsg_WindowDrag( - 0, handle_, drag_path, flags, press_escape_en_route, &result))) { + handle_, drag_path, flags, press_escape_en_route, &result))) { return false; } @@ -194,7 +194,7 @@ bool BrowserProxy::SimulateDrag(const gfx::Point& start, bool BrowserProxy::WaitForTabCountToBecome(int count) { bool success = false; if (!sender_->Send(new AutomationMsg_WaitForTabCountToBecome( - 0, handle_, count, &success))) { + handle_, count, &success))) { return false; } @@ -219,7 +219,7 @@ bool BrowserProxy::OpenFindInPage() { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_OpenFindInPage(0, handle_)); + return sender_->Send(new AutomationMsg_OpenFindInPage(handle_)); // This message expects no response. } @@ -227,8 +227,7 @@ bool BrowserProxy::GetFindWindowLocation(int* x, int* y) { if (!is_valid() || !x || !y) return false; - return sender_->Send( - new AutomationMsg_FindWindowLocation(0, handle_, x, y)); + return sender_->Send(new AutomationMsg_FindWindowLocation(handle_, x, y)); } bool BrowserProxy::IsFindWindowFullyVisible(bool* is_visible) { @@ -241,7 +240,7 @@ bool BrowserProxy::IsFindWindowFullyVisible(bool* is_visible) { } return sender_->Send( - new AutomationMsg_FindWindowVisibility(0, handle_, is_visible)); + new AutomationMsg_FindWindowVisibility(handle_, is_visible)); } bool BrowserProxy::RunCommandAsync(int browser_command) const { @@ -250,7 +249,7 @@ bool BrowserProxy::RunCommandAsync(int browser_command) const { bool result = false; - sender_->Send(new AutomationMsg_WindowExecuteCommandAsync(0, handle_, + sender_->Send(new AutomationMsg_WindowExecuteCommandAsync(handle_, browser_command, &result)); @@ -263,7 +262,7 @@ bool BrowserProxy::RunCommand(int browser_command) const { bool result = false; - sender_->Send(new AutomationMsg_WindowExecuteCommand(0, handle_, + sender_->Send(new AutomationMsg_WindowExecuteCommand(handle_, browser_command, &result)); @@ -281,7 +280,7 @@ bool BrowserProxy::GetBookmarkBarVisibility(bool* is_visible, } return sender_->Send(new AutomationMsg_BookmarkBarVisibility( - 0, handle_, is_visible, is_animating)); + handle_, is_visible, is_animating)); } bool BrowserProxy::GetBookmarksAsJSON(std::string *json_string) { @@ -292,7 +291,7 @@ bool BrowserProxy::GetBookmarksAsJSON(std::string *json_string) { return false; bool result = false; - sender_->Send(new AutomationMsg_GetBookmarksAsJSON(0, handle_, + sender_->Send(new AutomationMsg_GetBookmarksAsJSON(handle_, json_string, &result)); return result; @@ -303,8 +302,7 @@ bool BrowserProxy::WaitForBookmarkModelToLoad() { return false; bool result = false; - sender_->Send(new AutomationMsg_WaitForBookmarkModelToLoad(0, handle_, - &result)); + sender_->Send(new AutomationMsg_WaitForBookmarkModelToLoad(handle_, &result)); return result; } @@ -313,7 +311,7 @@ bool BrowserProxy::AddBookmarkGroup(int64 parent_id, int index, if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_AddBookmarkGroup(0, handle_, + sender_->Send(new AutomationMsg_AddBookmarkGroup(handle_, parent_id, index, title, &result)); @@ -325,7 +323,7 @@ bool BrowserProxy::AddBookmarkURL(int64 parent_id, int index, if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_AddBookmarkURL(0, handle_, + sender_->Send(new AutomationMsg_AddBookmarkURL(handle_, parent_id, index, title, url, &result)); @@ -336,7 +334,7 @@ bool BrowserProxy::ReparentBookmark(int64 id, int64 new_parent_id, int index) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_ReparentBookmark(0, handle_, + sender_->Send(new AutomationMsg_ReparentBookmark(handle_, id, new_parent_id, index, &result)); @@ -347,7 +345,7 @@ bool BrowserProxy::SetBookmarkTitle(int64 id, const std::wstring& title) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_SetBookmarkTitle(0, handle_, + sender_->Send(new AutomationMsg_SetBookmarkTitle(handle_, id, title, &result)); return result; @@ -357,7 +355,7 @@ bool BrowserProxy::SetBookmarkURL(int64 id, const GURL& url) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_SetBookmarkURL(0, handle_, + sender_->Send(new AutomationMsg_SetBookmarkURL(handle_, id, url, &result)); return result; @@ -367,7 +365,7 @@ bool BrowserProxy::RemoveBookmark(int64 id) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_RemoveBookmark(0, handle_, + sender_->Send(new AutomationMsg_RemoveBookmark(handle_, id, &result)); return result; @@ -382,7 +380,7 @@ bool BrowserProxy::IsShelfVisible(bool* is_visible) { return false; } - return sender_->Send(new AutomationMsg_ShelfVisibility(0, handle_, + return sender_->Send(new AutomationMsg_ShelfVisibility(handle_, is_visible)); } @@ -390,7 +388,7 @@ bool BrowserProxy::SetShelfVisible(bool is_visible) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_SetShelfVisibility(0, handle_, + return sender_->Send(new AutomationMsg_SetShelfVisibility(handle_, is_visible)); } @@ -400,7 +398,7 @@ bool BrowserProxy::SetIntPreference(const std::string& name, int value) { bool result = false; - sender_->Send(new AutomationMsg_SetIntPreference(0, handle_, name, value, + sender_->Send(new AutomationMsg_SetIntPreference(handle_, name, value, &result)); return result; } @@ -412,7 +410,7 @@ bool BrowserProxy::SetStringPreference(const std::string& name, bool result = false; - sender_->Send(new AutomationMsg_SetStringPreference(0, handle_, name, value, + sender_->Send(new AutomationMsg_SetStringPreference(handle_, name, value, &result)); return result; } @@ -424,7 +422,7 @@ bool BrowserProxy::GetBooleanPreference(const std::string& name, bool result = false; - sender_->Send(new AutomationMsg_GetBooleanPreference(0, handle_, name, value, + sender_->Send(new AutomationMsg_GetBooleanPreference(handle_, name, value, &result)); return result; } @@ -436,7 +434,7 @@ bool BrowserProxy::SetBooleanPreference(const std::string& name, bool result = false; - sender_->Send(new AutomationMsg_SetBooleanPreference(0, handle_, name, + sender_->Send(new AutomationMsg_SetBooleanPreference(handle_, name, value, &result)); return result; } @@ -454,7 +452,7 @@ bool BrowserProxy::SetContentSetting(const std::string& host, bool result = false; - sender_->Send(new AutomationMsg_SetContentSetting(0, handle_, host, + sender_->Send(new AutomationMsg_SetContentSetting(handle_, host, content_type, setting, &result)); return result; @@ -466,7 +464,7 @@ bool BrowserProxy::TerminateSession() { bool result = false; - sender_->Send(new AutomationMsg_TerminateSession(0, handle_, &result)); + sender_->Send(new AutomationMsg_TerminateSession(handle_, &result)); return result; } @@ -478,7 +476,7 @@ scoped_refptr<WindowProxy> BrowserProxy::GetWindow() const { bool handle_ok = false; int window_handle = 0; - sender_->Send(new AutomationMsg_WindowForBrowser(0, handle_, &handle_ok, + sender_->Send(new AutomationMsg_WindowForBrowser(handle_, &handle_ok, &window_handle)); if (!handle_ok) return NULL; @@ -504,7 +502,7 @@ scoped_refptr<AutocompleteEditProxy> BrowserProxy::GetAutocompleteEdit() { int autocomplete_edit_handle = 0; sender_->Send(new AutomationMsg_AutocompleteEditForBrowser( - 0, handle_, &handle_ok, &autocomplete_edit_handle)); + handle_, &handle_ok, &autocomplete_edit_handle)); if (!handle_ok) return NULL; @@ -529,8 +527,7 @@ bool BrowserProxy::IsFullscreen(bool* is_fullscreen) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_IsFullscreen(0, handle_, - is_fullscreen)); + return sender_->Send(new AutomationMsg_IsFullscreen(handle_, is_fullscreen)); } bool BrowserProxy::IsFullscreenBubbleVisible(bool* is_visible) { @@ -539,14 +536,14 @@ bool BrowserProxy::IsFullscreenBubbleVisible(bool* is_visible) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_IsFullscreenBubbleVisible(0, handle_, + return sender_->Send(new AutomationMsg_IsFullscreenBubbleVisible(handle_, is_visible)); } bool BrowserProxy::ShutdownSessionService() { bool did_shutdown = false; bool succeeded = sender_->Send( - new AutomationMsg_ShutdownSessionService(0, handle_, &did_shutdown)); + new AutomationMsg_ShutdownSessionService(handle_, &did_shutdown)); if (!succeeded) { DLOG(ERROR) << @@ -562,8 +559,8 @@ bool BrowserProxy::StartTrackingPopupMenus() { return false; bool result = false; - if (!sender_->Send(new AutomationMsg_StartTrackingPopupMenus - (0, handle_, &result))) + if (!sender_->Send(new AutomationMsg_StartTrackingPopupMenus( + handle_, &result))) return false; return result; } @@ -573,8 +570,7 @@ bool BrowserProxy::WaitForPopupMenuToOpen() { return false; bool result = false; - if (!sender_->Send(new AutomationMsg_WaitForPopupMenuToOpen - (0, &result))) + if (!sender_->Send(new AutomationMsg_WaitForPopupMenuToOpen(&result))) return false; return result; } @@ -585,7 +581,7 @@ bool BrowserProxy::SendJSONRequest(const std::string& request, return false; bool result = false; - return sender_->Send(new AutomationMsg_SendJSONRequest(0, handle_, + return sender_->Send(new AutomationMsg_SendJSONRequest(handle_, request, response, &result)); return result; diff --git a/chrome/test/automation/extension_proxy.cc b/chrome/test/automation/extension_proxy.cc index 4390c10..147df636 100644 --- a/chrome/test/automation/extension_proxy.cc +++ b/chrome/test/automation/extension_proxy.cc @@ -21,8 +21,7 @@ bool ExtensionProxy::Uninstall() { return false; bool success = false; - if (!sender_->Send(new AutomationMsg_UninstallExtension(0, handle_, - &success))) + if (!sender_->Send(new AutomationMsg_UninstallExtension(handle_, &success))) return false; return success; } @@ -32,8 +31,7 @@ bool ExtensionProxy::Enable() { return false; bool success = false; - if (!sender_->Send(new AutomationMsg_EnableExtension(0, handle_, - &success))) + if (!sender_->Send(new AutomationMsg_EnableExtension(handle_, &success))) return false; return success; } @@ -43,8 +41,7 @@ bool ExtensionProxy::Disable() { return false; bool success = false; - if (!sender_->Send(new AutomationMsg_DisableExtension(0, handle_, - &success))) + if (!sender_->Send(new AutomationMsg_DisableExtension(handle_, &success))) return false; return success; } @@ -55,7 +52,7 @@ bool ExtensionProxy::ExecuteActionInActiveTabAsync(BrowserProxy* browser) { bool success = false; if (!sender_->Send(new AutomationMsg_ExecuteExtensionActionInActiveTabAsync( - 0, handle_, browser->handle(), &success))) + handle_, browser->handle(), &success))) return false; return success; } @@ -65,8 +62,7 @@ bool ExtensionProxy::MoveBrowserAction(int index) { return false; bool success = false; if (!sender_->Send( - new AutomationMsg_MoveExtensionBrowserAction(0, handle_, index, - &success))) + new AutomationMsg_MoveExtensionBrowserAction(handle_, index, &success))) return false; return success; } @@ -135,7 +131,7 @@ bool ExtensionProxy::GetProperty(AutomationMsg_ExtensionProperty type, return false; bool success = false; - if (!sender_->Send(new AutomationMsg_GetExtensionProperty(0, handle_, type, + if (!sender_->Send(new AutomationMsg_GetExtensionProperty(handle_, type, &success, value))) return false; return success; diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index fdce639..dbf298c 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -33,7 +33,7 @@ bool TabProxy::GetTabTitle(std::wstring* title) const { int tab_title_size_response = 0; bool succeeded = sender_->Send( - new AutomationMsg_TabTitle(0, handle_, &tab_title_size_response, title)); + new AutomationMsg_TabTitle(handle_, &tab_title_size_response, title)); return succeeded; } @@ -46,7 +46,7 @@ bool TabProxy::GetTabIndex(int* index) const { return false; } - return sender_->Send(new AutomationMsg_TabIndex(0, handle_, index)); + return sender_->Send(new AutomationMsg_TabIndex(handle_, index)); } int TabProxy::FindInPage(const std::wstring& search_string, @@ -66,7 +66,7 @@ int TabProxy::FindInPage(const std::wstring& search_string, int matches = 0; int ordinal2 = 0; - bool succeeded = sender_->Send(new AutomationMsg_Find(0, handle_, + bool succeeded = sender_->Send(new AutomationMsg_Find(handle_, params, &ordinal2, &matches)); @@ -91,15 +91,8 @@ AutomationMsg_NavigationResponseValues AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; - if (number_of_navigations == 1) { - // TODO(phajdan.jr): Remove when the reference build gets updated. - // This is only for backwards compatibility. - sender_->Send(new AutomationMsg_NavigateToURL(0, handle_, url, - &navigate_response)); - } else { - sender_->Send(new AutomationMsg_NavigateToURLBlockUntilNavigationsComplete( - 0, handle_, url, number_of_navigations, &navigate_response)); - } + sender_->Send(new AutomationMsg_NavigateToURLBlockUntilNavigationsComplete( + handle_, url, number_of_navigations, &navigate_response)); return navigate_response; } @@ -111,7 +104,7 @@ bool TabProxy::SetAuth(const std::wstring& username, AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_SetAuth(0, handle_, username, password, + sender_->Send(new AutomationMsg_SetAuth(handle_, username, password, &navigate_response)); return navigate_response == AUTOMATION_MSG_NAVIGATION_SUCCESS; } @@ -122,7 +115,7 @@ bool TabProxy::CancelAuth() { AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_CancelAuth(0, handle_, &navigate_response)); + sender_->Send(new AutomationMsg_CancelAuth(handle_, &navigate_response)); return navigate_response == AUTOMATION_MSG_NAVIGATION_SUCCESS; } @@ -131,7 +124,7 @@ bool TabProxy::NeedsAuth() const { return false; bool needs_auth = false; - sender_->Send(new AutomationMsg_NeedsAuth(0, handle_, &needs_auth)); + sender_->Send(new AutomationMsg_NeedsAuth(handle_, &needs_auth)); return needs_auth; } @@ -147,7 +140,7 @@ AutomationMsg_NavigationResponseValues AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; sender_->Send(new AutomationMsg_GoBackBlockUntilNavigationsComplete( - 0, handle_, number_of_navigations, &navigate_response)); + handle_, number_of_navigations, &navigate_response)); return navigate_response; } @@ -164,7 +157,7 @@ AutomationMsg_NavigationResponseValues AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; sender_->Send(new AutomationMsg_GoForwardBlockUntilNavigationsComplete( - 0, handle_, number_of_navigations, &navigate_response)); + handle_, number_of_navigations, &navigate_response)); return navigate_response; } @@ -174,14 +167,14 @@ AutomationMsg_NavigationResponseValues TabProxy::Reload() { AutomationMsg_NavigationResponseValues navigate_response = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_Reload(0, handle_, &navigate_response)); + sender_->Send(new AutomationMsg_Reload(handle_, &navigate_response)); return navigate_response; } bool TabProxy::GetRedirectsFrom(const GURL& source_url, std::vector<GURL>* redirects) { bool succeeded = false; - sender_->Send(new AutomationMsg_RedirectsFrom(0, handle_, + sender_->Send(new AutomationMsg_RedirectsFrom(handle_, source_url, &succeeded, redirects)); @@ -198,7 +191,7 @@ bool TabProxy::GetCurrentURL(GURL* url) const { } bool succeeded = false; - sender_->Send(new AutomationMsg_TabURL(0, handle_, &succeeded, url)); + sender_->Send(new AutomationMsg_TabURL(handle_, &succeeded, url)); return succeeded; } @@ -207,8 +200,7 @@ bool TabProxy::NavigateToURLAsync(const GURL& url) { return false; bool status = false; - sender_->Send(new AutomationMsg_NavigationAsync(0, - handle_, + sender_->Send(new AutomationMsg_NavigationAsync(handle_, url, &status)); return status; @@ -221,8 +213,7 @@ bool TabProxy::NavigateToURLAsyncWithDisposition( return false; bool status = false; - sender_->Send(new AutomationMsg_NavigationAsyncWithDisposition(0, - handle_, + sender_->Send(new AutomationMsg_NavigationAsyncWithDisposition(handle_, url, disposition, &status)); @@ -238,7 +229,7 @@ bool TabProxy::GetProcessID(int* process_id) const { return false; } - return sender_->Send(new AutomationMsg_TabProcessID(0, handle_, process_id)); + return sender_->Send(new AutomationMsg_TabProcessID(handle_, process_id)); } bool TabProxy::ExecuteAndExtractString(const std::wstring& frame_xpath, @@ -323,7 +314,7 @@ bool TabProxy::ExecuteAndExtractValue(const std::wstring& frame_xpath, } std::string json; - if (!sender_->Send(new AutomationMsg_DomOperation(0, handle_, frame_xpath, + if (!sender_->Send(new AutomationMsg_DomOperation(handle_, frame_xpath, jscript, &json))) return false; // Wrap |json| in an array before deserializing because valid JSON has an @@ -352,7 +343,7 @@ bool TabProxy::SetEnableExtensionAutomation( return false; return sender_->Send(new AutomationMsg_SetEnableExtensionAutomation( - 0, handle_, functions_enabled)); + handle_, functions_enabled)); } bool TabProxy::GetConstrainedWindowCount(int* count) const { @@ -365,7 +356,7 @@ bool TabProxy::GetConstrainedWindowCount(int* count) const { } return sender_->Send(new AutomationMsg_ConstrainedWindowCount( - 0, handle_, count)); + handle_, count)); } bool TabProxy::WaitForChildWindowCountToChange(int count, int* new_count, @@ -393,7 +384,7 @@ bool TabProxy::GetBlockedPopupCount(int* count) const { } return sender_->Send(new AutomationMsg_BlockedPopupCount( - 0, handle_, count)); + handle_, count)); } bool TabProxy::WaitForBlockedPopupCountToChangeTo(int target_count, @@ -417,7 +408,7 @@ bool TabProxy::GetCookies(const GURL& url, std::string* cookies) { return false; int size = 0; - return sender_->Send(new AutomationMsg_GetCookies(0, url, handle_, &size, + return sender_->Send(new AutomationMsg_GetCookies(url, handle_, &size, cookies)); } @@ -442,13 +433,13 @@ bool TabProxy::GetCookieByName(const GURL& url, bool TabProxy::SetCookie(const GURL& url, const std::string& value) { int response_value = 0; - return sender_->Send(new AutomationMsg_SetCookie(0, url, value, handle_, + return sender_->Send(new AutomationMsg_SetCookie(url, value, handle_, &response_value)); } bool TabProxy::DeleteCookie(const GURL& url, const std::string& name) { bool succeeded; - sender_->Send(new AutomationMsg_DeleteCookie(0, url, name, handle_, + sender_->Send(new AutomationMsg_DeleteCookie(url, name, handle_, &succeeded)); return succeeded; } @@ -456,7 +447,7 @@ bool TabProxy::DeleteCookie(const GURL& url, const std::string& name) { bool TabProxy::ShowCollectedCookiesDialog() { bool succeeded = false; return sender_->Send(new AutomationMsg_ShowCollectedCookiesDialog( - 0, handle_, &succeeded)) && succeeded; + handle_, &succeeded)) && succeeded; } int TabProxy::InspectElement(int x, int y) { @@ -464,7 +455,7 @@ int TabProxy::InspectElement(int x, int y) { return -1; int ret = -1; - sender_->Send(new AutomationMsg_InspectElement(0, handle_, x, y, &ret)); + sender_->Send(new AutomationMsg_InspectElement(handle_, x, y, &ret)); return ret; } @@ -473,7 +464,7 @@ bool TabProxy::GetDownloadDirectory(FilePath* directory) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_DownloadDirectory(0, handle_, + return sender_->Send(new AutomationMsg_DownloadDirectory(handle_, directory)); } @@ -484,7 +475,7 @@ bool TabProxy::ShowInterstitialPage(const std::string& html_text) { AutomationMsg_NavigationResponseValues result = AUTOMATION_MSG_NAVIGATION_ERROR; if (!sender_->Send(new AutomationMsg_ShowInterstitialPage( - 0, handle_, html_text, &result))) { + handle_, html_text, &result))) { return false; } @@ -496,7 +487,7 @@ bool TabProxy::HideInterstitialPage() { return false; bool result = false; - sender_->Send(new AutomationMsg_HideInterstitialPage(0, handle_, &result)); + sender_->Send(new AutomationMsg_HideInterstitialPage(handle_, &result)); return result; } @@ -509,7 +500,7 @@ bool TabProxy::Close(bool wait_until_closed) { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_CloseTab(0, handle_, wait_until_closed, + sender_->Send(new AutomationMsg_CloseTab(handle_, wait_until_closed, &succeeded)); return succeeded; } @@ -520,7 +511,7 @@ bool TabProxy::ProcessUnhandledAccelerator(const MSG& msg) { return false; return sender_->Send( - new AutomationMsg_ProcessUnhandledAccelerator(0, handle_, msg)); + new AutomationMsg_ProcessUnhandledAccelerator(handle_, msg)); // This message expects no response } @@ -529,7 +520,7 @@ bool TabProxy::SetInitialFocus(bool reverse, bool restore_focus_to_view) { return false; return sender_->Send( - new AutomationMsg_SetInitialFocus(0, handle_, reverse, + new AutomationMsg_SetInitialFocus(handle_, reverse, restore_focus_to_view)); // This message expects no response } @@ -540,7 +531,7 @@ AutomationMsg_NavigationResponseValues TabProxy::NavigateInExternalTab( return AUTOMATION_MSG_NAVIGATION_ERROR; AutomationMsg_NavigationResponseValues rv = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_NavigateInExternalTab(0, handle_, url, + sender_->Send(new AutomationMsg_NavigateInExternalTab(handle_, url, referrer, &rv)); return rv; } @@ -551,7 +542,7 @@ AutomationMsg_NavigationResponseValues TabProxy::NavigateExternalTabAtIndex( return AUTOMATION_MSG_NAVIGATION_ERROR; AutomationMsg_NavigationResponseValues rv = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_NavigateExternalTabAtIndex(0, handle_, index, + sender_->Send(new AutomationMsg_NavigateExternalTabAtIndex(handle_, index, &rv)); return rv; } @@ -564,14 +555,14 @@ void TabProxy::HandleMessageFromExternalHost(const std::string& message, sender_->Send( new AutomationMsg_HandleMessageFromExternalHost( - 0, handle_, message, origin, target)); + handle_, message, origin, target)); } #endif // defined(OS_WIN) bool TabProxy::WaitForTabToBeRestored(uint32 timeout_ms) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_WaitForTabToBeRestored(0, handle_)); + return sender_->Send(new AutomationMsg_WaitForTabToBeRestored(handle_)); } bool TabProxy::GetSecurityState(SecurityStyle* security_style, @@ -585,7 +576,7 @@ bool TabProxy::GetSecurityState(SecurityStyle* security_style, bool succeeded = false; sender_->Send(new AutomationMsg_GetSecurityState( - 0, handle_, &succeeded, security_style, ssl_cert_status, + handle_, &succeeded, security_style, ssl_cert_status, insecure_content_status)); return succeeded; @@ -598,7 +589,7 @@ bool TabProxy::GetPageType(PageType* type) { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_GetPageType(0, handle_, &succeeded, type)); + sender_->Send(new AutomationMsg_GetPageType(handle_, &succeeded, type)); return succeeded; } @@ -608,7 +599,7 @@ bool TabProxy::TakeActionOnSSLBlockingPage(bool proceed) { AutomationMsg_NavigationResponseValues result = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_ActionOnSSLBlockingPage(0, handle_, proceed, + sender_->Send(new AutomationMsg_ActionOnSSLBlockingPage(handle_, proceed, &result)); return result == AUTOMATION_MSG_NAVIGATION_SUCCESS || result == AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED; @@ -619,7 +610,7 @@ bool TabProxy::PrintNow() { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_PrintNow(0, handle_, &succeeded)); + sender_->Send(new AutomationMsg_PrintNow(handle_, &succeeded)); return succeeded; } @@ -627,7 +618,7 @@ bool TabProxy::PrintAsync() { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_PrintAsync(0, handle_)); + return sender_->Send(new AutomationMsg_PrintAsync(handle_)); } bool TabProxy::SavePage(const FilePath& file_name, @@ -637,7 +628,7 @@ bool TabProxy::SavePage(const FilePath& file_name, return false; bool succeeded = false; - sender_->Send(new AutomationMsg_SavePage(0, handle_, file_name, dir_path, + sender_->Send(new AutomationMsg_SavePage(handle_, file_name, dir_path, static_cast<int>(type), &succeeded)); return succeeded; @@ -647,7 +638,7 @@ bool TabProxy::GetInfoBarCount(int* count) { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_GetInfoBarCount(0, handle_, count)); + return sender_->Send(new AutomationMsg_GetInfoBarCount(handle_, count)); } bool TabProxy::WaitForInfoBarCount(int target_count) { @@ -656,7 +647,7 @@ bool TabProxy::WaitForInfoBarCount(int target_count) { bool success = false; return sender_->Send(new AutomationMsg_WaitForInfoBarCount( - 0, handle_, target_count, &success)) && success; + handle_, target_count, &success)) && success; } bool TabProxy::ClickInfoBarAccept(int info_bar_index, @@ -667,7 +658,7 @@ bool TabProxy::ClickInfoBarAccept(int info_bar_index, AutomationMsg_NavigationResponseValues result = AUTOMATION_MSG_NAVIGATION_ERROR; sender_->Send(new AutomationMsg_ClickInfoBarAccept( - 0, handle_, info_bar_index, wait_for_navigation, &result)); + handle_, info_bar_index, wait_for_navigation, &result)); return result == AUTOMATION_MSG_NAVIGATION_SUCCESS || result == AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED; } @@ -678,7 +669,7 @@ bool TabProxy::GetLastNavigationTime(int64* nav_time) { bool success = false; success = sender_->Send(new AutomationMsg_GetLastNavigationTime( - 0, handle_, nav_time)); + handle_, nav_time)); return success; } @@ -688,7 +679,7 @@ bool TabProxy::WaitForNavigation(int64 last_navigation_time) { AutomationMsg_NavigationResponseValues result = AUTOMATION_MSG_NAVIGATION_ERROR; - sender_->Send(new AutomationMsg_WaitForNavigation(0, handle_, + sender_->Send(new AutomationMsg_WaitForNavigation(handle_, last_navigation_time, &result)); return result == AUTOMATION_MSG_NAVIGATION_SUCCESS || @@ -700,7 +691,7 @@ bool TabProxy::GetPageCurrentEncoding(std::string* encoding) { return false; bool succeeded = sender_->Send( - new AutomationMsg_GetPageCurrentEncoding(0, handle_, encoding)); + new AutomationMsg_GetPageCurrentEncoding(handle_, encoding)); return succeeded; } @@ -709,7 +700,7 @@ bool TabProxy::OverrideEncoding(const std::string& encoding) { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_OverrideEncoding(0, handle_, encoding, + sender_->Send(new AutomationMsg_OverrideEncoding(handle_, encoding, &succeeded)); return succeeded; } @@ -719,7 +710,7 @@ bool TabProxy::LoadBlockedPlugins() { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_LoadBlockedPlugins(0, handle_, &succeeded)); + sender_->Send(new AutomationMsg_LoadBlockedPlugins(handle_, &succeeded)); return succeeded; } @@ -728,7 +719,7 @@ bool TabProxy::CaptureEntirePageAsPNG(const FilePath& path) { return false; bool succeeded = false; - sender_->Send(new AutomationMsg_CaptureEntirePageAsPNG(0, handle_, path, + sender_->Send(new AutomationMsg_CaptureEntirePageAsPNG(handle_, path, &succeeded)); return succeeded; } @@ -737,7 +728,7 @@ bool TabProxy::CaptureEntirePageAsPNG(const FilePath& path) { void TabProxy::Reposition(HWND window, HWND window_insert_after, int left, int top, int width, int height, int flags, HWND parent_window) { - IPC::Reposition_Params params = {0}; + Reposition_Params params = {0}; params.window = window; params.window_insert_after = window_insert_after; params.left = left; @@ -747,45 +738,45 @@ void TabProxy::Reposition(HWND window, HWND window_insert_after, int left, params.flags = flags; params.set_parent = (::IsWindow(parent_window) ? true : false); params.parent_window = parent_window; - sender_->Send(new AutomationMsg_TabReposition(0, handle_, params)); + sender_->Send(new AutomationMsg_TabReposition(handle_, params)); } void TabProxy::SendContextMenuCommand(int selected_command) { sender_->Send(new AutomationMsg_ForwardContextMenuCommandToChrome( - 0, handle_, selected_command)); + handle_, selected_command)); } void TabProxy::OnHostMoved() { - sender_->Send(new AutomationMsg_BrowserMove(0, handle_)); + sender_->Send(new AutomationMsg_BrowserMove(handle_)); } #endif // defined(OS_WIN) void TabProxy::SelectAll() { - sender_->Send(new AutomationMsg_SelectAll(0, handle_)); + sender_->Send(new AutomationMsg_SelectAll(handle_)); } void TabProxy::Cut() { - sender_->Send(new AutomationMsg_Cut(0, handle_)); + sender_->Send(new AutomationMsg_Cut(handle_)); } void TabProxy::Copy() { - sender_->Send(new AutomationMsg_Copy(0, handle_)); + sender_->Send(new AutomationMsg_Copy(handle_)); } void TabProxy::Paste() { - sender_->Send(new AutomationMsg_Paste(0, handle_)); + sender_->Send(new AutomationMsg_Paste(handle_)); } void TabProxy::ReloadAsync() { - sender_->Send(new AutomationMsg_ReloadAsync(0, handle_)); + sender_->Send(new AutomationMsg_ReloadAsync(handle_)); } void TabProxy::StopAsync() { - sender_->Send(new AutomationMsg_StopAsync(0, handle_)); + sender_->Send(new AutomationMsg_StopAsync(handle_)); } void TabProxy::SaveAsAsync() { - sender_->Send(new AutomationMsg_SaveAsAsync(0, handle_)); + sender_->Send(new AutomationMsg_SaveAsAsync(handle_)); } void TabProxy::AddObserver(TabProxyDelegate* observer) { @@ -820,7 +811,7 @@ bool TabProxy::ExecuteJavaScriptAndGetJSON(const std::string& script, NOTREACHED(); return false; } - return sender_->Send(new AutomationMsg_DomOperation(0, handle_, L"", + return sender_->Send(new AutomationMsg_DomOperation(handle_, L"", UTF8ToWide(script), json)); } diff --git a/chrome/test/automation/window_proxy.cc b/chrome/test/automation/window_proxy.cc index 6774e6d..3230c08 100644 --- a/chrome/test/automation/window_proxy.cc +++ b/chrome/test/automation/window_proxy.cc @@ -19,15 +19,14 @@ bool WindowProxy::SimulateOSClick(const gfx::Point& click, int flags) { if (!is_valid()) return false; - return sender_->Send( - new AutomationMsg_WindowClick(0, handle_, click, flags)); + return sender_->Send(new AutomationMsg_WindowClick(handle_, click, flags)); } bool WindowProxy::SimulateOSMouseMove(const gfx::Point& location) { if (!is_valid()) return false; return sender_->Send( - new AutomationMsg_WindowMouseMove(0, handle_, location)); + new AutomationMsg_WindowMouseMove(handle_, location)); } bool WindowProxy::GetWindowTitle(string16* text) { @@ -38,14 +37,14 @@ bool WindowProxy::GetWindowTitle(string16* text) { return false; } - return sender_->Send(new AutomationMsg_WindowTitle(0, handle_, text)); + return sender_->Send(new AutomationMsg_WindowTitle(handle_, text)); } bool WindowProxy::SimulateOSKeyPress(app::KeyboardCode key, int flags) { if (!is_valid()) return false; return sender_->Send( - new AutomationMsg_WindowKeyPress(0, handle_, key, flags)); + new AutomationMsg_WindowKeyPress(handle_, key, flags)); } bool WindowProxy::SetVisible(bool visible) { @@ -53,8 +52,7 @@ bool WindowProxy::SetVisible(bool visible) { bool result = false; - sender_->Send(new AutomationMsg_SetWindowVisible(0, handle_, visible, - &result)); + sender_->Send(new AutomationMsg_SetWindowVisible(handle_, visible, &result)); return result; } @@ -63,14 +61,14 @@ bool WindowProxy::IsActive(bool* active) { bool result = false; - sender_->Send(new AutomationMsg_IsWindowActive(0, handle_, &result, active)); + sender_->Send(new AutomationMsg_IsWindowActive(handle_, &result, active)); return result; } bool WindowProxy::Activate() { if (!is_valid()) return false; - return sender_->Send(new AutomationMsg_ActivateWindow(0, handle_)); + return sender_->Send(new AutomationMsg_ActivateWindow(handle_)); } bool WindowProxy::GetViewBounds(int view_id, gfx::Rect* bounds, @@ -86,7 +84,7 @@ bool WindowProxy::GetViewBounds(int view_id, gfx::Rect* bounds, bool result = false; if (!sender_->Send(new AutomationMsg_WindowViewBounds( - 0, handle_, view_id, screen_coordinates, &result, bounds))) { + handle_, view_id, screen_coordinates, &result, bounds))) { return false; } @@ -97,8 +95,7 @@ bool WindowProxy::GetBounds(gfx::Rect* bounds) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_GetWindowBounds(0, handle_, bounds, - &result)); + sender_->Send(new AutomationMsg_GetWindowBounds(handle_, bounds, &result)); return result; } @@ -106,8 +103,7 @@ bool WindowProxy::SetBounds(const gfx::Rect& bounds) { if (!is_valid()) return false; bool result = false; - sender_->Send(new AutomationMsg_SetWindowBounds(0, handle_, bounds, - &result)); + sender_->Send(new AutomationMsg_SetWindowBounds(handle_, bounds, &result)); return result; } @@ -119,15 +115,14 @@ bool WindowProxy::GetFocusedViewID(int* view_id) { return false; } - return sender_->Send(new AutomationMsg_GetFocusedViewID(0, handle_, - view_id)); + return sender_->Send(new AutomationMsg_GetFocusedViewID(handle_, view_id)); } bool WindowProxy::WaitForFocusedViewIDToChange( int old_view_id, int* new_view_id) { bool result = false; - if (!sender_->Send(new AutomationMsg_WaitForFocusedViewIDToChange - (0, handle_, old_view_id, &result, new_view_id))) + if (!sender_->Send(new AutomationMsg_WaitForFocusedViewIDToChange( + handle_, old_view_id, &result, new_view_id))) return false; return result; } @@ -144,7 +139,7 @@ scoped_refptr<BrowserProxy> WindowProxy::GetBrowserWithTimeout( bool handle_ok = false; int browser_handle = 0; - sender_->Send(new AutomationMsg_BrowserForWindow(0, handle_, &handle_ok, + sender_->Send(new AutomationMsg_BrowserForWindow(handle_, &handle_ok, &browser_handle)); if (!handle_ok) return NULL; @@ -168,7 +163,7 @@ bool WindowProxy::IsMaximized(bool* maximized) { bool result = false; - sender_->Send(new AutomationMsg_IsWindowMaximized(0, handle_, maximized, + sender_->Send(new AutomationMsg_IsWindowMaximized(handle_, maximized, &result)); return result; } diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index f06fa89..1d50fe5 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -586,7 +586,7 @@ FilePath UITestBase::GetDownloadDirectory() { void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const { ASSERT_TRUE(automation_proxy_->Send( - new AutomationMsg_CloseBrowserRequestAsync(0, browser->handle()))); + new AutomationMsg_CloseBrowserRequestAsync(browser->handle()))); } bool UITestBase::CloseBrowser(BrowserProxy* browser, @@ -598,7 +598,7 @@ bool UITestBase::CloseBrowser(BrowserProxy* browser, bool result = true; bool succeeded = automation_proxy_->Send(new AutomationMsg_CloseBrowser( - 0, browser->handle(), &result, application_closed)); + browser->handle(), &result, application_closed)); if (!succeeded) return false; diff --git a/chrome_frame/cfproxy.h b/chrome_frame/cfproxy.h index c3acf7a..ae404b2 100644 --- a/chrome_frame/cfproxy.h +++ b/chrome_frame/cfproxy.h @@ -15,6 +15,7 @@ #include "base/file_path.h" #include "chrome/common/automation_constants.h" #include "chrome/common/page_zoom.h" +#include "ipc/ipc_channel.h" enum FindInPageDirection { BACK = 0, FWD = 1 }; enum FindInPageCase { IGNORE_CASE = 0, CASE_SENSITIVE = 1 }; @@ -28,18 +29,15 @@ enum AutomationPageFontSize { LARGEST_FONT = 36 }; -class URLRequestStatus; -namespace IPC { - struct ExternalTabSettings; - struct NavigationInfo; - struct AutomationURLRequest; - struct AttachExternalTabParams; - struct MiniContextMenuParams; -}; - -class GURL; -class ChromeProxyFactory; class ChromeProxyDelegate; +class ChromeProxyFactory; +class GURL; +class URLRequestStatus; +struct AttachExternalTabParams; +struct AutomationURLRequest; +struct ExternalTabSettings; +struct MiniContextMenuParams; +struct NavigationInfo; struct ProxyParams; // Some callers of synchronous messages wants a context to be passed back @@ -89,7 +87,7 @@ class ChromeProxy { // Tab management. virtual void CreateTab(ChromeProxyDelegate* delegate, - const IPC::ExternalTabSettings& settings) = 0; + const ExternalTabSettings& settings) = 0; virtual void ConnectTab(ChromeProxyDelegate* delegate, HWND hwnd, uint64 cookie) = 0; virtual void BlockTab(uint64 cookie) = 0; @@ -142,7 +140,7 @@ class ChromeProxy { // instance of Chromium. // Allow only one delegate per tab, i.e. delegate can handle only a single tab. // Note: all of the methods are invoked always in a background IPC thread. -class ChromeProxyDelegate { +class ChromeProxyDelegate : public IPC::Channel::Listener { public: enum DisconnectReason { CHROME_EXE_LAUNCH_FAILED, @@ -150,6 +148,9 @@ class ChromeProxyDelegate { CHANNEL_ERROR }; + // IPC::Channel::Listener. + void OnMessageReceived(const IPC::Message& message) = 0; + virtual void Connected(ChromeProxy* proxy) = 0; virtual void Disconnected() = 0; virtual void PeerLost(ChromeProxy* proxy, DisconnectReason reason) = 0; @@ -169,39 +170,6 @@ class ChromeProxyDelegate { virtual void Completed_GetEnabledExtensions(bool success, const std::vector<FilePath>* extensions) = 0; - // Network requests from Chrome. - virtual void Network_Start(int request_id, - const IPC::AutomationURLRequest& request_info) = 0; - virtual void Network_Read(int request_id, int bytes_to_read) = 0; - virtual void Network_End(int request_id, const URLRequestStatus& status) = 0; - virtual void Network_DownloadInHost(int request_id) = 0; - virtual void GetCookies(const GURL& url, int cookie_id) = 0; - virtual void SetCookie(const GURL& url, const std::string& cookie) = 0; - - // Navigation progress notifications. - virtual void NavigationStateChanged(int flags, - const IPC::NavigationInfo& nav_info) = 0; - virtual void UpdateTargetUrl(const std::wstring& url) = 0; - virtual void NavigationFailed(int error_code, const GURL& gurl) = 0; - virtual void DidNavigate(const IPC::NavigationInfo& navigation_info) = 0; - virtual void TabLoaded(const GURL& url) = 0; - - // Navigation and messaging. - virtual void OpenURL(const GURL& url_to_open, const GURL& referrer, - int open_disposition) = 0; - virtual void GoToHistoryOffset(int offset) = 0; - virtual void MessageToHost(const std::string& message, - const std::string& origin, - const std::string& target) = 0; - // Misc. UI. - virtual void HandleAccelerator(const MSG& accel_message) = 0; - virtual void HandleContextMenu(HANDLE menu_handle, int align_flags, - const IPC::MiniContextMenuParams& params) = 0; - virtual void TabbedOut(bool reverse) = 0; - - // Tab related. - virtual void TabClosed() = 0; - virtual void AttachTab(const IPC::AttachExternalTabParams& attach_params) = 0; protected: ~ChromeProxyDelegate() {} }; diff --git a/chrome_frame/cfproxy_private.h b/chrome_frame/cfproxy_private.h index a9cc6dc..6ec0080 100644 --- a/chrome_frame/cfproxy_private.h +++ b/chrome_frame/cfproxy_private.h @@ -155,7 +155,7 @@ class CFProxy : public Interface2IPCMessage, virtual void Tab_OverrideEncoding(int tab, const char* encoding); virtual void Tab_Navigate(int tab, const GURL& url, const GURL& referrer); virtual void CreateTab(ChromeProxyDelegate* delegate, - const IPC::ExternalTabSettings& p); + const ExternalTabSettings& p); virtual void ConnectTab(ChromeProxyDelegate* delegate, HWND hwnd, uint64 cookie); virtual void BlockTab(uint64 cookie); @@ -183,9 +183,6 @@ DISABLE_RUNNABLE_METHOD_REFCOUNT(CFProxy); // Support functions. std::string GenerateChannelId(); -int IsTabMessage(const IPC::Message& message); -bool DispatchTabMessageToDelegate(ChromeProxyDelegate* delegate, - const IPC::Message& m); std::wstring BuildCmdLine(const std::string& channel_id, const FilePath& profile_path, const std::wstring& extra_args); diff --git a/chrome_frame/cfproxy_proxy.cc b/chrome_frame/cfproxy_proxy.cc index 7dcb944..0f59d8a 100644 --- a/chrome_frame/cfproxy_proxy.cc +++ b/chrome_frame/cfproxy_proxy.cc @@ -128,21 +128,21 @@ void CFProxy::SendIpcMessageOnIoThread(IPC::Message* m) { void CFProxy::InstallExtension(ChromeProxyDelegate* delegate, const FilePath& crx_path, SyncMessageContext* ctx) { - IPC::SyncMessage* m = new AutomationMsg_InstallExtension(0, crx_path, NULL); + IPC::SyncMessage* m = new AutomationMsg_InstallExtension(crx_path, NULL); sync_dispatcher_.QueueSyncMessage(m, delegate, ctx); SendIpcMessage(m); } void CFProxy::LoadExtension(ChromeProxyDelegate* delegate, const FilePath& path, SyncMessageContext* ctx) { - IPC::SyncMessage* m = new AutomationMsg_LoadExpandedExtension(0, path, 0); + IPC::SyncMessage* m = new AutomationMsg_LoadExpandedExtension(path, 0); sync_dispatcher_.QueueSyncMessage(m, delegate, ctx); SendIpcMessage(m); } void CFProxy::GetEnabledExtensions(ChromeProxyDelegate* delegate, SyncMessageContext* ctx) { - IPC::SyncMessage* m = new AutomationMsg_GetEnabledExtensions(0, NULL); + IPC::SyncMessage* m = new AutomationMsg_GetEnabledExtensions(NULL); sync_dispatcher_.QueueSyncMessage(m, delegate, ctx); SendIpcMessage(m); } @@ -156,22 +156,21 @@ void CFProxy::Tab_Find(int tab, const string16& search_string, params.find_next = find_next; params.match_case = (match_case == CASE_SENSITIVE); params.forward = (forward == FWD); - IPC::SyncMessage* m = new AutomationMsg_Find(0, tab, params, NULL, NULL); + IPC::SyncMessage* m = new AutomationMsg_Find(tab, params, NULL, NULL); // Not interested in result. sync_dispatcher_.QueueSyncMessage(m, NULL, NULL); SendIpcMessage(m); } void CFProxy::Tab_OverrideEncoding(int tab, const char* encoding) { - IPC::SyncMessage* m = new AutomationMsg_OverrideEncoding(0, tab, encoding, - NULL); + IPC::SyncMessage* m = new AutomationMsg_OverrideEncoding(tab, encoding, NULL); // Not interested in result. sync_dispatcher_.QueueSyncMessage(m, NULL, NULL); SendIpcMessage(m); } void CFProxy::Tab_Navigate(int tab, const GURL& url, const GURL& referrer) { - IPC::SyncMessage* m = new AutomationMsg_NavigateInExternalTab(0, + IPC::SyncMessage* m = new AutomationMsg_NavigateInExternalTab( tab, url, referrer, NULL); // We probably are not interested in result since provider just checks // whether tab handle is valid. @@ -180,29 +179,29 @@ void CFProxy::Tab_Navigate(int tab, const GURL& url, const GURL& referrer) { } void CFProxy::CreateTab(ChromeProxyDelegate* delegate, - const IPC::ExternalTabSettings& p) { - IPC::SyncMessage* m = new AutomationMsg_CreateExternalTab(0, p, 0, 0, 0, 0); + const ExternalTabSettings& p) { + IPC::SyncMessage* m = new AutomationMsg_CreateExternalTab(p, 0, 0, 0, 0); sync_dispatcher_.QueueSyncMessage(m, delegate, NULL); SendIpcMessage(m); } void CFProxy::ConnectTab(ChromeProxyDelegate* delegate, HWND hwnd, uint64 cookie) { - IPC::SyncMessage* m = new AutomationMsg_ConnectExternalTab(0, cookie, true, + IPC::SyncMessage* m = new AutomationMsg_ConnectExternalTab(cookie, true, hwnd, NULL, NULL, NULL, 0); sync_dispatcher_.QueueSyncMessage(m, delegate, NULL); SendIpcMessage(m); } void CFProxy::BlockTab(uint64 cookie) { - IPC::SyncMessage* m = new AutomationMsg_ConnectExternalTab(0, cookie, false, + IPC::SyncMessage* m = new AutomationMsg_ConnectExternalTab(cookie, false, NULL, NULL, NULL, NULL, 0); sync_dispatcher_.QueueSyncMessage(m, NULL, NULL); SendIpcMessage(m); } void CFProxy::Tab_RunUnloadHandlers(int tab) { - IPC::SyncMessage* m = new AutomationMsg_RunUnloadHandlers(0, tab, 0); + IPC::SyncMessage* m = new AutomationMsg_RunUnloadHandlers(tab, 0); ChromeProxyDelegate* p = Tab2Delegate(tab); sync_dispatcher_.QueueSyncMessage(m, p, NULL); SendIpcMessage(m); @@ -216,13 +215,9 @@ void CFProxy::OnMessageReceived(const IPC::Message& message) { return; // Handle tab related message. - int tab_handle = IsTabMessage(message); - if (tab_handle != 0) { - ChromeProxyDelegate* d = Tab2Delegate(tab_handle); - if (d) - DispatchTabMessageToDelegate(d, message); - return; - } + ChromeProxyDelegate* d = Tab2Delegate(message.routing_id()); + if (d) + return d->OnMessageReceived(message); DLOG(WARNING) << "Unknown message received!"; } diff --git a/chrome_frame/cfproxy_support.cc b/chrome_frame/cfproxy_support.cc index 723943a..fea331c 100644 --- a/chrome_frame/cfproxy_support.cc +++ b/chrome_frame/cfproxy_support.cc @@ -93,70 +93,70 @@ bool DispatchReplyOk(const IPC::Message* reply_msg, uint32 type, // Itf2IPCMessage // Converts and sends trivial messages. void Interface2IPCMessage::RemoveBrowsingData(int mask) { - sender_->Send(new AutomationMsg_RemoveBrowsingData(0, mask)); + sender_->Send(new AutomationMsg_RemoveBrowsingData(mask)); } void Interface2IPCMessage::SetProxyConfig( const std::string& json_encoded_proxy_cfg) { - sender_->Send(new AutomationMsg_SetProxyConfig(0, json_encoded_proxy_cfg)); + sender_->Send(new AutomationMsg_SetProxyConfig(json_encoded_proxy_cfg)); } // Tab related. void Interface2IPCMessage::Tab_PostMessage(int tab, const std::string& message, const std::string& origin, const std::string& target) { sender_->Send(new AutomationMsg_HandleMessageFromExternalHost( - 0, tab, message, origin, target)); + tab, message, origin, target)); } void Interface2IPCMessage::Tab_Reload(int tab) { - sender_->Send(new AutomationMsg_ReloadAsync(0, tab)); + sender_->Send(new AutomationMsg_ReloadAsync(tab)); } void Interface2IPCMessage::Tab_Stop(int tab) { - sender_->Send(new AutomationMsg_StopAsync(0, tab)); + sender_->Send(new AutomationMsg_StopAsync(tab)); } void Interface2IPCMessage::Tab_SaveAs(int tab) { - sender_->Send(new AutomationMsg_SaveAsAsync(0, tab)); + sender_->Send(new AutomationMsg_SaveAsAsync(tab)); } void Interface2IPCMessage::Tab_Print(int tab) { - sender_->Send(new AutomationMsg_PrintAsync(0, tab)); + sender_->Send(new AutomationMsg_PrintAsync(tab)); } void Interface2IPCMessage::Tab_Cut(int tab) { - sender_->Send(new AutomationMsg_Cut(0, tab)); + sender_->Send(new AutomationMsg_Cut(tab)); } void Interface2IPCMessage::Tab_Copy(int tab) { - sender_->Send(new AutomationMsg_Copy(0, tab)); + sender_->Send(new AutomationMsg_Copy(tab)); } void Interface2IPCMessage::Tab_Paste(int tab) { - sender_->Send(new AutomationMsg_Paste(0, tab)); + sender_->Send(new AutomationMsg_Paste(tab)); } void Interface2IPCMessage::Tab_SelectAll(int tab) { - sender_->Send(new AutomationMsg_SelectAll(0, tab)); + sender_->Send(new AutomationMsg_SelectAll(tab)); } void Interface2IPCMessage::Tab_MenuCommand(int tab, int selected_command) { sender_->Send(new AutomationMsg_ForwardContextMenuCommandToChrome( - 0, tab, selected_command)); + tab, selected_command)); } void Interface2IPCMessage::Tab_Zoom(int tab, PageZoom::Function zoom_level) { - sender_->Send(new AutomationMsg_SetZoomLevel(0, tab, zoom_level)); + sender_->Send(new AutomationMsg_SetZoomLevel(tab, zoom_level)); } void Interface2IPCMessage::Tab_FontSize(int tab, enum AutomationPageFontSize font_size) { - sender_->Send(new AutomationMsg_SetPageFontSize(0, tab, font_size)); + sender_->Send(new AutomationMsg_SetPageFontSize(tab, font_size)); } void Interface2IPCMessage::Tab_SetInitialFocus(int tab, bool reverse, bool restore_focus_to_view) { - sender_->Send(new AutomationMsg_SetInitialFocus(0, tab, reverse, + sender_->Send(new AutomationMsg_SetInitialFocus(tab, reverse, restore_focus_to_view)); } @@ -171,17 +171,17 @@ void Interface2IPCMessage::Tab_Resize(int tab) { } void Interface2IPCMessage::Tab_ProcessAccelerator(int tab, const MSG& msg) { - sender_->Send(new AutomationMsg_ProcessUnhandledAccelerator(0, tab, msg)); + sender_->Send(new AutomationMsg_ProcessUnhandledAccelerator(tab, msg)); } // Misc. void Interface2IPCMessage::Tab_OnHostMoved(int tab) { - sender_->Send(new AutomationMsg_BrowserMove(0, tab)); + sender_->Send(new AutomationMsg_BrowserMove(tab)); } void Interface2IPCMessage::Tab_SetEnableExtensionAutomation(int tab, const std::vector<std::string>& functions_enabled) { - sender_->Send(new AutomationMsg_SetEnableExtensionAutomation(0, tab, + sender_->Send(new AutomationMsg_SetEnableExtensionAutomation(tab, functions_enabled)); } @@ -342,194 +342,3 @@ std::wstring BuildCmdLine(const std::string& channel_id, } return command_line_string; } - -int IsTabMessage(const IPC::Message& message) { - switch (message.type()) { - case AutomationMsg_NavigationStateChanged::ID: - case AutomationMsg_UpdateTargetUrl::ID: - case AutomationMsg_HandleAccelerator::ID: - case AutomationMsg_TabbedOut::ID: - case AutomationMsg_OpenURL::ID: - case AutomationMsg_NavigationFailed::ID: - case AutomationMsg_DidNavigate::ID: - case AutomationMsg_TabLoaded::ID: - case AutomationMsg_ForwardMessageToExternalHost::ID: - case AutomationMsg_ForwardContextMenuToExternalHost::ID: - case AutomationMsg_RequestStart::ID: - case AutomationMsg_RequestRead::ID: - case AutomationMsg_RequestEnd::ID: - case AutomationMsg_DownloadRequestInHost::ID: - case AutomationMsg_SetCookieAsync::ID: - case AutomationMsg_AttachExternalTab::ID: - case AutomationMsg_RequestGoToHistoryEntryOffset::ID: - case AutomationMsg_GetCookiesFromHost::ID: - case AutomationMsg_CloseExternalTab::ID: { - // Read tab handle from the message. - void* iter = NULL; - int tab_handle = 0; - message.ReadInt(&iter, &tab_handle); - return tab_handle; - } - } - - return 0; -} - -bool DispatchTabMessageToDelegate(ChromeProxyDelegate* delegate, - const IPC::Message& m) { - // The first argument of the message is always the tab handle. - void* iter = 0; - switch (m.type()) { - case AutomationMsg_NavigationStateChanged::ID: { - // Tuple3<int, int, IPC::NavigationInfo> - AutomationMsg_NavigationStateChanged::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->NavigationStateChanged(params.b, params.c); - return true; - } - - case AutomationMsg_UpdateTargetUrl::ID: { - // Tuple2<int, std::wstring> - AutomationMsg_UpdateTargetUrl::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->UpdateTargetUrl(params.b); - return true; - } - - case AutomationMsg_HandleAccelerator::ID: { - // Tuple2<int, MSG> - AutomationMsg_HandleAccelerator::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->HandleAccelerator(params.b); - return true; - } - - case AutomationMsg_TabbedOut::ID: { - // Tuple2<int, bool> - AutomationMsg_TabbedOut::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->TabbedOut(params.b); - return true; - } - - case AutomationMsg_OpenURL::ID: { - // Tuple4<int, GURL, GURL, int> - AutomationMsg_OpenURL::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->OpenURL(params.b, params.c, params.d); - return true; - } - - case AutomationMsg_NavigationFailed::ID: { - // Tuple3<int, int, GURL> - AutomationMsg_NavigationFailed::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->NavigationFailed(params.b, params.c); - return true; - } - - case AutomationMsg_DidNavigate::ID: { - // Tuple2<int, IPC::NavigationInfo> - AutomationMsg_DidNavigate::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->DidNavigate(params.b); - return true; - } - - case AutomationMsg_TabLoaded::ID: { - // Tuple2<int, GURL> - AutomationMsg_TabLoaded::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->TabLoaded(params.b); - return true; - } - - case AutomationMsg_ForwardMessageToExternalHost::ID: { - // Tuple4<int, string, string, string> - AutomationMsg_ForwardMessageToExternalHost::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->MessageToHost(params.b, params.c, params.d); - return true; - } - - case AutomationMsg_ForwardContextMenuToExternalHost::ID: { - // Tuple4<int, HANDLE, int, IPC::ContextMenuParams> - AutomationMsg_ForwardContextMenuToExternalHost::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->HandleContextMenu(params.b, params.c, params.d); - return true; - } - - case AutomationMsg_RequestStart::ID: { - // Tuple3<int, int, IPC::AutomationURLRequest> - AutomationMsg_RequestStart::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->Network_Start(params.b, params.c); - return true; - } - - case AutomationMsg_RequestRead::ID: { - // Tuple3<int, int, int> - AutomationMsg_RequestRead::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->Network_Read(params.b, params.c); - return true; - } - - case AutomationMsg_RequestEnd::ID: { - // Tuple3<int, int, URLRequestStatus> - AutomationMsg_RequestEnd::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->Network_End(params.b, params.c); - return true; - } - - case AutomationMsg_DownloadRequestInHost::ID: { - // Tuple2<int, int> - AutomationMsg_DownloadRequestInHost::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->Network_DownloadInHost(params.b); - return true; - } - - case AutomationMsg_SetCookieAsync::ID: { - // Tuple3<int, GURL, string> - AutomationMsg_SetCookieAsync::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->SetCookie(params.b, params.c); - return true; - } - - case AutomationMsg_AttachExternalTab::ID: { - // Tuple2<int, IPC::AttachExternalTabParams> - AutomationMsg_AttachExternalTab::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->AttachTab(params.b); - return true; - } - - case AutomationMsg_RequestGoToHistoryEntryOffset::ID: { - // Tuple2<int, int> - AutomationMsg_RequestGoToHistoryEntryOffset::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->GoToHistoryOffset(params.b); - return true; - } - - case AutomationMsg_GetCookiesFromHost::ID: { - // Tuple3<int, GURL, int> - AutomationMsg_GetCookiesFromHost::Param params; - if (ReadParam(&m, &iter, ¶ms)) - delegate->GetCookies(params.b, params.c); - return true; - } - - case AutomationMsg_CloseExternalTab::ID: { - // Tuple1<int> - delegate->TabClosed(); - return true; - } - } - - return false; -} diff --git a/chrome_frame/cfproxy_test.cc b/chrome_frame/cfproxy_test.cc index ab615f7..d6be8b1 100644 --- a/chrome_frame/cfproxy_test.cc +++ b/chrome_frame/cfproxy_test.cc @@ -28,6 +28,7 @@ struct MockFactory : public ChromeProxyFactory { }; struct MockChromeProxyDelegate : public ChromeProxyDelegate { + MOCK_METHOD1(OnMessageReceived, void(const IPC::Message& message)); MOCK_METHOD1(Connected, void(ChromeProxy* proxy)); MOCK_METHOD2(PeerLost, void(ChromeProxy*, enum DisconnectReason reason)); MOCK_METHOD0(Disconnected, void()); @@ -48,7 +49,7 @@ struct MockChromeProxyDelegate : public ChromeProxyDelegate { // Network requests from Chrome. MOCK_METHOD2(Network_Start, void(int request_id, - const IPC::AutomationURLRequest& request_info)); + const AutomationURLRequest& request_info)); MOCK_METHOD2(Network_Read, void(int request_id, int bytes_to_read)); MOCK_METHOD2(Network_End, void(int request_id, const URLRequestStatus& s)); MOCK_METHOD1(Network_DownloadInHost, void(int request_id)); @@ -57,10 +58,10 @@ struct MockChromeProxyDelegate : public ChromeProxyDelegate { // Navigation progress notifications. MOCK_METHOD2(NavigationStateChanged, void(int flags, - const IPC::NavigationInfo& nav_info)); + const NavigationInfo& nav_info)); MOCK_METHOD1(UpdateTargetUrl, void(const std::wstring& url)); MOCK_METHOD2(NavigationFailed, void(int error_code, const GURL& gurl)); - MOCK_METHOD1(DidNavigate, void(const IPC::NavigationInfo& navigation_info)); + MOCK_METHOD1(DidNavigate, void(const NavigationInfo& navigation_info)); MOCK_METHOD1(TabLoaded, void(const GURL& url)); // @@ -73,13 +74,12 @@ struct MockChromeProxyDelegate : public ChromeProxyDelegate { // Misc. UI. MOCK_METHOD1(HandleAccelerator, void(const MSG& accel_message)); MOCK_METHOD3(HandleContextMenu, void(HANDLE menu_handle, int align_flags, - const IPC::MiniContextMenuParams& params)); + const MiniContextMenuParams& params)); MOCK_METHOD1(TabbedOut, void(bool reverse)); // MOCK_METHOD0(TabClosed, void()); - MOCK_METHOD1(AttachTab, - void(const IPC::AttachExternalTabParams& attach_params)); + MOCK_METHOD1(AttachTab, void(const AttachExternalTabParams& attach_params)); }; struct MockSender : public IPC::Message::Sender { @@ -342,8 +342,8 @@ TEST(SyncMsgSender, Deserialize) { const int kSessionId = 8; // Create some sync messages and their replies. - AutomationMsg_InstallExtension m1(0, FilePath(L"c:\\awesome.x"), 0); - AutomationMsg_CreateExternalTab m2(0, IPC::ExternalTabSettings(), 0, 0, 0, 0); + AutomationMsg_InstallExtension m1(FilePath(L"c:\\awesome.x"), 0); + AutomationMsg_CreateExternalTab m2(ExternalTabSettings(), 0, 0, 0, 0); scoped_ptr<IPC::Message> r1(CreateReply(&m1, AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED)); scoped_ptr<IPC::Message> r2(CreateReply(&m2, (HWND)1, (HWND)2, kTabHandle, @@ -372,175 +372,3 @@ TEST(SyncMsgSender, Deserialize) { TEST(SyncMsgSender, OnChannelClosed) { // TODO(stoyan): implement. } - -MATCHER_P(EqNavigationInfo, ni, "") { - return arg.navigation_type == ni.navigation_type && - arg.relative_offset == ni.relative_offset && - arg.navigation_index == ni.navigation_index && - arg.title == ni.title && - arg.url == ni.url && - arg.referrer == ni.referrer && - arg.security_style == ni.security_style && - arg.displayed_insecure_content == ni.displayed_insecure_content && - arg.ran_insecure_content == ni.ran_insecure_content; -} - -MATCHER_P(EqMSG, msg, "") { - return arg.hwnd == msg.hwnd && - arg.message == msg.message && - arg.wParam == msg.wParam && - arg.lParam == msg.lParam && - arg.time == msg.time && - arg.pt.x == msg.pt.x && - arg.pt.y == msg.pt.y; -} - -MATCHER_P(EqContextMenuParam, p, "") { - return arg.screen_x == p.screen_x && - arg.screen_y == p.screen_y && - arg.link_url == p.link_url && - arg.unfiltered_link_url == p.unfiltered_link_url && - arg.src_url == p.src_url && - arg.page_url == p.page_url && - arg.frame_url == p.frame_url; -} - -MATCHER_P(EqURLRequest, p, "") { - return arg.url == p.url && - arg.method == p.method && - arg.referrer == p.referrer && - arg.extra_request_headers == p.extra_request_headers && - // TODO(stoyan): scoped_refptr<net::UploadData> upload_data; - arg.resource_type == p.resource_type; -} - - -MATCHER_P(EqAttachExternalTab, p, "") { - return arg.cookie == p.cookie && - arg.url == p.url && - arg.dimensions == p.dimensions && - arg.disposition == p.disposition && - arg.user_gesture == p.user_gesture && - arg.profile_name == p.profile_name; -} - -TEST(Deserialize, DispatchTabMessage) { - testing::InSequence s; - StrictMock<MockChromeProxyDelegate> delegate; - GURL url("http://destination"); - GURL ref("http://referer"); - - // Tuple3<int, int, IPC::NavigationInfo> - int flags = 2; - IPC::NavigationInfo ni(2, 3, 4, L"title", url, - ref, SECURITY_STYLE_AUTHENTICATION_BROKEN, true, true); - AutomationMsg_NavigationStateChanged m1(0, 1, flags, ni); - EXPECT_CALL(delegate, NavigationStateChanged(flags, EqNavigationInfo(ni))); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m1)); - - // Tuple2<int, std::wstring> - AutomationMsg_UpdateTargetUrl m2(0, 1, L"hello"); - EXPECT_CALL(delegate, UpdateTargetUrl(StrEq(L"hello"))); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m2)); - - // Tuple2<int, MSG> - MSG wnd_msg = {0, WM_DESTROY, 1, 9, 0x5671, { 11, 12 }}; - AutomationMsg_HandleAccelerator m3(0, 1, wnd_msg); - EXPECT_CALL(delegate, HandleAccelerator(EqMSG(wnd_msg))); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m3)); - - // Tuple2<int, bool> - AutomationMsg_TabbedOut m4(0, 1, true); - EXPECT_CALL(delegate, TabbedOut(true)); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m4)); - - - // Tuple4<int, GURL, GURL, int> - AutomationMsg_OpenURL m5(0, 1, url, ref, 4); - EXPECT_CALL(delegate, OpenURL(url, ref, 4)); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m5)); - - // Tuple3<int, int, GURL> - AutomationMsg_NavigationFailed m6(0, 1, 2, url); - EXPECT_CALL(delegate, NavigationFailed(2, url)); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m6)); - - - // Tuple2<int, IPC::NavigationInfo> - AutomationMsg_DidNavigate m7(0, 1, ni); - EXPECT_CALL(delegate, DidNavigate(EqNavigationInfo(ni))); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m7)); - - - // Tuple2<int, GURL> - AutomationMsg_TabLoaded m8(0, 1, url); - EXPECT_CALL(delegate, TabLoaded(url)); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m8)); - - // Tuple4<int, string, string, string> - std::string msg("Load oranges barrels"); - std::string origin("Brothers Karamazov"); - std::string target("Alexander Ivanovich"); - AutomationMsg_ForwardMessageToExternalHost m9(0, 1, msg, origin, target); - EXPECT_CALL(delegate, MessageToHost(msg, origin, target)); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m9)); - - // Tuple4<int, HANDLE, int, IPC::ContextMenuParams> - IPC::MiniContextMenuParams ctxmenu(711, 512, GURL("http://link_src"), - GURL("http://unfiltered_link_url"), GURL("http://src_url"), - GURL("http://page_url"), GURL("http://frame_url")); - AutomationMsg_ForwardContextMenuToExternalHost m10(0, 1, HANDLE(7), 4, - ctxmenu); - EXPECT_CALL(delegate, HandleContextMenu(HANDLE(7), 4, - EqContextMenuParam(ctxmenu))); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m10)); - - // Tuple3<int, int, IPC::AutomationURLRequest> - IPC::AutomationURLRequest url_request("url", "post", "referer", - "extra_headers", 0, 3, 0); - AutomationMsg_RequestStart m11(0, 1, 7, url_request); - EXPECT_CALL(delegate, Network_Start(7, EqURLRequest(url_request))); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m11)); - - // Tuple3<int, int, int> - AutomationMsg_RequestRead m12(0, 1, 7, 16384); - EXPECT_CALL(delegate, Network_Read(7, 16384)); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m12)); - - // Tuple3<int, int, URLRequestStatus> - AutomationMsg_RequestEnd m13(0, 1, 7, URLRequestStatus()); - EXPECT_CALL(delegate, Network_End(7, _)); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m13)); - - // Tuple2<int, int> - AutomationMsg_DownloadRequestInHost m14(0, 1, 7); - EXPECT_CALL(delegate, Network_DownloadInHost(7)); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m14)); - - // Tuple3<int, GURL, string> - AutomationMsg_SetCookieAsync m15(0, 1, url, "cake=big"); - EXPECT_CALL(delegate, SetCookie(url, "cake=big")); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m15)); - - // Tuple2<int, IPC::AttachExternalTabParams> - IPC::AttachExternalTabParams ext_tab(0xFEDCBA0987654321i64, url, - gfx::Rect(6, 9, 123, 999), 1, - false, "theprofile"); - AutomationMsg_AttachExternalTab m16(0, 1, ext_tab); - EXPECT_CALL(delegate, AttachTab(EqAttachExternalTab(ext_tab))); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m16)); - - // Tuple2<int, int> - AutomationMsg_RequestGoToHistoryEntryOffset m17(0, 1, -4); - EXPECT_CALL(delegate, GoToHistoryOffset(-4)); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m17)); - - // Tuple3<int, GURL, int> - AutomationMsg_GetCookiesFromHost m18(0, 1, url, 903); - EXPECT_CALL(delegate, GetCookies(url, 903)); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m18)); - - AutomationMsg_CloseExternalTab m19(0, 1); - EXPECT_CALL(delegate, TabClosed()); - EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m19)); -} diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index ba2390b..b726797 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -615,8 +615,8 @@ HRESULT ChromeActiveDocument::ActiveXDocActivate(LONG verb) { return S_OK; } -void ChromeActiveDocument::OnNavigationStateChanged(int tab_handle, int flags, - const IPC::NavigationInfo& nav_info) { +void ChromeActiveDocument::OnNavigationStateChanged( + int flags, const NavigationInfo& nav_info) { // TODO(joshia): handle INVALIDATE_TAB,INVALIDATE_LOAD etc. DVLOG(1) << __FUNCTION__ << "\n Flags: " << flags @@ -629,7 +629,7 @@ void ChromeActiveDocument::OnNavigationStateChanged(int tab_handle, int flags, UpdateNavigationState(nav_info); } -void ChromeActiveDocument::OnUpdateTargetUrl(int tab_handle, +void ChromeActiveDocument::OnUpdateTargetUrl( const std::wstring& new_target_url) { if (in_place_frame_) in_place_frame_->SetStatusText(new_target_url.c_str()); @@ -643,8 +643,7 @@ bool IsFindAccelerator(const MSG& msg) { !(win_util::IsAltPressed() || win_util::IsShiftPressed()); } -void ChromeActiveDocument::OnAcceleratorPressed(int tab_handle, - const MSG& accel_message) { +void ChromeActiveDocument::OnAcceleratorPressed(const MSG& accel_message) { if (::TranslateAccelerator(m_hWnd, accelerator_table_, const_cast<MSG*>(&accel_message))) return; @@ -660,14 +659,14 @@ void ChromeActiveDocument::OnAcceleratorPressed(int tab_handle, // Handle the showing of the find dialog explicitly. OnFindInPage(); } else { - BaseActiveX::OnAcceleratorPressed(tab_handle, accel_message); + BaseActiveX::OnAcceleratorPressed(accel_message); } } else { DVLOG(1) << "IE handled accel key " << accel_message.wParam; } } -void ChromeActiveDocument::OnTabbedOut(int tab_handle, bool reverse) { +void ChromeActiveDocument::OnTabbedOut(bool reverse) { DVLOG(1) << __FUNCTION__; if (in_place_frame_) { MSG msg = { NULL, WM_KEYDOWN, VK_TAB }; @@ -675,8 +674,7 @@ void ChromeActiveDocument::OnTabbedOut(int tab_handle, bool reverse) { } } -void ChromeActiveDocument::OnDidNavigate(int tab_handle, - const IPC::NavigationInfo& nav_info) { +void ChromeActiveDocument::OnDidNavigate(const NavigationInfo& nav_info) { DVLOG(1) << __FUNCTION__ << std::endl << "Url: " << nav_info.url << ", Title: " << nav_info.title @@ -696,9 +694,9 @@ void ChromeActiveDocument::OnDidNavigate(int tab_handle, UpdateNavigationState(nav_info); } -void ChromeActiveDocument::OnCloseTab(int tab_handle) { +void ChromeActiveDocument::OnCloseTab() { // Base class will fire DIChromeFrameEvents::onclose. - BaseActiveX::OnCloseTab(tab_handle); + BaseActiveX::OnCloseTab(); // Close the container window. ScopedComPtr<IWebBrowser2> web_browser2; @@ -708,7 +706,7 @@ void ChromeActiveDocument::OnCloseTab(int tab_handle) { } void ChromeActiveDocument::UpdateNavigationState( - const IPC::NavigationInfo& new_navigation_info) { + const NavigationInfo& new_navigation_info) { HRESULT hr = S_OK; bool is_title_changed = (navigation_info_.title != new_navigation_info.title); bool is_ssl_state_changed = @@ -919,8 +917,7 @@ void ChromeActiveDocument::OnUnload(const GUID* cmd_group_guid, } } -void ChromeActiveDocument::OnOpenURL(int tab_handle, - const GURL& url_to_open, +void ChromeActiveDocument::OnOpenURL(const GURL& url_to_open, const GURL& referrer, int open_disposition) { // If the disposition indicates that we should be opening the URL in the @@ -934,11 +931,11 @@ void ChromeActiveDocument::OnOpenURL(int tab_handle, g_active_doc_cache.Set(this); } - BaseActiveX::OnOpenURL(tab_handle, url_to_open, referrer, open_disposition); + BaseActiveX::OnOpenURL(url_to_open, referrer, open_disposition); } -void ChromeActiveDocument::OnAttachExternalTab(int tab_handle, - const IPC::AttachExternalTabParams& params) { +void ChromeActiveDocument::OnAttachExternalTab( + const AttachExternalTabParams& params) { if (!automation_client_.get()) { DLOG(WARNING) << "Invalid automation client instance"; return; @@ -957,7 +954,7 @@ void ChromeActiveDocument::OnAttachExternalTab(int tab_handle, } // Allow popup if (hr == S_OK) { - BaseActiveX::OnAttachExternalTab(tab_handle, params); + BaseActiveX::OnAttachExternalTab(params); return; } @@ -984,8 +981,8 @@ bool ChromeActiveDocument::PreProcessContextMenu(HMENU menu) { return BaseActiveX::PreProcessContextMenu(menu); } -bool ChromeActiveDocument::HandleContextMenuCommand(UINT cmd, - const IPC::MiniContextMenuParams& params) { +bool ChromeActiveDocument::HandleContextMenuCommand( + UINT cmd, const MiniContextMenuParams& params) { ScopedComPtr<IWebBrowser2> web_browser2; DoQueryService(SID_SWebBrowserApp, m_spClientSite, web_browser2.Receive()); @@ -1233,8 +1230,7 @@ HRESULT ChromeActiveDocument::OnEncodingChange(const GUID* cmd_group_guid, return S_OK; } -void ChromeActiveDocument::OnGoToHistoryEntryOffset(int tab_handle, - int offset) { +void ChromeActiveDocument::OnGoToHistoryEntryOffset(int offset) { DVLOG(1) << __FUNCTION__ << " - offset:" << offset; ScopedComPtr<IBrowserService> browser_service; @@ -1367,7 +1363,7 @@ void ChromeActiveDocument::SetWindowDimensions() { } bool ChromeActiveDocument::IsNewNavigation( - const IPC::NavigationInfo& new_navigation_info) const { + const NavigationInfo& new_navigation_info) const { // A new navigation is typically an internal navigation which is initiated by // the renderer(WebKit). Condition 1 below has to be true along with the // any of the other conditions below. diff --git a/chrome_frame/chrome_active_document.h b/chrome_frame/chrome_active_document.h index 55ee24f..598966b 100644 --- a/chrome_frame/chrome_active_document.h +++ b/chrome_frame/chrome_active_document.h @@ -280,15 +280,13 @@ BEGIN_EXEC_COMMAND_MAP(ChromeActiveDocument) END_EXEC_COMMAND_MAP() // IPCs from automation server. - virtual void OnNavigationStateChanged(int tab_handle, int flags, - const IPC::NavigationInfo& nav_info); - virtual void OnUpdateTargetUrl(int tab_handle, - const std::wstring& new_target_url); - virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message); - virtual void OnTabbedOut(int tab_handle, bool reverse); - virtual void OnDidNavigate(int tab_handle, - const IPC::NavigationInfo& nav_info); - virtual void OnCloseTab(int tab_handle); + virtual void OnNavigationStateChanged( + int flags, const NavigationInfo& nav_info); + virtual void OnUpdateTargetUrl(const std::wstring& new_target_url); + virtual void OnAcceleratorPressed(const MSG& accel_message); + virtual void OnTabbedOut(bool reverse); + virtual void OnDidNavigate(const NavigationInfo& nav_info); + virtual void OnCloseTab(); // Override DoVerb STDMETHOD(DoVerb)(LONG verb, LPMSG msg, @@ -344,8 +342,7 @@ END_EXEC_COMMAND_MAP() // Callbacks from ChromeFramePlugin<T> bool PreProcessContextMenu(HMENU menu); - bool HandleContextMenuCommand(UINT cmd, - const IPC::MiniContextMenuParams& params); + bool HandleContextMenuCommand(UINT cmd, const MiniContextMenuParams& params); // ChromeFramePlugin overrides. virtual void OnAutomationServerReady(); @@ -364,16 +361,15 @@ END_EXEC_COMMAND_MAP() protected: // ChromeFrameActivexBase overrides - virtual void OnOpenURL(int tab_handle, const GURL& url_to_open, - const GURL& referrer, int open_disposition); - virtual void OnAttachExternalTab(int tab_handle, - const IPC::AttachExternalTabParams& params); - virtual void OnGoToHistoryEntryOffset(int tab_handle, int offset); + virtual void OnOpenURL( + const GURL& url_to_open, const GURL& referrer, int open_disposition); + virtual void OnAttachExternalTab(const AttachExternalTabParams& params); + virtual void OnGoToHistoryEntryOffset(int offset); // A helper method that updates our internal navigation state // as well as IE's navigation state (viz Title and current URL). // The navigation_flags is a TabContents::InvalidateTypes enum - void UpdateNavigationState(const IPC::NavigationInfo& nav_info); + void UpdateNavigationState(const NavigationInfo& nav_info); TabProxy* GetTabProxy() const { if (automation_client_.get()) @@ -446,12 +442,12 @@ END_EXEC_COMMAND_MAP() // Returns true if the NavigationInfo object passed in represents a new // navigation initiated by the renderer. - bool IsNewNavigation(const IPC::NavigationInfo& new_navigation_info) const; + bool IsNewNavigation(const NavigationInfo& new_navigation_info) const; protected: typedef std::map<int, OLECMDF> CommandStatusMap; - IPC::NavigationInfo navigation_info_; + NavigationInfo navigation_info_; bool is_doc_object_; // This indicates whether this is the first navigation in this diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc index fe3a36a..ce5f386 100644 --- a/chrome_frame/chrome_frame_activex.cc +++ b/chrome_frame/chrome_frame_activex.cc @@ -182,14 +182,14 @@ HRESULT ChromeFrameActivex::GetDocumentWindow(IHTMLWindow2** window) { return hr; } -void ChromeFrameActivex::OnLoad(int tab_handle, const GURL& gurl) { +void ChromeFrameActivex::OnLoad(const GURL& gurl) { ScopedComPtr<IDispatch> event; std::string url = gurl.spec(); if (SUCCEEDED(CreateDomEvent("event", url, "", event.Receive()))) Fire_onload(event); FireEvent(onload_, url); - Base::OnLoad(tab_handle, gurl); + Base::OnLoad(gurl); } void ChromeFrameActivex::OnLoadFailed(int error_code, const std::string& url) { @@ -201,8 +201,7 @@ void ChromeFrameActivex::OnLoadFailed(int error_code, const std::string& url) { Base::OnLoadFailed(error_code, url); } -void ChromeFrameActivex::OnMessageFromChromeFrame(int tab_handle, - const std::string& message, +void ChromeFrameActivex::OnMessageFromChromeFrame(const std::string& message, const std::string& origin, const std::string& target) { DVLOG(1) << __FUNCTION__; diff --git a/chrome_frame/chrome_frame_activex.h b/chrome_frame/chrome_frame_activex.h index 8fee559..bbad3e8 100644 --- a/chrome_frame/chrome_frame_activex.h +++ b/chrome_frame/chrome_frame_activex.h @@ -90,9 +90,8 @@ END_MSG_MAP() protected: // ChromeFrameDelegate overrides - virtual void OnLoad(int tab_handle, const GURL& url); - virtual void OnMessageFromChromeFrame(int tab_handle, - const std::string& message, + virtual void OnLoad(const GURL& url); + virtual void OnMessageFromChromeFrame(const std::string& message, const std::string& origin, const std::string& target); virtual void OnLoadFailed(int error_code, const std::string& url); diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h index dfc3da0..cedd526 100644 --- a/chrome_frame/chrome_frame_activex_base.h +++ b/chrome_frame/chrome_frame_activex_base.h @@ -349,8 +349,7 @@ END_MSG_MAP() return CComControlBase::IOleObject_SetClientSite(client_site); } - bool HandleContextMenuCommand(UINT cmd, - const IPC::MiniContextMenuParams& params) { + bool HandleContextMenuCommand(UINT cmd, const MiniContextMenuParams& params) { if (cmd == IDC_ABOUT_CHROME_FRAME) { int tab_handle = automation_client_->tab()->handle(); HostNavigate(GURL("about:version"), GURL(), NEW_WINDOW); @@ -415,7 +414,7 @@ END_MSG_MAP() DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); } - void OnLoad(int tab_handle, const GURL& url) { + void OnLoad(const GURL& url) { if (ready_state_ < READYSTATE_COMPLETE) { ready_state_ = READYSTATE_COMPLETE; FireOnChanged(DISPID_READYSTATE); @@ -428,7 +427,7 @@ END_MSG_MAP() HRESULT hr = InvokeScriptFunction(onerror_handler_, url); } - void OnMessageFromChromeFrame(int tab_handle, const std::string& message, + void OnMessageFromChromeFrame(const std::string& message, const std::string& origin, const std::string& target) { base::win::ScopedComPtr<IDispatch> message_event; @@ -440,7 +439,7 @@ END_MSG_MAP() } } - virtual void OnTabbedOut(int tab_handle, bool reverse) { + virtual void OnTabbedOut(bool reverse) { DCHECK(m_bInPlaceActive); HWND parent = ::GetParent(m_hWnd); @@ -451,7 +450,7 @@ END_MSG_MAP() control_site->OnFocus(FALSE); } - virtual void OnOpenURL(int tab_handle, const GURL& url_to_open, + virtual void OnOpenURL(const GURL& url_to_open, const GURL& referrer, int open_disposition) { HostNavigate(url_to_open, referrer, open_disposition); } @@ -480,8 +479,7 @@ END_MSG_MAP() return TRUE; } - virtual void OnAttachExternalTab(int tab_handle, - const IPC::AttachExternalTabParams& params) { + virtual void OnAttachExternalTab(const AttachExternalTabParams& params) { std::wstring wide_url = url_; GURL parsed_url(WideToUTF8(wide_url)); @@ -515,12 +513,11 @@ END_MSG_MAP() HostNavigate(GURL(url), GURL(), params.disposition); } - virtual void OnHandleContextMenu(int tab_handle, HANDLE menu_handle, + virtual void OnHandleContextMenu(HANDLE menu_handle, int align_flags, - const IPC::MiniContextMenuParams& params) { + const MiniContextMenuParams& params) { scoped_refptr<BasePlugin> ref(this); - ChromeFramePlugin<T>::OnHandleContextMenu(tab_handle, menu_handle, - align_flags, params); + ChromeFramePlugin<T>::OnHandleContextMenu(menu_handle, align_flags, params); } LRESULT OnCreate(UINT message, WPARAM wparam, LPARAM lparam, @@ -567,7 +564,7 @@ END_MSG_MAP() FireOnChanged(DISPID_READYSTATE); } - virtual void OnCloseTab(int tab_handle) { + virtual void OnCloseTab() { Fire_onclose(); } @@ -1093,7 +1090,7 @@ END_MSG_MAP() return hr; } - virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message) { + virtual void OnAcceleratorPressed(const MSG& accel_message) { DCHECK(m_spInPlaceSite != NULL); // Allow our host a chance to handle the accelerator. // This catches things like Ctrl+F, Ctrl+O etc, but not browser diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index e0d8ead..a026669 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -67,17 +67,17 @@ class ChromeFrameAutomationProxyImpl::TabProxyNotificationMessageFilter if (message.is_reply()) return false; - int tab_handle = 0; - if (!ChromeFrameDelegateImpl::IsTabMessage(message, &tab_handle)) + if (!ChromeFrameDelegateImpl::IsTabMessage(message)) return false; // Get AddRef-ed pointer to corresponding TabProxy object - TabProxy* tab = static_cast<TabProxy*>(tracker_->GetResource(tab_handle)); + TabProxy* tab = static_cast<TabProxy*>(tracker_->GetResource( + message.routing_id())); if (tab) { tab->OnMessageReceived(message); tab->Release(); } else { - DLOG(ERROR) << "Failed to find TabProxy for tab:" << tab_handle; + DLOG(ERROR) << "Failed to find TabProxy for tab:" << message.routing_id(); } return true; } @@ -447,7 +447,7 @@ void AutomationProxyCacheEntry::SendUMAData() { snapshots_->GatherAllHistograms(); if (!histograms.empty()) { - proxy_->Send(new AutomationMsg_RecordHistograms(0, histograms)); + proxy_->Send(new AutomationMsg_RecordHistograms(histograms)); } MessageLoop::current()->PostDelayedTask(FROM_HERE, @@ -762,7 +762,7 @@ bool ChromeFrameAutomationClient::NavigateToIndex(int index) { DCHECK(::IsWindow(chrome_window_)); IPC::SyncMessage* msg = new AutomationMsg_NavigateExternalTabAtIndex( - 0, tab_->handle(), index, NULL); + tab_->handle(), index, NULL); automation_server_->SendAsAsync(msg, new BeginNavigateContext(this), this); return true; @@ -804,7 +804,7 @@ void ChromeFrameAutomationClient::BeginNavigate() { } IPC::SyncMessage* msg = - new AutomationMsg_NavigateInExternalTab(0, tab_->handle(), + new AutomationMsg_NavigateInExternalTab(tab_->handle(), chrome_launch_params_->url(), chrome_launch_params_->referrer(), NULL); automation_server_->SendAsAsync(msg, new BeginNavigateContext(this), this); @@ -840,7 +840,7 @@ void ChromeFrameAutomationClient::FindInPage(const std::wstring& search_string, params.forward = (forward == FWD); IPC::SyncMessage* msg = - new AutomationMsg_Find(0, tab_->handle(), params, NULL, NULL); + new AutomationMsg_Find(tab_->handle(), params, NULL, NULL); automation_server_->SendAsAsync(msg, NULL, this); } @@ -857,8 +857,7 @@ void ChromeFrameAutomationClient::InstallExtension( InstallExtensionContext* ctx = new InstallExtensionContext( this, crx_path, user_data); - IPC::SyncMessage* msg = - new AutomationMsg_InstallExtension(0, crx_path, NULL); + IPC::SyncMessage* msg = new AutomationMsg_InstallExtension(crx_path, NULL); // The context will delete itself after it is called. automation_server_->SendAsAsync(msg, ctx, this); @@ -885,7 +884,7 @@ void ChromeFrameAutomationClient::GetEnabledExtensions(void* user_data) { this, user_data); IPC::SyncMessage* msg = new AutomationMsg_GetEnabledExtensions( - 0, ctx->extension_directories()); + ctx->extension_directories()); // The context will delete itself after it is called. automation_server_->SendAsAsync(msg, ctx, this); @@ -932,8 +931,7 @@ void ChromeFrameAutomationClient::LoadExpandedExtension( InstallExtensionContext* ctx = new InstallExtensionContext( this, path, user_data); - IPC::SyncMessage* msg = - new AutomationMsg_LoadExpandedExtension(0, path, NULL); + IPC::SyncMessage* msg = new AutomationMsg_LoadExpandedExtension(path, NULL); // The context will delete itself after it is called. automation_server_->SendAsAsync(msg, ctx, this); @@ -948,7 +946,7 @@ void ChromeFrameAutomationClient::CreateExternalTab() { navigate_after_initialization_ = false; } - const IPC::ExternalTabSettings settings( + const ExternalTabSettings settings( m_hWnd, gfx::Rect(), WS_CHILD, @@ -969,7 +967,7 @@ void ChromeFrameAutomationClient::CreateExternalTab() { 2); IPC::SyncMessage* message = - new AutomationMsg_CreateExternalTab(0, settings, NULL, NULL, 0, 0); + new AutomationMsg_CreateExternalTab(settings, NULL, NULL, 0, 0); automation_server_->SendAsAsync(message, new CreateExternalTabContext(this), this); } @@ -1038,7 +1036,7 @@ void ChromeFrameAutomationClient::LaunchComplete( // Send a notification to Chrome that we are ready to connect to the // ExternalTab. IPC::SyncMessage* message = - new AutomationMsg_ConnectExternalTab(0, external_tab_cookie_, true, + new AutomationMsg_ConnectExternalTab(external_tab_cookie_, true, m_hWnd, NULL, NULL, NULL, 0); automation_server_->SendAsAsync(message, new CreateExternalTabContext(this), @@ -1374,7 +1372,7 @@ void ChromeFrameAutomationClient::AttachExternalTab( void ChromeFrameAutomationClient::BlockExternalTab(uint64 cookie) { // The host does not want this tab to be shown (due popup blocker). IPC::SyncMessage* message = - new AutomationMsg_ConnectExternalTab(0, cookie, false, m_hWnd, + new AutomationMsg_ConnectExternalTab(cookie, false, m_hWnd, NULL, NULL, NULL, 0); automation_server_->SendAsAsync(message, NULL, this); } @@ -1389,12 +1387,11 @@ void ChromeFrameAutomationClient::SetPageFontSize( } automation_server_->Send( - new AutomationMsg_SetPageFontSize(0, tab_handle_, font_size)); + new AutomationMsg_SetPageFontSize(tab_handle_, font_size)); } void ChromeFrameAutomationClient::RemoveBrowsingData(int remove_mask) { - automation_server_->Send( - new AutomationMsg_RemoveBrowsingData(0, remove_mask)); + automation_server_->Send(new AutomationMsg_RemoveBrowsingData(remove_mask)); } void ChromeFrameAutomationClient::SetUrlFetcher( @@ -1407,7 +1404,7 @@ void ChromeFrameAutomationClient::SetUrlFetcher( void ChromeFrameAutomationClient::SetZoomLevel(PageZoom::Function zoom_level) { if (automation_server_) { - automation_server_->Send(new AutomationMsg_SetZoomLevel(0, tab_handle_, + automation_server_->Send(new AutomationMsg_SetZoomLevel(tab_handle_, zoom_level)); } } @@ -1417,7 +1414,7 @@ void ChromeFrameAutomationClient::OnUnload(bool* should_unload) { if (automation_server_) { const DWORD kUnloadEventTimeout = 20000; - IPC::SyncMessage* msg = new AutomationMsg_RunUnloadHandlers(0, tab_handle_, + IPC::SyncMessage* msg = new AutomationMsg_RunUnloadHandlers(tab_handle_, should_unload); base::WaitableEvent unload_call_finished(false, false); UnloadContext* unload_context = new UnloadContext(&unload_call_finished, @@ -1436,7 +1433,7 @@ void ChromeFrameAutomationClient::OnResponseStarted(int request_id, const char* mime_type, const char* headers, int size, base::Time last_modified, const std::string& redirect_url, int redirect_status) { - const IPC::AutomationURLResponse response( + const AutomationURLResponse response( mime_type, headers ? headers : "", size, @@ -1444,24 +1441,24 @@ void ChromeFrameAutomationClient::OnResponseStarted(int request_id, redirect_url, redirect_status); - automation_server_->Send(new AutomationMsg_RequestStarted(0, + automation_server_->Send(new AutomationMsg_RequestStarted( tab_->handle(), request_id, response)); } void ChromeFrameAutomationClient::OnReadComplete(int request_id, const std::string& data) { - automation_server_->Send(new AutomationMsg_RequestData(0, tab_->handle(), - request_id, data)); + automation_server_->Send(new AutomationMsg_RequestData( + tab_->handle(), request_id, data)); } void ChromeFrameAutomationClient::OnResponseEnd(int request_id, const URLRequestStatus& status) { - automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), - request_id, status)); + automation_server_->Send(new AutomationMsg_RequestEnd( + tab_->handle(), request_id, status)); } void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, const GURL& url, const std::string& cookie_string, int cookie_id) { - automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, + automation_server_->Send(new AutomationMsg_GetCookiesHostResponse( tab_->handle(), success, url, cookie_string, cookie_id)); } diff --git a/chrome_frame/chrome_frame_delegate.cc b/chrome_frame/chrome_frame_delegate.cc index 6d3186a..cd54c5f 100644 --- a/chrome_frame/chrome_frame_delegate.cc +++ b/chrome_frame/chrome_frame_delegate.cc @@ -4,8 +4,7 @@ #include "chrome_frame/chrome_frame_delegate.h" -bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message, - int* tab_handle) { +bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message) { bool is_tab_message = true; IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, message) IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationStateChanged, ) @@ -31,12 +30,6 @@ bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message, IPC_MESSAGE_UNHANDLED(is_tab_message = false); IPC_END_MESSAGE_MAP() - if (is_tab_message) { - // Read tab handle from the message. - void* iter = NULL; - is_tab_message = message.ReadInt(&iter, tab_handle); - } - return is_tab_message; } diff --git a/chrome_frame/chrome_frame_delegate.h b/chrome_frame/chrome_frame_delegate.h index c7890b7..647f0d0 100644 --- a/chrome_frame/chrome_frame_delegate.h +++ b/chrome_frame/chrome_frame_delegate.h @@ -79,7 +79,7 @@ class ChromeFrameDelegateImpl : public ChromeFrameDelegate { virtual void OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError() {} - static bool IsTabMessage(const IPC::Message& message, int* tab_handle); + static bool IsTabMessage(const IPC::Message& message); virtual bool IsValid() const { return true; @@ -89,42 +89,33 @@ class ChromeFrameDelegateImpl : public ChromeFrameDelegate { protected: // Protected methods to be overriden. - virtual void OnNavigationStateChanged(int tab_handle, int flags, - const IPC::NavigationInfo& nav_info) {} - virtual void OnUpdateTargetUrl(int tab_handle, - const std::wstring& new_target_url) {} - virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message) {} - virtual void OnTabbedOut(int tab_handle, bool reverse) {} - virtual void OnOpenURL(int tab_handle, const GURL& url, - const GURL& referrer, int open_disposition) {} - virtual void OnDidNavigate(int tab_handle, - const IPC::NavigationInfo& navigation_info) {} - virtual void OnNavigationFailed(int tab_handle, int error_code, - const GURL& gurl) {} - virtual void OnLoad(int tab_handle, const GURL& url) {} - virtual void OnMessageFromChromeFrame(int tab_handle, - const std::string& message, + virtual void OnNavigationStateChanged( + int flags, const NavigationInfo& nav_info) {} + virtual void OnUpdateTargetUrl(const std::wstring& new_target_url) {} + virtual void OnAcceleratorPressed(const MSG& accel_message) {} + virtual void OnTabbedOut(bool reverse) {} + virtual void OnOpenURL( + const GURL& url, const GURL& referrer, int open_disposition) {} + virtual void OnDidNavigate(const NavigationInfo& navigation_info) {} + virtual void OnNavigationFailed(int error_code, const GURL& gurl) {} + virtual void OnLoad(const GURL& url) {} + virtual void OnMessageFromChromeFrame(const std::string& message, const std::string& origin, const std::string& target) {} - virtual void OnHandleContextMenu(int tab_handle, HANDLE menu_handle, - int align_flags, - const IPC::MiniContextMenuParams& params) {} - virtual void OnRequestStart(int tab_handle, int request_id, - const IPC::AutomationURLRequest& request) {} - virtual void OnRequestRead(int tab_handle, int request_id, - int bytes_to_read) {} - virtual void OnRequestEnd(int tab_handle, int request_id, - const URLRequestStatus& status) {} - virtual void OnDownloadRequestInHost(int tab_handle, int request_id) {} - virtual void OnSetCookieAsync(int tab_handle, const GURL& url, - const std::string& cookie) {} - virtual void OnAttachExternalTab(int tab_handle, - const IPC::AttachExternalTabParams& attach_params) {} - virtual void OnGoToHistoryEntryOffset(int tab_handle, int offset) {} - - virtual void OnGetCookiesFromHost(int tab_handle, const GURL& url, - int cookie_id) {} - virtual void OnCloseTab(int tab_handle) {} + virtual void OnHandleContextMenu(HANDLE menu_handle, int align_flags, + const MiniContextMenuParams& params) {} + virtual void OnRequestStart( + int request_id, const AutomationURLRequest& request) {} + virtual void OnRequestRead(int request_id, int bytes_to_read) {} + virtual void OnRequestEnd(int request_id, const URLRequestStatus& status) {} + virtual void OnDownloadRequestInHost(int request_id) {} + virtual void OnSetCookieAsync(const GURL& url, const std::string& cookie) {} + virtual void OnAttachExternalTab( + const AttachExternalTabParams& attach_params) {} + virtual void OnGoToHistoryEntryOffset(int offset) {} + + virtual void OnGetCookiesFromHost(const GURL& url, int cookie_id) {} + virtual void OnCloseTab() {} }; // This interface enables tasks to be marshaled to desired threads. diff --git a/chrome_frame/chrome_frame_npapi.cc b/chrome_frame/chrome_frame_npapi.cc index c36c1b7..a010fac 100644 --- a/chrome_frame/chrome_frame_npapi.cc +++ b/chrome_frame/chrome_frame_npapi.cc @@ -901,7 +901,7 @@ void ChromeFrameNPAPI::OnAutomationServerLaunchFailed( } } -void ChromeFrameNPAPI::OnCloseTab(int tab_handle) { +void ChromeFrameNPAPI::OnCloseTab() { std::string arg; FireEvent("close", arg); ScopedNpVariant result; @@ -1487,8 +1487,8 @@ bool ChromeFrameNPAPI::PreProcessContextMenu(HMENU menu) { return true; } -bool ChromeFrameNPAPI::HandleContextMenuCommand(UINT cmd, - const IPC::MiniContextMenuParams& params) { +bool ChromeFrameNPAPI::HandleContextMenuCommand( + UINT cmd, const MiniContextMenuParams& params) { if (cmd == IDC_ABOUT_CHROME_FRAME) { // TODO: implement "About Chrome Frame" } diff --git a/chrome_frame/chrome_frame_npapi.h b/chrome_frame/chrome_frame_npapi.h index f05185c..5f78ef7 100644 --- a/chrome_frame/chrome_frame_npapi.h +++ b/chrome_frame/chrome_frame_npapi.h @@ -129,8 +129,7 @@ END_MSG_MAP() static void InitializeIdentifiers(); bool PreProcessContextMenu(HMENU menu); - bool HandleContextMenuCommand(UINT cmd, - const IPC::MiniContextMenuParams& params); + bool HandleContextMenuCommand(UINT cmd, const MiniContextMenuParams& params); protected: // Handler for accelerator messages passed on from the hosted chrome // instance. @@ -153,7 +152,7 @@ END_MSG_MAP() virtual void OnGetEnabledExtensionsComplete( void* user_data, const std::vector<FilePath>& extension_directories); - virtual void OnCloseTab(int tab_handle); + virtual void OnCloseTab(); private: void SubscribeToFocusEvents(); diff --git a/chrome_frame/chrome_frame_plugin.h b/chrome_frame/chrome_frame_plugin.h index 7acda3c..4f543b5 100644 --- a/chrome_frame/chrome_frame_plugin.h +++ b/chrome_frame/chrome_frame_plugin.h @@ -114,14 +114,13 @@ END_MSG_MAP() } protected: - virtual void OnNavigationFailed(int tab_handle, int error_code, - const GURL& gurl) { + virtual void OnNavigationFailed(int error_code, const GURL& gurl) { OnLoadFailed(error_code, gurl.spec()); } - virtual void OnHandleContextMenu(int tab_handle, HANDLE menu_handle, + virtual void OnHandleContextMenu(HANDLE menu_handle, int align_flags, - const IPC::MiniContextMenuParams& params) { + const MiniContextMenuParams& params) { if (!menu_handle || !automation_client_.get()) { NOTREACHED(); return; @@ -220,7 +219,7 @@ END_MSG_MAP() // Return true if menu command is processed, otherwise the command will be // passed to Chrome for execution. Override in most-derived class if needed. bool HandleContextMenuCommand(UINT cmd, - const IPC::MiniContextMenuParams& params) { + const MiniContextMenuParams& params) { return false; } diff --git a/chrome_frame/external_tab.cc b/chrome_frame/external_tab.cc index 785b189..99477ef 100644 --- a/chrome_frame/external_tab.cc +++ b/chrome_frame/external_tab.cc @@ -34,6 +34,35 @@ ExternalTabProxy::~ExternalTabProxy() { Destroy(); } +void ExternalTabProxy::OnMessageReceived(const IPC::Message& message) { + IPC_BEGIN_MESSAGE_MAP(ExternalTabProxy, message) + IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, + OnNavigationStateChanged) + IPC_MESSAGE_HANDLER(AutomationMsg_UpdateTargetUrl, OnUpdateTargetUrl) + IPC_MESSAGE_HANDLER(AutomationMsg_HandleAccelerator, OnHandleAccelerator) + IPC_MESSAGE_HANDLER(AutomationMsg_TabbedOut, OnTabbedOut) + IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) + IPC_MESSAGE_HANDLER(AutomationMsg_NavigationFailed, OnNavigationFailed) + IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate) + IPC_MESSAGE_HANDLER(AutomationMsg_TabLoaded, OnTabLoaded) + IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost, + OnMessageToHost) + IPC_MESSAGE_HANDLER(AutomationMsg_ForwardContextMenuToExternalHost, + OnHandleContextMenu) + IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnNetwork_Start) + IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnNetwork_Read) + IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnNetwork_End) + IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost, + OnNetwork_DownloadInHost) + IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookies) + IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookie) + IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachTab) + IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset, + OnGoToHistoryOffset) + IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnTabClosed) + IPC_END_MESSAGE_MAP() +} + void ExternalTabProxy::Init() { if (m_hWnd == NULL) { // Create a window on the UI thread for marshaling messages back and forth @@ -88,7 +117,7 @@ void ExternalTabProxy::Connected(ChromeProxy* proxy) { void ExternalTabProxy::UiConnected(ChromeProxy* proxy) { proxy_ = proxy; - IPC::ExternalTabSettings settings; + ExternalTabSettings settings; settings.parent = m_hWnd; settings.style = WS_CHILD; settings.is_off_the_record = tab_params_.is_incognito; @@ -222,122 +251,126 @@ void ExternalTabProxy::Completed_CreateTab(bool success, HWND chrome_wnd, success, chrome_wnd, tab_window, tab_handle, session_id)); } -void ExternalTabProxy::Completed_ConnectToTab(bool success, - HWND chrome_window, HWND tab_window, int tab_handle, int session_id) { +void ExternalTabProxy::Completed_ConnectToTab( + bool success, HWND chrome_window, HWND tab_window, int tab_handle, + int session_id) { CHECK(0); } -void ExternalTabProxy::Completed_Navigate(bool success, - enum AutomationMsg_NavigationResponseValues res) { +void ExternalTabProxy::Completed_Navigate( + bool success, enum AutomationMsg_NavigationResponseValues res) { // ipc_thread; CHECK(0); } -void ExternalTabProxy::Completed_InstallExtension(bool success, - enum AutomationMsg_ExtensionResponseValues res, SyncMessageContext* ctx) { +void ExternalTabProxy::Completed_InstallExtension( + bool success, enum AutomationMsg_ExtensionResponseValues res, + SyncMessageContext* ctx) { CHECK(0); } -void ExternalTabProxy::Completed_LoadExpandedExtension(bool success, - enum AutomationMsg_ExtensionResponseValues res, SyncMessageContext* ctx) { +void ExternalTabProxy::Completed_LoadExpandedExtension( + bool success, enum AutomationMsg_ExtensionResponseValues res, + SyncMessageContext* ctx) { CHECK(0); } -void ExternalTabProxy::Completed_GetEnabledExtensions(bool success, - const std::vector<FilePath>* extensions) { +void ExternalTabProxy::Completed_GetEnabledExtensions( + bool success, const std::vector<FilePath>* extensions) { CHECK(0); } -void ExternalTabProxy::NavigationStateChanged(int flags, - const IPC::NavigationInfo& nav_info) { +void ExternalTabProxy::OnNavigationStateChanged( + int flags, const NavigationInfo& nav_info) { ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, &UIDelegate::OnNavigationStateChanged, flags, nav_info)); } -void ExternalTabProxy::UpdateTargetUrl(const std::wstring& url) { +void ExternalTabProxy::OnUpdateTargetUrl(const std::wstring& url) { ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, &UIDelegate::OnUpdateTargetUrl, url)); } -void ExternalTabProxy::TabLoaded(const GURL& url) { +void ExternalTabProxy::OnTabLoaded(const GURL& url) { ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, &UIDelegate::OnLoad, url)); } -void ExternalTabProxy::MessageToHost(const std::string& message, - const std::string& origin, - const std::string& target) { +void ExternalTabProxy::OnMessageToHost(const std::string& message, + const std::string& origin, + const std::string& target) { ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, &UIDelegate::OnMessageFromChromeFrame, message, origin, target)); } -void ExternalTabProxy::HandleAccelerator(const MSG& accel_message) { +void ExternalTabProxy::OnHandleAccelerator(const MSG& accel_message) { ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, &UIDelegate::OnHandleAccelerator, accel_message)); } -void ExternalTabProxy::HandleContextMenu( +void ExternalTabProxy::OnHandleContextMenu( HANDLE menu_handle, int align_flags, - const IPC::MiniContextMenuParams& params) { + const MiniContextMenuParams& params) { ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, &UIDelegate::OnHandleContextMenu, menu_handle, align_flags, params)); } -void ExternalTabProxy::TabbedOut(bool reverse) { +void ExternalTabProxy::OnTabbedOut(bool reverse) { ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, &UIDelegate::OnTabbedOut, reverse)); } -void ExternalTabProxy::GoToHistoryOffset(int offset) { +void ExternalTabProxy::OnGoToHistoryOffset(int offset) { ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, &UIDelegate::OnGoToHistoryOffset, offset)); } -void ExternalTabProxy::OpenURL(const GURL& url_to_open, const GURL& referrer, - int open_disposition) { +void ExternalTabProxy::OnOpenURL(const GURL& url_to_open, const GURL& referrer, + int open_disposition) { ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, &UIDelegate::OnOpenURL, url_to_open, referrer, open_disposition)); } -void ExternalTabProxy::NavigationFailed(int error_code, const GURL& gurl) { +void ExternalTabProxy::OnNavigationFailed(int error_code, const GURL& gurl) { // TODO(stoyan): } -void ExternalTabProxy::DidNavigate(const IPC::NavigationInfo& navigation_info) { +void ExternalTabProxy::OnDidNavigate(const NavigationInfo& navigation_info) { // TODO(stoyan): } -void ExternalTabProxy::Network_Start( - int request_id, const IPC::AutomationURLRequest& request_info) { +void ExternalTabProxy::OnNetwork_Start( + int request_id, const AutomationURLRequest& request_info) { // TODO(stoyan): url_fetcher_.Start(); } -void ExternalTabProxy::Network_Read(int request_id, int bytes_to_read) { +void ExternalTabProxy::OnNetwork_Read(int request_id, int bytes_to_read) { // TODO(stoyan): url_fetcher_.Read(); } -void ExternalTabProxy::Network_End(int request_id, const URLRequestStatus& s) { +void ExternalTabProxy::OnNetwork_End(int request_id, + const URLRequestStatus& s) { // TODO(stoyan): } -void ExternalTabProxy::Network_DownloadInHost(int request_id) { +void ExternalTabProxy::OnNetwork_DownloadInHost(int request_id) { // TODO(stoyan): } -void ExternalTabProxy::GetCookies(const GURL& url, int cookie_id) { +void ExternalTabProxy::OnGetCookies(const GURL& url, int cookie_id) { // TODO(stoyan): } -void ExternalTabProxy::SetCookie(const GURL& url, const std::string& cookie) { +void ExternalTabProxy::OnSetCookie(const GURL& url, const std::string& cookie) { // TODO(stoyan): } -void ExternalTabProxy::TabClosed() { +void ExternalTabProxy::OnTabClosed() { // TODO(stoyan): } -void ExternalTabProxy::AttachTab( - const IPC::AttachExternalTabParams& attach_params) { +void ExternalTabProxy::OnAttachTab( + const AttachExternalTabParams& attach_params) { // TODO(stoyan): } diff --git a/chrome_frame/external_tab.h b/chrome_frame/external_tab.h index 469d2d7..c3dcbab 100644 --- a/chrome_frame/external_tab.h +++ b/chrome_frame/external_tab.h @@ -36,21 +36,23 @@ namespace IPC { // by the customers of ExternalTabProxy class. class UIDelegate { public: - virtual void OnNavigationStateChanged(int flags, - const IPC::NavigationInfo& nav_info) = 0; + virtual void OnNavigationStateChanged( + int flags, const NavigationInfo& nav_info) = 0; virtual void OnUpdateTargetUrl(const std::wstring& new_target_url) = 0; virtual void OnExtensionInstalled(const FilePath& path, void* user_data, AutomationMsg_ExtensionResponseValues response) = 0; virtual void OnLoad(const GURL& url) = 0; - virtual void OnMessageFromChromeFrame(const std::string& message, - const std::string& origin, const std::string& target) = 0; - virtual void OnHandleContextMenu(HANDLE menu_handle, int align_flags, - const IPC::MiniContextMenuParams& params) = 0; + virtual void OnMessageFromChromeFrame( + const std::string& message, const std::string& origin, + const std::string& target) = 0; + virtual void OnHandleContextMenu( + HANDLE menu_handle, int align_flags, + const MiniContextMenuParams& params) = 0; virtual void OnHandleAccelerator(const MSG& accel_message) = 0; virtual void OnTabbedOut(bool reverse) = 0; virtual void OnGoToHistoryOffset(int offset) = 0; - virtual void OnOpenURL(const GURL& url_to_open, const GURL& referrer, - int open_disposition) = 0; + virtual void OnOpenURL( + const GURL& url_to_open, const GURL& referrer, int open_disposition) = 0; protected: ~UIDelegate() {} }; @@ -90,6 +92,10 @@ class ExternalTabProxy : public CWindowImpl<ExternalTabProxy>, proxy_factory_ = factory; } #endif + + // IPC::Channel::Listener implementation. + void OnMessageReceived(const IPC::Message& message); + // virtual void CreateTab(const CreateTabParams& create_params, UIDelegate* delegate); @@ -126,7 +132,6 @@ class ExternalTabProxy : public CWindowImpl<ExternalTabProxy>, virtual void PeerLost(ChromeProxy* proxy, DisconnectReason reason); virtual void Disconnected(); - // Sync message responses. virtual void Completed_CreateTab(bool success, HWND chrome_wnd, HWND tab_window, int tab_handle, int session_id); @@ -142,37 +147,38 @@ class ExternalTabProxy : public CWindowImpl<ExternalTabProxy>, const std::vector<FilePath>* extensions); // Network requests from Chrome. - virtual void Network_Start(int request_id, - const IPC::AutomationURLRequest& request_info); - virtual void Network_Read(int request_id, int bytes_to_read); - virtual void Network_End(int request_id, const URLRequestStatus& s); - virtual void Network_DownloadInHost(int request_id); - virtual void GetCookies(const GURL& url, int cookie_id); - virtual void SetCookie(const GURL& url, const std::string& cookie); + virtual void OnNetwork_Start( + int request_id, const AutomationURLRequest& request_info); + virtual void OnNetwork_Read(int request_id, int bytes_to_read); + virtual void OnNetwork_End(int request_id, const URLRequestStatus& s); + virtual void OnNetwork_DownloadInHost(int request_id); + virtual void OnGetCookies(const GURL& url, int cookie_id); + virtual void OnSetCookie(const GURL& url, const std::string& cookie); // Navigation progress notifications. - virtual void NavigationStateChanged(int flags, - const IPC::NavigationInfo& nav_info); - virtual void UpdateTargetUrl(const std::wstring& url); - virtual void NavigationFailed(int error_code, const GURL& gurl); - virtual void DidNavigate(const IPC::NavigationInfo& navigation_info); - virtual void TabLoaded(const GURL& url); - - virtual void OpenURL(const GURL& url_to_open, const GURL& referrer, - int open_disposition); - virtual void GoToHistoryOffset(int offset); - virtual void MessageToHost(const std::string& message, - const std::string& origin, const std::string& target); + virtual void OnNavigationStateChanged( + int flags, const NavigationInfo& nav_info); + virtual void OnUpdateTargetUrl(const std::wstring& url); + virtual void OnNavigationFailed(int error_code, const GURL& gurl); + virtual void OnDidNavigate(const NavigationInfo& navigation_info); + virtual void OnTabLoaded(const GURL& url); + + virtual void OnOpenURL(const GURL& url_to_open, const GURL& referrer, + int open_disposition); + virtual void OnGoToHistoryOffset(int offset); + virtual void OnMessageToHost( + const std::string& message, const std::string& origin, + const std::string& target); // Misc. UI. - virtual void HandleAccelerator(const MSG& accel_message); - virtual void HandleContextMenu(HANDLE menu_handle, int align_flags, - const IPC::MiniContextMenuParams& params); - virtual void TabbedOut(bool reverse); + virtual void OnHandleAccelerator(const MSG& accel_message); + virtual void OnHandleContextMenu(HANDLE menu_handle, int align_flags, + const MiniContextMenuParams& params); + virtual void OnTabbedOut(bool reverse); // Other - virtual void TabClosed(); - virtual void AttachTab(const IPC::AttachExternalTabParams& attach_params); + virtual void OnTabClosed(); + virtual void OnAttachTab(const AttachExternalTabParams& attach_params); // end of ChromeProxyDelegate methods ////////////////////////////////////////////////////////////////////////// diff --git a/chrome_frame/external_tab_test.cc b/chrome_frame/external_tab_test.cc index ac3359c..f44ce39 100644 --- a/chrome_frame/external_tab_test.cc +++ b/chrome_frame/external_tab_test.cc @@ -34,7 +34,7 @@ using chrome_frame_test::TimedMsgLoop; struct MockUIDelegate : public UIDelegate { MOCK_METHOD2(OnNavigationStateChanged, void(int flags, - const IPC::NavigationInfo& nav_info)); + const NavigationInfo& nav_info)); MOCK_METHOD1(OnUpdateTargetUrl, void(const std::wstring& new_target_url)); MOCK_METHOD3(OnExtensionInstalled, void(const FilePath& path, void* user_data, AutomationMsg_ExtensionResponseValues response)); @@ -42,7 +42,7 @@ struct MockUIDelegate : public UIDelegate { MOCK_METHOD3(OnMessageFromChromeFrame, void(const std::string& message, const std::string& origin, const std::string& target)); MOCK_METHOD3(OnHandleContextMenu, void(HANDLE menu_handle, int align_flags, - const IPC::MiniContextMenuParams& params)); + const MiniContextMenuParams& params)); MOCK_METHOD1(OnHandleAccelerator, void(const MSG& accel_message)); MOCK_METHOD1(OnTabbedOut, void(bool reverse)); MOCK_METHOD1(OnGoToHistoryOffset, void(int offset)); @@ -61,7 +61,7 @@ struct MockProxy : public ChromeProxy { MOCK_METHOD1(SetProxyConfig, void(const std::string& json_encoded_settings)); MOCK_METHOD2(CreateTab, void(ChromeProxyDelegate* delegate, - const IPC::ExternalTabSettings& settings)); + const ExternalTabSettings& settings)); MOCK_METHOD3(ConnectTab, void(ChromeProxyDelegate* delegate, HWND hwnd, uint64 cookie)); MOCK_METHOD1(BlockTab, void(uint64 cookie)); @@ -141,11 +141,6 @@ struct AsyncEventCreator { tab_window, tab_handle, session_id), delay.InMilliseconds()); } - void Fire_TabLoaded(const GURL& url, base::TimeDelta delay) { - ipc_loop_->PostDelayedTask(FROM_HERE, NewRunnableMethod(delegate_, - &ChromeProxyDelegate::TabLoaded, url), delay.InMilliseconds()); - } - private: ChromeProxyDelegate* delegate_; base::Thread ipc_thread_; @@ -191,59 +186,3 @@ TEST(ExternalTabProxy, CancelledCreateTab) { EXPECT_FALSE(loop.WasTimedOut()); tab.reset(); } - -// CreateTab with initial url, and the navigate to different url before -// initialization completes. -TEST(ExternalTabProxy, NavigateAfterCreate) { - MockUIDelegate ui_delegate; - StrictMock<MockFactory> factory; - scoped_ptr<ExternalTabProxy> tab(new ExternalTabProxy()); - AsyncEventCreator async_events(tab.get()); - StrictMock<MockProxy>* proxy = new StrictMock<MockProxy>(); - TimedMsgLoop loop; - tab->set_proxy_factory(&factory); - GURL initial_url("http://Xanadu.org"); - GURL real_url("http://asgard.org"); - - EXPECT_CALL(factory, CreateProxy()).WillOnce(Return(proxy)); - EXPECT_CALL(*proxy, Init(_)); - EXPECT_CALL(*proxy, AddDelegate(tab.get())) - .WillOnce(DoAll(InvokeWithoutArgs(CreateFunctor(&async_events, - &AsyncEventCreator::Fire_Connected, proxy, - base::TimeDelta::FromMilliseconds(30))), - Return(1))); - - EXPECT_CALL(*proxy, CreateTab(tab.get(), - Field(&IPC::ExternalTabSettings::initial_url, real_url))) - .WillOnce(DoAll( - InvokeWithoutArgs(CreateFunctor(&async_events, - &AsyncEventCreator::Fire_CompletedCreateTab, - true, HWND(0), HWND(0), 7, 0, base::TimeDelta::FromMilliseconds(9))), - InvokeWithoutArgs(CreateFunctor(&async_events, - &AsyncEventCreator::Fire_TabLoaded, real_url, - base::TimeDelta::FromMilliseconds(150))))); - - EXPECT_CALL(ui_delegate, OnLoad(real_url)) - .WillOnce(QUIT_LOOP(loop)); - - EXPECT_CALL(*proxy, RemoveDelegate(_)) - .WillOnce(DoAll(InvokeWithoutArgs(CreateFunctor(&async_events, - &AsyncEventCreator::Fire_Disconnected, - base::TimeDelta::FromMilliseconds(0))), - Return(0))); - - CreateTabParams tab_params; - tab_params.is_incognito = true; - tab_params.is_widget_mode = false; - tab_params.url = initial_url; - - NavigationConstraintsImpl navigation_constraints; - - tab->CreateTab(tab_params, &ui_delegate); - tab->Navigate("http://asgard.org", EmptyString(), - &navigation_constraints); - - loop.RunFor(5); - EXPECT_FALSE(loop.WasTimedOut()); - tab.reset(); -} diff --git a/chrome_frame/npapi_url_request.cc b/chrome_frame/npapi_url_request.cc index 878f0ed6..1d57065 100644 --- a/chrome_frame/npapi_url_request.cc +++ b/chrome_frame/npapi_url_request.cc @@ -215,7 +215,7 @@ PluginUrlRequestManager::ThreadSafeFlags } void NPAPIUrlRequestManager::StartRequest(int request_id, - const IPC::AutomationURLRequest& request_info) { + const AutomationURLRequest& request_info) { scoped_refptr<NPAPIUrlRequest> new_request(new NPAPIUrlRequest(instance_)); DCHECK(new_request); if (new_request->Initialize(this, request_id, request_info.url, diff --git a/chrome_frame/npapi_url_request.h b/chrome_frame/npapi_url_request.h index 3c29c73..a257faf 100644 --- a/chrome_frame/npapi_url_request.h +++ b/chrome_frame/npapi_url_request.h @@ -36,7 +36,7 @@ class NPAPIUrlRequestManager : public PluginUrlRequestManager, // PluginUrlRequestManager implementation. Called from AutomationClient. virtual PluginUrlRequestManager::ThreadSafeFlags GetThreadSafeFlags(); virtual void StartRequest(int request_id, - const IPC::AutomationURLRequest& request_info); + const AutomationURLRequest& request_info); virtual void ReadRequest(int request_id, int bytes_to_read); virtual void EndRequest(int request_id); virtual void DownloadRequestInHost(int request_id) { @@ -69,4 +69,3 @@ class NPAPIUrlRequestManager : public PluginUrlRequestManager, }; #endif // CHROME_FRAME_NPAPI_URL_REQUEST_H_ - diff --git a/chrome_frame/plugin_url_request.h b/chrome_frame/plugin_url_request.h index 2d25b94..a39cf7d 100644 --- a/chrome_frame/plugin_url_request.h +++ b/chrome_frame/plugin_url_request.h @@ -68,20 +68,20 @@ class DECLSPEC_NOVTABLE PluginUrlRequestManager { // NOLINT // automation messages are received from Chrome. // Strip 'tab' handle and forward to the virtual methods implemented by // derived classes. - void StartUrlRequest(int tab, int request_id, - const IPC::AutomationURLRequest& request_info) { + void StartUrlRequest(int request_id, + const AutomationURLRequest& request_info) { StartRequest(request_id, request_info); } - void ReadUrlRequest(int tab, int request_id, int bytes_to_read) { + void ReadUrlRequest(int request_id, int bytes_to_read) { ReadRequest(request_id, bytes_to_read); } - void EndUrlRequest(int tab, int request_id, const URLRequestStatus& s) { + void EndUrlRequest(int request_id, const URLRequestStatus& s) { EndRequest(request_id); } - void DownloadUrlRequestInHost(int tab, int request_id) { + void DownloadUrlRequestInHost(int request_id) { DownloadRequestInHost(request_id); } @@ -89,12 +89,11 @@ class DECLSPEC_NOVTABLE PluginUrlRequestManager { // NOLINT StopAll(); } - void GetCookiesFromHost(int tab_handle, const GURL& url, int cookie_id) { + void GetCookiesFromHost(const GURL& url, int cookie_id) { GetCookiesForUrl(url, cookie_id); } - void SetCookiesInHost(int tab_handle, const GURL& url, - const std::string& cookie) { + void SetCookiesInHost(const GURL& url, const std::string& cookie) { SetCookiesForUrl(url, cookie); } @@ -103,8 +102,8 @@ class DECLSPEC_NOVTABLE PluginUrlRequestManager { // NOLINT bool enable_frame_busting_; private: - virtual void StartRequest(int request_id, - const IPC::AutomationURLRequest& request_info) = 0; + virtual void StartRequest( + int request_id, const AutomationURLRequest& request_info) = 0; virtual void ReadRequest(int request_id, int bytes_to_read) = 0; virtual void EndRequest(int request_id) = 0; virtual void DownloadRequestInHost(int request_id) = 0; diff --git a/chrome_frame/test/automation_client_mock.cc b/chrome_frame/test/automation_client_mock.cc index e4bdad0..7265e10 100644 --- a/chrome_frame/test/automation_client_mock.cc +++ b/chrome_frame/test/automation_client_mock.cc @@ -170,18 +170,18 @@ TEST(CFACWithChrome, NavigateOk) { EXPECT_CALL(cfd, GetBounds(_)).Times(testing::AnyNumber()); - EXPECT_CALL(cfd, OnNavigationStateChanged(_, _)) + EXPECT_CALL(cfd, OnNavigationStateChanged(_)) .Times(testing::AnyNumber()); { testing::InSequence s; - EXPECT_CALL(cfd, OnDidNavigate(_, EqNavigationInfoUrl(GURL()))) + EXPECT_CALL(cfd, OnDidNavigate(EqNavigationInfoUrl(GURL()))) .Times(1); - EXPECT_CALL(cfd, OnUpdateTargetUrl(_, _)).Times(testing::AtMost(1)); + EXPECT_CALL(cfd, OnUpdateTargetUrl(_)).Times(testing::AtMost(1)); - EXPECT_CALL(cfd, OnLoad(_, _)) + EXPECT_CALL(cfd, OnLoad(_)) .Times(1) .WillOnce(QUIT_LOOP(loop)); } @@ -218,18 +218,18 @@ TEST(CFACWithChrome, NavigateFailed) { url, std::string(), &navigation_constraints)))); EXPECT_CALL(cfd, GetBounds(_)).Times(testing::AnyNumber()); - EXPECT_CALL(cfd, OnNavigationStateChanged(_, _)).Times(testing::AnyNumber()); + EXPECT_CALL(cfd, OnNavigationStateChanged(_)).Times(testing::AnyNumber()); - EXPECT_CALL(cfd, OnRequestStart(_, _, _)) + EXPECT_CALL(cfd, OnRequestStart(_, _)) // Often there's another request for the error page .Times(testing::Between(1, 2)) - .WillRepeatedly(testing::WithArgs<1>(testing::Invoke(CreateFunctor(&cfd, + .WillRepeatedly(testing::WithArgs<0>(testing::Invoke(CreateFunctor(&cfd, &MockCFDelegate::Reply, connection_failed)))); - EXPECT_CALL(cfd, OnUpdateTargetUrl(_, _)).Times(testing::AnyNumber()); - EXPECT_CALL(cfd, OnLoad(_, _)).Times(testing::AtMost(1)); + EXPECT_CALL(cfd, OnUpdateTargetUrl(_)).Times(testing::AnyNumber()); + EXPECT_CALL(cfd, OnLoad(_)).Times(testing::AtMost(1)); - EXPECT_CALL(cfd, OnNavigationFailed(_, _, GURL(url))) + EXPECT_CALL(cfd, OnNavigationFailed(_, GURL(url))) .Times(1) .WillOnce(QUIT_LOOP_SOON(loop, 2)); diff --git a/chrome_frame/test/automation_client_mock.h b/chrome_frame/test/automation_client_mock.h index 58928b8..4a25b10c 100644 --- a/chrome_frame/test/automation_client_mock.h +++ b/chrome_frame/test/automation_client_mock.h @@ -33,32 +33,28 @@ struct MockCFDelegate : public ChromeFrameDelegateImpl { // MOCK_METHOD1(OnMessageReceived, void(const IPC::Message&)); MOCK_METHOD0(OnChannelError, void(void)); - MOCK_METHOD2(OnNavigationStateChanged, void(int tab_handle, int flags)); - MOCK_METHOD2(OnUpdateTargetUrl, void(int tab_handle, + MOCK_METHOD1(OnNavigationStateChanged, void(int flags)); + MOCK_METHOD1(OnUpdateTargetUrl, void( const std::wstring& new_target_url)); - MOCK_METHOD2(OnAcceleratorPressed, void(int tab_handle, - const MSG& accel_message)); - MOCK_METHOD2(OnTabbedOut, void(int tab_handle, bool reverse)); - MOCK_METHOD3(OnOpenURL, void(int tab_handle, const GURL& url, - int open_disposition)); - MOCK_METHOD2(OnDidNavigate, void(int tab_handle, - const IPC::NavigationInfo& navigation_info)); - MOCK_METHOD3(OnNavigationFailed, void(int tab_handle, int error_code, - const GURL& gurl)); - MOCK_METHOD2(OnLoad, void(int tab_handle, const GURL& url)); - MOCK_METHOD4(OnMessageFromChromeFrame, void(int tab_handle, + MOCK_METHOD1(OnAcceleratorPressed, void(const MSG& accel_message)); + MOCK_METHOD1(OnTabbedOut, void(bool reverse)); + MOCK_METHOD2(OnOpenURL, void(const GURL& url, int open_disposition)); + MOCK_METHOD1(OnDidNavigate, void( + const NavigationInfo& navigation_info)); + MOCK_METHOD2(OnNavigationFailed, void(int error_code, const GURL& gurl)); + MOCK_METHOD1(OnLoad, void(const GURL& url)); + MOCK_METHOD3(OnMessageFromChromeFrame, void( const std::string& message, const std::string& origin, const std::string& target)); - MOCK_METHOD4(OnHandleContextMenu, void(int tab_handle, HANDLE menu_handle, - int align_flags, const IPC::MiniContextMenuParams& params)); - MOCK_METHOD3(OnRequestStart, void(int tab_handle, int request_id, - const IPC::AutomationURLRequest& request)); - MOCK_METHOD3(OnRequestRead, void(int tab_handle, int request_id, - int bytes_to_read)); - MOCK_METHOD3(OnRequestEnd, void(int tab_handle, int request_id, + MOCK_METHOD3(OnHandleContextMenu, void(HANDLE menu_handle, + int align_flags, const MiniContextMenuParams& params)); + MOCK_METHOD2(OnRequestStart, void(int request_id, + const AutomationURLRequest& request)); + MOCK_METHOD2(OnRequestRead, void(int request_id, int bytes_to_read)); + MOCK_METHOD2(OnRequestEnd, void(int request_id, const URLRequestStatus& status)); - MOCK_METHOD3(OnSetCookieAsync, void(int tab_handle, const GURL& url, + MOCK_METHOD2(OnSetCookieAsync, void(const GURL& url, const std::string& cookie)); // Use for sending network responses diff --git a/chrome_frame/test/chrome_frame_automation_mock.h b/chrome_frame/test/chrome_frame_automation_mock.h index 58d9fefa..4ba65e2 100644 --- a/chrome_frame/test/chrome_frame_automation_mock.h +++ b/chrome_frame/test/chrome_frame_automation_mock.h @@ -98,7 +98,7 @@ class AutomationMockDelegate QuitMessageLoop(); } - virtual void OnLoad(int tab_handle, const GURL& url) { + virtual void OnLoad(const GURL& url) { if (url_ == url) { navigation_result_ = true; } else { @@ -169,8 +169,8 @@ class AutomationMockNavigate : Base(caller_message_loop, launch_timeout, true, L"", L"", L"", false, false) { } - virtual void OnLoad(int tab_handle, const GURL& url) { - Base::OnLoad(tab_handle, url); + virtual void OnLoad(const GURL& url) { + Base::OnLoad(url); QuitMessageLoop(); } }; @@ -187,14 +187,13 @@ class AutomationMockPostMessage bool postmessage_result() const { return postmessage_result_; } - virtual void OnLoad(int tab_handle, const GURL& url) { - Base::OnLoad(tab_handle, url); + virtual void OnLoad(const GURL& url) { + Base::OnLoad(url); if (navigation_result()) { automation()->ForwardMessageFromExternalHost("Test", "null", "*"); } } - virtual void OnMessageFromChromeFrame(int tab_handle, - const std::string& message, + virtual void OnMessageFromChromeFrame(const std::string& message, const std::string& origin, const std::string& target) { postmessage_result_ = true; @@ -220,13 +219,13 @@ class AutomationMockHostNetworkRequestStart bool request_start_result() const { return request_start_result_; } - virtual void OnRequestStart(int tab_handle, int request_id, - const IPC::AutomationURLRequest& request) { + virtual void OnRequestStart(int request_id, + const AutomationURLRequest& request) { request_start_result_ = true; QuitMessageLoop(); } - virtual void OnLoad(int tab_handle, const GURL& url) { - Base::OnLoad(tab_handle, url); + virtual void OnLoad(const GURL& url) { + Base::OnLoad(url); } private: bool request_start_result_; diff --git a/chrome_frame/test/url_request_test.cc b/chrome_frame/test/url_request_test.cc index 95b8969..0059571 100644 --- a/chrome_frame/test/url_request_test.cc +++ b/chrome_frame/test/url_request_test.cc @@ -240,12 +240,12 @@ TEST(UrlmonUrlRequestTest, ZeroLengthResponse) { ACTION_P4(ManagerRead, loop, mgr, request_id, bytes_to_read) { loop->PostDelayedTask(FROM_HERE, NewRunnableMethod(mgr, - &UrlmonUrlRequestManager::ReadUrlRequest, 0, request_id, + &UrlmonUrlRequestManager::ReadUrlRequest, request_id, bytes_to_read), 0); } ACTION_P3(ManagerEndRequest, loop, mgr, request_id) { loop->PostDelayedTask(FROM_HERE, NewRunnableMethod(mgr, - &UrlmonUrlRequestManager::EndUrlRequest, 0, request_id, + &UrlmonUrlRequestManager::EndUrlRequest, request_id, URLRequestStatus()), 0); } @@ -260,7 +260,7 @@ TEST(UrlmonUrlRequestManagerTest, Simple1) { scoped_ptr<UrlmonUrlRequestManager> mgr(new UrlmonUrlRequestManager()); mgr->set_delegate(&mock); - IPC::AutomationURLRequest r1( + AutomationURLRequest r1( WideToUTF8(mock_server.Resolve(L"chrome_frame_window_open.html")), "get", "", "", NULL, 0, 0); @@ -278,7 +278,7 @@ TEST(UrlmonUrlRequestManagerTest, Simple1) { .Times(1) .WillOnce(QUIT_LOOP_SOON(loop, 2)); - mgr->StartUrlRequest(0, 1, r1); + mgr->StartUrlRequest(1, r1); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); mgr.reset(); } @@ -293,7 +293,7 @@ TEST(UrlmonUrlRequestManagerTest, Abort1) { scoped_ptr<UrlmonUrlRequestManager> mgr(new UrlmonUrlRequestManager()); mgr->set_delegate(&mock); - IPC::AutomationURLRequest r1( + AutomationURLRequest r1( WideToUTF8(mock_server.Resolve(L"chrome_frame_window_open.html")), "get", "", "", NULL, 0, 0); @@ -310,7 +310,7 @@ TEST(UrlmonUrlRequestManagerTest, Abort1) { EXPECT_CALL(mock, OnResponseEnd(1, testing::_)) .Times(0); - mgr->StartUrlRequest(0, 1, r1); + mgr->StartUrlRequest(1, r1); loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); mgr.reset(); } diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc index c4a1968..d191515 100644 --- a/chrome_frame/urlmon_url_request.cc +++ b/chrome_frame/urlmon_url_request.cc @@ -964,7 +964,7 @@ void UrlmonUrlRequestManager::SetInfoForUrl(const std::wstring& url, } void UrlmonUrlRequestManager::StartRequest(int request_id, - const IPC::AutomationURLRequest& request_info) { + const AutomationURLRequest& request_info) { DVLOG(1) << __FUNCTION__ << " id: " << request_id; DCHECK_EQ(0, calling_delegate_); diff --git a/chrome_frame/urlmon_url_request.h b/chrome_frame/urlmon_url_request.h index 18099fd..dcc0b7b 100644 --- a/chrome_frame/urlmon_url_request.h +++ b/chrome_frame/urlmon_url_request.h @@ -82,7 +82,7 @@ class UrlmonUrlRequestManager // PluginUrlRequestManager implementation. virtual PluginUrlRequestManager::ThreadSafeFlags GetThreadSafeFlags(); virtual void StartRequest(int request_id, - const IPC::AutomationURLRequest& request_info); + const AutomationURLRequest& request_info); virtual void ReadRequest(int request_id, int bytes_to_read); virtual void EndRequest(int request_id); virtual void DownloadRequestInHost(int request_id); diff --git a/ipc/ipc_message_impl_macros.h b/ipc/ipc_message_impl_macros.h index e04749c..8bff3ed 100644 --- a/ipc/ipc_message_impl_macros.h +++ b/ipc/ipc_message_impl_macros.h @@ -175,6 +175,16 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL0_4_EXTRA(msg_class, type1_out, type2_out, \ + type3_out, type4_out) \ + msg_class::msg_class(type1_out* arg1, type2_out* arg2, type3_out* arg3, type4_out* arg4) \ + : IPC::MessageWithReply<Tuple0, Tuple4<type1_out&, type2_out&, \ + type3_out&, type4_out&> >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeTuple(), MakeRefTuple(*arg1, *arg2, *arg3, *arg4)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + #define IPC_SYNC_MESSAGE_CONTROL1_0_EXTRA(msg_class, type1_in) \ msg_class::msg_class(const type1_in& arg1) \ @@ -212,6 +222,17 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL1_4_EXTRA(msg_class, type1_in, type1_out, \ + type2_out, type3_out, type4_out) \ + msg_class::msg_class(const type1_in& arg1, type1_out* arg2, \ + type2_out* arg3, type3_out* arg4, type4_out* arg5) \ + : IPC::MessageWithReply<Tuple1<type1_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >( \ + MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1), MakeRefTuple(*arg2, *arg3, *arg4, *arg5)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + #define IPC_SYNC_MESSAGE_CONTROL2_0_EXTRA(msg_class, type1_in, type2_in) \ msg_class::msg_class(const type1_in& arg1, const type2_in& arg2) \ : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 >( \ @@ -230,7 +251,6 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) - #define IPC_SYNC_MESSAGE_CONTROL2_2_EXTRA(msg_class, type1_in, type2_in, \ type1_out, type2_out) \ msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ @@ -241,7 +261,6 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) - #define IPC_SYNC_MESSAGE_CONTROL2_3_EXTRA(msg_class, type1_in, type2_in, \ type1_out, type2_out, type3_out) \ msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ @@ -253,6 +272,16 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL2_4_EXTRA(msg_class, type1_in, type2_in, \ + type1_out, type2_out, type3_out, type4_out) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ + type1_out* arg3, type2_out* arg4, type3_out* arg5, type4_out* arg6) \ + : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >(MSG_ROUTING_CONTROL, \ + ID, \ + MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4, *arg5, *arg6)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) #define IPC_SYNC_MESSAGE_CONTROL3_1_EXTRA(msg_class, type1_in, type2_in, \ type3_in, type1_out) \ @@ -344,6 +373,21 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL4_4_EXTRA(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type1_out, \ + type2_out, type3_out, type4_out) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ + const type3_in& arg3, const type4_in& arg4, \ + type1_out* arg5, type2_out* arg6, \ + type3_out* arg7, type4_out* arg8) \ + : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, \ + type4_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >(MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4), \ + MakeRefTuple(*arg5, *arg6, *arg7, *arg8)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + #define IPC_SYNC_MESSAGE_CONTROL5_1_EXTRA(msg_class, type1_in, type2_in, \ type3_in, type4_in, type5_in, \ type1_out) \ @@ -385,6 +429,22 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL5_4_EXTRA(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type5_in, \ + type1_out, type2_out, type3_out, \ + type4_out) \ + msg_class::msg_class(const type1_in& arg1, const type2_in& arg2, \ + const type3_in& arg3, const type4_in& arg4, \ + const type5_in& arg5, type1_out* arg6, \ + type2_out* arg7, type3_out* arg8, type4_out* arg9) \ + : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, \ + type4_in, type5_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >(MSG_ROUTING_CONTROL, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4, arg5), \ + MakeRefTuple(*arg6, *arg7, *arg8, *arg9)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + #define IPC_SYNC_MESSAGE_ROUTED0_0_EXTRA(msg_class) \ msg_class::msg_class(int routing_id) \ : IPC::MessageWithReply<Tuple0, Tuple0>( \ @@ -419,6 +479,16 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) +#define IPC_SYNC_MESSAGE_ROUTED0_4_EXTRA(msg_class, type1_out, type2_out, \ + type3_out, type4_out) \ + msg_class::msg_class(int routing_id, type1_out* arg1, type2_out* arg2, \ + type3_out* arg3, type4_out* arg4) \ + : IPC::MessageWithReply<Tuple0, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >(routing_id, ID, \ + MakeTuple(), MakeRefTuple(*arg1, *arg2, *arg3, *arg4)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + #define IPC_SYNC_MESSAGE_ROUTED1_0_EXTRA(msg_class, type1_in) \ msg_class::msg_class(int routing_id, const type1_in& arg1) \ : IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 >( \ @@ -509,6 +579,18 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) +#define IPC_SYNC_MESSAGE_ROUTED2_4_EXTRA(msg_class, type1_in, type2_in, \ + type1_out, type2_out, type3_out, \ + type4_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, type1_out* arg3, \ + type2_out* arg4, type3_out* arg5, type4_out* arg6) \ + : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4, *arg5, *arg6)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + #define IPC_SYNC_MESSAGE_ROUTED3_0_EXTRA(msg_class, type1_in, type2_in, \ type3_in) \ msg_class::msg_class(int routing_id, const type1_in& arg1, \ @@ -618,6 +700,20 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) +#define IPC_SYNC_MESSAGE_ROUTED4_4_EXTRA(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type1_out, \ + type2_out, type3_out, type4_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + const type4_in& arg4, type1_out* arg5, \ + type2_out* arg6, type3_out* arg7, type4_out* arg8) \ + : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4), \ + MakeRefTuple(*arg5, *arg6, *arg7, *arg8)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + #define IPC_SYNC_MESSAGE_ROUTED5_0_EXTRA(msg_class, type1_in, type2_in, \ type3_in, type4_in, type5_in) \ msg_class::msg_class(int routing_id, const type1_in& arg1, \ @@ -672,4 +768,20 @@ \ IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) +#define IPC_SYNC_MESSAGE_ROUTED5_4_EXTRA(msg_class, type1_in, type2_in, \ + type3_in, type4_in, type5_in, \ + type1_out, type2_out, type3_out, type4_out) \ + msg_class::msg_class(int routing_id, const type1_in& arg1, \ + const type2_in& arg2, const type3_in& arg3, \ + const type4_in& arg4, const type4_in& arg5, \ + type1_out* arg6, type2_out* arg7, \ + type3_out* arg8, type4_out* arg9) \ + : IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, \ + type4_in, type5_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >(routing_id, ID, \ + MakeRefTuple(arg1, arg2, arg3, arg4, arg5), \ + MakeRefTuple(*arg6, *arg7, *arg8, *arg9)) {} \ + \ + IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) + #endif // IPC_IPC_MESSAGE_IMPL_MACROS_H_ diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index 34fd4f4..504be00 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -120,6 +120,9 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_CONTROL0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL0_4_EXTRA(msg_class, type1_out, type2_out, type3_out, type4_out) \ + IPC_MESSAGE_LOG(msg_class) + #define IPC_SYNC_MESSAGE_CONTROL1_0_EXTRA(msg_class, type1_in) \ IPC_MESSAGE_LOG(msg_class) @@ -132,6 +135,9 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_CONTROL1_3_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL1_4_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) \ + IPC_MESSAGE_LOG(msg_class) + #define IPC_SYNC_MESSAGE_CONTROL2_0_EXTRA(msg_class, type1_in, type2_in) \ IPC_MESSAGE_LOG(msg_class) @@ -144,6 +150,9 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_CONTROL2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL2_4_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out, type4_out) \ + IPC_MESSAGE_LOG(msg_class) + #define IPC_SYNC_MESSAGE_CONTROL3_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out) \ IPC_MESSAGE_LOG(msg_class) @@ -165,6 +174,9 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_CONTROL4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL4_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out, type4_out) \ + IPC_MESSAGE_LOG(msg_class) + #define IPC_SYNC_MESSAGE_CONTROL5_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \ IPC_MESSAGE_LOG(msg_class) @@ -174,6 +186,9 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_CONTROL5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) +#define IPC_SYNC_MESSAGE_CONTROL5_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out, type4_out) \ + IPC_MESSAGE_LOG(msg_class) + #define IPC_SYNC_MESSAGE_ROUTED0_0_EXTRA(msg_class) \ IPC_MESSAGE_LOG(msg_class) @@ -186,6 +201,9 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_ROUTED0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) +#define IPC_SYNC_MESSAGE_ROUTED0_4_EXTRA(msg_class, type1_out, type2_out, type3_out, type4_out) \ + IPC_MESSAGE_LOG(msg_class) + #define IPC_SYNC_MESSAGE_ROUTED1_0_EXTRA(msg_class, type1_in) \ IPC_MESSAGE_LOG(msg_class) @@ -213,6 +231,9 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_ROUTED2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) +#define IPC_SYNC_MESSAGE_ROUTED2_4_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out, type4_out) \ + IPC_MESSAGE_LOG(msg_class) + #define IPC_SYNC_MESSAGE_ROUTED3_0_EXTRA(msg_class, type1_in, type2_in, type3_in) \ IPC_MESSAGE_LOG(msg_class) @@ -240,6 +261,10 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_ROUTED4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) + +#define IPC_SYNC_MESSAGE_ROUTED4_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out, type4_out) \ + IPC_MESSAGE_LOG(msg_class) + #define IPC_SYNC_MESSAGE_ROUTED5_0_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) \ IPC_MESSAGE_LOG(msg_class) @@ -252,6 +277,9 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_ROUTED5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) \ IPC_MESSAGE_LOG(msg_class) +#define IPC_SYNC_MESSAGE_ROUTED5_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out, type4_out) \ + IPC_MESSAGE_LOG(msg_class) + #else #define IPC_MESSAGE_CONTROL0_EXTRA(msg_class) @@ -270,14 +298,17 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_CONTROL0_1_EXTRA(msg_class, type1_out) #define IPC_SYNC_MESSAGE_CONTROL0_2_EXTRA(msg_class, type1_out, type2_out) #define IPC_SYNC_MESSAGE_CONTROL0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL0_4_EXTRA(msg_class, type1_out, type2_out, type3_out, type4_out) #define IPC_SYNC_MESSAGE_CONTROL1_0_EXTRA(msg_class, type1_in) #define IPC_SYNC_MESSAGE_CONTROL1_1_EXTRA(msg_class, type1_in, type1_out) #define IPC_SYNC_MESSAGE_CONTROL1_2_EXTRA(msg_class, type1_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_CONTROL1_3_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL1_4_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) #define IPC_SYNC_MESSAGE_CONTROL2_0_EXTRA(msg_class, type1_in, type2_in) #define IPC_SYNC_MESSAGE_CONTROL2_1_EXTRA(msg_class, type1_in, type2_in, type1_out) #define IPC_SYNC_MESSAGE_CONTROL2_2_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_CONTROL2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL2_4_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out, type4_out) #define IPC_SYNC_MESSAGE_CONTROL3_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out) #define IPC_SYNC_MESSAGE_CONTROL3_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_CONTROL3_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) @@ -285,13 +316,16 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_CONTROL4_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) #define IPC_SYNC_MESSAGE_CONTROL4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_CONTROL4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL4_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out, type4_out) #define IPC_SYNC_MESSAGE_CONTROL5_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) #define IPC_SYNC_MESSAGE_CONTROL5_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_CONTROL5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL5_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out, type4_out) #define IPC_SYNC_MESSAGE_ROUTED0_0_EXTRA(msg_class) #define IPC_SYNC_MESSAGE_ROUTED0_1_EXTRA(msg_class, type1_out) #define IPC_SYNC_MESSAGE_ROUTED0_2_EXTRA(msg_class, type1_out, type2_out) #define IPC_SYNC_MESSAGE_ROUTED0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED0_4_EXTRA(msg_class, type1_out, type2_out, type3_out, type4_out) #define IPC_SYNC_MESSAGE_ROUTED1_0_EXTRA(msg_class, type1_in) #define IPC_SYNC_MESSAGE_ROUTED1_1_EXTRA(msg_class, type1_in, type1_out) #define IPC_SYNC_MESSAGE_ROUTED1_2_EXTRA(msg_class, type1_in, type1_out, type2_out) @@ -301,6 +335,7 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_ROUTED2_1_EXTRA(msg_class, type1_in, type2_in, type1_out) #define IPC_SYNC_MESSAGE_ROUTED2_2_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_ROUTED2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED2_4_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out, type4_out) #define IPC_SYNC_MESSAGE_ROUTED3_0_EXTRA(msg_class, type1_in, type2_in, type3_in) #define IPC_SYNC_MESSAGE_ROUTED3_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out) #define IPC_SYNC_MESSAGE_ROUTED3_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) @@ -310,10 +345,12 @@ LogFunctionMap g_log_function_mapping; #define IPC_SYNC_MESSAGE_ROUTED4_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) #define IPC_SYNC_MESSAGE_ROUTED4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_ROUTED4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED4_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out, type4_out) #define IPC_SYNC_MESSAGE_ROUTED5_0_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) #define IPC_SYNC_MESSAGE_ROUTED5_1_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) #define IPC_SYNC_MESSAGE_ROUTED5_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) #define IPC_SYNC_MESSAGE_ROUTED5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED5_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type4_out) #endif @@ -500,6 +537,18 @@ LogFunctionMap g_log_function_mapping; }; \ IPC_SYNC_MESSAGE_CONTROL0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL0_4(msg_class, type1_out, type2_out, type3_out, type4_out) \ + class msg_class : \ + public IPC::MessageWithReply<Tuple0, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >{ \ + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(type1_out* arg1, type2_out* arg2, type3_out* arg3, type4_out* arg4); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL0_4_EXTRA(msg_class, type1_out, type2_out, type3_out, type4_out) + #define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \ class msg_class : \ public IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 > { \ @@ -545,6 +594,18 @@ LogFunctionMap g_log_function_mapping; }; \ IPC_SYNC_MESSAGE_CONTROL1_3_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL1_4(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) \ + class msg_class : \ + public IPC::MessageWithReply<Tuple1<type1_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >{ \ + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4, type4_out* arg5); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL1_4_EXTRA(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) + #define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \ class msg_class : \ public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 > { \ @@ -591,6 +652,18 @@ LogFunctionMap g_log_function_mapping; }; \ IPC_SYNC_MESSAGE_CONTROL2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL2_4(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out, type4_out) \ + class msg_class : \ + public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> > { \ + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4, type3_out* arg5, type4_out* arg6); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL2_4_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out, type4_out) + #define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ @@ -675,6 +748,18 @@ LogFunctionMap g_log_function_mapping; }; \ IPC_SYNC_MESSAGE_CONTROL4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_CONTROL4_4(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out, type4_out) \ + class msg_class : \ + public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> > { \ + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6, type3_out* arg7, type4_out* arg8); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL4_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out, type4_out) + #define IPC_SYNC_MESSAGE_CONTROL5_1(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \ class msg_class : \ public IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \ @@ -709,7 +794,19 @@ LogFunctionMap g_log_function_mapping; ~msg_class(); \ static void Log(std::string* name, const Message* msg, std::string* l); \ }; \ - IPC_SYNC_MESSAGE_CONTROL4_2_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) + IPC_SYNC_MESSAGE_CONTROL5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) + +#define IPC_SYNC_MESSAGE_CONTROL5_4(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out, type4_out) \ + class msg_class : \ + public IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> > { \ + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type5_in& arg5, type1_out* arg6, type2_out* arg7, type3_out* arg8, type4_out* arg9); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_CONTROL5_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out, type4_out) #define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \ class msg_class : public IPC::MessageWithReply<Tuple0, Tuple0 > { \ @@ -754,6 +851,18 @@ LogFunctionMap g_log_function_mapping; }; \ IPC_SYNC_MESSAGE_ROUTED0_3_EXTRA(msg_class, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED0_4(msg_class, type1_out, type2_out, type3_out, type4_out) \ + class msg_class : \ + public IPC::MessageWithReply<Tuple0, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> >{ \ + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, type1_out* arg1, type2_out* arg2, type3_out* arg3, type4_out* arg4); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED0_4_EXTRA(msg_class, type1_out, type2_out, type3_out, type4_out) + #define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \ class msg_class : \ public IPC::MessageWithReply<Tuple1<type1_in>, Tuple0 > { \ @@ -857,6 +966,18 @@ LogFunctionMap g_log_function_mapping; }; \ IPC_SYNC_MESSAGE_ROUTED2_3_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED2_4(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out, type4_out) \ + class msg_class : \ + public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> > { \ + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4, type3_out* arg5, type4_out* arg6); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED2_4_EXTRA(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out, type4_out) + #define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) \ class msg_class : \ public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, Tuple0 > { \ @@ -964,6 +1085,18 @@ LogFunctionMap g_log_function_mapping; }; \ IPC_SYNC_MESSAGE_ROUTED4_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED4_4(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out, type4_out) \ + class msg_class : \ + public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> > { \ + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6, type3_out* arg7, type4_out* arg8); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED4_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out, type4_out) + #define IPC_SYNC_MESSAGE_ROUTED5_0(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) \ class msg_class : \ public IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \ @@ -1012,6 +1145,18 @@ LogFunctionMap g_log_function_mapping; }; \ IPC_SYNC_MESSAGE_ROUTED5_3_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) +#define IPC_SYNC_MESSAGE_ROUTED5_4(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out, type4_out) \ + class msg_class : \ + public IPC::MessageWithReply<Tuple5<type1_in, type2_in, type3_in, type4_in, type5_in>, \ + Tuple4<type1_out&, type2_out&, type3_out&, type4_out&> > { \ + public: \ + enum { ID = (IPC_MESSAGE_START << 16) + __LINE__ }; \ + msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type4_in& arg5, type1_out* arg6, type2_out* arg7, type3_out* arg8, type4_out* arg9); \ + ~msg_class(); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + }; \ + IPC_SYNC_MESSAGE_ROUTED5_4_EXTRA(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out, type4_out) + // Message crackers and handlers. |