Pass actual HTTP response code to CefLoadHandler::OnLoadEnd (issue #521).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@922 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
9ce5dc6293
commit
8d37ead057
|
@ -1591,21 +1591,6 @@ void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
|||
has_document_ = true;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidFinishLoad(
|
||||
int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
content::RenderViewHost* render_view_host) {
|
||||
CefRefPtr<CefFrame> frame = GetOrCreateFrame(frame_id,
|
||||
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(),
|
||||
validated_url);
|
||||
|
||||
// Give internal scheme handlers an opportunity to update content.
|
||||
scheme::DidFinishLoad(frame, validated_url);
|
||||
|
||||
OnLoadEnd(frame, validated_url);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidFailLoad(
|
||||
int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
|
@ -1617,7 +1602,7 @@ void CefBrowserHostImpl::DidFailLoad(
|
|||
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(),
|
||||
validated_url);
|
||||
OnLoadError(frame, validated_url, error_code, error_description);
|
||||
OnLoadEnd(frame, validated_url);
|
||||
OnLoadEnd(frame, validated_url, error_code);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::PluginCrashed(const FilePath& plugin_path) {
|
||||
|
@ -1634,6 +1619,7 @@ bool CefBrowserHostImpl::OnMessageReceived(const IPC::Message& message) {
|
|||
IPC_MESSAGE_HANDLER(CefHostMsg_FrameIdentified, OnFrameIdentified)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_FrameDetached, DetachFrame)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_FrameFocusChange, SetFocusedFrame)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_DidFinishLoad, OnDidFinishLoad)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_LoadingURLChange, OnLoadingURLChange)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_Request, OnRequest)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_Response, OnResponse)
|
||||
|
@ -1670,6 +1656,20 @@ void CefBrowserHostImpl::OnFrameIdentified(int64 frame_id,
|
|||
GetOrCreateFrame(frame_id, parent_frame_id, is_main_frame, name, GURL());
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnDidFinishLoad(int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
int http_status_code) {
|
||||
CefRefPtr<CefFrame> frame = GetOrCreateFrame(frame_id,
|
||||
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(),
|
||||
validated_url);
|
||||
|
||||
// Give internal scheme handlers an opportunity to update content.
|
||||
scheme::DidFinishLoad(frame, validated_url);
|
||||
|
||||
OnLoadEnd(frame, validated_url, http_status_code);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnLoadingURLChange(const GURL& loading_url) {
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
loading_url_ = loading_url;
|
||||
|
@ -1952,14 +1952,12 @@ void CefBrowserHostImpl::OnLoadError(CefRefPtr<CefFrame> frame,
|
|||
}
|
||||
|
||||
void CefBrowserHostImpl::OnLoadEnd(CefRefPtr<CefFrame> frame,
|
||||
const GURL& url) {
|
||||
const GURL& url,
|
||||
int http_status_code) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler();
|
||||
if (handler.get()) {
|
||||
// Notify the handler that loading has ended.
|
||||
// TODO(cef): Identify the HTTP status code.
|
||||
handler->OnLoadEnd(this, frame, 200);
|
||||
}
|
||||
if (handler.get())
|
||||
handler->OnLoadEnd(this, frame, http_status_code);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||
CefProcessId target_process,
|
||||
CefRefPtr<CefProcessMessage> message) OVERRIDE;
|
||||
|
||||
|
||||
// Call LifeSpanHandler before destroying. Returns true if destruction
|
||||
// is allowed at this time.
|
||||
bool AllowDestroyBrowser();
|
||||
|
@ -313,11 +312,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||
const string16& error_description,
|
||||
content::RenderViewHost* render_view_host) OVERRIDE;
|
||||
virtual void DocumentAvailableInMainFrame() OVERRIDE;
|
||||
virtual void DidFinishLoad(int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
content::RenderViewHost* render_view_host)
|
||||
OVERRIDE;
|
||||
virtual void DidFailLoad(int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
|
@ -331,6 +325,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||
|
||||
// content::WebContentsObserver::OnMessageReceived() message handlers.
|
||||
void OnFrameIdentified(int64 frame_id, int64 parent_frame_id, string16 name);
|
||||
void OnDidFinishLoad(
|
||||
int64 frame_id,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
int http_status_code);
|
||||
void OnLoadingURLChange(const GURL& pending_url);
|
||||
void OnRequest(const Cef_Request_Params& params);
|
||||
void OnResponse(const Cef_Response_Params& params);
|
||||
|
@ -413,7 +412,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||
int error_code,
|
||||
const string16& error_description);
|
||||
void OnLoadEnd(CefRefPtr<CefFrame> frame,
|
||||
const GURL& url);
|
||||
const GURL& url,
|
||||
int http_status_code);
|
||||
|
||||
// Continuation from RunFileChooser.
|
||||
void RunFileChooserOnUIThread(const content::FileChooserParams& params,
|
||||
|
|
|
@ -172,6 +172,13 @@ IPC_MESSAGE_ROUTED1(CefHostMsg_FrameDetached,
|
|||
IPC_MESSAGE_ROUTED1(CefHostMsg_FrameFocusChange,
|
||||
int64 /* frame_id */)
|
||||
|
||||
// Sent when a frame has finished loading. Based on ViewHostMsg_DidFinishLoad.
|
||||
IPC_MESSAGE_ROUTED4(CefHostMsg_DidFinishLoad,
|
||||
int64 /* frame_id */,
|
||||
GURL /* validated_url */,
|
||||
bool /* is_main_frame */,
|
||||
int /* http_status_code */)
|
||||
|
||||
// Sent when a new URL is about to be loaded in the main frame. Used for the
|
||||
// cookie manager.
|
||||
IPC_MESSAGE_ROUTED1(CefHostMsg_LoadingURLChange,
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "content/public/renderer/navigation_state.h"
|
||||
#include "content/public/renderer/render_view.h"
|
||||
#include "net/http/http_util.h"
|
||||
#include "third_party/WebKit/Source/Platform/chromium/public/WebURLResponse.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
|
||||
|
@ -443,6 +444,15 @@ void CefBrowserImpl::OnDestruct() {
|
|||
CefContentRendererClient::Get()->OnBrowserDestroyed(this);
|
||||
}
|
||||
|
||||
void CefBrowserImpl::DidFinishLoad(WebKit::WebFrame* frame) {
|
||||
WebKit::WebDataSource* ds = frame->dataSource();
|
||||
Send(new CefHostMsg_DidFinishLoad(routing_id(),
|
||||
frame->identifier(),
|
||||
ds->request().url(),
|
||||
!frame->parent(),
|
||||
ds->response().httpStatusCode()));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::DidStartProvisionalLoad(WebKit::WebFrame* frame) {
|
||||
// Send the frame creation notification if necessary.
|
||||
GetWebFrameImpl(frame);
|
||||
|
|
|
@ -104,6 +104,7 @@ class CefBrowserImpl : public CefBrowser,
|
|||
private:
|
||||
// RenderViewObserver methods.
|
||||
virtual void OnDestruct() OVERRIDE;
|
||||
virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE;
|
||||
virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) OVERRIDE;
|
||||
virtual void FrameDetached(WebKit::WebFrame* frame) OVERRIDE;
|
||||
virtual void FocusedNodeChanged(const WebKit::WebNode& node) OVERRIDE;
|
||||
|
|
|
@ -125,9 +125,7 @@ class TestSchemeHandler : public TestHandler {
|
|||
test_results_->got_output.yes();
|
||||
|
||||
// Test that the status code is correct.
|
||||
// TODO(cef): Enable this check once the HTTP status code is passed
|
||||
// correctly.
|
||||
// EXPECT_EQ(httpStatusCode, test_results_->status_code);
|
||||
EXPECT_EQ(httpStatusCode, test_results_->status_code);
|
||||
|
||||
if (test_results_->sub_url.empty())
|
||||
DestroyTest();
|
||||
|
|
Loading…
Reference in New Issue