summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-17 20:35:54 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-17 20:35:54 +0000
commit2fcae57e6d6d61386703db3dad8eccbe6eef4ac3 (patch)
tree9296efce68b6feb2694f26cd5ac0901fcb9fae35 /chrome_frame
parent41c5b197b8f2f2a3293319ec7ccb4a36ef7a7b3e (diff)
downloadchromium_src-2fcae57e6d6d61386703db3dad8eccbe6eef4ac3.zip
chromium_src-2fcae57e6d6d61386703db3dad8eccbe6eef4ac3.tar.gz
chromium_src-2fcae57e6d6d61386703db3dad8eccbe6eef4ac3.tar.bz2
Remove the automation code for ChromeFrame since it's not used anymore.
This allows us to more clearly see which automation calls are left, since that code is also deprecated and will be removed in Q1. BUG=316496,316203 R=ananta@chromium.org Review URL: https://codereview.chromium.org/117033002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241349 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/chrome_active_document.cc281
-rw-r--r--chrome_frame/chrome_active_document.h28
-rw-r--r--chrome_frame/chrome_frame.gyp1
-rw-r--r--chrome_frame/chrome_frame_activex.cc164
-rw-r--r--chrome_frame/chrome_frame_activex.h9
-rw-r--r--chrome_frame/chrome_frame_activex_base.h245
-rw-r--r--chrome_frame/chrome_frame_automation.cc336
-rw-r--r--chrome_frame/chrome_frame_automation.h47
-rw-r--r--chrome_frame/chrome_frame_delegate.cc39
-rw-r--r--chrome_frame/chrome_frame_delegate.h30
-rw-r--r--chrome_frame/chrome_frame_plugin.cc14
-rw-r--r--chrome_frame/chrome_frame_plugin.h84
-rw-r--r--chrome_frame/custom_sync_call_context.cc15
-rw-r--r--chrome_frame/custom_sync_call_context.h15
-rw-r--r--chrome_frame/delete_chrome_history.cc3
-rw-r--r--chrome_frame/plugin_url_request.h5
-rw-r--r--chrome_frame/test/automation_client_mock.cc299
-rw-r--r--chrome_frame/test/automation_client_mock.h16
-rw-r--r--chrome_frame/test/chrome_frame_automation_mock.cc43
-rw-r--r--chrome_frame/test/chrome_frame_automation_mock.h79
-rw-r--r--chrome_frame/test/net/test_automation_provider.cc13
-rw-r--r--chrome_frame/test/net/test_automation_provider.h1
-rw-r--r--chrome_frame/urlmon_url_request.cc44
-rw-r--r--chrome_frame/urlmon_url_request.h4
-rw-r--r--chrome_frame/utils.cc66
-rw-r--r--chrome_frame/utils.h10
26 files changed, 3 insertions, 1888 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc
index 03b2e31..6557a1f 100644
--- a/chrome_frame/chrome_active_document.cc
+++ b/chrome_frame/chrome_active_document.cc
@@ -182,7 +182,6 @@ STDMETHODIMP ChromeActiveDocument::IsDirty() {
void ChromeActiveDocument::OnAutomationServerReady() {
BaseActiveX::OnAutomationServerReady();
- BaseActiveX::GiveFocusToChrome(true);
}
STDMETHODIMP ChromeActiveDocument::Load(BOOL fully_avalable,
@@ -426,13 +425,6 @@ STDMETHODIMP ChromeActiveDocument::SaveHistory(IStream* stream) {
}
STDMETHODIMP ChromeActiveDocument::SetPositionCookie(DWORD position_cookie) {
- if (automation_client_.get()) {
- int index = static_cast<int>(position_cookie);
- navigation_info_->navigation_index = index;
- automation_client_->NavigateToIndex(index);
- } else {
- DLOG(WARNING) << "Invalid automation client instance";
- }
return S_OK;
}
@@ -598,26 +590,6 @@ HRESULT ChromeActiveDocument::ActiveXDocActivate(LONG verb) {
return S_OK;
}
-void ChromeActiveDocument::OnNavigationStateChanged(
- int flags, const NavigationInfo& nav_info) {
- // TODO(joshia): handle INVALIDATE_TYPE_TAB,INVALIDATE_TYPE_LOAD etc.
- DVLOG(1) << __FUNCTION__
- << "\n Flags: " << flags
- << ", Url: " << nav_info.url
- << ", Title: " << nav_info.title
- << ", Type: " << nav_info.navigation_type
- << ", Relative Offset: " << nav_info.relative_offset
- << ", Index: " << nav_info.navigation_index;
-
- UpdateNavigationState(nav_info, flags);
-}
-
-void ChromeActiveDocument::OnUpdateTargetUrl(
- const std::wstring& new_target_url) {
- if (in_place_frame_)
- in_place_frame_->SetStatusText(new_target_url.c_str());
-}
-
bool IsFindAccelerator(const MSG& msg) {
// TODO(robertshield): This may not stand up to localization. Fix if this
// is the case.
@@ -626,62 +598,6 @@ bool IsFindAccelerator(const MSG& msg) {
!(base::win::IsAltPressed() || base::win::IsShiftPressed());
}
-void ChromeActiveDocument::OnAcceleratorPressed(const MSG& accel_message) {
- if (::TranslateAccelerator(m_hWnd, accelerator_table_,
- const_cast<MSG*>(&accel_message)))
- return;
-
- bool handled_accel = false;
- if (in_place_frame_ != NULL) {
- handled_accel = (S_OK == in_place_frame_->TranslateAcceleratorW(
- const_cast<MSG*>(&accel_message), 0));
- }
-
- if (!handled_accel) {
- if (IsFindAccelerator(accel_message)) {
- // Handle the showing of the find dialog explicitly.
- OnFindInPage();
- } else {
- BaseActiveX::OnAcceleratorPressed(accel_message);
- }
- } else {
- DVLOG(1) << "IE handled accel key " << accel_message.wParam;
- }
-}
-
-void ChromeActiveDocument::OnTabbedOut(bool reverse) {
- DVLOG(1) << __FUNCTION__;
- if (in_place_frame_) {
- MSG msg = { NULL, WM_KEYDOWN, VK_TAB };
- in_place_frame_->TranslateAcceleratorW(&msg, 0);
- }
-}
-
-void ChromeActiveDocument::OnDidNavigate(const NavigationInfo& nav_info) {
- DVLOG(1) << __FUNCTION__ << std::endl
- << "Url: " << nav_info.url
- << ", Title: " << nav_info.title
- << ", Type: " << nav_info.navigation_type
- << ", Relative Offset: " << nav_info.relative_offset
- << ", Index: " << nav_info.navigation_index;
-
- CrashMetricsReporter::GetInstance()->IncrementMetric(
- CrashMetricsReporter::CHROME_FRAME_NAVIGATION_COUNT);
-
- UpdateNavigationState(nav_info, 0);
-}
-
-void ChromeActiveDocument::OnCloseTab() {
- // Base class will fire DIChromeFrameEvents::onclose.
- BaseActiveX::OnCloseTab();
-
- // Close the container window.
- base::win::ScopedComPtr<IWebBrowser2> web_browser2;
- DoQueryService(SID_SWebBrowserApp, m_spClientSite, web_browser2.Receive());
- if (web_browser2)
- web_browser2->Quit();
-}
-
void ChromeActiveDocument::UpdateNavigationState(
const NavigationInfo& new_navigation_info, int flags) {
// This could be NULL if the active document instance is being destroyed.
@@ -905,102 +821,6 @@ void ChromeActiveDocument::OnGetZoomRange(const GUID* cmd_group_guid,
}
}
-void ChromeActiveDocument::OnSetZoomRange(const GUID* cmd_group_guid,
- DWORD command_id,
- DWORD cmd_exec_opt,
- VARIANT* in_args,
- VARIANT* out_args) {
- const int kZoomIn = 125;
- const int kZoomOut = 75;
-
- if (in_args && V_VT(in_args) == VT_I4 && IsValid()) {
- if (in_args->lVal == kZoomIn) {
- automation_client_->SetZoomLevel(content::PAGE_ZOOM_IN);
- } else if (in_args->lVal == kZoomOut) {
- automation_client_->SetZoomLevel(content::PAGE_ZOOM_OUT);
- } else {
- DLOG(WARNING) << "Unsupported zoom level:" << in_args->lVal;
- }
- }
-}
-
-void ChromeActiveDocument::OnUnload(const GUID* cmd_group_guid,
- DWORD command_id,
- DWORD cmd_exec_opt,
- VARIANT* in_args,
- VARIANT* out_args) {
- if (IsValid() && out_args) {
- // If the navigation is attempted to the url loaded in CF, with the only
- // difference being the addition of an anchor, IE will attempt to unload
- // the currently loaded document which basically would end up running
- // unload handlers on the currently loaded document thus rendering it non
- // functional. We handle this as below:-
- // The BHO receives the new url in the BeforeNavigate event.
- // We compare the non anchor portions of the url in the BHO with the loaded
- // url and if they match, we initiate a Chrome navigation to the url with
- // the anchor which works nicely.
- // We don't want to continue processing the unload in this case.
- // Note:-
- // IE handles these navigations by querying the loaded document for
- // IHTMLDocument which then handles the new navigation. That won't work for
- // us as we don't implement IHTMLDocument.
- NavigationManager* mgr = NavigationManager::GetThreadInstance();
- DLOG_IF(ERROR, !mgr) << "Couldn't get instance of NavigationManager";
- if (mgr) {
- ChromeFrameUrl url;
- url.Parse(mgr->url());
- if (url.gurl().has_ref()) {
- url_canon::Replacements<char> replacements;
- replacements.ClearRef();
-
- if (url.gurl().ReplaceComponents(replacements) ==
- GURL(static_cast<BSTR>(url_))) {
- // We want to reuse the existing automation client and channel for
- // initiating the new navigation. Setting the
- // is_automation_client_reused_ flag to true before calling the
- // LaunchUrl function achieves that.
- is_automation_client_reused_ = true;
- LaunchUrl(url, mgr->referrer());
- out_args->vt = VT_BOOL;
- out_args->boolVal = VARIANT_FALSE;
- return;
- }
- }
- }
- bool should_unload = true;
- automation_client_->OnUnload(&should_unload);
- out_args->vt = VT_BOOL;
- out_args->boolVal = should_unload ? VARIANT_TRUE : VARIANT_FALSE;
- }
-}
-
-void ChromeActiveDocument::OnAttachExternalTab(
- const AttachExternalTabParams& params) {
- if (!automation_client_.get()) {
- DLOG(WARNING) << "Invalid automation client instance";
- return;
- }
- DWORD flags = 0;
- if (params.user_gesture)
- flags = NWMF_USERREQUESTED;
- else if (popup_allowed_)
- flags = NWMF_USERALLOWED;
-
- HRESULT hr = S_OK;
- if (popup_manager_) {
- const std::wstring& url_wide = UTF8ToWide(params.url.spec());
- hr = popup_manager_->EvaluateNewWindow(url_wide.c_str(), NULL, url_,
- NULL, FALSE, flags, 0);
- }
- // Allow popup
- if (hr == S_OK) {
- BaseActiveX::OnAttachExternalTab(params);
- return;
- }
-
- automation_client_->BlockExternalTab(params.cookie);
-}
-
bool ChromeActiveDocument::PreProcessContextMenu(HMENU menu) {
base::win::ScopedComPtr<IBrowserService> browser_service;
base::win::ScopedComPtr<ITravelLog> travel_log;
@@ -1021,23 +841,6 @@ bool ChromeActiveDocument::PreProcessContextMenu(HMENU menu) {
return BaseActiveX::PreProcessContextMenu(menu);
}
-bool ChromeActiveDocument::HandleContextMenuCommand(
- UINT cmd, const MiniContextMenuParams& params) {
- base::win::ScopedComPtr<IWebBrowser2> web_browser2;
- DoQueryService(SID_SWebBrowserApp, m_spClientSite, web_browser2.Receive());
-
- if (cmd == IDC_BACK)
- web_browser2->GoBack();
- else if (cmd == IDC_FORWARD)
- web_browser2->GoForward();
- else if (cmd == IDC_RELOAD)
- web_browser2->Refresh();
- else
- return BaseActiveX::HandleContextMenuCommand(cmd, params);
-
- return true;
-}
-
HRESULT ChromeActiveDocument::IEExec(const GUID* cmd_group_guid,
DWORD command_id, DWORD cmd_exec_opt,
VARIANT* in_args, VARIANT* out_args) {
@@ -1062,48 +865,7 @@ HRESULT ChromeActiveDocument::IEExec(const GUID* cmd_group_guid,
bool ChromeActiveDocument::LaunchUrl(const ChromeFrameUrl& cf_url,
const std::string& referrer) {
- DCHECK(!cf_url.gurl().is_empty());
-
- if (!automation_client_.get()) {
- // http://code.google.com/p/chromium/issues/detail?id=52894
- // Still not sure how this happens.
- DLOG(ERROR) << "No automation client!";
- if (!Initialize()) {
- NOTREACHED() << "...and failed to start a new one >:(";
- return false;
- }
- }
-
- document_url_ = cf_url.gurl().spec();
-
- url_.Allocate(UTF8ToWide(cf_url.gurl().spec()).c_str());
- if (cf_url.attach_to_external_tab()) {
- automation_client_->AttachExternalTab(cf_url.cookie());
- OnMoveWindow(cf_url.dimensions());
- } else if (!automation_client_->InitiateNavigation(cf_url.gurl().spec(),
- referrer,
- this)) {
- DLOG(ERROR) << "Invalid URL: " << url_;
- Error(L"Invalid URL");
- url_.Reset();
- return false;
- }
-
- if (is_automation_client_reused_)
- return true;
-
- automation_client_->SetUrlFetcher(url_fetcher_.get());
- if (launch_params_) {
- return automation_client_->Initialize(this, launch_params_);
- } else {
- std::wstring profile = UTF8ToWide(cf_url.profile_name());
- // If no profile was given, then make use of the host process's name.
- if (profile.empty())
- profile = GetHostProcessName(false);
- return InitializeAutomation(profile, IsIEInPrivate(),
- false, cf_url.gurl(), GURL(referrer),
- false);
- }
+ return false;
}
HRESULT ChromeActiveDocument::OnRefreshPage(const GUID* cmd_group_guid,
@@ -1269,45 +1031,6 @@ HRESULT ChromeActiveDocument::OnEncodingChange(const GUID* cmd_group_guid,
IEExec(&CGID_ExplorerBarDoc, command_id, cmd_exec_opt, NULL, NULL);
return S_OK;
}
-
-void ChromeActiveDocument::OnGoToHistoryEntryOffset(int offset) {
- DVLOG(1) << __FUNCTION__ << " - offset:" << offset;
-
- base::win::ScopedComPtr<IBrowserService> browser_service;
- base::win::ScopedComPtr<ITravelLog> travel_log;
- GetBrowserServiceAndTravelLog(browser_service.Receive(),
- travel_log.Receive());
-
- if (browser_service && travel_log)
- travel_log->Travel(browser_service, offset);
-}
-
-void ChromeActiveDocument::OnMoveWindow(const gfx::Rect& dimensions) {
- base::win::ScopedComPtr<IWebBrowser2> web_browser2;
- DoQueryService(SID_SWebBrowserApp, m_spClientSite,
- web_browser2.Receive());
- if (!web_browser2)
- return;
- DVLOG(1) << "this:" << this << "\ndimensions: width:" << dimensions.width()
- << " height:" << dimensions.height();
- if (!dimensions.IsEmpty()) {
- web_browser2->put_MenuBar(VARIANT_FALSE);
- web_browser2->put_ToolBar(VARIANT_FALSE);
-
- int width = dimensions.width();
- int height = dimensions.height();
- // Compute the size of the browser window given the desired size of the
- // content area. As per MSDN, the WebBrowser object returns an error from
- // this method. As a result the code below is best effort.
- web_browser2->ClientToWindow(&width, &height);
-
- web_browser2->put_Width(width);
- web_browser2->put_Height(height);
- web_browser2->put_Left(dimensions.x());
- web_browser2->put_Top(dimensions.y());
- }
-}
-
HRESULT ChromeActiveDocument::GetBrowserServiceAndTravelLog(
IBrowserService** browser_service, ITravelLog** travel_log) {
DCHECK(browser_service || travel_log);
@@ -1392,8 +1115,6 @@ LRESULT ChromeActiveDocument::OnShowWindow(UINT message, WPARAM wparam,
LRESULT ChromeActiveDocument::OnSetFocus(UINT message, WPARAM wparam,
LPARAM lparam,
BOOL& handled) { // NO_LINT
- if (!ignore_setfocus_)
- GiveFocusToChrome(false);
return 0;
}
diff --git a/chrome_frame/chrome_active_document.h b/chrome_frame/chrome_active_document.h
index 9f23b90..b9e7278 100644
--- a/chrome_frame/chrome_active_document.h
+++ b/chrome_frame/chrome_active_document.h
@@ -248,8 +248,6 @@ END_MSG_MAP()
GetTabProxy()->command() : 1)
BEGIN_EXEC_COMMAND_MAP(ChromeActiveDocument)
- EXEC_COMMAND_HANDLER_GENERIC(NULL, OLECMDID_PRINT,
- automation_client_->PrintTab())
EXEC_COMMAND_HANDLER_NO_ARGS(NULL, OLECMDID_FIND, OnFindInPage)
EXEC_COMMAND_HANDLER_NO_ARGS(&CGID_MSHTML, IDM_FIND, OnFindInPage)
EXEC_COMMAND_HANDLER_NO_ARGS(&CGID_MSHTML, IDM_VIEWSOURCE, OnViewSource)
@@ -258,7 +256,6 @@ BEGIN_EXEC_COMMAND_MAP(ChromeActiveDocument)
FORWARD_TAB_COMMAND(NULL, OLECMDID_COPY, Copy)
FORWARD_TAB_COMMAND(NULL, OLECMDID_PASTE, Paste)
FORWARD_TAB_COMMAND(NULL, OLECMDID_STOP, StopAsync)
- FORWARD_TAB_COMMAND(NULL, OLECMDID_SAVEAS, SaveAsAsync)
EXEC_COMMAND_HANDLER(NULL, OLECMDID_REFRESH, OnRefreshPage)
EXEC_COMMAND_HANDLER(&CGID_Explorer, SBCMDID_MIXEDZONE,
OnDetermineSecurityZone)
@@ -274,18 +271,8 @@ BEGIN_EXEC_COMMAND_MAP(ChromeActiveDocument)
EXEC_COMMAND_HANDLER_NO_ARGS(&CGID_ShellDocView, DOCHOST_DISPLAY_PRIVACY,
OnDisplayPrivacyInfo)
EXEC_COMMAND_HANDLER(NULL, OLECMDID_OPTICAL_GETZOOMRANGE, OnGetZoomRange)
- EXEC_COMMAND_HANDLER(NULL, OLECMDID_OPTICAL_ZOOM, OnSetZoomRange)
- EXEC_COMMAND_HANDLER(NULL, OLECMDID_ONUNLOAD, OnUnload)
END_EXEC_COMMAND_MAP()
- // IPCs from automation server.
- 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,
@@ -341,7 +328,6 @@ END_EXEC_COMMAND_MAP()
// Callbacks from ChromeFramePlugin<T>
bool PreProcessContextMenu(HMENU menu);
- bool HandleContextMenuCommand(UINT cmd, const MiniContextMenuParams& params);
// ChromeFramePlugin overrides.
virtual void OnAutomationServerReady();
@@ -359,11 +345,6 @@ END_EXEC_COMMAND_MAP()
HRESULT GetInPlaceFrame(IOleInPlaceFrame** in_place_frame);
protected:
- // ChromeFrameActivexBase overrides
- virtual void OnAttachExternalTab(const AttachExternalTabParams& params);
- virtual void OnGoToHistoryEntryOffset(int offset);
- virtual void OnMoveWindow(const gfx::Rect& dimensions);
-
// 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
@@ -386,15 +367,6 @@ END_EXEC_COMMAND_MAP()
void OnGetZoomRange(const GUID* cmd_group_guid, DWORD command_id,
DWORD cmd_exec_opt, VARIANT* in_args, VARIANT* out_args);
- void OnSetZoomRange(const GUID* cmd_group_guid, DWORD command_id,
- DWORD cmd_exec_opt, VARIANT* in_args, VARIANT* out_args);
-
- // This function handles the OLECMDID_ONUNLOAD command. It enables Chrome to
- // invoke before unload and unload handlers on the page if any, thereby
- // enabling a webpage to potentially cancel the operation.
- void OnUnload(const GUID* cmd_group_guid, DWORD command_id,
- DWORD cmd_exec_opt, VARIANT* in_args, VARIANT* out_args);
-
// Call exec on our site's command target
HRESULT IEExec(const GUID* cmd_group_guid, DWORD command_id,
DWORD cmd_exec_opt, VARIANT* in_args, VARIANT* out_args);
diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp
index e3e7c71..369a873 100644
--- a/chrome_frame/chrome_frame.gyp
+++ b/chrome_frame/chrome_frame.gyp
@@ -834,7 +834,6 @@
'chrome_frame_automation.cc',
'chrome_frame_delegate.h',
'chrome_frame_delegate.cc',
- 'chrome_frame_plugin.cc',
'chrome_frame_plugin.h',
'chrome_launcher_utils.cc',
'chrome_launcher_utils.h',
diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc
index 9a76b78..4cb3c46 100644
--- a/chrome_frame/chrome_frame_activex.cc
+++ b/chrome_frame/chrome_frame_activex.cc
@@ -70,80 +70,8 @@ class TopLevelWindowMapping {
DISALLOW_COPY_AND_ASSIGN(TopLevelWindowMapping);
};
-// Message pump hook function that monitors for WM_MOVE and WM_MOVING
-// messages on a top-level window, and passes notification to the appropriate
-// Chrome-Frame instances.
-LRESULT CALLBACK TopWindowProc(int code, WPARAM wparam, LPARAM lparam) {
- CWPSTRUCT* info = reinterpret_cast<CWPSTRUCT*>(lparam);
- const UINT &message = info->message;
- const HWND &message_hwnd = info->hwnd;
-
- switch (message) {
- case WM_MOVE:
- case WM_MOVING: {
- TopLevelWindowMapping::WindowList cf_instances =
- TopLevelWindowMapping::GetInstance()->GetInstances(message_hwnd);
- TopLevelWindowMapping::WindowList::iterator
- iter(cf_instances.begin()), end(cf_instances.end());
- for (; iter != end; ++iter) {
- PostMessage(*iter, WM_HOST_MOVED_NOTIFICATION, NULL, NULL);
- }
- break;
- }
- default:
- break;
- }
-
- return CallNextHookEx(0, code, wparam, lparam);
-}
-
-HHOOK InstallLocalWindowHook(HWND window) {
- if (!window)
- return NULL;
-
- DWORD proc_thread = ::GetWindowThreadProcessId(window, NULL);
- if (!proc_thread)
- return NULL;
-
- // Note that this hook is installed as a LOCAL hook.
- return ::SetWindowsHookEx(WH_CALLWNDPROC,
- TopWindowProc,
- NULL,
- proc_thread);
-}
-
} // unnamed namespace
-namespace chrome_frame {
-std::string ActiveXCreateUrl(const GURL& parsed_url,
- const AttachExternalTabParams& params) {
- return base::StringPrintf(
- "%hs?attach_external_tab&%I64u&%d&%d&%d&%d&%d&%hs",
- parsed_url.GetOrigin().spec().c_str(),
- params.cookie,
- params.disposition,
- params.dimensions.x(),
- params.dimensions.y(),
- params.dimensions.width(),
- params.dimensions.height(),
- params.profile_name.c_str());
-}
-
-int GetDisposition(const AttachExternalTabParams& params) {
- return params.disposition;
-}
-
-void GetMiniContextMenuData(UINT cmd,
- const MiniContextMenuParams& params,
- GURL* referrer,
- GURL* url) {
- *referrer = params.frame_url.is_empty() ? params.page_url : params.frame_url;
- *url = (cmd == IDS_CONTENT_CONTEXT_SAVELINKAS ?
- params.link_url : params.src_url);
-}
-
-} // namespace chrome_frame
-
ChromeFrameActivex::ChromeFrameActivex()
: chrome_wndproc_hook_(NULL),
attaching_to_existing_cf_tab_(false) {
@@ -190,12 +118,6 @@ LRESULT ChromeFrameActivex::OnCreate(UINT message, WPARAM wparam, LPARAM lparam,
return 0;
}
-LRESULT ChromeFrameActivex::OnHostMoved(UINT message, WPARAM wparam,
- LPARAM lparam, BOOL& handled) {
- Base::OnHostMoved();
- return 0;
-}
-
HRESULT ChromeFrameActivex::GetContainingDocument(IHTMLDocument2** doc) {
base::win::ScopedComPtr<IOleContainer> container;
HRESULT hr = m_spClientSite->GetContainer(container.Receive());
@@ -212,16 +134,6 @@ HRESULT ChromeFrameActivex::GetDocumentWindow(IHTMLWindow2** window) {
return hr;
}
-void ChromeFrameActivex::OnLoad(const GURL& gurl) {
- base::win::ScopedComPtr<IDispatch> event;
- std::string url = gurl.spec();
- if (SUCCEEDED(CreateDomEvent("event", url, "", event.Receive())))
- Fire_onload(event);
-
- FireEvent(onload_, url);
- Base::OnLoad(gurl);
-}
-
void ChromeFrameActivex::OnLoadFailed(int error_code, const std::string& url) {
base::win::ScopedComPtr<IDispatch> event;
if (SUCCEEDED(CreateDomEvent("event", url, "", event.Receive())))
@@ -231,50 +143,6 @@ void ChromeFrameActivex::OnLoadFailed(int error_code, const std::string& url) {
Base::OnLoadFailed(error_code, url);
}
-void ChromeFrameActivex::OnMessageFromChromeFrame(const std::string& message,
- const std::string& origin,
- const std::string& target) {
- DVLOG(1) << __FUNCTION__;
-
- if (target.compare("*") != 0) {
- bool drop = true;
-
- if (is_privileged()) {
- // Forward messages if the control is in privileged mode.
- base::win::ScopedComPtr<IDispatch> message_event;
- if (SUCCEEDED(CreateDomEvent("message", message, origin,
- message_event.Receive()))) {
- base::win::ScopedBstr target_bstr(UTF8ToWide(target).c_str());
- Fire_onprivatemessage(message_event, target_bstr);
-
- FireEvent(onprivatemessage_, message_event, target_bstr);
- }
- } else {
- if (HaveSameOrigin(target, document_url_)) {
- drop = false;
- } else {
- DLOG(WARNING) << "Dropping posted message since target doesn't match "
- "the current document's origin. target=" << target;
- }
- }
-
- if (drop)
- return;
- }
-
- base::win::ScopedComPtr<IDispatch> message_event;
- if (SUCCEEDED(CreateDomEvent("message", message, origin,
- message_event.Receive()))) {
- Fire_onmessage(message_event);
-
- FireEvent(onmessage_, message_event);
-
- base::win::ScopedVariant event_var;
- event_var.Set(static_cast<IDispatch*>(message_event));
- InvokeScriptFunction(onmessage_handler_, event_var.AsInput());
- }
-}
-
bool ChromeFrameActivex::ShouldShowVersionMismatchDialog(
bool is_privileged,
IOleClientSite* client_site) {
@@ -478,18 +346,7 @@ HRESULT ChromeFrameActivex::IOleObject_SetClientSite(
InitializeAutomationSettings();
- if (service) {
- base::win::ScopedBstr navigation_url;
- service->GetNavigationUrl(navigation_url.Receive());
- if (navigation_url.Length()) {
- ChromeFrameUrl cf_url;
- cf_url.Parse(navigation_url.operator BSTR());
- if (cf_url.attach_to_external_tab()) {
- automation_client_->AttachExternalTab(cf_url.cookie());
- attaching_to_existing_cf_tab_ = true;
- }
- }
- }
+
url_fetcher_->set_frame_busting(!is_privileged());
automation_client_->SetUrlFetcher(url_fetcher_.get());
if (!InitializeAutomation(profile_name, IsIEInPrivate(), true,
@@ -629,24 +486,7 @@ void ChromeFrameActivex::FireEvent(const EventHandlers& handlers,
}
HRESULT ChromeFrameActivex::InstallTopLevelHook(IOleClientSite* client_site) {
- // Get the parent window of the site, and install our hook on the topmost
- // window of the parent.
- base::win::ScopedComPtr<IOleWindow> ole_window;
- HRESULT hr = ole_window.QueryFrom(client_site);
- if (FAILED(hr))
- return hr;
-
- HWND parent_wnd;
- hr = ole_window->GetWindow(&parent_wnd);
- if (FAILED(hr))
- return hr;
-
- HWND top_window = ::GetAncestor(parent_wnd, GA_ROOT);
- chrome_wndproc_hook_ = InstallLocalWindowHook(top_window);
- if (chrome_wndproc_hook_)
- TopLevelWindowMapping::GetInstance()->AddMapping(top_window, m_hWnd);
-
- return chrome_wndproc_hook_ ? S_OK : E_FAIL;
+ return E_FAIL;
}
HRESULT ChromeFrameActivex::registerBhoIfNeeded() {
diff --git a/chrome_frame/chrome_frame_activex.h b/chrome_frame/chrome_frame_activex.h
index 3023649..20432da 100644
--- a/chrome_frame/chrome_frame_activex.h
+++ b/chrome_frame/chrome_frame_activex.h
@@ -18,8 +18,6 @@
#include "chrome_frame/com_type_info_holder.h"
#include "grit/chrome_frame_resources.h"
-#define WM_HOST_MOVED_NOTIFICATION (WM_APP + 1)
-
// ChromeFrameActivex: Implementation of the ActiveX control that is
// responsible for hosting a chrome frame, i.e. an iframe like widget which
// hosts the the chrome window. This object delegates to Chrome.exe
@@ -48,7 +46,6 @@ END_COM_MAP()
BEGIN_MSG_MAP(ChromeFrameActivex)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
- MESSAGE_HANDLER(WM_HOST_MOVED_NOTIFICATION, OnHostMoved)
CHAIN_MSG_MAP(Base)
END_MSG_MAP()
@@ -88,10 +85,6 @@ END_MSG_MAP()
protected:
// ChromeFrameDelegate overrides
- 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);
virtual void OnAutomationServerLaunchFailed(
AutomationLaunchResult reason, const std::string& server_version);
@@ -104,8 +97,6 @@ END_MSG_MAP()
private:
LRESULT OnCreate(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled); // NO_LINT
- LRESULT OnHostMoved(UINT message, WPARAM wparam, LPARAM lparam,
- BOOL& handled); // NO_LINT
HRESULT GetContainingDocument(IHTMLDocument2** doc);
HRESULT GetDocumentWindow(IHTMLWindow2** window);
diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h
index b1dcc9f..4420550 100644
--- a/chrome_frame/chrome_frame_activex_base.h
+++ b/chrome_frame/chrome_frame_activex_base.h
@@ -81,12 +81,6 @@ class ATL_NO_VTABLE ProxyDIChromeFrameEvents
FireMethodWithParams(dispid, &param, 1);
}
- void Fire_onload(IDispatch* event) {
- VARIANT var = { VT_DISPATCH };
- var.pdispVal = event;
- FireMethodWithParam(CF_EVENT_DISPID_ONLOAD, var);
- }
-
void Fire_onloaderror(IDispatch* event) {
VARIANT var = { VT_DISPATCH };
var.pdispVal = event;
@@ -120,26 +114,10 @@ class ATL_NO_VTABLE ProxyDIChromeFrameEvents
void Fire_onchannelerror() { // NOLINT
FireMethodWithParams(CF_EVENT_DISPID_ONCHANNELERROR, NULL, 0);
}
-
- void Fire_onclose() { // NOLINT
- FireMethodWithParams(CF_EVENT_DISPID_ONCLOSE, NULL, 0);
- }
};
extern bool g_first_launch_by_process_;
-namespace chrome_frame {
-// Implemented outside this file so that the header doesn't include
-// automation_messages.h.
-std::string ActiveXCreateUrl(const GURL& parsed_url,
- const AttachExternalTabParams& params);
-int GetDisposition(const AttachExternalTabParams& params);
-void GetMiniContextMenuData(UINT cmd,
- const MiniContextMenuParams& params,
- GURL* referrer,
- GURL* url);
-} // namespace chrome_frame
-
// Common implementation for ActiveX and Active Document
template <class T, const CLSID& class_id>
class ATL_NO_VTABLE ChromeFrameActivexBase : // NOLINT
@@ -211,7 +189,6 @@ END_CONNECTION_POINT_MAP()
BEGIN_MSG_MAP(ChromeFrameActivexBase)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
- MESSAGE_HANDLER(WM_DOWNLOAD_IN_HOST, OnDownloadRequestInHost)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
CHAIN_MSG_MAP(ChromeFramePlugin<T>)
CHAIN_MSG_MAP(CComControl<T>)
@@ -336,33 +313,6 @@ END_MSG_MAP()
return CComControlBase::IOleObject_SetClientSite(client_site);
}
- 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);
- return true;
- } else {
- switch (cmd) {
- case IDS_CONTENT_CONTEXT_SAVEAUDIOAS:
- case IDS_CONTENT_CONTEXT_SAVEVIDEOAS:
- case IDS_CONTENT_CONTEXT_SAVEIMAGEAS:
- case IDS_CONTENT_CONTEXT_SAVELINKAS: {
- GURL referrer, url;
- chrome_frame::GetMiniContextMenuData(cmd, params, &referrer, &url);
- DoFileDownloadInIE(UTF8ToWide(url.spec()).c_str());
- return true;
- }
-
- case IDC_PRINT: {
- automation_client_->PrintTab();
- return true;
- }
- }
- }
-
- return false;
- }
-
// Should connections initiated by this class try to block
// responses served with the X-Frame-Options header?
// ActiveX controls genereally will want to do this,
@@ -404,98 +354,10 @@ END_MSG_MAP()
DVLOG(1) << __FUNCTION__ << ": " << profile_path->value();
}
- void OnLoad(const GURL& url) {
- if (ready_state_ < READYSTATE_COMPLETE) {
- ready_state_ = READYSTATE_COMPLETE;
- FireOnChanged(DISPID_READYSTATE);
- }
-
- HRESULT hr = InvokeScriptFunction(onload_handler_, url.spec());
- }
-
void OnLoadFailed(int error_code, const std::string& url) {
HRESULT hr = InvokeScriptFunction(onerror_handler_, url);
}
- void OnMessageFromChromeFrame(const std::string& message,
- const std::string& origin,
- const std::string& target) {
- base::win::ScopedComPtr<IDispatch> message_event;
- if (SUCCEEDED(CreateDomEvent("message", message, origin,
- message_event.Receive()))) {
- base::win::ScopedVariant event_var;
- event_var.Set(static_cast<IDispatch*>(message_event));
- InvokeScriptFunction(onmessage_handler_, event_var.AsInput());
- }
- }
-
- virtual void OnTabbedOut(bool reverse) {
- DCHECK(m_bInPlaceActive);
-
- HWND parent = ::GetParent(m_hWnd);
- ::SetFocus(parent);
- base::win::ScopedComPtr<IOleControlSite> control_site;
- control_site.QueryFrom(m_spClientSite);
- if (control_site)
- control_site->OnFocus(FALSE);
- }
-
- virtual void OnOpenURL(const GURL& url_to_open,
- const GURL& referrer, int open_disposition) {
- HostNavigate(url_to_open, referrer, open_disposition);
- }
-
- // Called when Chrome has decided that a request needs to be treated as a
- // download. The caller will be the UrlRequest worker thread.
- // The worker thread will block while we process the request and take
- // ownership of the request object.
- // There's room for improvement here and also see todo below.
- LPARAM OnDownloadRequestInHost(UINT message, WPARAM wparam, LPARAM lparam,
- BOOL& handled) {
- ChromeFrameUrl cf_url;
- cf_url.Parse(UTF8ToWide(GetDocumentUrl()));
-
- // Always issue the download request in a new window to ensure that the
- // currently loaded ChromeFrame document does not inadvartently see an
- // unload request. This runs javascript unload handlers on the page which
- // renders the page non functional.
- VARIANT flags = { VT_I4 };
- V_I4(&flags) = navNoHistory;
- if (!cf_url.attach_to_external_tab())
- V_I4(&flags) |= navOpenInNewWindow;
-
- DownloadInHostParams* download_params =
- reinterpret_cast<DownloadInHostParams*>(wparam);
- DCHECK(download_params);
- // TODO(tommi): It looks like we might have to switch the request object
- // into a pass-through request object and serve up any thus far received
- // content and headers to IE in order to prevent what can currently happen
- // which is reissuing requests and turning POST into GET.
- if (download_params->moniker) {
- NavigateBrowserToMoniker(
- doc_site_, download_params->moniker,
- UTF8ToWide(download_params->request_headers).c_str(),
- download_params->bind_ctx, NULL, download_params->post_data,
- &flags);
- }
- delete download_params;
- return TRUE;
- }
-
- virtual void OnAttachExternalTab(const AttachExternalTabParams& params) {
- GURL current_url(static_cast<BSTR>(url_));
- std::string url = chrome_frame::ActiveXCreateUrl(current_url, params);
- // Pass the current document url as the referrer for the new navigation.
- HostNavigate(GURL(url), current_url, chrome_frame::GetDisposition(params));
- }
-
- virtual void OnHandleContextMenu(const ContextMenuModel& menu_model,
- int align_flags,
- const MiniContextMenuParams& params) {
- scoped_refptr<BasePlugin> ref(this);
- ChromeFramePlugin<T>::OnHandleContextMenu(menu_model, align_flags, params);
- }
-
LRESULT OnCreate(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled) { // NO_LINT
ModifyStyle(0, WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0);
@@ -540,10 +402,6 @@ END_MSG_MAP()
FireOnChanged(DISPID_READYSTATE);
}
- virtual void OnCloseTab() {
- Fire_onclose();
- }
-
// Overridden to take advantage of readystate prop changes and send those
// to potential listeners.
HRESULT FireOnChanged(DISPID dispid) {
@@ -702,43 +560,6 @@ END_MSG_MAP()
// Posts a message to the chrome frame.
STDMETHOD(postMessage)(BSTR message, VARIANT target) {
- if (NULL == message) {
- return E_INVALIDARG;
- }
-
- if (!automation_client_.get())
- return E_FAIL;
-
- std::string utf8_target;
- if (target.vt == VT_BSTR) {
- int len = ::SysStringLen(target.bstrVal);
- if (len == 1 && target.bstrVal[0] == L'*') {
- utf8_target = "*";
- } else {
- GURL resolved(target.bstrVal);
- if (!resolved.is_valid()) {
- Error(L"Unable to parse the specified target URL.");
- return E_INVALIDARG;
- }
-
- utf8_target = resolved.spec();
- }
- } else {
- utf8_target = "*";
- }
-
- std::string utf8_message;
- WideToUTF8(message, ::SysStringLen(message), &utf8_message);
-
- GURL url(GURL(document_url_).GetOrigin());
- std::string origin(url.is_empty() ? "null" : url.spec());
- if (!automation_client_->ForwardMessageFromExternalHost(utf8_message,
- origin,
- utf8_target)) {
- Error(L"Failed to post message to chrome frame");
- return E_FAIL;
- }
-
return S_OK;
}
@@ -784,27 +605,6 @@ END_MSG_MAP()
}
STDMETHOD(postPrivateMessage)(BSTR message, BSTR origin, BSTR target) {
- if (NULL == message)
- return E_INVALIDARG;
-
- if (!is_privileged()) {
- DLOG(ERROR) << "Attempt to postPrivateMessage in non-privileged mode";
- return E_ACCESSDENIED;
- }
-
- DCHECK(automation_client_.get());
- std::string utf8_message, utf8_origin, utf8_target;
- WideToUTF8(message, ::SysStringLen(message), &utf8_message);
- WideToUTF8(origin, ::SysStringLen(origin), &utf8_origin);
- WideToUTF8(target, ::SysStringLen(target), &utf8_target);
-
- if (!automation_client_->ForwardMessageFromExternalHost(utf8_message,
- utf8_origin,
- utf8_target)) {
- Error(L"Failed to post message to chrome frame");
- return E_FAIL;
- }
-
return S_OK;
}
@@ -1017,51 +817,6 @@ END_MSG_MAP()
return hr;
}
- 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
- // accelerators such as F11, Ctrl+T etc.
- // (see AllowFrameToTranslateAccelerator for those).
- HRESULT hr = TranslateAccelerator(const_cast<MSG*>(&accel_message));
- if (hr != S_OK)
- hr = AllowFrameToTranslateAccelerator(accel_message);
-
- DVLOG(1) << __FUNCTION__ << " browser response: "
- << base::StringPrintf("0x%08x", hr);
-
- if (hr != S_OK) {
- // The WM_SYSKEYDOWN/WM_SYSKEYUP messages are not processed by the
- // IOleControlSite and IBrowserService2::v_MayTranslateAccelerator
- // implementations. We need to understand this better. That is for
- // another day. For now we just post these messages back to the parent
- // which forwards it off to the frame. This should not cause major
- // grief for Chrome as it does not need to handle WM_SYSKEY* messages in
- // in ChromeFrame mode.
- // TODO(iyengar)
- // Understand and fix WM_SYSCHAR handling
- // We should probably unify the accelerator handling for the active
- // document and the activex.
- if (accel_message.message == WM_SYSCHAR ||
- accel_message.message == WM_SYSKEYDOWN ||
- accel_message.message == WM_SYSKEYUP) {
- ::PostMessage(GetParent(), accel_message.message, accel_message.wParam,
- accel_message.lParam);
- return;
- }
- }
- // Last chance to handle the keystroke is to pass it to chromium.
- // We do this last partially because there's no way for us to tell if
- // chromium actually handled the keystroke, but also since the browser
- // should have first dibs anyway.
- if (hr != S_OK && automation_client_.get()) {
- TabProxy* tab = automation_client_->tab();
- if (tab) {
- tab->ProcessUnhandledAccelerator(accel_message);
- }
- }
- }
-
protected:
void HostNavigate(const GURL& url_to_open,
const GURL& referrer, int open_disposition) {
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc
index 9e79033..305fcaf 100644
--- a/chrome_frame/chrome_frame_automation.cc
+++ b/chrome_frame/chrome_frame_automation.cc
@@ -107,21 +107,6 @@ class ChromeFrameAutomationProxyImpl::CFMsgDispatcher
protected:
virtual bool HandleMessageType(const IPC::Message& msg,
SyncMessageCallContext* context) {
- switch (context->message_type()) {
- case AutomationMsg_CreateExternalTab::ID:
- case AutomationMsg_ConnectExternalTab::ID:
- InvokeCallback<CreateExternalTabContext>(msg, context);
- break;
- case AutomationMsg_NavigateExternalTabAtIndex::ID:
- case AutomationMsg_NavigateInExternalTab::ID:
- InvokeCallback<BeginNavigateContext>(msg, context);
- break;
- case AutomationMsg_RunUnloadHandlers::ID:
- InvokeCallback<UnloadContext>(msg, context);
- break;
- default:
- NOTREACHED();
- }
return true;
}
};
@@ -533,7 +518,6 @@ ChromeFrameAutomationClient::ChromeFrameAutomationClient()
handle_top_level_requests_(false),
tab_handle_(-1),
session_id_(-1),
- external_tab_cookie_(0),
url_fetcher_(NULL),
url_fetcher_flags_(PluginUrlRequestManager::NOT_THREADSAFE),
navigate_after_initialization_(false),
@@ -649,114 +633,9 @@ bool ChromeFrameAutomationClient::InitiateNavigation(
const std::string& url,
const std::string& referrer,
NavigationConstraints* navigation_constraints) {
- if (url.empty())
- return false;
-
- GURL parsed_url(url);
-
- // Catch invalid URLs early.
- // Can we allow this navigation to happen?
- if (!CanNavigate(parsed_url, navigation_constraints)) {
- DLOG(ERROR) << __FUNCTION__ << " Not allowing navigation to: " << url;
- return false;
- }
-
- // If we are not yet initialized ignore attempts to navigate to the same url.
- // Navigation attempts to the same URL could occur if the automation client
- // was reused for a new active document instance.
- if (!chrome_launch_params_ || is_initialized() ||
- parsed_url != chrome_launch_params_->url()) {
- // Important: Since we will be using the referrer_ variable from a
- // different thread, we need to force a new std::string buffer instance for
- // the referrer_ GURL variable. Otherwise we can run into strangeness when
- // the GURL is accessed and it could result in a bad URL that can cause the
- // referrer to be dropped or something worse.
- GURL referrer_gurl(referrer.c_str());
- if (!chrome_launch_params_) {
- base::FilePath profile_path;
- chrome_launch_params_ = new ChromeFrameLaunchParams(parsed_url,
- referrer_gurl, profile_path, L"", SimpleResourceLoader::GetLanguage(),
- false, false, route_all_top_level_navigations_);
- } else {
- chrome_launch_params_->set_referrer(referrer_gurl);
- chrome_launch_params_->set_url(parsed_url);
- }
-
- navigate_after_initialization_ = false;
-
- if (is_initialized()) {
- BeginNavigate();
- } else {
- navigate_after_initialization_ = true;
- }
- }
-
- return true;
-}
-
-bool ChromeFrameAutomationClient::NavigateToIndex(int index) {
- // Could be NULL if we failed to launch Chrome in LaunchAutomationServer()
- if (!automation_server_ || !tab_.get() || !tab_->is_valid()) {
- return false;
- }
-
- DCHECK(::IsWindow(chrome_window_));
-
- IPC::SyncMessage* msg = new AutomationMsg_NavigateExternalTabAtIndex(
- tab_->handle(), index, NULL);
- automation_server_->SendAsAsync(msg, new BeginNavigateContext(this),
- this);
- return true;
-}
-
-bool ChromeFrameAutomationClient::ForwardMessageFromExternalHost(
- const std::string& message, const std::string& origin,
- const std::string& target) {
- // Could be NULL if we failed to launch Chrome in LaunchAutomationServer()
- if (!is_initialized())
- return false;
-
- tab_->HandleMessageFromExternalHost(message, origin, target);
return true;
}
-bool ChromeFrameAutomationClient::SetProxySettings(
- const std::string& json_encoded_proxy_settings) {
- if (!is_initialized())
- return false;
- automation_server_->SendProxyConfig(json_encoded_proxy_settings);
- return true;
-}
-
-void ChromeFrameAutomationClient::BeginNavigate() {
- // Could be NULL if we failed to launch Chrome in LaunchAutomationServer()
- if (!automation_server_ || !tab_.get()) {
- DLOG(WARNING) << "BeginNavigate - can't navigate.";
- ReportNavigationError(AUTOMATION_MSG_NAVIGATION_ERROR,
- chrome_launch_params_->url().spec());
- return;
- }
-
- DCHECK(::IsWindow(chrome_window_));
-
- if (!tab_->is_valid()) {
- DLOG(WARNING) << "BeginNavigate - tab isn't valid.";
- return;
- }
-
- IPC::SyncMessage* msg =
- new AutomationMsg_NavigateInExternalTab(tab_->handle(),
- chrome_launch_params_->url(), chrome_launch_params_->referrer(),
- NULL);
- automation_server_->SendAsAsync(msg, new BeginNavigateContext(this), this);
-
- RECT client_rect = {0};
- chrome_frame_delegate_->GetBounds(&client_rect);
- Resize(client_rect.right - client_rect.left,
- client_rect.bottom - client_rect.top,
- SWP_NOACTIVATE | SWP_NOZORDER);
-}
-
void ChromeFrameAutomationClient::BeginNavigateCompleted(
AutomationMsg_NavigationResponseValues result) {
if (result == AUTOMATION_MSG_NAVIGATION_ERROR)
@@ -786,161 +665,20 @@ void ChromeFrameAutomationClient::FindInPage(const std::wstring& search_string,
automation_server_->SendAsAsync(msg, NULL, this);
}
-void ChromeFrameAutomationClient::OnChromeFrameHostMoved() {
- // Use a local var to avoid the small possibility of getting the tab_
- // member be cleared while we try to use it.
- // Note that TabProxy is a RefCountedThreadSafe object, so we should be OK.
- scoped_refptr<TabProxy> tab(tab_);
- // There also is a possibility that tab_ has not been set yet,
- // so we still need to test for NULL.
- if (tab)
- tab->OnHostMoved();
-}
-
-void ChromeFrameAutomationClient::CreateExternalTab() {
- AutomationLaunchResult launch_result = AUTOMATION_SUCCESS;
- DCHECK(IsWindow());
- DCHECK(automation_server_ != NULL);
-
- if (chrome_launch_params_->url().is_valid()) {
- navigate_after_initialization_ = false;
- }
-
- ExternalTabSettings settings;
- settings.parent = m_hWnd;
- settings.style = WS_CHILD;
- settings.is_incognito = chrome_launch_params_->incognito();
- settings.load_requests_via_automation = !use_chrome_network_;
- settings.handle_top_level_requests = handle_top_level_requests_;
- settings.initial_url = chrome_launch_params_->url();
- settings.referrer = chrome_launch_params_->referrer();
- // Infobars disabled in widget mode.
- settings.infobars_enabled = !chrome_launch_params_->widget_mode();
- settings.route_all_top_level_navigations =
- chrome_launch_params_->route_all_top_level_navigations();
-
- UMA_HISTOGRAM_CUSTOM_COUNTS(
- "ChromeFrame.HostNetworking", !use_chrome_network_, 1, 2, 3);
-
- UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.HandleTopLevelRequests",
- handle_top_level_requests_, 1, 2, 3);
-
- IPC::SyncMessage* message =
- new AutomationMsg_CreateExternalTab(settings, NULL, NULL, 0, 0);
- automation_server_->SendAsAsync(message, new CreateExternalTabContext(this),
- this);
-}
-
-AutomationLaunchResult ChromeFrameAutomationClient::CreateExternalTabComplete(
- HWND chrome_window, HWND tab_window, int tab_handle, int session_id) {
- if (!automation_server_) {
- // If we receive this notification while shutting down, do nothing.
- DLOG(ERROR) << "CreateExternalTabComplete called when automation server "
- << "was null!";
- return AUTOMATION_CREATE_TAB_FAILED;
- }
-
- AutomationLaunchResult launch_result = AUTOMATION_SUCCESS;
- if (tab_handle == 0 || !::IsWindow(chrome_window)) {
- launch_result = AUTOMATION_CREATE_TAB_FAILED;
- } else {
- chrome_window_ = chrome_window;
- tab_window_ = tab_window;
- tab_ = automation_server_->CreateTabProxy(tab_handle);
- tab_->AddObserver(this);
- tab_handle_ = tab_handle;
- session_id_ = session_id;
- }
- return launch_result;
-}
-
// Invoked in the automation proxy's worker thread.
void ChromeFrameAutomationClient::LaunchComplete(
ChromeFrameAutomationProxy* proxy,
AutomationLaunchResult result) {
- // If we're shutting down we don't keep a pointer to the automation server.
- if (init_state_ != UNINITIALIZING) {
- DCHECK(init_state_ == INITIALIZING);
- automation_server_ = proxy;
- } else {
- DVLOG(1) << "Not storing automation server pointer due to shutting down";
- }
-
- if (result == AUTOMATION_SUCCESS) {
- // NOTE: A potential problem here is that Uninitialize() may just have
- // been called so we need to be careful and check the automation_server_
- // pointer.
- if (automation_server_ != NULL) {
- // If we have a valid tab_handle here it means that we are attaching to
- // an existing ExternalTabContainer instance, in which case we don't
- // want to create an external tab instance in Chrome.
- if (external_tab_cookie_ == 0) {
- // Continue with Initialization - Create external tab
- CreateExternalTab();
- } else {
- // Send a notification to Chrome that we are ready to connect to the
- // ExternalTab.
- IPC::SyncMessage* message =
- new AutomationMsg_ConnectExternalTab(external_tab_cookie_, true,
- m_hWnd, NULL, NULL, NULL, 0);
- automation_server_->SendAsAsync(message,
- new CreateExternalTabContext(this),
- this);
- DVLOG(1) << __FUNCTION__ << ": sending CreateExternalTabComplete";
- }
- }
- } else {
- // Launch failed. Note, we cannot delete proxy here.
- PostTask(FROM_HERE,
- base::Bind(&ChromeFrameAutomationClient::InitializeComplete,
- base::Unretained(this), result));
- }
}
// Invoked in the automation proxy's worker thread.
void ChromeFrameAutomationClient::AutomationServerDied() {
- // Make sure we notify our delegate.
- PostTask(
- FROM_HERE, base::Bind(&ChromeFrameAutomationClient::InitializeComplete,
- base::Unretained(this), AUTOMATION_SERVER_CRASHED));
// Then uninitialize.
PostTask(
FROM_HERE, base::Bind(&ChromeFrameAutomationClient::Uninitialize,
base::Unretained(this)));
}
-void ChromeFrameAutomationClient::InitializeComplete(
- AutomationLaunchResult result) {
- DCHECK_EQ(base::PlatformThread::CurrentId(), ui_thread_id_);
- if (result != AUTOMATION_SUCCESS) {
- DLOG(WARNING) << "InitializeComplete: failure " << result;
- } else {
- init_state_ = INITIALIZED;
-
- // If the host already have a window, ask Chrome to re-parent.
- if (parent_window_)
- SetParentWindow(parent_window_);
-
- // If host specified destination URL - navigate. Apparently we do not use
- // accelerator table.
- if (navigate_after_initialization_) {
- navigate_after_initialization_ = false;
- BeginNavigate();
- }
- }
-
- if (chrome_frame_delegate_) {
- if (result == AUTOMATION_SUCCESS) {
- chrome_frame_delegate_->OnAutomationServerReady();
- } else {
- std::string version;
- if (automation_server_)
- version = automation_server_->server_version();
- chrome_frame_delegate_->OnAutomationServerLaunchFailed(result, version);
- }
- }
-}
-
bool ChromeFrameAutomationClient::ProcessUrlRequestMessage(TabProxy* tab,
const IPC::Message& msg, bool ui_thread) {
// Either directly call appropriate url_fetcher function
@@ -976,15 +714,6 @@ bool ChromeFrameAutomationClient::ProcessUrlRequestMessage(TabProxy* tab,
return true;
}
break;
-
- case AutomationMsg_DownloadRequestInHost::ID:
- if (ui_thread || (url_fetcher_flags_ &
- PluginUrlRequestManager::DOWNLOAD_REQUEST_THREADSAFE)) {
- AutomationMsg_DownloadRequestInHost::Dispatch(&msg, url_fetcher_, this,
- &PluginUrlRequestManager::DownloadUrlRequestInHost);
- return true;
- }
- break;
}
PostTask(
@@ -1064,15 +793,6 @@ void ChromeFrameAutomationClient::ReportNavigationError(
}
}
-void ChromeFrameAutomationClient::Resize(int width, int height,
- int flags) {
- if (tab_.get() && ::IsWindow(chrome_window())) {
- SetWindowPos(HWND_TOP, 0, 0, width, height, flags);
- tab_->Reposition(chrome_window(), HWND_TOP, 0, 0, width, height,
- flags, m_hWnd);
- }
-}
-
void ChromeFrameAutomationClient::SetParentWindow(HWND parent_window) {
parent_window_ = parent_window;
// If we're done with the initialization step, go ahead
@@ -1100,8 +820,6 @@ void ChromeFrameAutomationClient::SetParentWindow(HWND parent_window) {
::GetClientRect(parent_window, &parent_client_rect);
int width = parent_client_rect.right - parent_client_rect.left;
int height = parent_client_rect.bottom - parent_client_rect.top;
-
- Resize(width, height, SWP_SHOWWINDOW | SWP_NOZORDER);
}
}
}
@@ -1136,12 +854,6 @@ void ChromeFrameAutomationClient::ReleaseAutomationServer() {
}
}
-void ChromeFrameAutomationClient::SendContextMenuCommandToChromeFrame(
- int selected_command) {
- if (tab_)
- tab_->SendContextMenuCommand(selected_command);
-}
-
std::wstring ChromeFrameAutomationClient::GetVersion() const {
return GetCurrentModuleVersion();
}
@@ -1164,27 +876,6 @@ void ChromeFrameAutomationClient::Print(HDC print_dc,
::ReleaseDC(tab_window_, window_dc);
}
-void ChromeFrameAutomationClient::PrintTab() {
- if (tab_)
- tab_->PrintAsync();
-}
-
-void ChromeFrameAutomationClient::AttachExternalTab(
- uint64 external_tab_cookie) {
- DCHECK_EQ(static_cast<TabProxy*>(NULL), tab_.get());
- DCHECK_EQ(-1, tab_handle_);
-
- external_tab_cookie_ = external_tab_cookie;
-}
-
-void ChromeFrameAutomationClient::BlockExternalTab(uint64 cookie) {
- // The host does not want this tab to be shown (due popup blocker).
- IPC::SyncMessage* message =
- new AutomationMsg_ConnectExternalTab(cookie, false, m_hWnd,
- NULL, NULL, NULL, 0);
- automation_server_->SendAsAsync(message, NULL, this);
-}
-
void ChromeFrameAutomationClient::SetPageFontSize(
enum AutomationPageFontSize font_size) {
if (font_size < SMALLEST_FONT ||
@@ -1198,10 +889,6 @@ void ChromeFrameAutomationClient::SetPageFontSize(
new AutomationMsg_SetPageFontSize(tab_handle_, font_size));
}
-void ChromeFrameAutomationClient::RemoveBrowsingData(int remove_mask) {
- automation_server_->Send(new AutomationMsg_RemoveBrowsingData(remove_mask));
-}
-
void ChromeFrameAutomationClient::SetUrlFetcher(
PluginUrlRequestManager* url_fetcher) {
DCHECK(url_fetcher != NULL);
@@ -1210,29 +897,6 @@ void ChromeFrameAutomationClient::SetUrlFetcher(
url_fetcher_->set_delegate(this);
}
-void ChromeFrameAutomationClient::SetZoomLevel(content::PageZoom zoom_level) {
- if (automation_server_) {
- automation_server_->Send(new AutomationMsg_SetZoomLevel(tab_handle_,
- zoom_level));
- }
-}
-
-void ChromeFrameAutomationClient::OnUnload(bool* should_unload) {
- *should_unload = true;
- if (automation_server_) {
- const DWORD kUnloadEventTimeout = 20000;
-
- 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,
- should_unload);
- automation_server_->SendAsAsync(msg, unload_context, this);
- HANDLE done = unload_call_finished.handle();
- WaitWithMessageLoop(&done, 1, kUnloadEventTimeout);
- }
-}
-
//////////////////////////////////////////////////////////////////////////
// PluginUrlRequestDelegate implementation.
// Forward network related responses to Chrome.
diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h
index 57b4b00..cf7e37c 100644
--- a/chrome_frame/chrome_frame_automation.h
+++ b/chrome_frame/chrome_frame_automation.h
@@ -45,7 +45,6 @@ struct DECLSPEC_NOVTABLE ChromeFrameAutomationProxy { // NOLINT
virtual void ReleaseTabProxy(AutomationHandle handle) = 0;
virtual std::string server_version() = 0;
- virtual void SendProxyConfig(const std::string&) = 0;
protected:
virtual ~ChromeFrameAutomationProxy() {}
};
@@ -84,10 +83,6 @@ class ChromeFrameAutomationProxyImpl
return AutomationProxy::Send(msg);
}
- virtual void SendProxyConfig(const std::string& p) {
- AutomationProxy::SendProxyConfig(p);
- }
-
protected:
friend class AutomationProxyCacheEntry;
ChromeFrameAutomationProxyImpl(AutomationProxyCacheEntry* entry,
@@ -318,19 +313,11 @@ class ChromeFrameAutomationClient
const std::string& referrer,
NavigationConstraints* navigation_constraints);
- virtual bool NavigateToIndex(int index);
- bool ForwardMessageFromExternalHost(const std::string& message,
- const std::string& origin,
- const std::string& target);
- bool SetProxySettings(const std::string& json_encoded_proxy_settings);
-
void FindInPage(const std::wstring& search_string,
FindInPageDirection forward,
FindInPageCase match_case,
bool find_next);
- virtual void OnChromeFrameHostMoved();
-
TabProxy* tab() const { return tab_.get(); }
BEGIN_MSG_MAP(ChromeFrameAutomationClient)
@@ -338,16 +325,9 @@ class ChromeFrameAutomationClient
TaskMarshallerThroughWindowsMessages<ChromeFrameAutomationClient>)
END_MSG_MAP()
- // Resizes the hosted chrome window. This is brokered to the chrome
- // automation instance as the host browser could be running under low IL,
- // which would cause the SetWindowPos call to fail.
- void Resize(int width, int height, int flags);
-
// Sets the passed in window as the parent of the external tab.
void SetParentWindow(HWND parent_window);
- void SendContextMenuCommandToChromeFrame(int selected_command);
-
HWND tab_window() const {
return tab_window_;
}
@@ -360,10 +340,6 @@ class ChromeFrameAutomationClient
// BitBlts the contents of the chrome window to the print dc.
void Print(HDC print_dc, const RECT& print_bounds);
- // Called in full tab mode and indicates a request to chrome to print
- // the whole tab.
- void PrintTab();
-
void set_use_chrome_network(bool use_chrome_network) {
use_chrome_network_ = use_chrome_network;
}
@@ -385,22 +361,11 @@ class ChromeFrameAutomationClient
// Url request manager set up.
void SetUrlFetcher(PluginUrlRequestManager* url_fetcher);
- // Attaches an existing external tab to this automation client instance.
- void AttachExternalTab(uint64 external_tab_cookie);
- void BlockExternalTab(uint64 cookie);
-
void SetPageFontSize(enum AutomationPageFontSize);
// For IDeleteBrowsingHistorySupport
void RemoveBrowsingData(int remove_mask);
- // Sets the current zoom level on the tab.
- void SetZoomLevel(content::PageZoom zoom_level);
-
- // Fires before unload and unload handlers on the page if any. Allows the
- // the website to put up a confirmation dialog on unload.
- void OnUnload(bool* should_unload);
-
protected:
// ChromeFrameAutomationProxy::LaunchDelegate implementation.
virtual void LaunchComplete(ChromeFrameAutomationProxy* proxy,
@@ -411,15 +376,6 @@ class ChromeFrameAutomationClient
virtual bool OnMessageReceived(TabProxy* tab, const IPC::Message& msg);
virtual void OnChannelError(TabProxy* tab);
- void CreateExternalTab();
- AutomationLaunchResult CreateExternalTabComplete(HWND chrome_window,
- HWND tab_window,
- int tab_handle,
- int session_id);
- // Called in UI thread. Here we fire event to the client notifying for
- // the result of Initialize() method call.
- void InitializeComplete(AutomationLaunchResult result);
-
virtual void OnFinalMessage(HWND wnd) {
Release();
}
@@ -433,7 +389,6 @@ class ChromeFrameAutomationClient
void OnChannelErrorUIThread();
HWND chrome_window() const { return chrome_window_; }
- void BeginNavigate();
void BeginNavigateCompleted(AutomationMsg_NavigationResponseValues result);
// Helpers
@@ -489,8 +444,6 @@ class ChromeFrameAutomationClient
int tab_handle_;
// The SessionId used by Chrome as the id in the Javascript Tab object.
int session_id_;
- // Only used if we attach to an existing tab.
- uint64 external_tab_cookie_;
// Set to true if we received a navigation request prior to the automation
// server being initialized.
diff --git a/chrome_frame/chrome_frame_delegate.cc b/chrome_frame/chrome_frame_delegate.cc
index ab5adee..2914219 100644
--- a/chrome_frame/chrome_frame_delegate.cc
+++ b/chrome_frame/chrome_frame_delegate.cc
@@ -11,27 +11,9 @@
bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message) {
bool is_tab_message = true;
IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, message)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationStateChanged, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_UpdateTargetUrl, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_HandleAccelerator, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_TabbedOut, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_OpenURL, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_NavigationFailed, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_DidNavigate, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_TabLoaded, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_MoveWindow, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(
- AutomationMsg_ForwardMessageToExternalHost, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(
- AutomationMsg_ForwardContextMenuToExternalHost, NO_CODE)
IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestStart, NO_CODE)
IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestRead, NO_CODE)
IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_RequestEnd, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_DownloadRequestInHost, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_AttachExternalTab, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(
- AutomationMsg_RequestGoToHistoryEntryOffset, NO_CODE)
- IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_CloseExternalTab, NO_CODE)
IPC_MESSAGE_UNHANDLED(is_tab_message = false);
IPC_END_MESSAGE_MAP()
@@ -49,30 +31,9 @@ bool ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, msg)
- IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged,
- OnNavigationStateChanged)
- IPC_MESSAGE_HANDLER(AutomationMsg_UpdateTargetUrl, OnUpdateTargetUrl)
- IPC_MESSAGE_HANDLER(AutomationMsg_HandleAccelerator,
- OnAcceleratorPressed)
- 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, OnLoad)
- IPC_MESSAGE_HANDLER(AutomationMsg_MoveWindow, OnMoveWindow)
- IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost,
- OnMessageFromChromeFrame)
- IPC_MESSAGE_HANDLER(AutomationMsg_ForwardContextMenuToExternalHost,
- OnHandleContextMenu)
IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnRequestStart)
IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnRequestRead)
IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnRequestEnd)
- IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost,
- OnDownloadRequestInHost)
- IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab)
- IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset,
- OnGoToHistoryEntryOffset)
- IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnCloseTab)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
diff --git a/chrome_frame/chrome_frame_delegate.h b/chrome_frame/chrome_frame_delegate.h
index 0bee663..9df536b 100644
--- a/chrome_frame/chrome_frame_delegate.h
+++ b/chrome_frame/chrome_frame_delegate.h
@@ -20,10 +20,8 @@
#include "ipc/ipc_message.h"
class GURL;
-struct AttachExternalTabParams;
struct AutomationURLRequest;
struct ContextMenuModel;
-struct MiniContextMenuParams;
struct NavigationInfo;
namespace net {
@@ -57,10 +55,6 @@ class ChromeFrameDelegate {
// messages.
virtual bool IsValid() const = 0;
- // To be called when the top-most window of an application hosting
- // ChromeFrame is moved.
- virtual void OnHostMoved() = 0;
-
protected:
virtual ~ChromeFrameDelegate() {}
};
@@ -86,37 +80,13 @@ class ChromeFrameDelegateImpl : public ChromeFrameDelegate {
return true;
}
- virtual void OnHostMoved() {}
-
protected:
// Protected methods to be overridden.
- 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 OnMoveWindow(const gfx::Rect& pos) {}
- virtual void OnMessageFromChromeFrame(const std::string& message,
- const std::string& origin,
- const std::string& target) {}
- virtual void OnHandleContextMenu(const ContextMenuModel& context_menu_model,
- 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 net::URLRequestStatus& status) {}
- virtual void OnDownloadRequestInHost(int request_id) {}
- virtual void OnAttachExternalTab(
- const AttachExternalTabParams& attach_params) {}
- virtual void OnGoToHistoryEntryOffset(int offset) {}
- virtual void OnCloseTab() {}
};
// This interface enables tasks to be marshaled to desired threads.
diff --git a/chrome_frame/chrome_frame_plugin.cc b/chrome_frame/chrome_frame_plugin.cc
deleted file mode 100644
index f665e51..0000000
--- a/chrome_frame/chrome_frame_plugin.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome_frame/chrome_frame_plugin.h"
-
-#include "chrome/common/automation_messages.h"
-
-void ChromeFramePluginGetParamsCoordinates(const MiniContextMenuParams& params,
- int* x,
- int* y) {
- *x = params.screen_x;
- *y = params.screen_y;
-}
diff --git a/chrome_frame/chrome_frame_plugin.h b/chrome_frame/chrome_frame_plugin.h
index 4ac984e..e796737 100644
--- a/chrome_frame/chrome_frame_plugin.h
+++ b/chrome_frame/chrome_frame_plugin.h
@@ -20,12 +20,6 @@
#define IDC_ABOUT_CHROME_FRAME 40018
-// Helper so that this file doesn't include the messages header.
-void ChromeFramePluginGetParamsCoordinates(
- const MiniContextMenuParams& params,
- int* x,
- int* y);
-
// A class to implement common functionality for all types of
// plugins: ActiveX and ActiveDoc
template <typename T>
@@ -41,7 +35,6 @@ class ChromeFramePlugin
BEGIN_MSG_MAP(T)
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
- MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_PARENTNOTIFY, OnParentNotify)
END_MSG_MAP()
@@ -108,68 +101,9 @@ END_MSG_MAP()
return automation_client_.get() != NULL;
}
- virtual void OnHostMoved() {
- if (IsValid())
- automation_client_->OnChromeFrameHostMoved();
- }
-
protected:
- virtual void OnNavigationFailed(int error_code, const GURL& gurl) {
- OnLoadFailed(error_code, gurl.spec());
- }
-
- virtual void OnHandleContextMenu(const ContextMenuModel& menu_model,
- int align_flags,
- const MiniContextMenuParams& params) {
- if (!automation_client_.get()) {
- NOTREACHED();
- return;
- }
-
- HMENU menu = BuildContextMenu(menu_model);
- if (!menu)
- return;
-
- T* self = static_cast<T*>(this);
- if (self->PreProcessContextMenu(menu)) {
- // In order for the context menu to handle keyboard input, give the
- // ActiveX window focus.
- ignore_setfocus_ = true;
- SetFocus(GetWindow());
- ignore_setfocus_ = false;
- UINT flags = align_flags | TPM_LEFTBUTTON | TPM_RETURNCMD | TPM_RECURSE;
- int x, y;
- ChromeFramePluginGetParamsCoordinates(params, &x, &y);
- UINT selected = TrackPopupMenuEx(menu, flags, x, y, GetWindow(), NULL);
- // Menu is over now give focus back to chrome
- GiveFocusToChrome(false);
- if (IsValid() && selected != 0 &&
- !self->HandleContextMenuCommand(selected, params)) {
- automation_client_->SendContextMenuCommandToChromeFrame(selected);
- }
- }
-
- DestroyMenu(menu);
- }
-
LRESULT OnSetFocus(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled) { // NO_LINT
- if (!ignore_setfocus_ && IsValid()) {
- // Pass false to |restore_focus_view|, because we do not want Chrome
- // to focus the first focusable element in the current view, only the
- // view itself.
- GiveFocusToChrome(false);
- }
- return 0;
- }
-
- LRESULT OnSize(UINT message, WPARAM wparam, LPARAM lparam,
- BOOL& handled) { // NO_LINT
- handled = FALSE;
- // When we get resized, we need to resize the external tab window too.
- if (IsValid())
- automation_client_->Resize(LOWORD(lparam), HIWORD(lparam),
- SWP_NOACTIVATE | SWP_NOZORDER);
return 0;
}
@@ -214,29 +148,11 @@ END_MSG_MAP()
return true;
}
- // 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 MiniContextMenuParams& params) {
- return false;
- }
-
// Allow overriding the type of automation client used, for unit tests.
virtual ChromeFrameAutomationClient* CreateAutomationClient() {
return new ChromeFrameAutomationClient;
}
- void GiveFocusToChrome(bool restore_focus_to_view) {
- if (IsValid()) {
- TabProxy* tab = automation_client_->tab();
- HWND chrome_window = automation_client_->tab_window();
- if (tab && ::IsWindow(chrome_window)) {
- DVLOG(1) << "Setting initial focus";
- tab->SetInitialFocus(base::win::IsShiftPressed(), restore_focus_to_view);
- }
- }
- }
-
virtual void GetProfilePath(const std::wstring& profile_name,
base::FilePath* profile_path) {
return GetChromeFrameProfilePath(profile_name, profile_path);
diff --git a/chrome_frame/custom_sync_call_context.cc b/chrome_frame/custom_sync_call_context.cc
index 9544b4b..71ca0a2 100644
--- a/chrome_frame/custom_sync_call_context.cc
+++ b/chrome_frame/custom_sync_call_context.cc
@@ -6,21 +6,6 @@
#include "base/bind.h"
-CreateExternalTabContext::CreateExternalTabContext(
- ChromeFrameAutomationClient* client)
- : client_(client) {
-}
-
-void CreateExternalTabContext::Completed(
- HWND chrome_window, HWND tab_window, int tab_handle, int session_id) {
- AutomationLaunchResult launch_result =
- client_->CreateExternalTabComplete(chrome_window, tab_window,
- tab_handle, session_id);
- client_->PostTask(
- FROM_HERE, base::Bind(&ChromeFrameAutomationClient::InitializeComplete,
- client_.get(), launch_result));
-}
-
BeginNavigateContext::BeginNavigateContext(ChromeFrameAutomationClient* client)
: client_(client) {
}
diff --git a/chrome_frame/custom_sync_call_context.h b/chrome_frame/custom_sync_call_context.h
index 58b9c5a..0d9ff53 100644
--- a/chrome_frame/custom_sync_call_context.h
+++ b/chrome_frame/custom_sync_call_context.h
@@ -14,21 +14,6 @@
#include "chrome_frame/chrome_frame_automation.h"
#include "ipc/ipc_sync_message.h"
-// Class that maintains contextual information for the create and connect
-// external tab operations.
-class CreateExternalTabContext
- : public SyncMessageReplyDispatcher::SyncMessageCallContext {
- public:
- typedef Tuple4<HWND, HWND, int, int> output_type;
- explicit CreateExternalTabContext(ChromeFrameAutomationClient* client);
-
- void Completed(HWND chrome_window, HWND tab_window, int tab_handle,
- int session_id);
-
- private:
- scoped_refptr<ChromeFrameAutomationClient> client_;
-};
-
// This class maintains context information for the BeginNavigate operations
// pertaining to the external tab.
class BeginNavigateContext
diff --git a/chrome_frame/delete_chrome_history.cc b/chrome_frame/delete_chrome_history.cc
index 0d1fa38..fcd4fd6 100644
--- a/chrome_frame/delete_chrome_history.cc
+++ b/chrome_frame/delete_chrome_history.cc
@@ -31,9 +31,6 @@ HRESULT DeleteChromeHistory::FinalConstruct() {
}
void DeleteChromeHistory::OnAutomationServerReady() {
- DVLOG(1) << __FUNCTION__;
- automation_client_->RemoveBrowsingData(remove_mask_);
- loop_.Quit();
}
void DeleteChromeHistory::OnAutomationServerLaunchFailed(
diff --git a/chrome_frame/plugin_url_request.h b/chrome_frame/plugin_url_request.h
index edd724a..ba1e1d1 100644
--- a/chrome_frame/plugin_url_request.h
+++ b/chrome_frame/plugin_url_request.h
@@ -81,10 +81,6 @@ class DECLSPEC_NOVTABLE PluginUrlRequestManager { // NOLINT
EndRequest(request_id);
}
- void DownloadUrlRequestInHost(int request_id) {
- DownloadRequestInHost(request_id);
- }
-
void StopAllRequests() {
StopAll();
}
@@ -98,7 +94,6 @@ class DECLSPEC_NOVTABLE PluginUrlRequestManager { // NOLINT
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;
virtual void StopAll() = 0;
};
diff --git a/chrome_frame/test/automation_client_mock.cc b/chrome_frame/test/automation_client_mock.cc
index 2bd0c64..6bc6e28 100644
--- a/chrome_frame/test/automation_client_mock.cc
+++ b/chrome_frame/test/automation_client_mock.cc
@@ -173,302 +173,3 @@ TEST_F(CFACWithChrome, CreateNotSoFast) {
loop_.RunFor(kChromeLaunchTimeout);
}
-
-TEST_F(CFACWithChrome, NavigateOk) {
- NavigationConstraintsImpl navigation_constraints;
-
- const std::string url = "about:version";
-
- EXPECT_CALL(cfd_, OnAutomationServerReady())
- .WillOnce(InitiateNavigation(client_.get(), url, std::string(),
- &navigation_constraints));
-
- EXPECT_CALL(cfd_, GetBounds(_)).Times(testing::AnyNumber());
-
- EXPECT_CALL(cfd_, OnNavigationStateChanged(_))
- .Times(testing::AnyNumber());
-
- {
- testing::InSequence s;
-
- EXPECT_CALL(cfd_, OnDidNavigate(EqNavigationInfoUrl(GURL())))
- .Times(1);
-
- EXPECT_CALL(cfd_, OnUpdateTargetUrl(_)).Times(testing::AtMost(1));
-
- EXPECT_CALL(cfd_, OnLoad(_))
- .WillOnce(QUIT_LOOP(loop_));
- }
-
- EXPECT_TRUE(client_->Initialize(&cfd_, launch_params_));
- loop_.RunFor(kChromeLaunchTimeout);
-}
-
-TEST_F(CFACWithChrome, NavigateFailed) {
- NavigationConstraintsImpl navigation_constraints;
- const std::string url = "http://127.0.0.3:65412/";
- const net::URLRequestStatus connection_failed(net::URLRequestStatus::FAILED,
- net::ERR_INVALID_URL);
-
- cfd_.SetRequestDelegate(client_);
-
- EXPECT_CALL(cfd_, OnAutomationServerReady())
- .WillOnce(testing::IgnoreResult(testing::InvokeWithoutArgs(CreateFunctor(
- client_.get(), &ChromeFrameAutomationClient::InitiateNavigation,
- url, std::string(), &navigation_constraints))));
-
- EXPECT_CALL(cfd_, GetBounds(_)).Times(testing::AnyNumber());
- EXPECT_CALL(cfd_, OnNavigationStateChanged(_)).Times(testing::AnyNumber());
-
- EXPECT_CALL(cfd_, OnRequestStart(_, _))
- // Often there's another request for the error page
- .Times(testing::Between(1, 2))
- .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_, OnNavigationFailed(_, GURL(url)))
- .Times(1)
- .WillOnce(QUIT_LOOP_SOON(loop_, base::TimeDelta::FromSeconds(2)));
-
- EXPECT_TRUE(client_->Initialize(&cfd_, launch_params_));
-
- loop_.RunFor(kChromeLaunchTimeout);
-}
-
-TEST_F(CFACMockTest, MockedCreateTabOk) {
- int timeout = 500;
- CreateTab();
- SetAutomationServerOk(1);
-
- EXPECT_CALL(mock_proxy_, server_version()).Times(testing::AnyNumber())
- .WillRepeatedly(Return(""));
-
- // We need some valid HWNDs, when responding to CreateExternalTab
- HWND h1 = ::GetDesktopWindow();
- HWND h2 = ::GetDesktopWindow();
- EXPECT_CALL(mock_proxy_, SendAsAsync(testing::Property(
- &IPC::SyncMessage::type, AutomationMsg_CreateExternalTab::ID),
- testing::NotNull(), _))
- .Times(1).WillOnce(HandleCreateTab(tab_handle_, h1, h2, 99));
-
- EXPECT_CALL(mock_proxy_, CreateTabProxy(testing::Eq(tab_handle_)))
- .WillOnce(Return(tab_));
-
- EXPECT_CALL(cfd_, OnAutomationServerReady())
- .WillOnce(QUIT_LOOP(loop_));
-
- EXPECT_CALL(mock_proxy_, CancelAsync(_)).Times(testing::AnyNumber());
-
- // Here we go!
- GURL empty;
- scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
- empty, empty, profile_path_, profile_path_.BaseName().value(), L"",
- false, false, false));
- clp->set_launch_timeout(timeout);
- clp->set_version_check(false);
- EXPECT_TRUE(client_->Initialize(&cfd_, clp));
- loop_.RunFor(base::TimeDelta::FromSeconds(10));
-
- EXPECT_CALL(mock_proxy_, ReleaseTabProxy(testing::Eq(tab_handle_))).Times(1);
- client_->Uninitialize();
-}
-
-TEST_F(CFACMockTest, MockedCreateTabFailed) {
- HWND null_wnd = NULL;
- SetAutomationServerOk(1);
-
- EXPECT_CALL(mock_proxy_, server_version()).Times(testing::AnyNumber())
- .WillRepeatedly(Return(""));
-
- EXPECT_CALL(mock_proxy_, SendAsAsync(testing::Property(
- &IPC::SyncMessage::type, AutomationMsg_CreateExternalTab::ID),
- testing::NotNull(), _))
- .Times(1).WillOnce(HandleCreateTab(tab_handle_, null_wnd, null_wnd,
- 99));
-
- EXPECT_CALL(mock_proxy_, CreateTabProxy(_)).Times(0);
-
- EXPECT_CALL(mock_proxy_, CancelAsync(_)).Times(testing::AnyNumber());
-
- Set_CFD_LaunchFailed(AUTOMATION_CREATE_TAB_FAILED);
-
- // Here we go!
- GURL empty;
- scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
- empty, empty, profile_path_, profile_path_.BaseName().value(), L"",
- false, false, false));
- clp->set_launch_timeout(timeout_);
- clp->set_version_check(false);
- EXPECT_TRUE(client_->Initialize(&cfd_, clp));
- loop_.RunFor(base::TimeDelta::FromSeconds(4));
- client_->Uninitialize();
-}
-
-class TestChromeFrameAutomationProxyImpl
- : public ChromeFrameAutomationProxyImpl {
- public:
- TestChromeFrameAutomationProxyImpl()
- // 1 is an unneeded timeout.
- : ChromeFrameAutomationProxyImpl(
- NULL,
- AutomationProxy::GenerateChannelID(),
- base::TimeDelta::FromMilliseconds(1)) {
- }
- MOCK_METHOD3(
- SendAsAsync,
- void(IPC::SyncMessage* msg,
- SyncMessageReplyDispatcher::SyncMessageCallContext* context,
- void* key));
- void FakeChannelError() {
- reinterpret_cast<IPC::ChannelProxy::MessageFilter*>(message_filter_.get())->
- OnChannelError();
- }
-};
-
-TEST_F(CFACMockTest, OnChannelErrorEmpty) {
- TestChromeFrameAutomationProxyImpl proxy;
-
- // No tabs should do nothing yet still not fail either.
- proxy.FakeChannelError();
-}
-
-TEST_F(CFACMockTest, OnChannelError) {
- const base::TimeDelta loop_duration = base::TimeDelta::FromSeconds(11);
- TestChromeFrameAutomationProxyImpl proxy;
- returned_proxy_ = &proxy;
-
- GURL empty;
- scoped_refptr<ChromeFrameLaunchParams> clp(new ChromeFrameLaunchParams(
- empty, empty, profile_path_, profile_path_.BaseName().value(), L"",
- false, false, false));
- clp->set_launch_timeout(1); // Unneeded timeout, but can't be 0.
- clp->set_version_check(false);
-
- HWND h1 = ::GetDesktopWindow();
- HWND h2 = ::GetDesktopWindow();
- EXPECT_CALL(proxy, SendAsAsync(testing::Property(
- &IPC::SyncMessage::type, AutomationMsg_CreateExternalTab::ID),
- testing::NotNull(), _)).Times(3)
- .WillOnce(HandleCreateTab(tab_handle_, h1, h2, 99))
- .WillOnce(HandleCreateTab(tab_handle_ * 2, h1, h2, 100))
- .WillOnce(HandleCreateTab(tab_handle_ * 3, h1, h2, 101));
-
- SetAutomationServerOk(3);
-
- // First, try a single tab and make sure the notification find its way to the
- // Chrome Frame Delegate.
- StrictMock<MockCFDelegate> cfd1;
- scoped_refptr<ChromeFrameAutomationClient> client1;
- client1 = new ChromeFrameAutomationClient;
- client1->set_proxy_factory(&factory_);
-
- EXPECT_CALL(cfd1, OnAutomationServerReady()).WillOnce(QUIT_LOOP(loop_));
- EXPECT_TRUE(client1->Initialize(&cfd1, clp));
- // Wait for OnAutomationServerReady to be called in the UI thread.
- loop_.RunFor(loop_duration);
-
- proxy.FakeChannelError();
- EXPECT_CALL(cfd1, OnChannelError()).WillOnce(QUIT_LOOP(loop_));
- // Wait for OnChannelError to be propagated to delegate from the UI thread.
- loop_.RunFor(loop_duration);
-
- // Add a second tab using a different delegate.
- StrictMock<MockCFDelegate> cfd2;
- scoped_refptr<ChromeFrameAutomationClient> client2;
- client2 = new ChromeFrameAutomationClient;
- client2->set_proxy_factory(&factory_);
-
- EXPECT_CALL(cfd2, OnAutomationServerReady()).WillOnce(QUIT_LOOP(loop_));
- EXPECT_TRUE(client2->Initialize(&cfd2, clp));
- // Wait for OnAutomationServerReady to be called in the UI thread.
- loop_.RunFor(loop_duration);
-
- EXPECT_CALL(cfd1, OnChannelError()).Times(1);
- EXPECT_CALL(cfd2, OnChannelError()).WillOnce(QUIT_LOOP(loop_));
- proxy.FakeChannelError();
- // Wait for OnChannelError to be propagated to delegate from the UI thread.
- loop_.RunFor(loop_duration);
-
- // And now a 3rd tab using the first delegate.
- scoped_refptr<ChromeFrameAutomationClient> client3;
- client3 = new ChromeFrameAutomationClient;
- client3->set_proxy_factory(&factory_);
-
- EXPECT_CALL(cfd1, OnAutomationServerReady()).WillOnce(QUIT_LOOP(loop_));
- EXPECT_TRUE(client3->Initialize(&cfd1, clp));
- // Wait for OnAutomationServerReady to be called in the UI thread.
- loop_.RunFor(loop_duration);
-
- EXPECT_CALL(cfd2, OnChannelError()).Times(1);
- EXPECT_CALL(cfd1, OnChannelError()).Times(2).WillOnce(Return())
- .WillOnce(QUIT_LOOP(loop_));
- proxy.FakeChannelError();
- // Wait for OnChannelError to be propagated to delegate from the UI thread.
- loop_.RunFor(loop_duration);
-
- // Cleanup.
- client1->Uninitialize();
- client2->Uninitialize();
- client3->Uninitialize();
- client1 = NULL;
- client2 = NULL;
- client3 = NULL;
-}
-
-TEST_F(CFACMockTest, NavigateTwiceAfterInitToSameUrl) {
- int timeout = 500;
- NavigationConstraintsImpl navigation_constraints;
-
- CreateTab();
- SetAutomationServerOk(1);
-
- EXPECT_CALL(mock_proxy_, server_version()).Times(testing::AnyNumber())
- .WillRepeatedly(Return(""));
-
- // We need some valid HWNDs, when responding to CreateExternalTab
- HWND h1 = ::GetDesktopWindow();
- HWND h2 = ::GetDesktopWindow();
- EXPECT_CALL(mock_proxy_, SendAsAsync(testing::Property(
- &IPC::SyncMessage::type, AutomationMsg_CreateExternalTab::ID),
- testing::NotNull(), _))
- .Times(1).WillOnce(HandleCreateTab(tab_handle_, h1, h2, 99));
-
- EXPECT_CALL(mock_proxy_, CreateTabProxy(testing::Eq(tab_handle_)))
- .WillOnce(Return(tab_));
-
- EXPECT_CALL(cfd_, OnAutomationServerReady())
- .WillOnce(InitiateNavigation(client_.get(),
- std::string("http://www.nonexistent.com"),
- std::string(), &navigation_constraints));
-
- EXPECT_CALL(mock_proxy_, SendAsAsync(testing::Property(
- &IPC::SyncMessage::type, AutomationMsg_NavigateInExternalTab::ID),
- testing::NotNull(), _))
- .Times(1).WillOnce(QUIT_LOOP(loop_));
-
- EXPECT_CALL(mock_proxy_, CancelAsync(_)).Times(testing::AnyNumber());
-
- EXPECT_CALL(mock_proxy_, Send(
- testing::Property(&IPC::Message::type, AutomationMsg_TabReposition::ID)))
- .Times(1)
- .WillOnce(Return(true));
-
- EXPECT_CALL(cfd_, GetBounds(_)).Times(1);
-
- // Here we go!
- GURL empty;
- scoped_refptr<ChromeFrameLaunchParams> launch_params(
- new ChromeFrameLaunchParams(
- GURL("http://www.nonexistent.com"), empty, profile_path_,
- profile_path_.BaseName().value(), L"", false, false, false));
- launch_params->set_launch_timeout(timeout);
- launch_params->set_version_check(false);
- EXPECT_TRUE(client_->Initialize(&cfd_, launch_params));
- loop_.RunFor(base::TimeDelta::FromSeconds(10));
-
- EXPECT_CALL(mock_proxy_, ReleaseTabProxy(testing::Eq(tab_handle_))).Times(1);
- client_->Uninitialize();
-}
diff --git a/chrome_frame/test/automation_client_mock.h b/chrome_frame/test/automation_client_mock.h
index 1abedf4..131bb8e 100644
--- a/chrome_frame/test/automation_client_mock.h
+++ b/chrome_frame/test/automation_client_mock.h
@@ -36,22 +36,7 @@ struct MockCFDelegate : public ChromeFrameDelegateImpl {
// MOCK_METHOD1(OnMessageReceived, void(const IPC::Message&));
MOCK_METHOD0(OnChannelError, void(void));
- MOCK_METHOD1(OnNavigationStateChanged, void(int flags));
- MOCK_METHOD1(OnUpdateTargetUrl, void(
- const std::wstring& new_target_url));
- 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_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));
@@ -95,7 +80,6 @@ class MockAutomationProxy : public ChromeFrameAutomationProxy {
MOCK_METHOD1(CreateTabProxy, scoped_refptr<TabProxy>(int handle));
MOCK_METHOD1(ReleaseTabProxy, void(AutomationHandle handle));
MOCK_METHOD0(server_version, std::string(void));
- MOCK_METHOD1(SendProxyConfig, void(const std::string&));
~MockAutomationProxy() {}
};
diff --git a/chrome_frame/test/chrome_frame_automation_mock.cc b/chrome_frame/test/chrome_frame_automation_mock.cc
index 06c456b..bd343ba 100644
--- a/chrome_frame/test/chrome_frame_automation_mock.cc
+++ b/chrome_frame/test/chrome_frame_automation_mock.cc
@@ -21,46 +21,3 @@ TEST(ChromeFrame, Launch) {
run_loop.Run();
EXPECT_TRUE(mock_launch.launch_result());
}
-
-TEST(ChromeFrame, Navigate) {
- base::MessageLoopForUI loop;
- AutomationMockNavigate mock_navigate(&loop,
- kLongWaitTimeout.InMilliseconds());
-
- loop.PostDelayedTask(
- FROM_HERE, base::MessageLoop::QuitClosure(), kLongWaitTimeout);
-
- mock_navigate.NavigateRelativeFile(L"postmessage_basic_frame.html");
- base::RunLoop run_loop(NULL);
- run_loop.Run();
- EXPECT_FALSE(mock_navigate.navigation_result());
-}
-
-TEST(ChromeFrame, PostMessage) {
- base::MessageLoopForUI loop;
- AutomationMockPostMessage mock_postmessage(&loop,
- kLongWaitTimeout.InMilliseconds());
-
- loop.PostDelayedTask(
- FROM_HERE, base::MessageLoop::QuitClosure(), kLongWaitTimeout);
-
- mock_postmessage.NavigateRelativeFile(L"postmessage_basic_frame.html");
- base::RunLoop run_loop(NULL);
- run_loop.Run();
- EXPECT_FALSE(mock_postmessage.postmessage_result());
-}
-
-TEST(ChromeFrame, RequestStart) {
- base::MessageLoopForUI loop;
- AutomationMockHostNetworkRequestStart mock_request_start(
- &loop, kLongWaitTimeout.InMilliseconds());
-
- loop.PostDelayedTask(
- FROM_HERE, base::MessageLoop::QuitClosure(), kLongWaitTimeout);
-
- mock_request_start.NavigateRelative(L"postmessage_basic_frame.html");
- base::RunLoop run_loop(NULL);
- run_loop.Run();
- EXPECT_TRUE(mock_request_start.request_start_result());
-}
-
diff --git a/chrome_frame/test/chrome_frame_automation_mock.h b/chrome_frame/test/chrome_frame_automation_mock.h
index e8e2a39..0b383e4 100644
--- a/chrome_frame/test/chrome_frame_automation_mock.h
+++ b/chrome_frame/test/chrome_frame_automation_mock.h
@@ -104,14 +104,6 @@ class AutomationMockDelegate
QuitMessageLoop();
}
- virtual void OnLoad(const GURL& url) {
- if (url_ == url) {
- navigation_result_ = true;
- } else {
- QuitMessageLoop();
- }
- }
-
virtual void OnLoadFailed(int error_code, const std::string& url) {
navigation_result_ = false;
QuitMessageLoop();
@@ -166,75 +158,4 @@ class AutomationMockLaunch
}
};
-class AutomationMockNavigate
- : public AutomationMockDelegate<AutomationMockNavigate> {
- public:
- typedef AutomationMockDelegate<AutomationMockNavigate> Base;
- AutomationMockNavigate(base::MessageLoop* caller_message_loop,
- int launch_timeout)
- : Base(caller_message_loop, launch_timeout, true, L"", L"", false,
- false) {
- }
- virtual void OnLoad(const GURL& url) {
- Base::OnLoad(url);
- QuitMessageLoop();
- }
-};
-
-class AutomationMockPostMessage
- : public AutomationMockDelegate<AutomationMockPostMessage> {
- public:
- typedef AutomationMockDelegate<AutomationMockPostMessage> Base;
- AutomationMockPostMessage(base::MessageLoop* caller_message_loop,
- int launch_timeout)
- : Base(caller_message_loop, launch_timeout, true, L"", L"", false,
- false),
- postmessage_result_(false) {}
- bool postmessage_result() const {
- return postmessage_result_;
- }
- virtual void OnLoad(const GURL& url) {
- Base::OnLoad(url);
- if (navigation_result()) {
- automation()->ForwardMessageFromExternalHost("Test", "null", "*");
- }
- }
- virtual void OnMessageFromChromeFrame(const std::string& message,
- const std::string& origin,
- const std::string& target) {
- postmessage_result_ = true;
- QuitMessageLoop();
- }
- private:
- bool postmessage_result_;
-};
-
-class AutomationMockHostNetworkRequestStart
- : public AutomationMockDelegate<AutomationMockHostNetworkRequestStart> {
- public:
- typedef AutomationMockDelegate<AutomationMockHostNetworkRequestStart> Base;
- AutomationMockHostNetworkRequestStart(base::MessageLoop* caller_message_loop,
- int launch_timeout)
- : Base(caller_message_loop, launch_timeout, true, L"", L"", false,
- false),
- request_start_result_(false) {
- if (automation()) {
- automation()->set_use_chrome_network(false);
- }
- }
- bool request_start_result() const {
- return request_start_result_;
- }
- virtual void OnRequestStart(int request_id,
- const AutomationURLRequest& request) {
- request_start_result_ = true;
- QuitMessageLoop();
- }
- virtual void OnLoad(const GURL& url) {
- Base::OnLoad(url);
- }
- private:
- bool request_start_result_;
-};
-
#endif // CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_
diff --git a/chrome_frame/test/net/test_automation_provider.cc b/chrome_frame/test/net/test_automation_provider.cc
index 9acec9a..57095de 100644
--- a/chrome_frame/test/net/test_automation_provider.cc
+++ b/chrome_frame/test/net/test_automation_provider.cc
@@ -57,19 +57,6 @@ bool TestAutomationProvider::OnMessageReceived(const IPC::Message& msg) {
return __super::OnMessageReceived(msg);
}
-// IPC override to grab the tab handle.
-bool TestAutomationProvider::Send(IPC::Message* msg) {
- if (msg->type() == AutomationMsg_TabLoaded::ID) {
- DCHECK(tab_handle_ == -1) << "Currently only support one tab";
- tab_handle_ = msg->routing_id();
- DVLOG(1) << "Got tab handle: " << tab_handle_;
- DCHECK(tab_handle_ != -1 && tab_handle_ != 0);
- delegate_->OnInitialTabLoaded();
- }
-
- return AutomationProvider::Send(msg);
-}
-
net::URLRequestJob* TestAutomationProvider::Factory(
net::URLRequest* request,
net::NetworkDelegate* network_delegate,
diff --git a/chrome_frame/test/net/test_automation_provider.h b/chrome_frame/test/net/test_automation_provider.h
index 2c84d76..04c4e52 100644
--- a/chrome_frame/test/net/test_automation_provider.h
+++ b/chrome_frame/test/net/test_automation_provider.h
@@ -39,7 +39,6 @@ class TestAutomationProvider
// AutomationProvider overrides.
virtual bool OnMessageReceived(const IPC::Message& msg);
- virtual bool Send(IPC::Message* msg);
// Protocol factory for handling http/https requests over automation.
static net::URLRequestJob* Factory(net::URLRequest* request,
diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc
index ec592c8..078aa9c 100644
--- a/chrome_frame/urlmon_url_request.cc
+++ b/chrome_frame/urlmon_url_request.cc
@@ -1156,54 +1156,10 @@ void UrlmonUrlRequestManager::ReadRequest(int request_id, int bytes_to_read) {
DLOG(ERROR) << __FUNCTION__ << " no request found for " << request_id;
}
-void UrlmonUrlRequestManager::DownloadRequestInHost(int request_id) {
- DVLOG(1) << __FUNCTION__ << " " << request_id;
- if (!IsWindow(notification_window_)) {
- NOTREACHED() << "Cannot handle download if we don't have anyone to hand it "
- "to.";
- return;
- }
-
- scoped_refptr<UrlmonUrlRequest> request(LookupRequest(request_id,
- &request_map_));
- if (request) {
- DownloadRequestInHostHelper(request);
- } else if (background_worker_thread_enabled_) {
- base::AutoLock lock(background_resource_map_lock_);
- request = LookupRequest(request_id, &background_request_map_);
- if (request) {
- background_thread_->message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&UrlmonUrlRequestManager::DownloadRequestInHostHelper,
- base::Unretained(this), request.get()));
- }
- }
- if (!request)
- DLOG(ERROR) << __FUNCTION__ << " no request found for " << request_id;
-}
-
-void UrlmonUrlRequestManager::DownloadRequestInHostHelper(
- UrlmonUrlRequest* request) {
- DCHECK(request);
- UrlmonUrlRequest::TerminateBindCallback callback =
- base::Bind(&UrlmonUrlRequestManager::BindTerminated,
- base::Unretained(this));
- request->TerminateBind(callback);
-}
-
void UrlmonUrlRequestManager::BindTerminated(IMoniker* moniker,
IBindCtx* bind_ctx,
IStream* post_data,
const char* request_headers) {
- DownloadInHostParams* download_params = new DownloadInHostParams;
- download_params->bind_ctx = bind_ctx;
- download_params->moniker = moniker;
- download_params->post_data = post_data;
- if (request_headers) {
- download_params->request_headers = request_headers;
- }
- ::PostMessage(notification_window_, WM_DOWNLOAD_IN_HOST,
- reinterpret_cast<WPARAM>(download_params), 0);
}
void UrlmonUrlRequestManager::EndRequest(int request_id) {
diff --git a/chrome_frame/urlmon_url_request.h b/chrome_frame/urlmon_url_request.h
index 2138fe1..4ae2783 100644
--- a/chrome_frame/urlmon_url_request.h
+++ b/chrome_frame/urlmon_url_request.h
@@ -84,7 +84,6 @@ class UrlmonUrlRequestManager
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);
virtual void StopAll();
// PluginUrlRequestDelegate implementation
@@ -103,9 +102,6 @@ class UrlmonUrlRequestManager
void BindTerminated(IMoniker* moniker, IBindCtx* bind_ctx,
IStream* post_data, const char* request_headers);
- // Helper function to initiate a download request in the host.
- void DownloadRequestInHostHelper(UrlmonUrlRequest* request);
-
// Map for (request_id <-> UrlmonUrlRequest)
typedef std::map<int, scoped_refptr<UrlmonUrlRequest> > RequestMap;
RequestMap request_map_;
diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc
index 71cb31c..b0efbe74 100644
--- a/chrome_frame/utils.cc
+++ b/chrome_frame/utils.cc
@@ -558,72 +558,6 @@ bool GetModuleVersion(HMODULE module, uint32* high, uint32* low) {
return ok;
}
-namespace {
-
-const int kMaxSubmenuDepth = 10;
-
-// Builds a Windows menu from the menu model sent from Chrome. The
-// caller is responsible for closing the returned HMENU. This does
-// not currently handle bitmaps (e.g. hbmpChecked, hbmpUnchecked or
-// hbmpItem), so checkmarks, radio buttons, and custom icons won't work.
-// It also copies over submenus up to a maximum depth of kMaxSubMenuDepth.
-HMENU BuildContextMenuImpl(const ContextMenuModel* menu_model, int depth) {
- if (depth >= kMaxSubmenuDepth)
- return NULL;
-
- HMENU menu = CreatePopupMenu();
- for (size_t i = 0; i < menu_model->items.size(); i++) {
- const ContextMenuModel::Item& item = menu_model->items[i];
-
- MENUITEMINFO item_info = { 0 };
- item_info.cbSize = sizeof(MENUITEMINFO);
- switch (item.type) {
- case ui::MenuModel::TYPE_COMMAND:
- case ui::MenuModel::TYPE_CHECK:
- item_info.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING;
- item_info.fType = MFT_STRING;
- item_info.wID = item.item_id;
- item_info.dwTypeData = const_cast<LPWSTR>(item.label.c_str());
- break;
- case ui::MenuModel::TYPE_RADIO:
- item_info.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING;
- item_info.fType = MFT_STRING | MFT_RADIOCHECK;
- item_info.wID = item.item_id;
- item_info.dwTypeData = const_cast<LPWSTR>(item.label.c_str());
- break;
- case ui::MenuModel::TYPE_SEPARATOR:
- item_info.fMask = MIIM_FTYPE;
- item_info.fType = MFT_SEPARATOR;
- break;
- case ui::MenuModel::TYPE_SUBMENU:
- item_info.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING | MIIM_SUBMENU;
- item_info.fType = MFT_STRING;
- item_info.wID = item.item_id;
- item_info.dwTypeData = const_cast<LPWSTR>(item.label.c_str());
- item_info.hSubMenu = BuildContextMenuImpl(item.submenu, depth + 1);
- break;
- default:
- NOTREACHED() << "Unsupported MenuModel::ItemType " << item.type;
- break;
- }
-
- item_info.fMask |= MIIM_STATE;
- item_info.fState =
- (item.checked ? MFS_CHECKED : MFS_UNCHECKED) |
- (item.enabled ? MFS_ENABLED : (MFS_DISABLED | MFS_GRAYED));
-
- InsertMenuItem(menu, i, TRUE, &item_info);
- }
-
- return menu;
-}
-
-} // namespace
-
-HMENU BuildContextMenu(const ContextMenuModel& menu_model) {
- return BuildContextMenuImpl(&menu_model, 0);
-}
-
std::string ResolveURL(const std::string& document,
const std::string& relative) {
if (document.empty()) {
diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h
index 1e8e534..b399c70 100644
--- a/chrome_frame/utils.h
+++ b/chrome_frame/utils.h
@@ -231,9 +231,6 @@ bool IsIEInPrivate();
// Calls [ieframe|shdocvw]!DoFileDownload to initiate a download.
HRESULT DoFileDownloadInIE(const wchar_t* url);
-// Construct a menu from the model sent from Chrome.
-HMENU BuildContextMenu(const ContextMenuModel& menu_model);
-
// Uses GURL internally to append 'relative' to 'document'
std::string ResolveURL(const std::string& document,
const std::string& relative);
@@ -429,13 +426,6 @@ HRESULT RewindStream(IStream* stream);
// Fired when we want to notify IE about privacy changes.
#define WM_FIRE_PRIVACY_CHANGE_NOTIFICATION (WM_APP + 1)
-// Sent (not posted) when a request needs to be downloaded in the host browser
-// instead of Chrome. WPARAM is 0 and LPARAM is a pointer to an IMoniker
-// object.
-// NOTE: Since the message is sent synchronously, the handler should only
-// start asynchronous operations in order to not block the sender unnecessarily.
-#define WM_DOWNLOAD_IN_HOST (WM_APP + 2)
-
// This structure contains the parameters sent over to initiate a download
// request in the host browser.
struct DownloadInHostParams {