mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-26 17:07:47 +01:00
- Update to Chromium revision 71081.
- Add a new |isMainContent| boolean argument to HandleLoadStart and HandleLoadEnd (issue #166). - Only call HandleAddressChange and HandleTitleChange for the main content load (issue #166). - Pass the URL for new popup windows to HandleBeforeCreated (issue #5). - cefclient: Add a test for XMLHttpRequest. - cefclient: Size popup windows in ClientHandler::HandleBeforeCreated. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@162 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
b8385a7649
commit
bf02152631
@ -61,3 +61,4 @@ Date | CEF Revision | Chromium Revision
|
||||
2010-11-16 | /trunk@138 | /trunk@66269
|
||||
2010-12-16 | /trunk@152 | /trunk@69409
|
||||
2010-01-07 | /trunk@159 | /trunk@70742
|
||||
2010-01-11 | /trunk@162 | /trunk@71081
|
||||
|
10
cef.gyp
10
cef.gyp
@ -137,7 +137,7 @@
|
||||
# Add the WebCore resources to the bundle.
|
||||
'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/',
|
||||
'files': [
|
||||
'../third_party/WebKit/WebCore/Resources/',
|
||||
'../third_party/WebKit/Source/WebCore/Resources/',
|
||||
],
|
||||
},
|
||||
],
|
||||
@ -243,14 +243,16 @@
|
||||
'../third_party/libxml/libxml.gyp:libxml',
|
||||
'../third_party/libxslt/libxslt.gyp:libxslt',
|
||||
'../third_party/modp_b64/modp_b64.gyp:modp_b64',
|
||||
'../third_party/WebKit/WebCore/WebCore.gyp/WebCore.gyp:webcore',
|
||||
'../third_party/WebKit/Source/WebCore/WebCore.gyp/WebCore.gyp:webcore',
|
||||
'../third_party/WebKit/WebKit/chromium/WebKit.gyp:webkit',
|
||||
'../third_party/zlib/zlib.gyp:zlib',
|
||||
'../ui/ui.gyp:ui_base',
|
||||
'../webkit/support/webkit_support.gyp:appcache',
|
||||
'../webkit/support/webkit_support.gyp:blob',
|
||||
'../webkit/support/webkit_support.gyp:database',
|
||||
'../webkit/support/webkit_support.gyp:fileapi',
|
||||
'../webkit/support/webkit_support.gyp:glue',
|
||||
'../webkit/support/webkit_support.gyp:webkit_gpu',
|
||||
'../webkit/support/webkit_support.gyp:webkit_resources',
|
||||
'../webkit/support/webkit_support.gyp:webkit_strings',
|
||||
'libcef_static',
|
||||
@ -442,14 +444,16 @@
|
||||
'../third_party/libxml/libxml.gyp:libxml',
|
||||
'../third_party/libxslt/libxslt.gyp:libxslt',
|
||||
'../third_party/modp_b64/modp_b64.gyp:modp_b64',
|
||||
'../third_party/WebKit/WebCore/WebCore.gyp/WebCore.gyp:webcore',
|
||||
'../third_party/WebKit/Source/WebCore/WebCore.gyp/WebCore.gyp:webcore',
|
||||
'../third_party/WebKit/WebKit/chromium/WebKit.gyp:webkit',
|
||||
'../third_party/zlib/zlib.gyp:zlib',
|
||||
'../ui/ui.gyp:ui_base',
|
||||
'../webkit/support/webkit_support.gyp:appcache',
|
||||
'../webkit/support/webkit_support.gyp:blob',
|
||||
'../webkit/support/webkit_support.gyp:database',
|
||||
'../webkit/support/webkit_support.gyp:fileapi',
|
||||
'../webkit/support/webkit_support.gyp:glue',
|
||||
'../webkit/support/webkit_support.gyp:webkit_gpu',
|
||||
'../webkit/support/webkit_support.gyp:webkit_resources',
|
||||
'../webkit/support/webkit_support.gyp:webkit_strings',
|
||||
],
|
||||
|
@ -592,19 +592,24 @@ public:
|
||||
|
||||
// Event called when the browser begins loading a page. The |frame| pointer
|
||||
// will be empty if the event represents the overall load status and not the
|
||||
// load status for a particular frame. The return value is currently ignored.
|
||||
// load status for a particular frame. |isMainContent| will be true if this
|
||||
// load is for the main content area and not an iframe. This method may not
|
||||
// be called if the load request fails. The return value is currently ignored.
|
||||
/*--cef()--*/
|
||||
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) =0;
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent) =0;
|
||||
|
||||
// Event called when the browser is done loading a page. The |frame| pointer
|
||||
// will be empty if the event represents the overall load status and not the
|
||||
// load status for a particular frame. This event will be generated
|
||||
// irrespective of whether the request completes successfully. The return
|
||||
// value is currently ignored.
|
||||
// load status for a particular frame. |isMainContent| will be true if this
|
||||
// load is for the main content area and not an iframe. This method will be
|
||||
// called irrespective of whether the request completes successfully. The
|
||||
// return value is currently ignored.
|
||||
/*--cef()--*/
|
||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) =0;
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent) =0;
|
||||
|
||||
// Supported error code values. See net\base\net_error_list.h for complete
|
||||
// descriptions of the error codes.
|
||||
|
@ -412,18 +412,23 @@ typedef struct _cef_handler_t
|
||||
|
||||
// Event called when the browser begins loading a page. The |frame| pointer
|
||||
// will be NULL if the event represents the overall load status and not the
|
||||
// load status for a particular frame. The return value is currently ignored.
|
||||
// load status for a particular frame. |isMainContent| will be true (1) if
|
||||
// this load is for the main content area and not an iframe. This function may
|
||||
// not be called if the load request fails. The return value is currently
|
||||
// ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_load_start)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame);
|
||||
struct _cef_frame_t* frame, int isMainContent);
|
||||
|
||||
// Event called when the browser is done loading a page. The |frame| pointer
|
||||
// will be NULL if the event represents the overall load status and not the
|
||||
// load status for a particular frame. This event will be generated
|
||||
// irrespective of whether the request completes successfully. The return
|
||||
// value is currently ignored.
|
||||
// load status for a particular frame. |isMainContent| will be true (1) if
|
||||
// this load is for the main content area and not an iframe. This function
|
||||
// will be called irrespective of whether the request completes successfully.
|
||||
// The return value is currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_load_end)(struct _cef_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame);
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||
int isMainContent);
|
||||
|
||||
// Called when the browser fails to load a resource. |errorCode| is the error
|
||||
// code number and |failedUrl| is the URL that failed to load. To provide
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
|
||||
#include "third_party/WebKit/WebCore/config.h"
|
||||
#include "third_party/WebKit/Source/WebCore/config.h"
|
||||
MSVC_PUSH_WARNING_LEVEL(0);
|
||||
#include "MemoryCache.h"
|
||||
#include "TextEncoding.h"
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
|
||||
#include "third_party/webkit/webcore/config.h"
|
||||
#include "third_party/WebKit/Source/WebCore/config.h"
|
||||
MSVC_PUSH_WARNING_LEVEL(0);
|
||||
#include "PlatformContextSkia.h"
|
||||
MSVC_POP_WARNING();
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "webkit/extensions/v8/gears_extension.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebData.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebGraphicsContext3D.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebRuntimeFeatures.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h"
|
||||
@ -43,6 +42,7 @@
|
||||
#include "webkit/glue/webfileutilities_impl.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
#include "webkit/glue/webkitclient_impl.h"
|
||||
#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
|
||||
|
||||
|
||||
class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
||||
@ -229,7 +229,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
||||
}
|
||||
|
||||
virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D() {
|
||||
return WebKit::WebGraphicsContext3D::createDefault();
|
||||
return new webkit_gpu::WebGraphicsContext3DInProcessImpl();
|
||||
}
|
||||
|
||||
WebKit::WebString queryLocalizedString(
|
||||
|
@ -162,12 +162,15 @@ void TranslatePopupFeatures(const WebWindowFeatures& webKitFeatures,
|
||||
// WebViewClient -------------------------------------------------------------
|
||||
|
||||
WebView* BrowserWebViewDelegate::createView(WebFrame* creator,
|
||||
const WebWindowFeatures& features,
|
||||
const WebString& name) {
|
||||
const WebURLRequest& request, const WebWindowFeatures& features,
|
||||
const WebString& name) {
|
||||
CefString url;
|
||||
if (!request.isNull())
|
||||
url = request.url().spec().utf16();
|
||||
CefPopupFeatures cefFeatures;
|
||||
TranslatePopupFeatures(features, cefFeatures);
|
||||
CefRefPtr<CefBrowserImpl> browser =
|
||||
browser_->UIT_CreatePopupWindow(std::wstring(), cefFeatures);
|
||||
browser_->UIT_CreatePopupWindow(url, cefFeatures);
|
||||
return browser.get() ? browser->GetWebView() : NULL;
|
||||
}
|
||||
|
||||
@ -217,34 +220,6 @@ void BrowserWebViewDelegate::printPage(WebFrame* frame) {
|
||||
browser_->UIT_PrintPages(frame);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didStartLoading() {
|
||||
// clear the title so we can tell if it wasn't provided by the page
|
||||
browser_->UIT_SetTitle(std::wstring());
|
||||
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler that loading has started
|
||||
handler->HandleLoadStart(browser_, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didStopLoading() {
|
||||
if(browser_->UIT_GetTitle().empty()) {
|
||||
// no title was provided by the page, so send a blank string to the client
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler of a page title change
|
||||
handler->HandleTitleChange(browser_, browser_->UIT_GetTitle());
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler that loading has ended
|
||||
handler->HandleLoadEnd(browser_, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
bool BrowserWebViewDelegate::shouldBeginEditing(const WebRange& range) {
|
||||
return browser_->UIT_AllowEditing();
|
||||
}
|
||||
@ -657,14 +632,12 @@ void BrowserWebViewDelegate::didCreateDataSource(
|
||||
void BrowserWebViewDelegate::didStartProvisionalLoad(WebFrame* frame) {
|
||||
if (!top_loading_frame_) {
|
||||
top_loading_frame_ = frame;
|
||||
is_main_content_ = true;
|
||||
}
|
||||
|
||||
UpdateAddressBar(frame->view());
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didReceiveServerRedirectForProvisionalLoad(
|
||||
WebFrame* frame) {
|
||||
UpdateAddressBar(frame->view());
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didFailProvisionalLoad(
|
||||
@ -720,11 +693,35 @@ void BrowserWebViewDelegate::didFailProvisionalLoad(
|
||||
|
||||
void BrowserWebViewDelegate::didCommitProvisionalLoad(
|
||||
WebFrame* frame, bool is_new_navigation) {
|
||||
// Determine if this commit represents the main content.
|
||||
if (frame == top_loading_frame_) {
|
||||
is_main_content_ = false;
|
||||
if (is_new_navigation) {
|
||||
// New navigations will be the main content.
|
||||
is_main_content_ = true;
|
||||
} else {
|
||||
// Session history navigations will be the main content.
|
||||
BrowserExtraData* extra_data = static_cast<BrowserExtraData*>(
|
||||
frame->dataSource()->extraData());
|
||||
if (extra_data && extra_data->pending_page_id != -1 &&
|
||||
!extra_data->request_committed)
|
||||
is_main_content_ = true;
|
||||
}
|
||||
|
||||
if (is_main_content_) {
|
||||
// Clear the title so we can tell if it wasn't provided by the page.
|
||||
browser_->UIT_SetTitle(std::wstring());
|
||||
}
|
||||
}
|
||||
|
||||
UpdateForCommittedLoad(frame, is_new_navigation);
|
||||
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler that loading has started
|
||||
handler->HandleLoadStart(browser_, browser_->GetCefFrame(frame));
|
||||
// Notify the handler that loading has started.
|
||||
handler->HandleLoadStart(browser_,
|
||||
(frame == top_loading_frame_) ? NULL : browser_->GetCefFrame(frame),
|
||||
is_main_content_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -746,12 +743,14 @@ void BrowserWebViewDelegate::didClearWindowObject(WebFrame* frame) {
|
||||
|
||||
void BrowserWebViewDelegate::didReceiveTitle(
|
||||
WebFrame* frame, const WebString& title) {
|
||||
CefString titleStr = string16(title);
|
||||
browser_->UIT_SetTitle(titleStr);
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler of a page title change
|
||||
handler->HandleTitleChange(browser_, titleStr);
|
||||
if (frame == top_loading_frame_ && is_main_content_) {
|
||||
CefString titleStr = string16(title);
|
||||
browser_->UIT_SetTitle(titleStr);
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler of a page title change
|
||||
handler->HandleTitleChange(browser_, titleStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -761,13 +760,7 @@ void BrowserWebViewDelegate::didFailLoad(
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didFinishLoad(WebFrame* frame) {
|
||||
UpdateAddressBar(frame->view());
|
||||
LocationChangeDone(frame);
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler that loading has ended
|
||||
handler->HandleLoadEnd(browser_, browser_->GetCefFrame(frame));
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didChangeLocationWithinPage(
|
||||
@ -821,6 +814,7 @@ BrowserWebViewDelegate::BrowserWebViewDelegate(CefBrowserImpl* browser)
|
||||
policy_delegate_should_notify_done_(false),
|
||||
browser_(browser),
|
||||
top_loading_frame_(NULL),
|
||||
is_main_content_(false),
|
||||
page_id_(-1),
|
||||
last_page_id_updated_(-1),
|
||||
smart_insert_delete_enabled_(true),
|
||||
@ -885,12 +879,32 @@ void BrowserWebViewDelegate::WaitForPolicyDelegate() {
|
||||
|
||||
// Private methods -----------------------------------------------------------
|
||||
|
||||
void BrowserWebViewDelegate::UpdateAddressBar(WebView* webView) {
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
|
||||
if (frame == top_loading_frame_)
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
bool is_top_frame = false;
|
||||
|
||||
if (frame == top_loading_frame_) {
|
||||
top_loading_frame_ = NULL;
|
||||
is_top_frame = true;
|
||||
|
||||
if(is_main_content_ && handler.get()) {
|
||||
CefString title = browser_->UIT_GetTitle();
|
||||
if (title.empty()) {
|
||||
// No title was provided by the page, so send a blank string to the
|
||||
// client.
|
||||
handler->HandleTitleChange(browser_, title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(handler.get()) {
|
||||
// Notify the handler that loading has ended.
|
||||
handler->HandleLoadEnd(browser_,
|
||||
(is_top_frame) ? NULL : browser_->GetCefFrame(frame), is_main_content_);
|
||||
}
|
||||
|
||||
if (is_top_frame && is_main_content_)
|
||||
is_main_content_ = false;
|
||||
}
|
||||
|
||||
WebWidgetHost* BrowserWebViewDelegate::GetWidgetHost() {
|
||||
@ -902,7 +916,7 @@ WebWidgetHost* BrowserWebViewDelegate::GetWidgetHost() {
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::UpdateForCommittedLoad(WebFrame* frame,
|
||||
bool is_new_navigation) {
|
||||
bool is_new_navigation) {
|
||||
// Code duplicated from RenderView::DidCommitLoadForFrame.
|
||||
BrowserExtraData* extra_data = static_cast<BrowserExtraData*>(
|
||||
frame->dataSource()->extraData());
|
||||
@ -943,12 +957,13 @@ void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
||||
entry->SetURL(request.url());
|
||||
}
|
||||
|
||||
std::string url = std::string(entry->GetURL().spec().c_str());
|
||||
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler of an address change
|
||||
handler->HandleAddressChange(browser_, browser_->GetCefFrame(frame), url);
|
||||
if (is_main_content_) {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler of an address change
|
||||
std::string url = std::string(entry->GetURL().spec().c_str());
|
||||
handler->HandleAddressChange(browser_, browser_->GetCefFrame(frame), url);
|
||||
}
|
||||
}
|
||||
|
||||
const WebHistoryItem& history_item = frame->currentHistoryItem();
|
||||
|
@ -51,9 +51,9 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
||||
public base::SupportsWeakPtr<BrowserWebViewDelegate> {
|
||||
public:
|
||||
// WebKit::WebViewClient
|
||||
virtual WebKit::WebView* createView(WebKit::WebFrame* creator,
|
||||
const WebKit::WebWindowFeatures& features,
|
||||
const WebKit::WebString& name);
|
||||
virtual WebKit::WebView* createView(
|
||||
WebKit::WebFrame* creator, const WebKit::WebURLRequest& request,
|
||||
const WebKit::WebWindowFeatures& features, const WebKit::WebString& name);
|
||||
virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
|
||||
virtual WebKit::WebWidget* createPopupMenu(
|
||||
const WebKit::WebPopupMenuInfo& info);
|
||||
@ -63,8 +63,6 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
||||
const WebKit::WebConsoleMessage& message,
|
||||
const WebKit::WebString& source_name, unsigned source_line);
|
||||
virtual void printPage(WebKit::WebFrame* frame);
|
||||
virtual void didStartLoading();
|
||||
virtual void didStopLoading();
|
||||
virtual bool shouldBeginEditing(const WebKit::WebRange& range);
|
||||
virtual bool shouldEndEditing(const WebKit::WebRange& range);
|
||||
virtual bool shouldInsertNode(
|
||||
@ -248,9 +246,6 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
||||
CefBrowserImpl* GetBrowser() { return browser_; }
|
||||
|
||||
protected:
|
||||
// Called when the URL of the page changes.
|
||||
void UpdateAddressBar(WebKit::WebView* webView);
|
||||
|
||||
// Default handling of JavaScript messages.
|
||||
void ShowJavaScriptAlert(WebKit::WebFrame* webframe,
|
||||
const CefString& message);
|
||||
@ -295,8 +290,10 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
||||
// Non-owning pointer. The delegate is owned by the host.
|
||||
CefBrowserImpl* browser_;
|
||||
|
||||
// This is non-NULL IFF a load is in progress.
|
||||
// This is non-NULL if a load is in progress.
|
||||
WebKit::WebFrame* top_loading_frame_;
|
||||
// This is true if the in-progress load is the main content.
|
||||
bool is_main_content_;
|
||||
|
||||
// For tracking session history. See RenderView.
|
||||
int page_id_;
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "app/clipboard/clipboard.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/string16.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "ui/base/clipboard/clipboard.h"
|
||||
#include "webkit/glue/scoped_clipboard_writer_glue.h"
|
||||
|
||||
// Clipboard glue
|
||||
@ -25,26 +25,27 @@ ScopedClipboardWriterGlue::~ScopedClipboardWriterGlue() {
|
||||
|
||||
namespace webkit_glue {
|
||||
|
||||
base::LazyInstance<Clipboard> clipboard(base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<ui::Clipboard> clipboard(base::LINKER_INITIALIZED);
|
||||
|
||||
Clipboard* ClipboardGetClipboard() {
|
||||
ui::Clipboard* ClipboardGetClipboard() {
|
||||
return clipboard.Pointer();
|
||||
}
|
||||
|
||||
bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format,
|
||||
Clipboard::Buffer buffer) {
|
||||
bool ClipboardIsFormatAvailable(const ui::Clipboard::FormatType& format,
|
||||
ui::Clipboard::Buffer buffer) {
|
||||
return ClipboardGetClipboard()->IsFormatAvailable(format, buffer);
|
||||
}
|
||||
|
||||
void ClipboardReadText(Clipboard::Buffer buffer, string16* result) {
|
||||
void ClipboardReadText(ui::Clipboard::Buffer buffer, string16* result) {
|
||||
ClipboardGetClipboard()->ReadText(buffer, result);
|
||||
}
|
||||
|
||||
void ClipboardReadAsciiText(Clipboard::Buffer buffer, std::string* result) {
|
||||
void ClipboardReadAsciiText(ui::Clipboard::Buffer buffer, std::string* result) {
|
||||
ClipboardGetClipboard()->ReadAsciiText(buffer, result);
|
||||
}
|
||||
|
||||
void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url) {
|
||||
void ClipboardReadHTML(ui::Clipboard::Buffer buffer, string16* markup,
|
||||
GURL* url) {
|
||||
std::string url_str;
|
||||
ClipboardGetClipboard()->ReadHTML(buffer, markup, url ? &url_str : NULL);
|
||||
if (url)
|
||||
@ -52,18 +53,18 @@ void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url) {
|
||||
}
|
||||
|
||||
// TODO(dcheng): Implement.
|
||||
bool ClipboardReadAvailableTypes(Clipboard::Buffer buffer,
|
||||
bool ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer,
|
||||
std::vector<string16>* types,
|
||||
bool* contains_filenames) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ClipboardReadData(Clipboard::Buffer buffer, const string16& type,
|
||||
bool ClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type,
|
||||
string16* data, string16* metadata) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ClipboardReadFilenames(Clipboard::Buffer buffer,
|
||||
bool ClipboardReadFilenames(ui::Clipboard::Buffer buffer,
|
||||
std::vector<string16>* filenames) {
|
||||
return false;
|
||||
}
|
||||
|
@ -29,7 +29,11 @@ WebViewHost* WebViewHost::Create(GtkWidget* parent_view,
|
||||
host->view_ = WebWidgetHost::CreateWidget(parent_view, host);
|
||||
host->plugin_container_manager_.set_host_widget(host->view_);
|
||||
|
||||
#if defined(WEBKIT_HAS_WEB_AUTO_FILL_CLIENT)
|
||||
host->webwidget_ = WebView::create(delegate, dev_tools_client, NULL);
|
||||
#else
|
||||
host->webwidget_ = WebView::create(delegate, dev_tools_client);
|
||||
#endif
|
||||
prefs.Apply(host->webview());
|
||||
host->webview()->initializeMainFrame(delegate);
|
||||
host->webwidget_->layout();
|
||||
|
@ -34,7 +34,11 @@ WebViewHost* WebViewHost::Create(NSView* parent_view,
|
||||
[parent_view addSubview:host->view_];
|
||||
[host->view_ release];
|
||||
|
||||
#if defined(WEBKIT_HAS_WEB_AUTO_FILL_CLIENT)
|
||||
host->webwidget_ = WebView::create(delegate, dev_tools_client, NULL);
|
||||
#else
|
||||
host->webwidget_ = WebView::create(delegate, dev_tools_client);
|
||||
#endif
|
||||
prefs.Apply(host->webview());
|
||||
host->webview()->initializeMainFrame(delegate);
|
||||
host->webwidget_->resize(WebSize(content_rect.size.width,
|
||||
|
@ -42,7 +42,11 @@ WebViewHost* WebViewHost::Create(HWND parent_view,
|
||||
GetModuleHandle(NULL), NULL);
|
||||
app::win::SetWindowUserData(host->view_, host);
|
||||
|
||||
#if defined(WEBKIT_HAS_WEB_AUTO_FILL_CLIENT)
|
||||
host->webwidget_ = WebView::create(delegate, dev_tools_client, NULL);
|
||||
#else
|
||||
host->webwidget_ = WebView::create(delegate, dev_tools_client);
|
||||
#endif
|
||||
prefs.Apply(host->webview());
|
||||
host->webview()->initializeMainFrame(delegate);
|
||||
|
||||
|
@ -135,7 +135,8 @@ enum cef_retval_t CEF_CALLBACK handler_handle_before_browse(
|
||||
}
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_load_start(
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame)
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
||||
int isMainContent)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(browser);
|
||||
@ -147,11 +148,12 @@ enum cef_retval_t CEF_CALLBACK handler_handle_load_start(
|
||||
framePtr = CefFrameCToCpp::Wrap(frame);
|
||||
|
||||
return CefHandlerCppToC::Get(self)->HandleLoadStart(
|
||||
CefBrowserCToCpp::Wrap(browser), framePtr);
|
||||
CefBrowserCToCpp::Wrap(browser), framePtr, isMainContent?true:false);
|
||||
}
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_load_end(
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame)
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
||||
int isMainContent)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(browser);
|
||||
@ -163,7 +165,7 @@ enum cef_retval_t CEF_CALLBACK handler_handle_load_end(
|
||||
framePtr = CefFrameCToCpp::Wrap(frame);
|
||||
|
||||
return CefHandlerCppToC::Get(self)->HandleLoadEnd(
|
||||
CefBrowserCToCpp::Wrap(browser), framePtr);
|
||||
CefBrowserCToCpp::Wrap(browser), framePtr, isMainContent?true:false);
|
||||
}
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_load_error(
|
||||
|
@ -98,7 +98,8 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeBrowse(
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleLoadStart(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame)
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_load_start))
|
||||
return RV_CONTINUE;
|
||||
@ -108,11 +109,12 @@ CefHandler::RetVal CefHandlerCToCpp::HandleLoadStart(
|
||||
frameStruct = CefFrameCppToC::Wrap(frame);
|
||||
|
||||
return struct_->handle_load_start(struct_, CefBrowserCppToC::Wrap(browser),
|
||||
frameStruct);
|
||||
frameStruct, isMainContent);
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleLoadEnd(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame)
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_load_end))
|
||||
return RV_CONTINUE;
|
||||
@ -122,7 +124,7 @@ CefHandler::RetVal CefHandlerCToCpp::HandleLoadEnd(
|
||||
frameStruct = CefFrameCppToC::Wrap(frame);
|
||||
|
||||
return struct_->handle_load_end(struct_, CefBrowserCppToC::Wrap(browser),
|
||||
frameStruct);
|
||||
frameStruct, isMainContent);
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleLoadError(
|
||||
|
@ -44,9 +44,9 @@ public:
|
||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request,
|
||||
NavType navType, bool isRedirect);
|
||||
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame);
|
||||
CefRefPtr<CefFrame> frame, bool isMainContent);
|
||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame);
|
||||
CefRefPtr<CefFrame> frame, bool isMainContent);
|
||||
virtual RetVal HandleLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, ErrorCode errorCode,
|
||||
const CefString& failedUrl, CefString& errorText);
|
||||
|
@ -60,7 +60,7 @@ CefHandler::RetVal ClientHandler::HandleAfterCreated(
|
||||
}
|
||||
|
||||
CefHandler::RetVal ClientHandler::HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
CefRefPtr<CefFrame> frame, bool isMainContent)
|
||||
{
|
||||
if(!browser->IsPopup() && !frame.get())
|
||||
{
|
||||
@ -75,7 +75,7 @@ CefHandler::RetVal ClientHandler::HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
}
|
||||
|
||||
CefHandler::RetVal ClientHandler::HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
CefRefPtr<CefFrame> frame, bool isMainContent)
|
||||
{
|
||||
if(!browser->IsPopup() && !frame.get())
|
||||
{
|
||||
@ -363,3 +363,8 @@ void RunHTML5VideoTest(CefRefPtr<CefBrowser> browser)
|
||||
browser->GetMainFrame()->LoadURL(
|
||||
"http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True");
|
||||
}
|
||||
|
||||
void RunXMLHTTPRequestTest(CefRefPtr<CefBrowser> browser)
|
||||
{
|
||||
browser->GetMainFrame()->LoadURL("http://tests/xmlhttprequest");
|
||||
}
|
||||
|
@ -45,10 +45,7 @@ public:
|
||||
const CefPopupFeatures& popupFeatures,
|
||||
CefRefPtr<CefHandler>& handler,
|
||||
CefString& url,
|
||||
CefBrowserSettings& settings)
|
||||
{
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
CefBrowserSettings& settings);
|
||||
|
||||
// Event called after a new window is created. The return value is currently
|
||||
// ignored.
|
||||
@ -78,17 +75,22 @@ public:
|
||||
|
||||
// Event called when the browser begins loading a page. The |frame| pointer
|
||||
// will be empty if the event represents the overall load status and not the
|
||||
// load status for a particular frame. The return value is currently ignored.
|
||||
// load status for a particular frame. |isMainContent| will be true if this
|
||||
// load is for the main content area and not an iframe. This method may not
|
||||
// be called if the load request fails. The return value is currently ignored.
|
||||
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame);
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent);
|
||||
|
||||
// Event called when the browser is done loading a page. The |frame| pointer
|
||||
// will be empty if the event represents the overall load status and not the
|
||||
// load status for a particular frame. This event will be generated
|
||||
// irrespective of whether the request completes successfully. The return
|
||||
// value is currently ignored.
|
||||
// load status for a particular frame. |isMainContent| will be true if this
|
||||
// load is for the main content area and not an iframe. This method will be
|
||||
// called irrespective of whether the request completes successfully. The
|
||||
// return value is currently ignored.
|
||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame);
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent);
|
||||
|
||||
// Called when the browser fails to load a resource. |errorCode| is the
|
||||
// error code number and |failedUrl| is the URL that failed to load. To
|
||||
@ -381,5 +383,6 @@ void RunAccelerated2DCanvasTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunAcceleratedLayersTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunWebGLTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunHTML5VideoTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunXMLHTTPRequestTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
#endif // _CEFCLIENT_H
|
||||
|
@ -28,10 +28,11 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
// Binary
|
||||
//
|
||||
|
||||
IDS_LOGO BINARY "res\logo.png"
|
||||
IDS_UIPLUGIN BINARY "res\uiplugin.html"
|
||||
IDS_LOGOBALL BINARY "res\logoball.png"
|
||||
IDS_LOCALSTORAGE BINARY "res\localstorage.html"
|
||||
IDS_LOGO BINARY "res\\logo.png"
|
||||
IDS_UIPLUGIN BINARY "res\\uiplugin.html"
|
||||
IDS_LOGOBALL BINARY "res\\logoball.png"
|
||||
IDS_LOCALSTORAGE BINARY "res\\localstorage.html"
|
||||
IDS_XMLHTTPREQUEST BINARY "res\\xmlhttprequest.html"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -75,6 +76,7 @@ BEGIN
|
||||
MENUITEM "Scheme Handler", ID_TESTS_SCHEME_HANDLER
|
||||
MENUITEM "UI App Example", ID_TESTS_UIAPP
|
||||
MENUITEM "Local Storage", ID_TESTS_LOCALSTORAGE
|
||||
MENUITEM "XMLHttpRequest", ID_TESTS_XMLHTTPREQUEST
|
||||
MENUITEM "Accelerated 2D Canvas", ID_TESTS_ACCELERATED2DCANVAS
|
||||
MENUITEM "Accelerated Layers", ID_TESTS_ACCELERATEDLAYERS
|
||||
MENUITEM "WebGL", ID_TESTS_WEBGL
|
||||
|
@ -367,6 +367,14 @@ int main(int argc, char* argv[])
|
||||
|
||||
// ClientHandler implementation
|
||||
|
||||
CefHandler::RetVal ClientHandler::HandleBeforeCreated(
|
||||
CefRefPtr<CefBrowser> parentBrowser, CefWindowInfo& createInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
|
||||
CefString& url, CefBrowserSettings& settings)
|
||||
{
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
|
||||
CefHandler::RetVal ClientHandler::HandleAddressChange(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
const CefString& url)
|
||||
|
@ -69,9 +69,6 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||
// Specify a cache path value.
|
||||
//CefString(&settings.cache_path).FromASCII("c:\\temp\\cache");
|
||||
|
||||
// Disable accelerated compositing to view HTML5 video.
|
||||
//browserDefaults.accelerated_compositing_disabled = true;
|
||||
|
||||
#ifdef TEST_SINGLE_THREADED_MESSAGE_LOOP
|
||||
// Initialize the CEF with messages processed using the current application's
|
||||
// message loop.
|
||||
@ -567,6 +564,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if(browser.get())
|
||||
RunHTML5VideoTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_XMLHTTPREQUEST: // Test XMLHttpRequest
|
||||
if(browser.get())
|
||||
RunXMLHTTPRequestTest(browser);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -648,6 +649,25 @@ INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
// ClientHandler implementation
|
||||
|
||||
CefHandler::RetVal ClientHandler::HandleBeforeCreated(
|
||||
CefRefPtr<CefBrowser> parentBrowser, CefWindowInfo& createInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
|
||||
CefString& url, CefBrowserSettings& settings)
|
||||
{
|
||||
if(popup) {
|
||||
if(popupFeatures.xSet)
|
||||
createInfo.m_x = popupFeatures.x;
|
||||
if(popupFeatures.ySet)
|
||||
createInfo.m_y = popupFeatures.y;
|
||||
if(popupFeatures.widthSet)
|
||||
createInfo.m_nWidth = popupFeatures.width;
|
||||
if(popupFeatures.heightSet)
|
||||
createInfo.m_nHeight = popupFeatures.height;
|
||||
}
|
||||
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
|
||||
CefHandler::RetVal ClientHandler::HandleAddressChange(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
const CefString& url)
|
||||
@ -687,8 +707,8 @@ CefHandler::RetVal ClientHandler::HandleBeforeResourceLoad(
|
||||
// Show the request contents
|
||||
std::string dump;
|
||||
DumpRequestContents(request, dump);
|
||||
resourceStream = CefStreamReader::CreateForData((void*)dump.c_str(),
|
||||
dump.size());
|
||||
resourceStream =
|
||||
CefStreamReader::CreateForData((void*)dump.c_str(), dump.size());
|
||||
mimeType = "text/plain";
|
||||
} else if(url == "http://tests/uiapp") {
|
||||
// Show the uiapp contents
|
||||
@ -704,6 +724,13 @@ CefHandler::RetVal ClientHandler::HandleBeforeResourceLoad(
|
||||
new CefByteReadHandler(pBytes, dwSize, NULL));
|
||||
mimeType = "text/html";
|
||||
}
|
||||
} else if(url == "http://tests/xmlhttprequest") {
|
||||
// Show the xmlhttprequest HTML contents
|
||||
if(LoadBinaryResource(IDS_XMLHTTPREQUEST, dwSize, pBytes)) {
|
||||
resourceStream = CefStreamReader::CreateForHandler(
|
||||
new CefByteReadHandler(pBytes, dwSize, NULL));
|
||||
mimeType = "text/html";
|
||||
}
|
||||
} else if(strstr(url.c_str(), "/ps_logo2.png") != NULL) {
|
||||
// Any time we find "ps_logo2.png" in the URL substitute in our own image
|
||||
if(LoadBinaryResource(IDS_LOGO, dwSize, pBytes)) {
|
||||
|
18
tests/cefclient/res/xmlhttprequest.html
Normal file
18
tests/cefclient/res/xmlhttprequest.html
Normal file
@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<body>
|
||||
<script language="JavaScript">
|
||||
function execXMLHttpRequest()
|
||||
{
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET","request",false);
|
||||
xhr.setRequestHeader('My-Custom-Header', 'Some Value');
|
||||
xhr.send();
|
||||
document.getElementById('ta').value = "Request\n\n"+xhr.responseText;
|
||||
}
|
||||
</script>
|
||||
<form>
|
||||
<input type="button" onclick="execXMLHttpRequest();" value="Execute XMLHttpRequest">
|
||||
<br/><textarea rows="10" cols="40" id="ta"></textarea>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -41,11 +41,13 @@
|
||||
#define ID_TESTS_ACCELERATEDLAYERS 32781
|
||||
#define ID_TESTS_WEBGL 32782
|
||||
#define ID_TESTS_HTML5VIDEO 32783
|
||||
#define ID_TESTS_XMLHTTPREQUEST 32784
|
||||
#define IDC_STATIC -1
|
||||
#define IDS_LOGO 1000
|
||||
#define IDS_UIPLUGIN 1001
|
||||
#define IDS_LOGOBALL 1002
|
||||
#define IDS_LOCALSTORAGE 1003
|
||||
#define IDS_XMLHTTPREQUEST 1004
|
||||
|
||||
// Avoid files associated with MacOS
|
||||
#define _X86_
|
||||
|
@ -272,7 +272,8 @@ public:
|
||||
}
|
||||
|
||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent)
|
||||
{
|
||||
if(!browser->IsPopup() && !frame.get())
|
||||
DestroyTest();
|
||||
@ -380,7 +381,8 @@ public:
|
||||
}
|
||||
|
||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent)
|
||||
{
|
||||
if(!browser->IsPopup() && !frame.get())
|
||||
{
|
||||
|
@ -69,13 +69,15 @@ public:
|
||||
}
|
||||
|
||||
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent)
|
||||
{
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
|
||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent)
|
||||
{
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
|
@ -247,7 +247,8 @@ public:
|
||||
}
|
||||
|
||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
CefRefPtr<CefFrame> frame,
|
||||
bool isMainContent)
|
||||
{
|
||||
if(!browser->IsPopup() && !frame.get())
|
||||
DestroyTest();
|
||||
|
Loading…
x
Reference in New Issue
Block a user