libcef: Update due to underlying chromium changes.

- Printing fix was committed as Chromium rev 23338, so the patches are no longer required.
- Add a patch for plugin loading support that was broken in Chromium rev 23501.
- NPAPI::PluginList static methods are replaced with methods provided by the singleton instance.
- WebPreferences now has an Apply() method.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@35 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2009-08-20 17:53:30 +00:00
parent cbb3124475
commit 65b06ebf66
13 changed files with 70 additions and 79 deletions

View File

@ -34,3 +34,4 @@ Date | CEF Revision | Chromium Revision
2009-06-02 | /trunk@28 | /trunk@17397
2009-07-24 | /trunk@32 | /trunk@21529
2009-08-13 | /trunk@34 | /trunk@23266
2009-08-20 | /trunk@35 | /trunk@23814

View File

@ -9,7 +9,6 @@
#include "browser_webkit_glue.h"
#include "stream_impl.h"
#include "printing/units.h"
#include "../patch/patch_state.h"
#include "base/string_util.h"
#include "base/win_util.h"
@ -428,11 +427,6 @@ void CefBrowserImpl::UIT_CanGoForwardNotify(bool *retVal, HANDLE hEvent)
void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
const gfx::Size& canvas_size,
WebKit::WebFrame* frame) {
#if !CEF_PATCHES_APPLIED
NOTREACHED() << "CEF patches must be applied to support printing.";
return;
#endif // !CEF_PATCHES_APPLIED
REQUIRE_UIT();
printing::PrintParams params;
@ -473,10 +467,7 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
canvas.clipRect(clip_rect);
// Apply the WebKit scaling factor.
float webkit_scale = 0;
#if CEF_PATCHES_APPLIED
webkit_scale = frame->getPrintPageShrink(page_number);
#endif // CEF_PATCHES_APPLIED
float webkit_scale = frame->getPrintPageShrink(page_number);
if (webkit_scale <= 0) {
NOTREACHED() << "Printing page " << page_number << " failed.";
}
@ -577,11 +568,6 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
}
void CefBrowserImpl::UIT_PrintPages(WebKit::WebFrame* frame) {
#if !CEF_PATCHES_APPLIED
NOTREACHED() << "CEF patches must be applied to support printing.";
return;
#endif // !CEF_PATCHES_APPLIED
REQUIRE_UIT();
TCHAR printername[512];

View File

@ -6,8 +6,15 @@
#include "precompiled_libcef.h"
#include "browser_request_context.h"
#include "build/build_config.h"
#include "net/base/cookie_monster.h"
#include "net/base/host_resolver.h"
#if defined(OS_WIN)
#include "net/base/ssl_config_service_win.h"
#else
#include "net/base/ssl_config_service_defaults.h"
#endif
#include "net/ftp/ftp_network_layer.h"
#include "net/proxy/proxy_service.h"
#include "webkit/glue/webkit_glue.h"
@ -37,12 +44,19 @@ void BrowserRequestContext::Init(
host_resolver_ = net::CreateSystemHostResolver();
proxy_service_ = net::ProxyService::Create(no_proxy ? &proxy_config : NULL,
false, NULL, NULL);
#if defined(OS_WIN)
ssl_config_service_ = new net::SSLConfigServiceWin;
#else
ssl_config_service_ = new net::SSLConfigServiceDefaults;
#endif
net::HttpCache *cache;
if (cache_path.empty()) {
cache = new net::HttpCache(host_resolver_, proxy_service_, 0);
cache = new net::HttpCache(host_resolver_, proxy_service_,
ssl_config_service_, 0);
} else {
cache = new net::HttpCache(host_resolver_, proxy_service_, cache_path, 0);
cache = new net::HttpCache(host_resolver_, proxy_service_,
ssl_config_service_, cache_path, 0);
}
cache->set_mode(cache_mode);
http_transaction_factory_ = cache;
@ -54,7 +68,6 @@ BrowserRequestContext::~BrowserRequestContext() {
delete cookie_store_;
delete ftp_transaction_factory_;
delete http_transaction_factory_;
delete proxy_service_;
}
const std::string& BrowserRequestContext::GetUserAgent(

View File

@ -748,7 +748,7 @@ bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
request_context->proxy_service()));
net::ProxyInfo proxy_info;
int rv = sync_proxy_service->ResolveProxy(NULL, url, &proxy_info);
int rv = sync_proxy_service->ResolveProxy(url, &proxy_info, NULL);
if (rv == net::OK) {
*proxy_list = proxy_info.ToPacString();
}

View File

@ -8,6 +8,7 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
#undef LOG
#include "config.h"
MSVC_PUSH_WARNING_LEVEL(0);
#include "TextEncoding.h"
@ -16,7 +17,6 @@ MSVC_POP_WARNING();
#include "browser_webkit_glue.h"
#undef LOG
#include "base/path_service.h"
#include "base/resource_util.h"
#include "base/scoped_ptr.h"
@ -132,8 +132,10 @@ StringPiece GetDataResource(int resource_id) {
case IDR_SEARCH_MAGNIFIER_RESULTS:
case IDR_MEDIA_PAUSE_BUTTON:
case IDR_MEDIA_PLAY_BUTTON:
case IDR_MEDIA_PLAY_BUTTON_DISABLED:
case IDR_MEDIA_SOUND_FULL_BUTTON:
case IDR_MEDIA_SOUND_NONE_BUTTON:
case IDR_MEDIA_SOUND_DISABLED:
case IDR_MEDIA_SLIDER_THUMB:
return NetResourceProvider(resource_id);
default:

View File

@ -50,9 +50,8 @@ HCURSOR LoadCursor(int cursor_id) {
return NULL;
}
bool GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) {
void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) {
NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins);
return true;
}
bool EnsureFontLoaded(HFONT font) {

View File

@ -9,6 +9,7 @@
#include "precompiled_libcef.h"
#include "config.h"
#undef LOG
#include "browser_webview_delegate.h"
#include "browser_impl.h"
#include "browser_navigation_controller.h"
@ -583,14 +584,14 @@ void BrowserWebViewDelegate::TakeFocus(WebView* webview, bool reverse) {
void BrowserWebViewDelegate::SetUserStyleSheetEnabled(bool is_enabled) {
WebPreferences* prefs = _Context->GetWebPreferences();
prefs->user_style_sheet_enabled = is_enabled;
browser_->GetWebView()->SetPreferences(*prefs);
prefs->Apply(browser_->GetWebView());
}
void BrowserWebViewDelegate::SetUserStyleSheetLocation(const GURL& location) {
WebPreferences* prefs = _Context->GetWebPreferences();
prefs->user_style_sheet_enabled = true;
prefs->user_style_sheet_location = location;
browser_->GetWebView()->SetPreferences(*prefs);
prefs->Apply(browser_->GetWebView());
}
void BrowserWebViewDelegate::SetSmartInsertDeleteEnabled(bool enabled) {

View File

@ -138,8 +138,7 @@ void CefContext::UIT_RegisterPlugin(struct CefPluginInfo* plugin_info)
info.entry_points.np_initialize = plugin_info->np_initialize;
info.entry_points.np_shutdown = plugin_info->np_shutdown;
NPAPI::PluginList::RegisterInternalPlugin(info);
NPAPI::PluginList::Singleton()->LoadPlugin(FilePath(info.path));
NPAPI::PluginList::Singleton()->RegisterInternalPlugin(info);
delete plugin_info;
}

View File

@ -9,6 +9,7 @@
#include "base/gfx/rect.h"
#include "base/gfx/size.h"
#include "base/win_util.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webview.h"
static const wchar_t kWindowClassName[] = L"WebViewHost";
@ -38,7 +39,9 @@ WebViewHost* WebViewHost::Create(HWND parent_view,
GetModuleHandle(NULL), NULL);
win_util::SetWindowUserData(host->view_, host);
host->webwidget_ = WebView::Create(delegate, prefs);
host->webwidget_ = WebView::Create();
prefs.Apply(host->webview());
host->webview()->InitializeMainFrame(delegate);
return host;
}

View File

@ -3,7 +3,6 @@
# file entry should be proceeded by the code review or bug report link that it
# relates to.
patches = {
# http://codereview.chromium.org/164482
"webkit_api" : "../../webkit/api/",
"webkit_glue" : "../../webkit/glue/"
# http://codereview.chromium.org/173107
"webkit_glue_plugins" : "../../webkit/glue/plugins/"
}

View File

@ -1,16 +0,0 @@
Index: public/WebFrame.h
===================================================================
--- public/WebFrame.h (revision 23266)
+++ public/WebFrame.h (working copy)
@@ -332,6 +332,11 @@
// given page size.
virtual int printBegin(const WebSize& pageSize) = 0;
+ // Returns the page shrinking factor calculated by webkit (usually
+ // between 1/1.25 and 1/2). Returns 0 if the page number is invalid or
+ // not in printing mode.
+ virtual float getPrintPageShrink(int page) = 0;
+
// Prints one page, and returns the calculated page shrinking factor
// (usually between 1/1.25 and 1/2). Returns 0 if the page number is
// invalid or not in printing mode.

View File

@ -1,33 +0,0 @@
Index: webframe_impl.cc
===================================================================
--- webframe_impl.cc (revision 23266)
+++ webframe_impl.cc (working copy)
@@ -1045,6 +1045,16 @@
return print_context_->pageCount();
}
+float WebFrameImpl::getPrintPageShrink(int page) {
+ // Ensure correct state.
+ if (!print_context_.get() || page < 0) {
+ NOTREACHED();
+ return 0;
+ }
+
+ return print_context_->getPageShrink(page);
+}
+
float WebFrameImpl::printPage(int page, WebCanvas* canvas) {
// Ensure correct state.
if (!print_context_.get() || page < 0 || !frame() || !frame()->document()) {
Index: webframe_impl.h
===================================================================
--- webframe_impl.h (revision 23266)
+++ webframe_impl.h (working copy)
@@ -147,6 +147,7 @@
virtual WebKit::WebString selectionAsMarkup() const;
virtual int printBegin(const WebKit::WebSize& page_size);
virtual float printPage(int page_to_print, WebKit::WebCanvas* canvas);
+ virtual float getPrintPageShrink(int page);
virtual void printEnd();
virtual bool find(
int identifier, const WebKit::WebString& search_text,

View File

@ -0,0 +1,37 @@
Index: plugin_list.cc
===================================================================
--- plugin_list.cc (revision 23814)
+++ plugin_list.cc (working copy)
@@ -50,7 +50,7 @@
void PluginList::RegisterInternalPlugin(const PluginVersionInfo& info) {
AutoLock lock(lock_);
- internal_plugins_.push_back(info);
+ internal_plugins_.insert(internal_plugins_.begin(), info);
}
bool PluginList::ReadPluginInfo(const FilePath &filename,
Index: plugin_list_win.cc
===================================================================
--- plugin_list_win.cc (revision 23814)
+++ plugin_list_win.cc (working copy)
@@ -356,10 +356,15 @@
}
void PluginList::LoadInternalPlugins(std::vector<WebPluginInfo>* plugins) {
- if (!use_internal_activex_shim_)
- return;
- LoadPlugin(FilePath(kActiveXShimFileName), plugins);
- LoadPlugin(FilePath(kActiveXShimFileNameForMediaPlayer), plugins);
+ for (size_t i = 0; i < internal_plugins_.size(); ++i) {
+ if (!use_internal_activex_shim_ &&
+ (internal_plugins_[i].path.value() == kActiveXShimFileName ||
+ internal_plugins_[i].path.value() ==
+ kActiveXShimFileNameForMediaPlayer)) {
+ continue;
+ }
+ LoadPlugin(internal_plugins_[i].path, plugins);
+ }
}
} // namespace NPAPI