diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 18:25:45 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 18:25:45 +0000 |
commit | de246f570b68acaf037db138fa871b791132ef30 (patch) | |
tree | 06b8b6d614806c47f771e76331328e5c38e9c659 /chrome/browser | |
parent | 625edd6ec115e7de3dd1e7d1e6f20f934b3cdcfe (diff) | |
download | chromium_src-de246f570b68acaf037db138fa871b791132ef30.zip chromium_src-de246f570b68acaf037db138fa871b791132ef30.tar.gz chromium_src-de246f570b68acaf037db138fa871b791132ef30.tar.bz2 |
Compile parts of chrome/browser/automation on Linux.
This patch involves heavy temporary stubbing-out of windowsic parts
of automation framework.
Review URL: http://codereview.chromium.org/28092
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10351 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 156 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 37 | ||||
-rw-r--r-- | chrome/browser/automation/automation_tab_tracker.h | 19 | ||||
-rw-r--r-- | chrome/browser/browser.scons | 2 | ||||
-rw-r--r-- | chrome/browser/browser_process_impl.h | 2 |
5 files changed, 175 insertions, 41 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index d5a13d1..38154d6 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -8,38 +8,43 @@ #include "base/path_service.h" #include "base/thread.h" #include "chrome/app/chrome_dll_resource.h" -#include "chrome/browser/app_modal_dialog_queue.h" #include "chrome/browser/automation/automation_provider_list.h" -#include "chrome/browser/automation/ui_controls.h" #include "chrome/browser/automation/url_request_failed_dns_job.h" #include "chrome/browser/automation/url_request_mock_http_job.h" #include "chrome/browser/automation/url_request_slow_download_job.h" #include "chrome/browser/browser_window.h" -#include "chrome/browser/character_encoding.h" #include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/download/download_manager.h" -#include "chrome/browser/download/save_package.h" -#include "chrome/browser/external_tab_container.h" #include "chrome/browser/find_notification_details.h" -#include "chrome/browser/login_prompt.h" -#include "chrome/browser/printing/print_job.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/ssl/ssl_manager.h" #include "chrome/browser/ssl/ssl_blocking_page.h" #include "chrome/browser/tab_contents/web_contents.h" #include "chrome/browser/tab_contents/web_contents_view.h" -#include "chrome/browser/views/bookmark_bar_view.h" -#include "chrome/browser/views/location_bar_view.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/ipc_message_utils.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/pref_service.h" -#include "chrome/views/app_modal_dialog_delegate.h" -#include "chrome/views/window.h" #include "chrome/test/automation/automation_messages.h" #include "net/base/cookie_monster.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_filter.h" +#if defined(OS_WIN) +// TODO(port): Port these headers. +#include "chrome/browser/app_modal_dialog_queue.h" +#include "chrome/browser/automation/ui_controls.h" +#include "chrome/browser/character_encoding.h" +#include "chrome/browser/download/save_package.h" +#include "chrome/browser/external_tab_container.h" +#include "chrome/browser/login_prompt.h" +#include "chrome/browser/printing/print_job.h" +#include "chrome/browser/views/bookmark_bar_view.h" +#include "chrome/browser/views/location_bar_view.h" +#include "chrome/views/app_modal_dialog_delegate.h" +#include "chrome/views/window.h" +#endif // defined(OS_WIN) + using base::Time; class InitialLoadObserver : public NotificationObserver { @@ -48,7 +53,6 @@ class InitialLoadObserver : public NotificationObserver { : automation_(automation), outstanding_tab_count_(tab_count) { if (outstanding_tab_count_ > 0) { - NotificationService* service = NotificationService::current(); registrar_.Add(this, NotificationType::LOAD_START, NotificationService::AllSources()); registrar_.Add(this, NotificationType::LOAD_STOP, @@ -286,6 +290,7 @@ class NavigationNotificationObserver : public NotificationObserver { // occur while authentication is ongoing. navigation_started_ = true; } else if (type == NotificationType::AUTH_NEEDED) { +#if defined(OS_WIN) if (navigation_started_) { // Remember the login handler that wants authentication. LoginHandler* handler = @@ -298,6 +303,10 @@ class NavigationNotificationObserver : public NotificationObserver { } else { NOTREACHED(); } +#else + // TODO(port): Enable when we have LoginNotificationDetails etc. + NOTIMPLEMENTED(); +#endif } else { NOTREACHED(); } @@ -577,6 +586,8 @@ class DomInspectorNotificationObserver : public NotificationObserver { AutomationProvider* automation_; }; +#if defined(OS_WIN) +// TODO(port): Enable when printing is ported. class DocumentPrintedNotificationObserver : public NotificationObserver { public: DocumentPrintedNotificationObserver(AutomationProvider* automation, @@ -643,6 +654,7 @@ class DocumentPrintedNotificationObserver : public NotificationObserver { bool success_; IPC::Message* reply_message_; }; +#endif // defined(OS_WIN) class AutomationInterstitialPage : public InterstitialPage { public: @@ -666,12 +678,15 @@ AutomationProvider::AutomationProvider(Profile* profile) profile_(profile), reply_message_(NULL) { browser_tracker_.reset(new AutomationBrowserTracker(this)); - window_tracker_.reset(new AutomationWindowTracker(this)); tab_tracker_.reset(new AutomationTabTracker(this)); +#if defined(OS_WIN) + // TODO(port): Enable as the trackers get ported. + window_tracker_.reset(new AutomationWindowTracker(this)); autocomplete_edit_tracker_.reset( new AutomationAutocompleteEditTracker(this)); cwindow_tracker_.reset(new AutomationConstrainedWindowTracker(this)); new_tab_ui_load_observer_.reset(new NewTabUILoadObserver(this)); +#endif // defined(OS_WIN) dom_operation_observer_.reset(new DomOperationNotificationObserver(this)); dom_inspector_observer_.reset(new DomInspectorNotificationObserver(this)); } @@ -782,13 +797,16 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(AutomationMsg_ActiveWindow, GetActiveWindow) IPC_MESSAGE_HANDLER(AutomationMsg_IsWindowActive, IsWindowActive) IPC_MESSAGE_HANDLER(AutomationMsg_ActivateWindow, ActivateWindow); +#if defined(OS_WIN) IPC_MESSAGE_HANDLER(AutomationMsg_WindowHWND, GetWindowHWND) +#endif // defined(OS_WIN) IPC_MESSAGE_HANDLER(AutomationMsg_WindowExecuteCommand, ExecuteBrowserCommand) IPC_MESSAGE_HANDLER(AutomationMsg_WindowViewBounds, WindowGetViewBounds) IPC_MESSAGE_HANDLER(AutomationMsg_SetWindowVisible, SetWindowVisible) +#if defined(OS_WIN) IPC_MESSAGE_HANDLER(AutomationMsg_WindowClick, WindowSimulateClick) IPC_MESSAGE_HANDLER(AutomationMsg_WindowKeyPress, WindowSimulateKeyPress) @@ -797,6 +815,7 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(AutomationMsg_TabCount, GetTabCount) IPC_MESSAGE_HANDLER(AutomationMsg_Tab, GetTab) IPC_MESSAGE_HANDLER(AutomationMsg_TabHWND, GetTabHWND) +#endif // defined(OS_WIN) IPC_MESSAGE_HANDLER(AutomationMsg_TabProcessID, GetTabProcessID) IPC_MESSAGE_HANDLER(AutomationMsg_TabTitle, GetTabTitle) IPC_MESSAGE_HANDLER(AutomationMsg_TabURL, GetTabURL) @@ -831,6 +850,7 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { GetAutocompleteEditForBrowser); IPC_MESSAGE_HANDLER(AutomationMsg_BrowserForWindow, GetBrowserForWindow); +#if defined(OS_WIN) IPC_MESSAGE_HANDLER(AutomationMsg_CreateExternalTab, CreateExternalTab) IPC_MESSAGE_HANDLER(AutomationMsg_NavigateInExternalTab, NavigateInExternalTab) @@ -846,6 +866,7 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { WaitForTabToBeRestored) IPC_MESSAGE_HANDLER(AutomationMsg_SetInitialFocus, SetInitialFocus) +#endif // defined(OS_WIN) IPC_MESSAGE_HANDLER(AutomationMsg_GetSecurityState, GetSecurityState) IPC_MESSAGE_HANDLER(AutomationMsg_GetPageType, @@ -951,9 +972,6 @@ void AutomationProvider::AppendTab(int handle, const GURL& url, void AutomationProvider::NavigateToURL(int handle, const GURL& url, IPC::Message* reply_message) { - AutomationMsg_NavigationResponseValues status = - AUTOMATION_MSG_NAVIGATION_ERROR; - if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); @@ -1075,6 +1093,7 @@ void AutomationProvider::SetAuth(int tab_handle, status = 0; } } + if (status < 0) { AutomationMsg_SetAuth::WriteReplyParams(reply_message, status); Send(reply_message); @@ -1097,6 +1116,7 @@ void AutomationProvider::CancelAuth(int tab_handle, status = 0; } } + if (status < 0) { AutomationMsg_CancelAuth::WriteReplyParams(reply_message, status); Send(reply_message); @@ -1160,6 +1180,8 @@ void AutomationProvider::GetBrowserWindowCount(int* window_count) { *window_count = static_cast<int>(BrowserList::size()); } +#if defined(OS_WIN) +// TODO(port): Enable when dialog delegate is ported. void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, int* dialog_button) { views::AppModalDialogDelegate* dialog_delegate = @@ -1193,6 +1215,7 @@ void AutomationProvider::ClickAppModalDialogButton(int button, bool* success) { } } } +#endif void AutomationProvider::GetBrowserWindow(int index, int* handle) { *handle = 0; @@ -1213,6 +1236,8 @@ void AutomationProvider::GetLastActiveBrowserWindow(int* handle) { *handle = browser_tracker_->Add(browser); } +#if defined(OS_WIN) +// TODO(port): Remove windowsisms. BOOL CALLBACK EnumThreadWndProc(HWND hwnd, LPARAM l_param) { if (hwnd == reinterpret_cast<HWND>(l_param)) { return FALSE; @@ -1239,6 +1264,7 @@ void AutomationProvider::GetActiveWindow(int* handle) { void AutomationProvider::GetWindowHWND(int handle, HWND* win32_handle) { *win32_handle = window_tracker_->GetResource(handle); } +#endif // defined(OS_WIN) void AutomationProvider::ExecuteBrowserCommand(int handle, int command, bool* success) { @@ -1259,6 +1285,7 @@ void AutomationProvider::WindowGetViewBounds(int handle, int view_id, gfx::Rect* bounds) { *success = false; +#if defined(OS_WIN) void* iter = NULL; if (window_tracker_->ContainsHandle(handle)) { HWND hwnd = window_tracker_->GetResource(handle); @@ -1277,8 +1304,15 @@ void AutomationProvider::WindowGetViewBounds(int handle, int view_id, } } } +#else + // TODO(port): Enable when window_tracker is ported. + NOTIMPLEMENTED(); +#endif } +#if defined(OS_WIN) +// TODO(port): Use portable replacement for POINT. + // This task enqueues a mouse event on the event loop, so that the view // that it's being sent to can do the requisite post-processing. class MouseEventTask : public Task { @@ -1335,6 +1369,7 @@ void AutomationProvider::ScheduleMouseEvent(views::View* view, MessageLoop::current()->PostTask(FROM_HERE, new MouseEventTask(view, type, point, flags)); } +#endif // defined(OS_WIN) // This task just adds another task to the event queue. This is useful if // you want to ensure that any tasks added to the event queue after this one @@ -1354,6 +1389,9 @@ class InvokeTaskLaterTask : public Task { DISALLOW_COPY_AND_ASSIGN(InvokeTaskLaterTask); }; +#if defined(OS_WIN) +// TODO(port): Replace POINT and other windowsisms. + // This task sends a WindowDragResponse message with the appropriate // routing ID to the automation proxy. This is implemented as a task so that // we know that the mouse events (and any tasks that they spawn on the message @@ -1541,6 +1579,7 @@ void AutomationProvider::ActivateWindow(int handle) { ::SetActiveWindow(window_tracker_->GetResource(handle)); } } +#endif // defined(OS_WIN) void AutomationProvider::GetTabCount(int handle, int* tab_count) { *tab_count = -1; // -1 is the error code @@ -1553,7 +1592,6 @@ void AutomationProvider::GetTabCount(int handle, int* tab_count) { void AutomationProvider::GetTab(int win_handle, int tab_index, int* tab_handle) { - void* iter = NULL; *tab_handle = 0; if (browser_tracker_->ContainsHandle(win_handle) && (tab_index >= 0)) { Browser* browser = browser_tracker_->GetResource(win_handle); @@ -1576,9 +1614,14 @@ void AutomationProvider::GetTabTitle(int handle, int* title_string_size, } void AutomationProvider::HandleUnused(const IPC::Message& message, int handle) { +#if defined(OS_WIN) if (window_tracker_->ContainsHandle(handle)) { window_tracker_->Remove(window_tracker_->GetResource(handle)); } +#else + // TODO(port): Enable when window_tracker is ported. + NOTIMPLEMENTED(); +#endif } void AutomationProvider::OnChannelError() { @@ -1662,6 +1705,7 @@ void AutomationProvider::GetTabURL(int handle, bool* success, GURL* url) { } } +#if defined(OS_WIN) void AutomationProvider::GetTabHWND(int handle, HWND* tab_hwnd) { *tab_hwnd = NULL; @@ -1670,6 +1714,7 @@ void AutomationProvider::GetTabHWND(int handle, HWND* tab_hwnd) { *tab_hwnd = tab->active_contents()->GetNativeView(); } } +#endif // defined(OS_WIN) void AutomationProvider::GetTabProcessID(int handle, int* process_id) { *process_id = -1; @@ -1727,9 +1772,14 @@ void AutomationProvider::ExecuteJavascript(int handle, void AutomationProvider::GetShelfVisibility(int handle, bool* visible) { *visible = false; +#if defined(OS_WIN) WebContents* web_contents = GetWebContentsForHandle(handle, NULL); if (web_contents) *visible = web_contents->IsDownloadShelfVisible(); +#else + // TODO(port): Enable when web_contents->IsDownloadShelfVisible is ported. + NOTIMPLEMENTED(); +#endif } void AutomationProvider::GetConstrainedWindowCount(int handle, int* count) { @@ -1751,8 +1801,13 @@ void AutomationProvider::GetConstrainedWindow(int handle, int index, tab_tracker_->GetResource(handle); TabContents* tab = nav_controller->active_contents(); if (tab && index < static_cast<int>(tab->child_windows_.size())) { +#if defined(OS_WIN) ConstrainedWindow* window = tab->child_windows_[index]; *cwindow_handle = cwindow_tracker_->Add(window); +#else + // TODO(port): Enable when cwindow_tracker is ported. + NOTIMPLEMENTED(); +#endif } } } @@ -1761,16 +1816,22 @@ void AutomationProvider::GetConstrainedTitle(int handle, int* title_string_size, std::wstring* title) { *title_string_size = -1; // -1 is the error code +#if defined(OS_WIN) if (cwindow_tracker_->ContainsHandle(handle)) { ConstrainedWindow* window = cwindow_tracker_->GetResource(handle); *title = window->GetWindowTitle(); *title_string_size = static_cast<int>(title->size()); } +#else + // TODO(port): Enable when cwindow_tracker is ported. + NOTIMPLEMENTED(); +#endif } void AutomationProvider::GetConstrainedWindowBounds(int handle, bool* exists, gfx::Rect* rect) { *rect = gfx::Rect(0, 0, 0, 0); +#if defined(OS_WIN) if (cwindow_tracker_->ContainsHandle(handle)) { ConstrainedWindow* window = cwindow_tracker_->GetResource(handle); if (window) { @@ -1778,6 +1839,10 @@ void AutomationProvider::GetConstrainedWindowBounds(int handle, bool* exists, *rect = window->GetCurrentBounds(); } } +#else + // TODO(port): Enable when cwindow_tracker is ported. + NOTIMPLEMENTED(); +#endif } void AutomationProvider::HandleFindInPageRequest( @@ -1820,8 +1885,13 @@ void AutomationProvider::HandleFindRequest(int handle, void AutomationProvider::HandleOpenFindInPageRequest( const IPC::Message& message, int handle) { if (browser_tracker_->ContainsHandle(handle)) { +#if defined(OS_WIN) Browser* browser = browser_tracker_->GetResource(handle); browser->FindInPage(false, false); +#else + // TODO(port): Enable when Browser::FindInPage is ported. + NOTIMPLEMENTED(); +#endif } } @@ -1829,16 +1899,22 @@ void AutomationProvider::GetFindWindowVisibility(int handle, bool* visible) { gfx::Point position; *visible = false; if (browser_tracker_->ContainsHandle(handle)) { +#if defined(OS_WIN) Browser* browser = browser_tracker_->GetResource(handle); BrowserWindowTesting* testing = browser->window()->GetBrowserWindowTesting(); testing->GetFindBarWindowInfo(&position, visible); +#else + // TODO(port): Depends on BrowserWindowTesting::GetFindBarWindowInfo. + NOTIMPLEMENTED(); +#endif } } void AutomationProvider::HandleFindWindowLocationRequest(int handle, int* x, int* y) { gfx::Point position(0, 0); +#if defined(OS_WIN) bool visible = false; if (browser_tracker_->ContainsHandle(handle)) { Browser* browser = browser_tracker_->GetResource(handle); @@ -1846,6 +1922,10 @@ void AutomationProvider::HandleFindWindowLocationRequest(int handle, int* x, browser->window()->GetBrowserWindowTesting(); testing->GetFindBarWindowInfo(&position, &visible); } +#else + // TODO(port): Depends on BrowserWindowTesting::GetFindBarWindowInfo. + NOTIMPLEMENTED(); +#endif *x = position.x(); *y = position.y(); @@ -1856,7 +1936,7 @@ void AutomationProvider::GetBookmarkBarVisibility(int handle, bool* visible, *visible = false; *animating = false; - void* iter = NULL; +#if defined(OS_WIN) if (browser_tracker_->ContainsHandle(handle)) { Browser* browser = browser_tracker_->GetResource(handle); if (browser) { @@ -1869,6 +1949,10 @@ void AutomationProvider::GetBookmarkBarVisibility(int handle, bool* visible, } } } +#else + // TODO(port): Enable when bookmarks ui is ported. + NOTIMPLEMENTED(); +#endif } void AutomationProvider::HandleInspectElementRequest( @@ -1937,6 +2021,8 @@ void AutomationProvider::GetDownloadDirectory( } } +#if defined(OS_WIN) +// TODO(port): Remove windowsisms. void AutomationProvider::OpenNewBrowserWindow(int show_command) { // We may have no current browser windows open so don't rely on // asking an existing browser to execute the IDC_NEWWINDOW command @@ -2004,6 +2090,7 @@ void AutomationProvider::GetBrowserForWindow(int window_handle, } } } +#endif // defined(OS_WIN) void AutomationProvider::ShowInterstitialPage(int tab_handle, const std::string& html_text, @@ -2046,14 +2133,14 @@ void AutomationProvider::CloseTab(int tab_handle, int index; Browser* browser = Browser::GetBrowserForController(controller, &index); DCHECK(browser); - TabClosedNotificationObserver* observer = - new TabClosedNotificationObserver(browser, this, - reply_message->routing_id(), - wait_until_closed, reply_message); + new TabClosedNotificationObserver(browser, this, + reply_message->routing_id(), + wait_until_closed, reply_message); browser->CloseContents(controller->active_contents()); - } else { - AutomationMsg_CloseTab::WriteReplyParams(reply_message, false); + return; } + + AutomationMsg_CloseTab::WriteReplyParams(reply_message, false); } void AutomationProvider::CloseBrowser(int browser_handle, @@ -2078,6 +2165,8 @@ void AutomationProvider::CloseBrowserAsync(int browser_handle) { } } +#if defined(OS_WIN) +// TODO(port): Remove windowsisms. void AutomationProvider::CreateExternalTab(HWND parent, const gfx::Rect& dimensions, unsigned int style, @@ -2218,6 +2307,7 @@ void AutomationProvider::ActionOnSSLBlockingPage(int handle, bool proceed, false); Send(reply_message); } +#endif // defined(OS_WIN) void AutomationProvider::BringBrowserToFront(int browser_handle, bool* success) { @@ -2242,6 +2332,8 @@ void AutomationProvider::IsPageMenuCommandEnabled(int browser_handle, } } +#if defined(OS_WIN) +// TODO(port): Enable these. void AutomationProvider::PrintNow(int tab_handle, IPC::Message* reply_message) { NavigationController* tab = NULL; @@ -2399,6 +2491,7 @@ ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { return NULL; } +#endif // defined(OS_WIN) TestingAutomationProvider::TestingAutomationProvider(Profile* profile) : AutomationProvider(profile) { @@ -2450,11 +2543,16 @@ void TestingAutomationProvider::OnRemoveProvider() { void AutomationProvider::GetSSLInfoBarCount(int handle, int* count) { *count = -1; // -1 means error. +#if defined(OS_WIN) if (tab_tracker_->ContainsHandle(handle)) { NavigationController* nav_controller = tab_tracker_->GetResource(handle); if (nav_controller) *count = nav_controller->active_contents()->infobar_delegate_count(); } +#else + // TODO(port): Enable when TabContents infobar related stuff is ported. + NOTIMPLEMENTED(); +#endif } void AutomationProvider::ClickSSLInfoBarLink(int handle, @@ -2462,6 +2560,7 @@ void AutomationProvider::ClickSSLInfoBarLink(int handle, bool wait_for_navigation, IPC::Message* reply_message) { bool success = false; +#if defined(OS_WIN) if (tab_tracker_->ContainsHandle(handle)) { NavigationController* nav_controller = tab_tracker_->GetResource(handle); if (nav_controller) { @@ -2480,6 +2579,10 @@ void AutomationProvider::ClickSSLInfoBarLink(int handle, } } } +#else + // TODO(port): Enable when TabContents infobar related stuff is ported. + NOTIMPLEMENTED(); +#endif if (!wait_for_navigation || !success) AutomationMsg_ClickSSLInfoBarLink::WriteReplyParams(reply_message, success); @@ -2579,6 +2682,7 @@ void AutomationProvider::OverrideEncoding(int tab_handle, const std::wstring& encoding_name, bool* success) { *success = false; +#if defined(OS_WIN) if (tab_tracker_->ContainsHandle(tab_handle)) { NavigationController* nav = tab_tracker_->GetResource(tab_handle); Browser* browser = FindAndActivateTab(nav); @@ -2595,6 +2699,10 @@ void AutomationProvider::OverrideEncoding(int tab_handle, } } } +#else + // TODO(port): Enable when encoding-related parts of Browser are ported. + NOTIMPLEMENTED(); +#endif } void AutomationProvider::SavePackageShouldPromptUser(bool should_prompt) { diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index a310d8e..17f4a40 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -15,11 +15,9 @@ #include <string> #include <vector> +#include "base/basictypes.h" #include "chrome/browser/automation/automation_browser_tracker.h" -#include "chrome/browser/automation/automation_constrained_window_tracker.h" #include "chrome/browser/automation/automation_tab_tracker.h" -#include "chrome/browser/automation/automation_window_tracker.h" -#include "chrome/browser/automation/automation_autocomplete_edit_tracker.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/history/history.h" #include "chrome/browser/tab_contents/navigation_entry.h" @@ -29,10 +27,17 @@ #include "chrome/views/event.h" #include "webkit/glue/find_in_page_request.h" +#if defined(OS_WIN) +// TODO(port): enable these. +#include "chrome/browser/automation/automation_autocomplete_edit_tracker.h" +#include "chrome/browser/automation/automation_constrained_window_tracker.h" +#include "chrome/browser/automation/automation_window_tracker.h" +enum AutomationMsg_NavigationResponseValues; +#endif + class LoginHandler; class NavigationControllerRestoredObserver; class ExternalTabContainer; -enum AutomationMsg_NavigationResponseValues; struct AutocompleteMatchData; class AutomationProvider : public base::RefCounted<AutomationProvider>, @@ -64,7 +69,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, // to the IPC message. template<class NavigationCodeType> NotificationObserver* AddNavigationStatusListener( - NavigationController* tab, IPC::Message* reply_message, + NavigationController* tab, IPC::Message* reply_message, NavigationCodeType success_code, NavigationCodeType auth_needed_code, NavigationCodeType failed_code); @@ -105,7 +110,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, void ReceivedInspectElementResponse(int num_resources); IPC::Message* reply_message_release() { - IPC::Message* reply_message = reply_message_; + IPC::Message* reply_message = reply_message_; reply_message_ = NULL; return reply_message; } @@ -132,10 +137,15 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, void GetBrowserWindow(int index, int* handle); void GetLastActiveBrowserWindow(int* handle); void GetActiveWindow(int* handle); +#if defined(OS_WIN) + // TODO(port): Replace HWND. void GetWindowHWND(int handle, HWND* win32_handle); +#endif // defined(OS_WIN) void ExecuteBrowserCommand(int handle, int command, bool* success); void WindowGetViewBounds(int handle, int view_id, bool screen_coordinates, bool* success, gfx::Rect* bounds); +#if defined(OS_WIN) + // TODO(port): Replace POINT. void WindowSimulateDrag(int handle, std::vector<POINT> drag_path, int flags, @@ -145,6 +155,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, int handle, POINT click, int flags); +#endif // defined(OS_WIN) void WindowSimulateKeyPress(const IPC::Message& message, int handle, wchar_t key, @@ -155,7 +166,10 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, void GetTabCount(int handle, int* tab_count); void GetTab(int win_handle, int tab_index, int* tab_handle); +#if defined(OS_WIN) + // TODO(port): Replace HWND. void GetTabHWND(int handle, HWND* tab_hwnd); +#endif // defined(OS_WIN) void GetTabProcessID(int handle, int* process_id); void GetTabTitle(int handle, int* title_string_size, std::wstring* title); void GetTabURL(int handle, bool* success, GURL* url); @@ -179,10 +193,13 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, void GetShelfVisibility(int handle, bool* visible); void SetFilteredInet(const IPC::Message& message, bool enabled); +#if defined(OS_WIN) + // TODO(port): Replace POINT. void ScheduleMouseEvent(views::View* view, views::Event::EventType type, POINT point, int flags); +#endif // defined(OS_WIN) void GetFocusedViewID(int handle, int* view_id); // Helper function to find the browser window that contains a given @@ -254,6 +271,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, IPC::Message* reply_message); void HideInterstitialPage(int tab_handle, bool* success); +#if defined(OS_WIN) + // TODO(port): Re-enable. void CreateExternalTab(HWND parent, const gfx::Rect& dimensions, unsigned int style, HWND* tab_container_window, int* tab_handle); @@ -276,6 +295,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, // Chrome. void SetAcceleratorsForTab(int handle, HACCEL accel_table, int accel_entry_count, bool* status); +#endif // defined(OS_WIN) // Gets the security state for the tab associated to the specified |handle|. void GetSecurityState(int handle, bool* success, @@ -412,11 +432,14 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, scoped_ptr<NotificationObserver> find_in_page_observer_; scoped_ptr<NotificationObserver> dom_operation_observer_; scoped_ptr<NotificationObserver> dom_inspector_observer_; + scoped_ptr<AutomationBrowserTracker> browser_tracker_; scoped_ptr<AutomationTabTracker> tab_tracker_; +#if defined(OS_WIN) + // TODO(port): Enable as trackers get ported. scoped_ptr<AutomationConstrainedWindowTracker> cwindow_tracker_; scoped_ptr<AutomationWindowTracker> window_tracker_; - scoped_ptr<AutomationBrowserTracker> browser_tracker_; scoped_ptr<AutomationAutocompleteEditTracker> autocomplete_edit_tracker_; +#endif scoped_ptr<NavigationControllerRestoredObserver> restore_tracker_; LoginHandlerMap login_handler_map_; NotificationObserverList notification_observer_list_; diff --git a/chrome/browser/automation/automation_tab_tracker.h b/chrome/browser/automation/automation_tab_tracker.h index d119915..70172ec 100644 --- a/chrome/browser/automation/automation_tab_tracker.h +++ b/chrome/browser/automation/automation_tab_tracker.h @@ -16,7 +16,7 @@ class AutomationTabTracker : public AutomationResourceTracker<NavigationController*> { public: AutomationTabTracker(IPC::Message::Sender* automation) - : AutomationResourceTracker(automation) {} + : AutomationResourceTracker<NavigationController*>(automation) {} virtual ~AutomationTabTracker() { ClearAllMappings(); @@ -54,14 +54,19 @@ public: return; case NotificationType::EXTERNAL_TAB_CLOSED: case NotificationType::TAB_CLOSING: - std::map<NavigationController*, base::Time>::iterator iter = - last_navigation_times_.find( - Source<NavigationController>(source).ptr()); - if (iter != last_navigation_times_.end()) - last_navigation_times_.erase(iter); + { + std::map<NavigationController*, base::Time>::iterator iter = + last_navigation_times_.find( + Source<NavigationController>(source).ptr()); + if (iter != last_navigation_times_.end()) + last_navigation_times_.erase(iter); + } break; + default: + NOTREACHED(); } - AutomationResourceTracker::Observe(type, source, details); + AutomationResourceTracker<NavigationController*>::Observe(type, source, + details); } base::Time GetLastNavigationTime(int handle) { diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons index e0b346c..5a5f0b4 100644 --- a/chrome/browser/browser.scons +++ b/chrome/browser/browser.scons @@ -665,8 +665,6 @@ if not env.Bit('windows'): 'autocomplete/autocomplete_edit.cc', 'autocomplete/autocomplete_popup.cc', 'autocomplete/edit_drop_target.cc', - 'automation/automation_provider.cc', - 'automation/automation_provider_list.cc', 'automation/ui_controls.cc', 'browser_accessibility.cc', 'browser_accessibility_manager.cc', diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index 07b09c4..a2edeac 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -18,10 +18,10 @@ #include "base/non_thread_safe.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "chrome/browser/automation/automation_provider_list.h" #include "chrome/browser/browser_process.h" #if defined(OS_WIN) -#include "chrome/browser/automation/automation_provider_list.h" #include "sandbox/src/sandbox.h" #else #include "chrome/common/temp_scaffolding_stubs.h" |