diff options
author | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-19 00:53:23 +0000 |
---|---|---|
committer | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-19 00:53:23 +0000 |
commit | a1800e8c451736dea5663ae461454ab663d05bc4 (patch) | |
tree | 87ff9157562b9616139bb6154a06902e5ede5287 /chrome_frame/chrome_frame_activex.cc | |
parent | 4f03cbccc4c09db3f053b74393961e8728bceeec (diff) | |
download | chromium_src-a1800e8c451736dea5663ae461454ab663d05bc4.zip chromium_src-a1800e8c451736dea5663ae461454ab663d05bc4.tar.gz chromium_src-a1800e8c451736dea5663ae461454ab663d05bc4.tar.bz2 |
Back/Forward support for url fragments
Added support for anchor (url fragments). this involves
mainly implementing IPersistHistory. The rest of the stuff
is a song and dance to get called in IPersistHistory in the
first place and then behave correctly when we do.
BUG=23981
TEst=unit tests added and back forward with '#' URLs, sub frames etc.
Review URL: http://codereview.chromium.org/371004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32454 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_frame_activex.cc')
-rw-r--r-- | chrome_frame/chrome_frame_activex.cc | 70 |
1 files changed, 2 insertions, 68 deletions
diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc index 16f5dda..297b5ad 100644 --- a/chrome_frame/chrome_frame_activex.cc +++ b/chrome_frame/chrome_frame_activex.cc @@ -21,7 +21,6 @@ #include "chrome/common/chrome_switches.h" #include "chrome/test/automation/tab_proxy.h" #include "googleurl/src/gurl.h" -#include "chrome_frame/com_message_event.h" #include "chrome_frame/utils.h" ChromeFrameActivex::ChromeFrameActivex() { @@ -75,13 +74,7 @@ void ChromeFrameActivex::OnLoad(int tab_handle, const GURL& gurl) { Fire_onload(event); FireEvent(onload_, url); - - HRESULT hr = InvokeScriptFunction(onload_handler_, url); - - if (ready_state_ < READYSTATE_COMPLETE) { - ready_state_ = READYSTATE_COMPLETE; - FireOnChanged(DISPID_READYSTATE); - } + Base::OnLoad(tab_handle, gurl); } void ChromeFrameActivex::OnLoadFailed(int error_code, const std::string& url) { @@ -90,8 +83,7 @@ void ChromeFrameActivex::OnLoadFailed(int error_code, const std::string& url) { Fire_onloaderror(event); FireEvent(onloaderror_, url); - - HRESULT hr = InvokeScriptFunction(onerror_handler_, url); + Base::OnLoadFailed(error_code, url); } void ChromeFrameActivex::OnMessageFromChromeFrame(int tab_handle, @@ -156,38 +148,6 @@ void ChromeFrameActivex::OnExtensionInstalled( Fire_onextensionready(path_str, response); } -HRESULT ChromeFrameActivex::InvokeScriptFunction(const VARIANT& script_object, - const std::string& param) { - ScopedVariant script_arg(UTF8ToWide(param.c_str()).c_str()); - return InvokeScriptFunction(script_object, script_arg.AsInput()); -} - -HRESULT ChromeFrameActivex::InvokeScriptFunction(const VARIANT& script_object, - VARIANT* param) { - return InvokeScriptFunction(script_object, param, 1); -} - -HRESULT ChromeFrameActivex::InvokeScriptFunction(const VARIANT& script_object, - VARIANT* params, - int param_count) { - DCHECK(param_count >= 0); - DCHECK(params); - - if (V_VT(&script_object) != VT_DISPATCH) { - return S_FALSE; - } - - CComPtr<IDispatch> script(script_object.pdispVal); - HRESULT hr = script.InvokeN(static_cast<DISPID>(DISPID_VALUE), - params, - param_count); - // 0x80020101 == SCRIPT_E_REPORTED. - // When the script we're invoking has an error, we get this error back. - DLOG_IF(ERROR, FAILED(hr) && hr != 0x80020101) << "Failed to invoke script"; - - return hr; -} - HRESULT ChromeFrameActivex::OnDraw(ATL_DRAWINFO& draw_info) { // NO_LINT HRESULT hr = S_OK; int dc_type = ::GetObjectType(draw_info.hicTargetDev); @@ -437,32 +397,6 @@ HRESULT ChromeFrameActivex::CreateScriptBlockForEvent( return hr; } -HRESULT ChromeFrameActivex::CreateDomEvent(const std::string& event_type, - const std::string& data, - const std::string& origin, - IDispatch** event) { - DCHECK(event_type.length() > 0); - DCHECK(event != NULL); - - CComObject<ComMessageEvent>* ev = NULL; - HRESULT hr = CComObject<ComMessageEvent>::CreateInstance(&ev); - if (SUCCEEDED(hr)) { - ev->AddRef(); - - ScopedComPtr<IOleContainer> container; - m_spClientSite->GetContainer(container.Receive()); - if (ev->Initialize(container, data, origin, event_type)) { - *event = ev; - } else { - NOTREACHED() << "event->Initialize"; - ev->Release(); - hr = E_UNEXPECTED; - } - } - - return hr; -} - void ChromeFrameActivex::FireEvent(const EventHandlers& handlers, const std::string& arg) { if (handlers.size()) { |