Index: include/PopupWidget.h =================================================================== --- include/PopupWidget.h (revision 1) +++ include/PopupWidget.h (working copy) @@ -26,6 +26,9 @@ #ifndef __POPUP_WIDGET_H__ #define __POPUP_WIDGET_H__ +#ifdef _USE_CHROMIUM_TRUNK +#include "base/basictypes.h" +#endif #include "webkit/glue/webwidget.h" #include "webkit/glue/webwidget_delegate.h" #include "base/gfx/platform_canvas.h" @@ -61,7 +64,11 @@ * The following methods are inherited from WebWidgetDelegate */ +#ifndef _USE_CHROMIUM_TRUNK gfx::NativeView GetContainingView(WebWidget* webwidget); +#else + gfx::NativeViewId GetContainingView(WebWidget* webwidget); +#endif // Called when a region of the WebWidget needs to be re-painted. void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect); Index: include/WebViewProxy.h =================================================================== --- include/WebViewProxy.h (revision 1) +++ include/WebViewProxy.h (working copy) @@ -242,9 +242,15 @@ void RunFileChooser(const std::wstring& initial_filename, WebFileChooserCallback* file_chooser); +#ifndef _USE_CHROMIUM_TRUNK void ShowContextMenu(::WebView* webview, ContextNode::Type type, int x, int y, const GURL& link_url, const GURL& image_url, const GURL& page_url, const GURL& frame_url, const std::wstring& selection_text, const std::wstring& misspelled_word, int edit_flags, const std::string& frame_encoding); +#else + void ShowContextMenu(::WebView* webview, ContextNode node, int x, int y, const GURL& link_url, + const GURL& image_url, const GURL& page_url, const GURL& frame_url, const std::wstring& selection_text, + const std::wstring& misspelled_word, int edit_flags, const std::string& frame_encoding); +#endif void StartDragging(::WebView* webview, const WebDropData& drop_data); @@ -309,7 +315,11 @@ void TransitionToCommittedForNewPage(); +#ifndef _USE_CHROMIUM_TRUNK gfx::NativeView GetContainingView(WebWidget* webwidget); +#else + gfx::NativeViewId GetContainingView(WebWidget* webwidget); +#endif void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect); Index: src/PopupWidget.cpp =================================================================== --- src/PopupWidget.cpp (revision 1) +++ src/PopupWidget.cpp (working copy) @@ -37,7 +37,9 @@ delete canvas; widget->Close(); +#ifndef _USE_CHROMIUM_TRUNK widget->Release(); +#endif } WebWidget* PopupWidget::getWidget() @@ -89,7 +91,11 @@ } } +#ifndef _USE_CHROMIUM_TRUNK gfx::NativeView PopupWidget::GetContainingView(WebWidget* webwidget) +#else +gfx::NativeViewId PopupWidget::GetContainingView(WebWidget* webwidget) +#endif { return NULL; } Index: src/RequestContext.cpp =================================================================== --- src/RequestContext.cpp (revision 1) +++ src/RequestContext.cpp (working copy) @@ -25,7 +25,9 @@ bool no_proxy) { cookie_store_ = new net::CookieMonster(); +#ifndef _USE_CHROMIUM_TRUNK user_agent_ = webkit_glue::GetUserAgent(); +#endif // hard-code A-L and A-C for test shells accept_language_ = "en-us,en"; Index: src/ResourceLoaderBridge.cpp =================================================================== --- src/ResourceLoaderBridge.cpp (revision 1) +++ src/ResourceLoaderBridge.cpp (working copy) @@ -37,6 +37,11 @@ #include "base/thread.h" #include "base/waitable_event.h" #include "net/base/cookie_monster.h" +#ifdef _USE_CHROMIUM_TRUNK +#include "net/base/io_buffer.h" +#include "net/http/http_response_headers.h" +#include "net/proxy/proxy_service.h" +#endif #include "net/base/net_util.h" #include "net/base/upload_data.h" #include "net/url_request/url_request.h" @@ -104,7 +109,11 @@ public base::RefCountedThreadSafe { public: // Takes ownership of the params. +#ifndef _USE_CHROMIUM_TRUNK RequestProxy() { +#else + RequestProxy() : buf_(new net::IOBuffer(kDataSize)) { +#endif } virtual ~RequestProxy() { @@ -155,7 +164,11 @@ // Make a local copy of buf_, since AsyncReadData reuses it. scoped_array buf_copy(new char[bytes_read]); +#ifndef _USE_CHROMIUM_TRUNK memcpy(buf_copy.get(), buf_, bytes_read); +#else + memcpy(buf_copy.get(), buf_->data(), bytes_read); +#endif // Continue reading more data into buf_ // Note: Doing this before notifying our peer ensures our load events get @@ -211,7 +224,11 @@ if (request_->status().is_success()) { int bytes_read; +#ifndef _USE_CHROMIUM_TRUNK if (request_->Read(buf_, sizeof(buf_), &bytes_read) && bytes_read) { +#else + if (request_->Read(buf_, kDataSize, &bytes_read) && bytes_read) { +#endif OnReceivedData(bytes_read); } else if (!request_->status().is_io_pending()) { Done(); @@ -296,7 +313,11 @@ static const int kDataSize = 16*1024; // read buffer for async IO +#ifndef _USE_CHROMIUM_TRUNK char buf_[kDataSize]; +#else + scoped_refptr buf_; +#endif MessageLoop* owner_loop_; @@ -333,7 +354,11 @@ } virtual void OnReceivedData(int bytes_read) { +#ifndef _USE_CHROMIUM_TRUNK result_->data.append(buf_, bytes_read); +#else + result_->data.append(buf_->data(), bytes_read); +#endif AsyncReadData(); // read more (may recurse) } @@ -496,6 +521,28 @@ headers, load_flags); } +#ifdef _USE_CHROMIUM_TRUNK + +// Issue the proxy resolve request on the io thread, and wait +// for the result. +bool FindProxyForUrl(const GURL& url, std::string* proxy_list) { + DCHECK(request_context); + + scoped_refptr sync_proxy_service( + new net::SyncProxyServiceHelper(io_thread->message_loop(), + request_context->proxy_service())); + + net::ProxyInfo proxy_info; + int rv = sync_proxy_service->ResolveProxy(url, &proxy_info); + if (rv == net::OK) { + *proxy_list = proxy_info.ToPacString(); + } + + return rv == net::OK; +} + +#endif + void SetCookie(const GURL& url, const GURL& policy_url, const std::string& cookie) { // Proxy to IO thread to synchronize w/ network loading. Index: src/WebkitGlue.cpp =================================================================== --- src/WebkitGlue.cpp (revision 1) +++ src/WebkitGlue.cpp (working copy) @@ -37,7 +37,11 @@ #include "webkit/glue/scoped_clipboard_writer_glue.h" #include "SkBitmap.h" #if defined(_WIN32) +#ifndef _USE_CHROMIUM_TRUNK #include "webkit/glue/webkit_resources.h" +#else +#include "webkit/glue/screen_info.h" +#endif #include #endif @@ -78,7 +82,11 @@ return net::GetMimeTypeFromExtension(ext, mime_type); } +#ifndef _USE_CHROMIUM_TRUNK bool GetMimeTypeFromFile(const std::wstring &file_path, std::string *mime_type) +#else +bool GetMimeTypeFromFile(const FilePath& file_path, std::string* mime_type) +#endif { return net::GetMimeTypeFromFile(file_path, mime_type); } @@ -153,6 +161,8 @@ #if defined(__APPLE__) return ""; #else + +#ifndef _USE_CHROMIUM_TRUNK switch(resource_id) { case IDR_BROKENIMAGE: @@ -185,7 +195,11 @@ default: return ""; } +#else + return ""; #endif + +#endif } #if defined(WIN32) @@ -268,10 +282,18 @@ } #endif +#ifndef _USE_CHROMIUM_TRUNK ScreenInfo GetScreenInfo(gfx::NativeView window) +#else +ScreenInfo GetScreenInfo(gfx::NativeViewId window) +#endif { #if defined(WIN32) +#ifdef _USE_CHROMIUM_TRUNK + return GetScreenInfoHelper(gfx::NativeViewFromId(window)); +#else return GetScreenInfoHelper(window); +#endif #else return ScreenInfo(); #endif @@ -343,6 +365,8 @@ #if defined(OS_WIN) + +#ifndef _USE_CHROMIUM_TRUNK // The call is being made within the current process. void ScopedClipboardWriterGlue::WriteBitmap(const SkBitmap& bitmap) { @@ -351,6 +375,7 @@ bitmap.height())); } #endif +#endif ScopedClipboardWriterGlue::~ScopedClipboardWriterGlue() { Index: src/WebViewProxy.cpp =================================================================== --- src/WebViewProxy.cpp (revision 1) +++ src/WebViewProxy.cpp (working copy) @@ -97,7 +97,9 @@ delete clientObject; view->Close(); +#ifndef _USE_CHROMIUM_TRUNK view->Release(); +#endif LOG(INFO) << "In WebViewProxy::asyncShutdown, refCount is " << refCount; @@ -529,10 +531,16 @@ return 0; if(actual_mime_type && !actual_mime_type->empty()) +#ifndef _USE_CHROMIUM_TRUNK return WindowlessPlugin::Create(info.file, *actual_mime_type); else return WindowlessPlugin::Create(info.file, mime_type); #else + return WindowlessPlugin::Create(info.path, *actual_mime_type); + else + return WindowlessPlugin::Create(info.path, mime_type); +#endif +#else return 0; #endif } @@ -968,9 +976,15 @@ // @param edit_flags Which edit operations the renderer believes are available // @param frame_encoding Which indicates the encoding of current focused // sub frame. +#ifndef _USE_CHROMIUM_TRUNK void WebViewProxy::ShowContextMenu(::WebView* webview, ContextNode::Type type, int x, int y, const GURL& link_url, const GURL& image_url, const GURL& page_url, const GURL& frame_url, const std::wstring& selection_text, const std::wstring& misspelled_word, int edit_flags, const std::string& frame_encoding) +#else +void WebViewProxy::ShowContextMenu(::WebView* webview, ContextNode node, int x, int y, const GURL& link_url, + const GURL& image_url, const GURL& page_url, const GURL& frame_url, const std::wstring& selection_text, + const std::wstring& misspelled_word, int edit_flags, const std::string& frame_encoding) +#endif { } @@ -1165,7 +1179,11 @@ // BEGIN WEBWIDGET_DELEGATE // Returns the view in which the WebWidget is embedded. +#ifndef _USE_CHROMIUM_TRUNK gfx::NativeView WebViewProxy::GetContainingView(WebWidget* webwidget) +#else +gfx::NativeViewId WebViewProxy::GetContainingView(WebWidget* webwidget) +#endif { return NULL; } Index: src/WindowlessPlugin.h =================================================================== --- src/WindowlessPlugin.h (revision 1) +++ src/WindowlessPlugin.h (working copy) @@ -181,8 +181,12 @@ // relative to its containing window, to the coords given by window_rect. // Its contents should be clipped to the coords given by clip_rect, which are // relative to the origin of the plugin window. +#ifndef _USE_CHROMIUM_TRUNK void UpdateGeometry(const gfx::Rect& window_rect, const gfx::Rect& clip_rect, const std::vector& cutout_rects, bool visible) +#else + void UpdateGeometry(const gfx::Rect& window_rect, const gfx::Rect& clip_rect) +#endif { window.x = window_rect.x(); window.y = window_rect.y(); @@ -313,7 +317,11 @@ // Only Available after Initialize is called. FilePath GetPluginPath() { +#ifndef _USE_CHROMIUM_TRUNK return pluginInstance->plugin_lib()->plugin_info().file; +#else + return pluginInstance->plugin_lib()->plugin_info().path; +#endif } // Only Supported when the plugin is the default plugin.