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 /chrome/browser | |
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
Diffstat (limited to 'chrome/browser')
14 files changed, 66 insertions, 139 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); |