Update to Chromium revision b0aa1fb5 (#296183).

- Restore CefRenderHandler::OnScrollOffsetChanged.
- Add new RT_PING and RT_SERVICE_WORKER resource type values.
- The resource type for image sub-resource loads has changed from RT_IMAGE to RT_PREFETCH (this is a regression, see http://crbug.com/415253#c23).
- Add a patch to fix a crash in Scheduler::swapQueuesRunPendingTasks* (http://crbug.com/415478).
- Add documentation for cef_key_event_type_t values.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1846 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2014-09-26 23:48:19 +00:00
parent 418303a1ff
commit 2ba756d3e1
85 changed files with 956 additions and 1398 deletions

View File

@ -7,5 +7,5 @@
# https://code.google.com/p/chromiumembedded/wiki/BranchesAndBuilding
{
'chromium_checkout': 'ad468e8b47617a4f9fb70fecfd9ea320e6f8c1cf',
'chromium_checkout': 'b0aa1fb52e46b9c6580227c856ec4e063bb57799',
}

22
cef.gyp
View File

@ -718,6 +718,7 @@
'target_name': 'cef_pak',
'type': 'none',
'dependencies': [
'<(DEPTH)/components/components_resources.gyp:components_resources',
'<(DEPTH)/components/components_strings.gyp:components_strings',
'<(DEPTH)/content/app/resources/content_resources.gyp:content_resources',
'<(DEPTH)/content/app/strings/content_strings.gyp:content_strings',
@ -736,6 +737,7 @@
'variables': {
'pak_inputs': [
'<(SHARED_INTERMEDIATE_DIR)/blink/public/resources/blink_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/components/component_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
'<(grit_out_dir)/cef_resources.pak',
@ -748,6 +750,7 @@
'action_name': 'repack_cef_100_percent_pack',
'variables': {
'pak_inputs': [
'<(SHARED_INTERMEDIATE_DIR)/components/component_resources_100_percent.pak',
'<(SHARED_INTERMEDIATE_DIR)/content/app/resources/content_resources_100_percent.pak',
'<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_100_percent.pak',
],
@ -759,6 +762,7 @@
'action_name': 'repack_cef_200_percent_pack',
'variables': {
'pak_inputs': [
'<(SHARED_INTERMEDIATE_DIR)/components/component_resources_200_percent.pak',
'<(SHARED_INTERMEDIATE_DIR)/content/app/resources/content_resources_200_percent.pak',
'<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_200_percent.pak',
],
@ -849,6 +853,7 @@
'<(DEPTH)/components/components.gyp:pdf_browser',
'<(DEPTH)/components/components.gyp:pdf_common',
'<(DEPTH)/components/components.gyp:pdf_renderer',
'<(DEPTH)/components/components.gyp:web_cache_renderer',
'<(DEPTH)/content/content.gyp:content_app_both',
'<(DEPTH)/content/content.gyp:content_browser',
'<(DEPTH)/content/content.gyp:content_common',
@ -860,11 +865,13 @@
'<(DEPTH)/content/content.gyp:content_utility',
'<(DEPTH)/gpu/gpu.gyp:gpu',
'<(DEPTH)/ipc/ipc.gyp:ipc',
'<(DEPTH)/media/blink/media_blink.gyp:media_blink',
'<(DEPTH)/media/media.gyp:media',
'<(DEPTH)/net/net.gyp:net',
'<(DEPTH)/net/net.gyp:net_with_v8',
'<(DEPTH)/pdf/pdf.gyp:pdf',
'<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/storage/storage_browser.gyp:storage',
'<(DEPTH)/third_party/libxml/libxml.gyp:libxml',
'<(DEPTH)/third_party/re2/re2.gyp:re2',
'<(DEPTH)/third_party/WebKit/public/blink.gyp:blink',
@ -873,7 +880,6 @@
'<(DEPTH)/ui/gl/gl.gyp:gl',
'<(DEPTH)/ui/base/ui_base.gyp:ui_base',
'<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
'<(DEPTH)/webkit/storage_browser.gyp:storage',
# Necessary to generate the grit include files.
'cef_pak',
],
@ -992,8 +998,6 @@
'libcef/browser/zip_reader_impl.cc',
'libcef/browser/zip_reader_impl.h',
'libcef/common/base_impl.cc',
'libcef/common/breakpad_client.cc',
'libcef/common/breakpad_client.h',
'libcef/common/cef_message_generator.cc',
'libcef/common/cef_message_generator.h',
'libcef/common/cef_messages.cc',
@ -1004,6 +1008,8 @@
'libcef/common/command_line_impl.h',
'libcef/common/content_client.cc',
'libcef/common/content_client.h',
'libcef/common/crash_reporter_client.cc',
'libcef/common/crash_reporter_client.h',
'libcef/common/drag_data_impl.cc',
'libcef/common/drag_data_impl.h',
'libcef/common/http_header_utils.cc',
@ -1131,10 +1137,6 @@
'libcef/browser/menu_creator_runner_win.cc',
'libcef/browser/menu_creator_runner_win.h',
'libcef/browser/render_widget_host_view_osr_win.cc',
],
}],
['OS=="win" and win_pdf_metafile_for_printing==1', {
'sources': [
# Include sources for printing using PDF.
'libcef/utility/printing_handler.cc',
'libcef/utility/printing_handler.h',
@ -1144,12 +1146,6 @@
'<(DEPTH)/chrome/renderer/printing/print_web_view_helper_pdf_win.cc',
],
}],
['OS=="win" and win_pdf_metafile_for_printing!=1', {
'sources': [
# Include sources for printing using EMF.
'<(DEPTH)/chrome/renderer/printing/print_web_view_helper_win.cc',
],
}],
[ 'OS=="mac"', {
'sources': [
'<@(includes_mac)',

View File

@ -6,6 +6,8 @@
'variables': {
# Don't use the chrome style plugin with CEF.
'clang_use_chrome_plugins': 0,
# Set ENABLE_PRINTING=1.
'enable_printing': 2,
'conditions': [
# Directory for CEF source files.
[ 'OS=="win"', {

View File

@ -64,7 +64,7 @@ class BindStateBase : public RefCountedThreadSafe<BindStateBase> {
class CallbackBase {
public:
// Returns true if Callback is null (doesn't refer to anything).
bool is_null() const;
bool is_null() const { return bind_state_.get() == NULL; }
// Returns the Callback into an uninitialized state.
void Reset();

View File

@ -159,6 +159,12 @@ class CefRenderHandler : public virtual CefBase {
/*--cef()--*/
virtual void UpdateDragCursor(CefRefPtr<CefBrowser> browser,
DragOperation operation) {}
///
// Called when the scroll offset has changed.
///
/*--cef()--*/
virtual void OnScrollOffsetChanged(CefRefPtr<CefBrowser> browser) {}
};
#endif // CEF_INCLUDE_CEF_RENDER_HANDLER_H_

View File

@ -915,6 +915,16 @@ typedef enum {
// XMLHttpRequest.
///
RT_XHR,
///
// A request for a <ping>
///
RT_PING,
///
// Main resource of a service worker.
///
RT_SERVICE_WORKER,
} cef_resource_type_t;
///
@ -1459,9 +1469,28 @@ typedef enum {
// Key event types.
///
typedef enum {
///
// Notification that a key transitioned from "up" to "down".
///
KEYEVENT_RAWKEYDOWN = 0,
///
// Notification that a key was pressed. This does not necessarily correspond
// to a character depending on the key and language. Use KEYEVENT_CHAR for
// character input.
///
KEYEVENT_KEYDOWN,
///
// Notification that a key was released.
///
KEYEVENT_KEYUP,
///
// Notification that a character was typed. Use this for text input. Key
// down events may generate 0, 1, or more than one character event depending
// on the key, locale, and operating system.
///
KEYEVENT_CHAR
} cef_key_event_type_t;

View File

@ -36,12 +36,6 @@ class CefBrowserContextImpl::CefResourceContext : public content::ResourceContex
CHECK(getter_);
return getter_->GetURLRequestContext();
}
virtual bool AllowMicAccess(const GURL& origin) OVERRIDE {
return true;
}
virtual bool AllowCameraAccess(const GURL& origin) OVERRIDE {
return true;
}
void set_url_request_context_getter(CefURLRequestContextGetter* getter) {
getter_ = getter;
@ -141,7 +135,7 @@ content::SSLHostStateDelegate*
net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
DCHECK(!url_request_getter_);
DCHECK(!url_request_getter_.get());
url_request_getter_ = new CefURLRequestContextGetter(
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),

View File

@ -19,7 +19,8 @@
using content::BrowserThread;
class CefBrowserContextProxy::CefResourceContext : public content::ResourceContext {
class CefBrowserContextProxy::CefResourceContext :
public content::ResourceContext {
public:
CefResourceContext() : getter_(NULL) {}
virtual ~CefResourceContext() {}
@ -33,12 +34,6 @@ class CefBrowserContextProxy::CefResourceContext : public content::ResourceConte
CHECK(getter_);
return getter_->GetURLRequestContext();
}
virtual bool AllowMicAccess(const GURL& origin) OVERRIDE {
return true;
}
virtual bool AllowCameraAccess(const GURL& origin) OVERRIDE {
return true;
}
void set_url_request_context_getter(CefURLRequestContextGetterProxy* getter) {
getter_ = getter;
@ -138,7 +133,7 @@ content::SSLHostStateDelegate*
net::URLRequestContextGetter* CefBrowserContextProxy::CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
DCHECK(!url_request_getter_);
DCHECK(!url_request_getter_.get());
url_request_getter_ =
new CefURLRequestContextGetterProxy(handler_,
static_cast<CefURLRequestContextGetter*>(

View File

@ -373,9 +373,9 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::CreateInternal(windowInfo, settings, client, NULL,
info, opener, request_context);
if (browser && !url.empty()) {
if (browser.get() && !url.empty()) {
browser->LoadURL(CefFrameHostImpl::kMainFrameId, url, content::Referrer(),
content::PAGE_TRANSITION_TYPED, std::string());
ui::PAGE_TRANSITION_TYPED, std::string());
}
return browser.get();
}
@ -1427,7 +1427,7 @@ void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) {
void CefBrowserHostImpl::LoadRequest(int64 frame_id,
CefRefPtr<CefRequest> request) {
CefNavigateParams params(GURL(std::string(request->GetURL())),
content::PAGE_TRANSITION_TYPED);
ui::PAGE_TRANSITION_TYPED);
params.method = request->GetMethod();
params.frame_id = frame_id;
params.first_party_for_cookies =
@ -1454,7 +1454,7 @@ void CefBrowserHostImpl::LoadURL(
int64 frame_id,
const std::string& url,
const content::Referrer& referrer,
content::PageTransition transition,
ui::PageTransition transition,
const std::string& extra_headers) {
if (frame_id == CefFrameHostImpl::kMainFrameId) {
// Go through the navigation controller.
@ -2318,7 +2318,7 @@ void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) {
void CefBrowserHostImpl::DidCommitProvisionalLoadForFrame(
content::RenderFrameHost* render_frame_host,
const GURL& url,
content::PageTransition transition_type) {
ui::PageTransition transition_type) {
const bool is_main_frame = !render_frame_host->GetParent();
CefRefPtr<CefFrame> frame = GetOrCreateFrame(
render_frame_host->GetRoutingID(),
@ -2749,12 +2749,12 @@ void CefBrowserHostImpl::SetFocusedFrame(int64 frame_id) {
}
focused_frame_id_ =
focused_frame ? frame_id : CefFrameHostImpl::kInvalidFrameId;
focused_frame.get() ? frame_id : CefFrameHostImpl::kInvalidFrameId;
}
if (unfocused_frame)
if (unfocused_frame.get())
unfocused_frame->SetFocused(false);
if (focused_frame)
if (focused_frame.get())
focused_frame->SetFocused(true);
}
@ -2771,7 +2771,7 @@ void CefBrowserHostImpl::OnAddressChange(CefRefPtr<CefFrame> frame,
void CefBrowserHostImpl::OnLoadStart(CefRefPtr<CefFrame> frame,
const GURL& url,
content::PageTransition transition_type) {
ui::PageTransition transition_type) {
if (client_.get()) {
CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler();
if (handler.get()) {

View File

@ -246,7 +246,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
void LoadURL(int64 frame_id,
const std::string& url,
const content::Referrer& referrer,
content::PageTransition transition,
ui::PageTransition transition,
const std::string& extra_headers);
// Load the specified string.
@ -413,7 +413,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
virtual void DidCommitProvisionalLoadForFrame(
content::RenderFrameHost* render_frame_host,
const GURL& url,
content::PageTransition transition_type) OVERRIDE;
ui::PageTransition transition_type) OVERRIDE;
virtual void DidFailProvisionalLoad(
content::RenderFrameHost* render_frame_host,
const GURL& validated_url,
@ -545,7 +545,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
const GURL& url);
void OnLoadStart(CefRefPtr<CefFrame> frame,
const GURL& url,
content::PageTransition transition_type);
ui::PageTransition transition_type);
void OnLoadError(CefRefPtr<CefFrame> frame,
const GURL& url,
int error_code,

View File

@ -127,6 +127,6 @@ void CefBrowserMessageFilter::OnFrameFocused(int32 render_frame_routing_id) {
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForFrame(host_->GetID(),
render_frame_routing_id);
if (browser)
if (browser.get())
browser->SetFocusedFrame(render_frame_routing_id);
}

View File

@ -27,12 +27,12 @@ scoped_ptr<PrefService> CefBrowserPrefStore::CreateService() {
scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple());
// Default settings.
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry);
PrefProxyConfigTrackerImpl::RegisterPrefs(registry);
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get());
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
return factory.Create(registry);
return factory.Create(registry.get());
}
CefBrowserPrefStore::~CefBrowserPrefStore() {

View File

@ -70,7 +70,7 @@ class NET_EXPORT CefURLFetcherResponseWriter :
virtual int Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) OVERRIDE {
if (url_request_) {
if (url_request_.get()) {
message_loop_proxy_->PostTask(FROM_HERE,
base::Bind(&CefURLFetcherResponseWriter::WriteOnClientThread,
url_request_, scoped_refptr<net::IOBuffer>(buffer),
@ -82,7 +82,7 @@ class NET_EXPORT CefURLFetcherResponseWriter :
}
virtual int Finish(const net::CompletionCallback& callback) OVERRIDE {
if (url_request_)
if (url_request_.get())
url_request_ = NULL;
return net::OK;
}
@ -95,7 +95,7 @@ class NET_EXPORT CefURLFetcherResponseWriter :
const net::CompletionCallback& callback,
scoped_refptr<base::MessageLoopProxy> source_message_loop_proxy) {
CefRefPtr<CefURLRequestClient> client = url_request->GetClient();
if (client)
if (client.get())
client->OnDownloadData(url_request.get(), buffer->data(), num_bytes);
source_message_loop_proxy->PostTask(FROM_HERE,
@ -184,7 +184,7 @@ class CefBrowserURLRequest::Context
fetcher_.reset(net::URLFetcher::Create(url, request_type,
fetcher_delegate_.get()));
fetcher_->SetRequestContext(
CefContentBrowserClient::Get()->request_context());
CefContentBrowserClient::Get()->request_context().get());
CefRequest::HeaderMap headerMap;
request_->GetHeaderMap(headerMap);

View File

@ -15,6 +15,7 @@
#include "libcef/browser/browser_settings.h"
#include "libcef/browser/chrome_scheme_handler.h"
#include "libcef/browser/context.h"
#include "libcef/browser/devtools_delegate.h"
#include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/printing/printing_message_filter.h"
#include "libcef/browser/resource_dispatcher_host_delegate.h"
@ -63,7 +64,7 @@ class CefAccessTokenStore : public content::AccessTokenStore {
virtual void LoadAccessTokens(
const LoadAccessTokensCallbackType& callback) OVERRIDE {
callback.Run(access_token_set_,
CefContentBrowserClient::Get()->request_context());
CefContentBrowserClient::Get()->request_context().get());
}
virtual void SaveAccessToken(
@ -978,6 +979,10 @@ std::string CefContentBrowserClient::GetDefaultDownloadName() {
return "download";
}
content::DevToolsManagerDelegate*
CefContentBrowserClient::GetDevToolsManagerDelegate() {
return new CefDevToolsManagerDelegate(browser_context());
}
#if defined(OS_POSIX) && !defined(OS_MACOSX)
void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(

View File

@ -145,6 +145,8 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
virtual void BrowserURLHandlerCreated(
content::BrowserURLHandler* handler) OVERRIDE;
virtual std::string GetDefaultDownloadName() OVERRIDE;
virtual content::DevToolsManagerDelegate* GetDevToolsManagerDelegate()
OVERRIDE;
#if defined(OS_POSIX) && !defined(OS_MACOSX)
virtual void GetAdditionalMappedFilesForChildProcess(

View File

@ -108,7 +108,7 @@ void CefCookieManagerImpl::Initialize(
void CefCookieManagerImpl::SetSupportedSchemes(
const std::vector<CefString>& schemes) {
if (CEF_CURRENTLY_ON_IOT()) {
if (!cookie_monster_)
if (!cookie_monster_.get())
return;
if (is_global_) {
@ -157,11 +157,11 @@ void CefCookieManagerImpl::SetSupportedSchemes(
bool CefCookieManagerImpl::VisitAllCookies(
CefRefPtr<CefCookieVisitor> visitor) {
if (CEF_CURRENTLY_ON_IOT()) {
if (!cookie_monster_)
if (!cookie_monster_.get())
return false;
scoped_refptr<VisitCookiesCallback> callback(
new VisitCookiesCallback(cookie_monster_, visitor));
new VisitCookiesCallback(cookie_monster_.get(), visitor));
cookie_monster_->GetAllCookiesAsync(
base::Bind(&VisitCookiesCallback::Run, callback.get()));
@ -179,7 +179,7 @@ bool CefCookieManagerImpl::VisitUrlCookies(
const CefString& url, bool includeHttpOnly,
CefRefPtr<CefCookieVisitor> visitor) {
if (CEF_CURRENTLY_ON_IOT()) {
if (!cookie_monster_)
if (!cookie_monster_.get())
return false;
net::CookieOptions options;
@ -187,7 +187,7 @@ bool CefCookieManagerImpl::VisitUrlCookies(
options.set_include_httponly();
scoped_refptr<VisitCookiesCallback> callback(
new VisitCookiesCallback(cookie_monster_, visitor));
new VisitCookiesCallback(cookie_monster_.get(), visitor));
GURL gurl = GURL(url.ToString());
cookie_monster_->GetAllCookiesForURLWithOptionsAsync(gurl, options,
@ -206,7 +206,7 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
const CefCookie& cookie) {
CEF_REQUIRE_IOT_RETURN(false);
if (!cookie_monster_)
if (!cookie_monster_.get())
return false;
GURL gurl = GURL(url.ToString());
@ -236,7 +236,7 @@ bool CefCookieManagerImpl::DeleteCookies(const CefString& url,
const CefString& cookie_name) {
CEF_REQUIRE_IOT_RETURN(false);
if (!cookie_monster_)
if (!cookie_monster_.get())
return false;
if (url.empty()) {
@ -279,8 +279,8 @@ bool CefCookieManagerImpl::SetStoragePath(
return true;
}
if (cookie_monster_ && ((storage_path_.empty() && path.empty()) ||
storage_path_ == new_path)) {
if (cookie_monster_.get() && ((storage_path_.empty() && path.empty()) ||
storage_path_ == new_path)) {
// The path has not changed so don't do anything.
return true;
}
@ -330,7 +330,7 @@ bool CefCookieManagerImpl::SetStoragePath(
bool CefCookieManagerImpl::FlushStore(
CefRefPtr<CefCompletionCallback> callback) {
if (CEF_CURRENTLY_ON_IOT()) {
if (!cookie_monster_) {
if (!cookie_monster_.get()) {
if (callback.get())
RunCompletionOnIOThread(callback);
return true;
@ -355,10 +355,10 @@ bool CefCookieManagerImpl::FlushStore(
void CefCookieManagerImpl::SetGlobal() {
if (CEF_CURRENTLY_ON_IOT()) {
if (CefContentBrowserClient::Get()->request_context()) {
if (CefContentBrowserClient::Get()->request_context().get()) {
cookie_monster_ = CefContentBrowserClient::Get()->request_context()->
GetURLRequestContext()->cookie_store()->GetCookieMonster();
DCHECK(cookie_monster_);
DCHECK(cookie_monster_.get());
}
} else {
// Execute on the IO thread.

View File

@ -33,7 +33,7 @@ class CefCookieManagerImpl : public CefCookieManager {
bool persist_session_cookies) OVERRIDE;
virtual bool FlushStore(CefRefPtr<CefCompletionCallback> callback) OVERRIDE;
net::CookieMonster* cookie_monster() { return cookie_monster_; }
net::CookieMonster* cookie_monster() { return cookie_monster_.get(); }
static bool GetCefCookie(const net::CanonicalCookie& cc, CefCookie& cookie);
static bool GetCefCookie(const GURL& url, const std::string& cookie_line,

View File

@ -155,26 +155,6 @@ base::FilePath CefDevToolsDelegate::GetDebugFrontendDir() {
return base::FilePath();
}
std::string CefDevToolsDelegate::GetPageThumbnailData(const GURL& url) {
return std::string();
}
scoped_ptr<content::DevToolsTarget> CefDevToolsDelegate::CreateNewTarget(
const GURL& url) {
return scoped_ptr<content::DevToolsTarget>();
}
void CefDevToolsDelegate::EnumerateTargets(TargetCallback callback) {
TargetList targets;
content::DevToolsAgentHost::List agents =
content::DevToolsAgentHost::GetOrCreateAll();
for (content::DevToolsAgentHost::List::iterator it = agents.begin();
it != agents.end(); ++it) {
targets.push_back(new Target(*it));
}
callback.Run(targets);
}
scoped_ptr<net::StreamListenSocket>
CefDevToolsDelegate::CreateSocketForTethering(
net::StreamListenSocket::Delegate* delegate,
@ -186,3 +166,40 @@ std::string CefDevToolsDelegate::GetChromeDevToolsURL() {
return base::StringPrintf("%s://%s/devtools.html",
content::kChromeDevToolsScheme, scheme::kChromeDevToolsHost);
}
// CefDevToolsManagerDelegate
CefDevToolsManagerDelegate::CefDevToolsManagerDelegate(
content::BrowserContext* browser_context)
: browser_context_(browser_context) {
}
CefDevToolsManagerDelegate::~CefDevToolsManagerDelegate() {
}
base::DictionaryValue* CefDevToolsManagerDelegate::HandleCommand(
content::DevToolsAgentHost* agent_host,
base::DictionaryValue* command) {
return NULL;
}
std::string CefDevToolsManagerDelegate::GetPageThumbnailData(
const GURL& url) {
return std::string();
}
scoped_ptr<content::DevToolsTarget>
CefDevToolsManagerDelegate::CreateNewTarget(const GURL& url) {
return scoped_ptr<content::DevToolsTarget>();
}
void CefDevToolsManagerDelegate::EnumerateTargets(TargetCallback callback) {
TargetList targets;
content::DevToolsAgentHost::List agents =
content::DevToolsAgentHost::GetOrCreateAll();
for (content::DevToolsAgentHost::List::iterator it = agents.begin();
it != agents.end(); ++it) {
targets.push_back(new Target(*it));
}
callback.Run(targets);
}

View File

@ -15,6 +15,7 @@
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_http_handler.h"
#include "content/public/browser/devtools_http_handler_delegate.h"
#include "content/public/browser/devtools_manager_delegate.h"
namespace content {
class RenderViewHost;
@ -28,14 +29,10 @@ class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
// Stops http server.
void Stop();
// DevToolsHttpProtocolHandler::Delegate overrides.
// DevToolsHttpHandlerDelegate overrides.
virtual std::string GetDiscoveryPageHTML() OVERRIDE;
virtual bool BundlesFrontendResources() OVERRIDE;
virtual base::FilePath GetDebugFrontendDir() OVERRIDE;
virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE;
virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget(const GURL& url)
OVERRIDE;
virtual void EnumerateTargets(TargetCallback callback) OVERRIDE;
virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering(
net::StreamListenSocket::Delegate* delegate,
std::string* name) OVERRIDE;
@ -49,4 +46,29 @@ class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
DISALLOW_COPY_AND_ASSIGN(CefDevToolsDelegate);
};
class CefDevToolsManagerDelegate : public content::DevToolsManagerDelegate {
public:
explicit CefDevToolsManagerDelegate(
content::BrowserContext* browser_context);
virtual ~CefDevToolsManagerDelegate();
// DevToolsManagerDelegate implementation.
virtual void Inspect(content::BrowserContext* browser_context,
content::DevToolsAgentHost* agent_host) OVERRIDE {}
virtual void DevToolsAgentStateChanged(content::DevToolsAgentHost* agent_host,
bool attached) OVERRIDE {}
virtual base::DictionaryValue* HandleCommand(
content::DevToolsAgentHost* agent_host,
base::DictionaryValue* command) OVERRIDE;
virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget(
const GURL& url) OVERRIDE;
virtual void EnumerateTargets(TargetCallback callback) OVERRIDE;
virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE;
private:
content::BrowserContext* browser_context_;
DISALLOW_COPY_AND_ASSIGN(CefDevToolsManagerDelegate);
};
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DELEGATE_H_

View File

@ -121,7 +121,7 @@ void CefFrameHostImpl::LoadRequest(CefRefPtr<CefRequest> request) {
frame_id = (is_main_frame_ ? kMainFrameId : frame_id_);
}
if (browser)
if (browser.get())
browser->LoadRequest(frame_id, request);
}
@ -135,9 +135,9 @@ void CefFrameHostImpl::LoadURL(const CefString& url) {
frame_id = (is_main_frame_ ? kMainFrameId : frame_id_);
}
if (browser) {
if (browser.get()) {
browser->LoadURL(frame_id, url, content::Referrer(),
content::PAGE_TRANSITION_TYPED, std::string());
ui::PAGE_TRANSITION_TYPED, std::string());
}
}
@ -152,7 +152,7 @@ void CefFrameHostImpl::LoadString(const CefString& string,
frame_id = (is_main_frame_ ? kMainFrameId : frame_id_);
}
if (browser)
if (browser.get())
browser->LoadString(frame_id, string, url);
}
@ -192,7 +192,7 @@ CefRefPtr<CefFrame> CefFrameHostImpl::GetParent() {
parent_frame_id = parent_frame_id_;
}
if (browser)
if (browser.get())
return browser->GetFrame(parent_frame_id);
return NULL;
@ -252,7 +252,7 @@ void CefFrameHostImpl::SendJavaScript(
frame_id = (is_main_frame_ ? kMainFrameId : frame_id_);
}
if (browser)
if (browser.get())
browser->SendCode(frame_id, true, jsCode, scriptUrl, startLine, NULL);
}
@ -274,6 +274,6 @@ void CefFrameHostImpl::SendCommand(
frame_id = frame_id_;
}
if (browser && frame_id != kInvalidFrameId)
if (browser.get() && frame_id != kInvalidFrameId)
browser->SendCommand(frame_id, command, responseHandler);
}

View File

@ -28,7 +28,7 @@ class CefLocationRequest :
private:
void OnLocationUpdate(const content::Geoposition& position) {
CEF_REQUIRE_UIT();
if (callback_) {
if (callback_.get()) {
CefGeoposition cef_position;
SetPosition(position, cef_position);
callback_->OnLocationUpdate(cef_position);

View File

@ -115,19 +115,6 @@ void CefMediaCaptureDevicesDispatcher::OnCreatingAudioStream(
int render_view_id) {
}
void CefMediaCaptureDevicesDispatcher::OnAudioStreamPlaying(
int render_process_id,
int render_frame_id,
int stream_id,
const ReadPowerAndClipCallback& power_read_callback) {
}
void CefMediaCaptureDevicesDispatcher::OnAudioStreamStopped(
int render_process_id,
int render_frame_id,
int stream_id) {
}
const MediaStreamDevices&
CefMediaCaptureDevicesDispatcher::GetAudioCaptureDevices() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

View File

@ -53,15 +53,6 @@ class CefMediaCaptureDevicesDispatcher : public content::MediaObserver {
content::MediaRequestState state) OVERRIDE;
virtual void OnCreatingAudioStream(int render_process_id,
int render_view_id) OVERRIDE;
virtual void OnAudioStreamPlaying(
int render_process_id,
int render_frame_id,
int stream_id,
const ReadPowerAndClipCallback& power_read_callback) OVERRIDE;
virtual void OnAudioStreamStopped(
int render_process_id,
int render_frame_id,
int stream_id) OVERRIDE;
private:
friend struct DefaultSingletonTraits<CefMediaCaptureDevicesDispatcher>;

View File

@ -7,7 +7,7 @@
CefNavigateParams::CefNavigateParams(
const GURL& a_url,
content::PageTransition a_transition)
ui::PageTransition a_transition)
: url(a_url),
frame_id(-1),
disposition(CURRENT_TAB),

View File

@ -12,15 +12,15 @@
#include "libcef/common/upload_data.h"
#include "content/public/browser/global_request_id.h"
#include "content/public/common/page_transition_types.h"
#include "content/public/common/referrer.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/window_open_disposition.h"
#include "url/gurl.h"
// Parameters that tell CefBrowserHostImpl::Navigate() what to do.
struct CefNavigateParams {
CefNavigateParams(const GURL& a_url,
content::PageTransition a_transition);
ui::PageTransition a_transition);
~CefNavigateParams();
// The following parameters are sent to the renderer via CefMsg_LoadRequest.
@ -61,7 +61,7 @@ struct CefNavigateParams {
WindowOpenDisposition disposition;
// The transition type of the navigation.
content::PageTransition transition;
ui::PageTransition transition;
// Whether this navigation was initiated by the renderer process.
bool is_renderer_initiated;

View File

@ -36,7 +36,7 @@ class CefPrintDialogCallbackImpl : public CefPrintDialogCallback {
virtual void Continue(CefRefPtr<CefPrintSettings> settings) OVERRIDE {
if (CEF_CURRENTLY_ON_UIT()) {
if (dialog_) {
if (dialog_.get()) {
dialog_->OnPrintContinue(settings);
dialog_ = NULL;
}
@ -48,7 +48,7 @@ class CefPrintDialogCallbackImpl : public CefPrintDialogCallback {
virtual void Cancel() OVERRIDE {
if (CEF_CURRENTLY_ON_UIT()) {
if (dialog_) {
if (dialog_.get()) {
dialog_->OnPrintCancel();
dialog_ = NULL;
}
@ -77,7 +77,7 @@ class CefPrintJobCallbackImpl : public CefPrintJobCallback {
virtual void Continue() OVERRIDE {
if (CEF_CURRENTLY_ON_UIT()) {
if (dialog_) {
if (dialog_.get()) {
dialog_->OnJobCompleted();
dialog_ = NULL;
}
@ -131,7 +131,7 @@ void CefPrintDialogLinux::ShowDialog(
CEF_REQUIRE_UIT();
SetHandler();
if (!handler_) {
if (!handler_.get()) {
callback.Run(PrintingContextLinux::CANCEL);
return;
}
@ -147,8 +147,9 @@ void CefPrintDialogLinux::ShowDialog(
}
}
void CefPrintDialogLinux::PrintDocument(const printing::Metafile* metafile,
const base::string16& document_name) {
void CefPrintDialogLinux::PrintDocument(
const printing::MetafilePlayer& metafile,
const base::string16& document_name) {
// This runs on the print worker thread, does not block the UI thread.
DCHECK(!CEF_CURRENTLY_ON_UIT());
@ -156,28 +157,30 @@ void CefPrintDialogLinux::PrintDocument(const printing::Metafile* metafile,
// this dialog.
AddRef();
bool error = false;
if (!base::CreateTemporaryFile(&path_to_pdf_)) {
LOG(ERROR) << "Creating temporary file failed";
error = true;
bool success = base::CreateTemporaryFile(&path_to_pdf_);
if (success) {
base::File file;
file.Initialize(path_to_pdf_,
base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
success = metafile.SaveTo(&file);
file.Close();
if (!success)
base::DeleteFile(path_to_pdf_, false);
}
if (!error && !metafile->SaveTo(path_to_pdf_)) {
if (!success) {
LOG(ERROR) << "Saving metafile failed";
base::DeleteFile(path_to_pdf_, false);
error = true;
}
if (error) {
// Matches AddRef() above.
Release();
} else {
// No errors, continue printing.
CEF_POST_TASK(
CEF_UIT,
base::Bind(&CefPrintDialogLinux::SendDocumentToPrinter, this,
document_name));
return;
}
// No errors, continue printing.
CEF_POST_TASK(
CEF_UIT,
base::Bind(&CefPrintDialogLinux::SendDocumentToPrinter, this,
document_name));
}
void CefPrintDialogLinux::AddRefToDialog() {
@ -189,20 +192,20 @@ void CefPrintDialogLinux::ReleaseDialog() {
}
void CefPrintDialogLinux::SetHandler() {
if (handler_)
if (handler_.get())
return;
CefRefPtr<CefApp> app = CefContentClient::Get()->application();
if (app.get()) {
CefRefPtr<CefBrowserProcessHandler> browser_handler =
app->GetBrowserProcessHandler();
if (browser_handler)
if (browser_handler.get())
handler_ = browser_handler->GetPrintHandler();
}
}
void CefPrintDialogLinux::ReleaseHandler() {
if (handler_) {
if (handler_.get()) {
handler_->OnPrintReset();
handler_ = NULL;
}
@ -213,7 +216,7 @@ bool CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings,
CEF_REQUIRE_UIT();
SetHandler();
if (!handler_)
if (!handler_.get())
return false;
CefRefPtr<CefPrintSettingsImpl> settings_impl(
@ -229,7 +232,7 @@ void CefPrintDialogLinux::SendDocumentToPrinter(
const base::string16& document_name) {
CEF_REQUIRE_UIT();
if (!handler_) {
if (!handler_.get()) {
OnJobCompleted();
return;
}

View File

@ -17,7 +17,7 @@
#include "printing/printing_context_linux.h"
namespace printing {
class Metafile;
class MetafilePlayer;
class PrintSettings;
}
@ -40,7 +40,7 @@ class CefPrintDialogLinux
gfx::NativeView parent_view,
bool has_selection,
const PrintingContextLinux::PrintSettingsCallback& callback) OVERRIDE;
virtual void PrintDocument(const printing::Metafile* metafile,
virtual void PrintDocument(const printing::MetafilePlayer& metafile,
const base::string16& document_name) OVERRIDE;
virtual void AddRefToDialog() OVERRIDE;
virtual void ReleaseDialog() OVERRIDE;

View File

@ -15,7 +15,6 @@
#include "chrome/common/print_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "printing/print_destination_interface.h"
using content::BrowserThread;
@ -30,19 +29,11 @@ PrintViewManager::PrintViewManager(content::WebContents* web_contents)
PrintViewManager::~PrintViewManager() {
}
#if !defined(DISABLE_BASIC_PRINTING)
bool PrintViewManager::PrintForSystemDialogNow() {
return PrintNowInternal(new PrintMsg_PrintForSystemDialog(routing_id()));
}
bool PrintViewManager::PrintToDestination() {
// TODO(mad): Remove this once we can send user metrics from the metro driver.
// crbug.com/142330
UMA_HISTOGRAM_ENUMERATION("Metro.Print", 0, 2);
// TODO(mad): Use a passed in destination interface instead.
g_browser_process->print_job_manager()->queue()->SetDestination(
printing::CreatePrintDestination());
return PrintNowInternal(new PrintMsg_PrintPages(routing_id()));
}
#endif // !DISABLE_BASIC_PRINTING
void PrintViewManager::RenderProcessGone(base::TerminationStatus status) {
PrintViewManagerBase::RenderProcessGone(status);

View File

@ -20,14 +20,11 @@ class PrintViewManager : public PrintViewManagerBase,
public:
virtual ~PrintViewManager();
#if !defined(DISABLE_BASIC_PRINTING)
// Same as PrintNow(), but for the case where a user prints with the system
// dialog from print preview.
bool PrintForSystemDialogNow();
// Same as PrintNow(), but for the case where we want to send the result to
// another destination.
// TODO(mad) Add an argument so we can pass the destination interface.
bool PrintToDestination();
#endif // !DISABLE_BASIC_PRINTING
// content::WebContentsObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;

View File

@ -25,17 +25,10 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "printing/metafile_impl.h"
#include "printing/pdf_metafile_skia.h"
#include "printing/printed_document.h"
#include "ui/base/l10n/l10n_util.h"
#if defined(WIN_PDF_METAFILE_FOR_PRINTING)
#include "base/memory/ref_counted.h"
#include "base/memory/ref_counted_memory.h"
#include "chrome/browser/printing/pdf_to_emf_converter.h"
#include "printing/pdf_render_settings.h"
#endif
using base::TimeDelta;
using content::BrowserThread;
@ -43,11 +36,6 @@ namespace printing {
namespace {
#if defined(OS_WIN) && !defined(WIN_PDF_METAFILE_FOR_PRINTING)
// Limits memory usage by raster to 64 MiB.
const int kMaxRasterSizeInPixels = 16*1024*1024;
#endif
} // namespace
PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
@ -58,10 +46,9 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
cookie_(0),
queue_(g_browser_process->print_job_manager()->queue()) {
DCHECK(queue_.get());
#if (defined(OS_POSIX) && !defined(OS_MACOSX)) || \
defined(WIN_PDF_METAFILE_FOR_PRINTING)
#if !defined(OS_MACOSX)
expecting_first_page_ = true;
#endif
#endif // OS_MACOSX
printing_enabled_.Init(
prefs::kPrintingEnabled,
CefContentBrowserClient::Get()->pref_service(),
@ -74,9 +61,11 @@ PrintViewManagerBase::~PrintViewManagerBase() {
DisconnectFromCurrentPrintJob();
}
#if !defined(DISABLE_BASIC_PRINTING)
bool PrintViewManagerBase::PrintNow() {
return PrintNowInternal(new PrintMsg_PrintPages(routing_id()));
}
#endif // !DISABLE_BASIC_PRINTING
void PrintViewManagerBase::UpdateScriptedPrintingBlocked() {
Send(new PrintMsg_SetScriptedPrintingBlocked(
@ -123,37 +112,6 @@ void PrintViewManagerBase::OnDidGetDocumentCookie(int cookie) {
cookie_ = cookie;
}
#if defined(WIN_PDF_METAFILE_FOR_PRINTING)
void PrintViewManagerBase::OnPdfToEmfConverted(
const PrintHostMsg_DidPrintPage_Params& params,
double scale_factor,
const std::vector<base::FilePath>& emf_files) {
if (!print_job_.get())
return;
PrintedDocument* document = print_job_->document();
if (!document)
return;
for (size_t i = 0; i < emf_files.size(); ++i) {
scoped_ptr<printing::Emf> metafile(new printing::Emf);
if (!metafile->InitFromFile(emf_files[i])) {
NOTREACHED() << "Invalid metafile";
web_contents()->Stop();
return;
}
// Update the rendered document. It will send notifications to the listener.
document->SetPage(i,
metafile.release(),
scale_factor,
params.page_size,
params.content_area);
}
ShouldQuitFromInnerMessageLoop();
}
#endif // WIN_PDF_METAFILE_FOR_PRINTING
void PrintViewManagerBase::OnDidPrintPage(
const PrintHostMsg_DidPrintPage_Params& params) {
if (!OpportunisticallyCreatePrintJob(params.document_cookie))
@ -166,13 +124,12 @@ void PrintViewManagerBase::OnDidPrintPage(
return;
}
#if (defined(OS_WIN) && !defined(WIN_PDF_METAFILE_FOR_PRINTING)) || \
defined(OS_MACOSX)
#if defined(OS_MACOSX)
const bool metafile_must_be_valid = true;
#elif defined(OS_POSIX) || defined(WIN_PDF_METAFILE_FOR_PRINTING)
#else
const bool metafile_must_be_valid = expecting_first_page_;
expecting_first_page_ = false;
#endif
#endif // OS_MACOSX
base::SharedMemory shared_buf(params.metafile_data_handle, true);
if (metafile_must_be_valid) {
@ -183,7 +140,7 @@ void PrintViewManagerBase::OnDidPrintPage(
}
}
scoped_ptr<NativeMetafile> metafile(new NativeMetafile);
scoped_ptr<PdfMetafileSkia> metafile(new PdfMetafileSkia);
if (metafile_must_be_valid) {
if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) {
NOTREACHED() << "Invalid metafile header";
@ -192,32 +149,10 @@ void PrintViewManagerBase::OnDidPrintPage(
}
}
#if defined(OS_WIN) && !defined(WIN_PDF_METAFILE_FOR_PRINTING)
bool big_emf = (params.data_size && params.data_size >= kMetafileMaxSize);
int raster_size =
std::min(params.page_size.GetArea(), kMaxRasterSizeInPixels);
if (big_emf) {
scoped_ptr<NativeMetafile> raster_metafile(
metafile->RasterizeMetafile(raster_size));
if (raster_metafile.get()) {
metafile.swap(raster_metafile);
} else if (big_emf) {
// Don't fall back to emf here.
NOTREACHED() << "size:" << params.data_size;
TerminatePrintJob(true);
web_contents()->Stop();
return;
}
}
#endif // OS_WIN && !WIN_PDF_METAFILE_FOR_PRINTING
#if !defined(WIN_PDF_METAFILE_FOR_PRINTING)
#if !defined(OS_WIN)
// Update the rendered document. It will send notifications to the listener.
document->SetPage(params.page_number,
metafile.release(),
#if defined(OS_WIN)
params.actual_shrink,
#endif // OS_WIN
metafile.PassAs<MetafilePlayer>(),
params.page_size,
params.content_area);
@ -229,19 +164,10 @@ void PrintViewManagerBase::OnDidPrintPage(
params.data_size);
document->DebugDumpData(bytes, FILE_PATH_LITERAL(".pdf"));
if (!pdf_to_emf_converter_)
pdf_to_emf_converter_ = PdfToEmfConverter::CreateDefault();
const int kPrinterDpi = print_job_->settings().dpi();
pdf_to_emf_converter_->Start(
bytes,
printing::PdfRenderSettings(params.content_area, kPrinterDpi, true),
base::Bind(&PrintViewManagerBase::OnPdfToEmfConverted,
base::Unretained(this),
params));
print_job_->StartPdfToEmfConversion(
bytes, params.page_size, params.content_area);
}
#endif // !WIN_PDF_METAFILE_FOR_PRINTING
#endif // !OS_WIN
}
void PrintViewManagerBase::OnPrintingFailed(int cookie) {
@ -258,6 +184,9 @@ void PrintViewManagerBase::OnPrintingFailed(int cookie) {
content::NotificationService::NoDetails());
}
void PrintViewManagerBase::OnShowInvalidPrinterSettingsError() {
}
void PrintViewManagerBase::DidStartLoading(
content::RenderViewHost* render_view_host) {
UpdateScriptedPrintingBlocked();
@ -272,6 +201,8 @@ bool PrintViewManagerBase::OnMessageReceived(const IPC::Message& message) {
OnDidGetDocumentCookie)
IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage)
IPC_MESSAGE_HANDLER(PrintHostMsg_PrintingFailed, OnPrintingFailed)
IPC_MESSAGE_HANDLER(PrintHostMsg_ShowInvalidPrinterSettingsError,
OnShowInvalidPrinterSettingsError);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@ -434,10 +365,9 @@ void PrintViewManagerBase::DisconnectFromCurrentPrintJob() {
// DO NOT wait for the job to finish.
ReleasePrintJob();
}
#if (defined(OS_POSIX) && !defined(OS_MACOSX)) || \
defined(WIN_PDF_METAFILE_FOR_PRINTING)
#if !defined(OS_MACOSX)
expecting_first_page_ = true;
#endif
#endif // OS_MACOSX
}
void PrintViewManagerBase::PrintingDone(bool success) {
@ -560,8 +490,6 @@ void PrintViewManagerBase::ReleasePrinterQuery() {
int cookie = cookie_;
cookie_ = 0;
queue_->SetDestination(NULL);
printing::PrintJobManager* print_job_manager =
g_browser_process->print_job_manager();

View File

@ -23,7 +23,7 @@ class RenderViewHost;
namespace printing {
class JobEventDetails;
class PdfToEmfConverter;
class MetafilePlayer;
class PrintJob;
class PrintJobWorkerOwner;
class PrintQueriesQueue;
@ -35,10 +35,12 @@ class PrintViewManagerBase : public content::NotificationObserver,
public:
virtual ~PrintViewManagerBase();
#if !defined(DISABLE_BASIC_PRINTING)
// Prints the current document immediately. Since the rendering is
// asynchronous, the actual printing will not be completed on the return of
// this function. Returns false if printing is impossible at the moment.
virtual bool PrintNow();
#endif // !DISABLE_BASIC_PRINTING
// Whether to block scripted printing for our tab or not.
void UpdateScriptedPrintingBlocked();
@ -78,6 +80,7 @@ class PrintViewManagerBase : public content::NotificationObserver,
void OnDidGetPrintedPagesCount(int cookie, int number_pages);
void OnDidGetDocumentCookie(int cookie);
void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params);
void OnShowInvalidPrinterSettingsError();
// Processes a NOTIFY_PRINT_JOB_EVENT notification.
void OnNotifyPrintJobEvent(const JobEventDetails& event_details);
@ -130,13 +133,6 @@ class PrintViewManagerBase : public content::NotificationObserver,
// Release the PrinterQuery associated with our |cookie_|.
void ReleasePrinterQuery();
#if defined(WIN_PDF_METAFILE_FOR_PRINTING)
// Called on completion of converting the pdf to emf.
void OnPdfToEmfConverted(const PrintHostMsg_DidPrintPage_Params& params,
double scale_factor,
const std::vector<base::FilePath>& emf_file);
#endif
content::NotificationRegistrar registrar_;
// Manages the low-level talk to the printer.
@ -153,15 +149,10 @@ class PrintViewManagerBase : public content::NotificationObserver,
// print settings are being loaded.
bool inside_inner_message_loop_;
#if (defined(OS_POSIX) && !defined(OS_MACOSX)) || \
defined(WIN_PDF_METAFILE_FOR_PRINTING)
#if !defined(OS_MACOSX)
// Set to true when OnDidPrintPage() should be expecting the first page.
bool expecting_first_page_;
#endif
#if defined(WIN_PDF_METAFILE_FOR_PRINTING)
scoped_ptr<PdfToEmfConverter> pdf_to_emf_converter_;
#endif
#endif // OS_MACOSX
// The document cookie of the current PrinterQuery.
int cookie_;

View File

@ -405,7 +405,7 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
PrintHostMsg_UpdatePrintSettings::WriteReplyParams(
reply_msg,
params,
printer_query &&
printer_query.get() &&
(printer_query->last_status() == printing::PrintingContext::CANCEL));
Send(reply_msg);
// If user hasn't cancelled.

View File

@ -157,6 +157,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
popup_host_view_(NULL),
is_showing_(true),
is_destroyed_(false),
is_scroll_offset_changed_pending_(false),
#if defined(OS_MACOSX)
text_input_context_osr_mac_(NULL),
#endif
@ -182,7 +183,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
#endif
compositor_->SetRootLayer(root_layer_.get());
if (browser_impl_) {
if (browser_impl_.get()) {
SetFrameRate();
ResizeRootLayer();
compositor_->SetScaleAndSize(CurrentDeviceScaleFactor(),
@ -218,6 +219,10 @@ void CefRenderWidgetHostViewOSR::SetSize(const gfx::Size& size) {
void CefRenderWidgetHostViewOSR::SetBounds(const gfx::Rect& rect) {
}
gfx::Vector2dF CefRenderWidgetHostViewOSR::GetLastScrollOffset() const {
return last_scroll_offset_;
}
gfx::NativeView CefRenderWidgetHostViewOSR::GetNativeView() const {
return gfx::NativeView();
}
@ -262,7 +267,7 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetViewBounds() const {
if (IsPopupWidget())
return popup_position_;
if (!browser_impl_)
if (!browser_impl_.get())
return gfx::Rect();
CefRect rc;
@ -288,6 +293,18 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
uint32 output_surface_id,
scoped_ptr<cc::CompositorFrame> frame) {
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame");
if (frame->metadata.root_scroll_offset != last_scroll_offset_) {
last_scroll_offset_ = frame->metadata.root_scroll_offset;
if (!is_scroll_offset_changed_pending_) {
// Send the notification asnychronously.
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefRenderWidgetHostViewOSR::OnScrollOffsetChanged,
weak_ptr_factory_.GetWeakPtr()));
}
}
if (frame->delegated_frame_data) {
delegated_frame_host_->SwapDelegatedFrame(
output_surface_id,
@ -313,7 +330,7 @@ void CefRenderWidgetHostViewOSR::InitAsPopup(
parent_host_view_ = static_cast<CefRenderWidgetHostViewOSR*>(
parent_host_view);
browser_impl_ = parent_host_view_->browser_impl();
if (!browser_impl_)
if (!browser_impl_.get())
return;
if (parent_host_view_->popup_host_view_) {
@ -363,7 +380,7 @@ void CefRenderWidgetHostViewOSR::WasHidden() {
if (!is_showing_)
return;
if (browser_impl_)
if (browser_impl_.get())
browser_impl_->CancelContextMenu();
if (render_widget_host_)
@ -383,7 +400,7 @@ void CefRenderWidgetHostViewOSR::Blur() {
void CefRenderWidgetHostViewOSR::UpdateCursor(
const content::WebCursor& cursor) {
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::UpdateCursor");
if (!browser_impl_)
if (!browser_impl_.get())
return;
#if defined(USE_AURA)
@ -453,7 +470,7 @@ void CefRenderWidgetHostViewOSR::Destroy() {
void CefRenderWidgetHostViewOSR::SetTooltipText(
const base::string16& tooltip_text) {
if (!browser_impl_)
if (!browser_impl_.get())
return;
CefString tooltip(tooltip_text);
@ -552,7 +569,7 @@ bool CefRenderWidgetHostViewOSR::HasAcceleratedSurface(
}
void CefRenderWidgetHostViewOSR::GetScreenInfo(blink::WebScreenInfo* results) {
if (!browser_impl_)
if (!browser_impl_.get())
return;
CefScreenInfo screen_info(
@ -585,7 +602,7 @@ void CefRenderWidgetHostViewOSR::GetScreenInfo(blink::WebScreenInfo* results) {
}
gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
if (!browser_impl_)
if (!browser_impl_.get())
return gfx::Rect();
CefRect rc;
@ -645,7 +662,7 @@ gfx::Size CefRenderWidgetHostViewOSR::DesiredFrameSize() {
}
float CefRenderWidgetHostViewOSR::CurrentDeviceScaleFactor() {
if (!browser_impl_)
if (!browser_impl_.get())
return kDefaultScaleFactor;
CefScreenInfo screen_info(
@ -670,7 +687,7 @@ content::DelegatedFrameHost*
}
bool CefRenderWidgetHostViewOSR::InstallTransparency() {
if (browser_impl_ && browser_impl_->IsTransparent()) {
if (browser_impl_.get() && browser_impl_->IsTransparent()) {
SetBackgroundOpaque(false);
return true;
}
@ -728,7 +745,7 @@ void CefRenderWidgetHostViewOSR::SendMouseEvent(
const blink::WebMouseEvent& event) {
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::SendMouseEvent");
if (!IsPopupWidget()) {
if (browser_impl_ && event.type == blink::WebMouseEvent::MouseDown)
if (browser_impl_.get() && event.type == blink::WebMouseEvent::MouseDown)
browser_impl_->CancelContextMenu();
if (popup_host_view_ &&
@ -752,7 +769,7 @@ void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
const blink::WebMouseWheelEvent& event) {
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::SendMouseWheelEvent");
if (!IsPopupWidget()) {
if (browser_impl_)
if (browser_impl_.get())
browser_impl_->CancelContextMenu();
if (popup_host_view_) {
@ -789,7 +806,7 @@ void CefRenderWidgetHostViewOSR::SendFocusEvent(bool focus) {
widget->GotFocus();
widget->SetActive(true);
} else {
if (browser_impl_)
if (browser_impl_.get())
browser_impl_->CancelContextMenu();
widget->SetActive(false);
@ -816,7 +833,7 @@ void CefRenderWidgetHostViewOSR::ReleaseResize() {
}
void CefRenderWidgetHostViewOSR::SetFrameRate() {
if (!browser_impl_)
if (!browser_impl_.get())
return;
int frame_rate = browser_impl_->settings().windowless_frame_rate;
if (frame_rate < 1)
@ -915,11 +932,11 @@ void CefRenderWidgetHostViewOSR::PrepareTextureCopyOutputResult(
bitmap_size.height() != result_size.height()) {
// Create a new bitmap if the size has changed.
bitmap_.reset(new SkBitmap);
if (!bitmap_->allocN32Pixels(result_size.width(),
result_size.height(),
true)) {
bitmap_->allocN32Pixels(result_size.width(),
result_size.height(),
true);
if (bitmap_->drawsNothing())
return;
}
}
content::ImageTransportFactory* factory =
@ -1065,7 +1082,7 @@ void CefRenderWidgetHostViewOSR::CancelPopupWidget() {
WasHidden();
if (browser_impl_) {
if (browser_impl_.get()) {
browser_impl_->GetClient()->GetRenderHandler()->OnPopupShow(
browser_impl_.get(), false);
browser_impl_ = NULL;
@ -1083,3 +1100,11 @@ void CefRenderWidgetHostViewOSR::CancelPopupWidget() {
}
}
void CefRenderWidgetHostViewOSR::OnScrollOffsetChanged() {
if (browser_impl_.get()) {
CefRefPtr<CefRenderHandler> handler =
browser_impl_->client()->GetRenderHandler();
handler->OnScrollOffsetChanged(browser_impl_.get());
}
is_scroll_offset_changed_pending_ = false;
}

View File

@ -81,6 +81,7 @@ class CefRenderWidgetHostViewOSR
virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
virtual void SetSize(const gfx::Size& size) OVERRIDE;
virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
virtual gfx::Vector2dF GetLastScrollOffset() const OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
@ -279,6 +280,8 @@ class CefRenderWidgetHostViewOSR
void CancelPopupWidget();
void OnScrollOffsetChanged();
#if defined(OS_MACOSX)
// Returns composition character boundary rectangle. The |range| is
// composition based range. Also stores |actual_range| which is corresponding
@ -342,6 +345,10 @@ class CefRenderWidgetHostViewOSR
bool is_destroyed_;
gfx::Rect popup_position_;
// The last scroll offset of the view.
gfx::Vector2dF last_scroll_offset_;
bool is_scroll_offset_changed_pending_;
#if defined(OS_MACOSX)
NSTextInputContext* text_input_context_osr_mac_;
#endif

View File

@ -109,7 +109,7 @@ void CefResourceDispatcherHostDelegate::OnRequestRedirected(
if (active_url.is_valid() && redirect_url.is_valid() &&
active_url.GetOrigin() != redirect_url.GetOrigin() &&
HasCrossOriginWhitelistEntry(active_url, redirect_url)) {
if (!response->head.headers)
if (!response->head.headers.get())
response->head.headers = new net::HttpResponseHeaders(std::string());
// Add CORS headers to support XMLHttpRequest redirects.

View File

@ -208,7 +208,7 @@ void CefResourceRequestJob::Kill() {
handler_->Cancel();
}
if (callback_) {
if (callback_.get()) {
callback_->Detach();
callback_ = NULL;
}
@ -290,7 +290,7 @@ void CefResourceRequestJob::GetLoadTimingInfo(
net::LoadTimingInfo* load_timing_info) const {
// If haven't made it far enough to receive any headers, don't return
// anything. This makes for more consistent behavior in the case of errors.
if (!response_ || receive_headers_end_.is_null())
if (!response_.get() || receive_headers_end_.is_null())
return;
load_timing_info->request_start_time = request_start_time_;
load_timing_info->receive_headers_end = receive_headers_end_;
@ -468,13 +468,13 @@ void CefResourceRequestJob::StartTransaction() {
}
net::HttpResponseHeaders* CefResourceRequestJob::GetResponseHeaders() {
DCHECK(response_);
DCHECK(response_.get());
if (!response_headers_.get()) {
CefResponseImpl* responseImpl =
static_cast<CefResponseImpl*>(response_.get());
response_headers_ = responseImpl->GetResponseHeaders();
}
return response_headers_;
return response_headers_.get();
}
void CefResourceRequestJob::SaveCookiesAndNotifyHeadersComplete() {

View File

@ -265,7 +265,7 @@ class CefUrlRequestManager {
net::URLRequestJob* job = NULL;
CefRefPtr<CefSchemeHandlerFactory> factory =
GetHandlerFactory(request, scheme);
if (factory) {
if (factory.get()) {
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForRequest(request);
CefRefPtr<CefFrame> frame;

View File

@ -7,8 +7,25 @@
#include "libcef/browser/thread_util.h"
#include "base/debug/trace_event.h"
#include "base/files/file_util.h"
#include "content/public/browser/tracing_controller.h"
namespace {
// Create the temporary file and then execute |callback| on the thread
// represented by |message_loop_proxy|.
void CreateTemporaryFileOnFileThread(
scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
base::Callback<void(const base::FilePath&)> callback) {
CEF_REQUIRE_FILET();
base::FilePath file_path;
if (!base::CreateTemporaryFile(&file_path))
LOG(ERROR) << "Failed to create temporary file.";
message_loop_proxy->PostTask(FROM_HERE, base::Bind(callback, file_path));
}
} // namespace
using content::TracingController;
CefTraceSubscriber::CefTraceSubscriber()
@ -19,11 +36,8 @@ CefTraceSubscriber::CefTraceSubscriber()
CefTraceSubscriber::~CefTraceSubscriber() {
CEF_REQUIRE_UIT();
if (collecting_trace_data_) {
TracingController::GetInstance()->DisableRecording(
base::FilePath(),
TracingController::TracingFileResultCallback());
}
if (collecting_trace_data_)
TracingController::GetInstance()->DisableRecording(NULL);
}
bool CefTraceSubscriber::BeginTracing(
@ -37,8 +51,10 @@ bool CefTraceSubscriber::BeginTracing(
collecting_trace_data_ = true;
TracingController::EnableRecordingDoneCallback done_callback;
if (callback.get())
done_callback = base::Bind(&CefCompletionCallback::OnComplete, callback);
if (callback.get()) {
done_callback =
base::Bind(&CefCompletionCallback::OnComplete, callback.get());
}
TracingController::GetInstance()->EnableRecording(
base::debug::CategoryFilter(categories),
@ -55,18 +71,36 @@ bool CefTraceSubscriber::EndTracing(
if (!collecting_trace_data_)
return false;
TracingController::TracingFileResultCallback result_callback;
if (tracing_file.empty()) {
// Create a new temporary file path on the FILE thread, then continue.
CEF_POST_TASK(CEF_FILET,
base::Bind(CreateTemporaryFileOnFileThread,
base::MessageLoop::current()->message_loop_proxy(),
base::Bind(&CefTraceSubscriber::ContinueEndTracing,
weak_factory_.GetWeakPtr(), callback)));
return true;
}
base::Closure result_callback;
if (callback.get()) {
result_callback =
base::Bind(&CefTraceSubscriber::OnTracingFileResult,
weak_factory_.GetWeakPtr(), callback);
weak_factory_.GetWeakPtr(), callback, tracing_file);
}
TracingController::GetInstance()->DisableRecording(
tracing_file, result_callback);
TracingController::CreateFileSink(tracing_file, result_callback));
return true;
}
void CefTraceSubscriber::ContinueEndTracing(
CefRefPtr<CefEndTracingCallback> callback,
const base::FilePath& tracing_file) {
CEF_REQUIRE_UIT();
if (!tracing_file.empty())
EndTracing(tracing_file, callback);
}
void CefTraceSubscriber::OnTracingFileResult(
CefRefPtr<CefEndTracingCallback> callback,
const base::FilePath& tracing_file) {

View File

@ -25,6 +25,8 @@ class CefTraceSubscriber {
CefRefPtr<CefEndTracingCallback> callback);
private:
void ContinueEndTracing(CefRefPtr<CefEndTracingCallback> callback,
const base::FilePath& tracing_file);
void OnTracingFileResult(CefRefPtr<CefEndTracingCallback> callback,
const base::FilePath& tracing_file);

View File

@ -302,7 +302,7 @@ void CefURLRequestContextGetter::SetCookieStoragePath(
// longer referenced.
scoped_refptr<net::CookieMonster> cookie_monster =
new net::CookieMonster(persistent_store.get(), NULL);
storage_->set_cookie_store(cookie_monster);
storage_->set_cookie_store(cookie_monster.get());
if (persistent_store.get() && persist_session_cookies)
cookie_monster->SetPersistSessionCookies(true);
cookie_store_path_ = path;
@ -390,5 +390,5 @@ void CefURLRequestContextGetter::CreateProxyConfigService() {
proxy_config_service_.reset(
net::ProxyService::CreateSystemProxyConfigService(
io_loop_->message_loop_proxy(), file_loop_));
io_loop_->message_loop_proxy(), file_loop_->message_loop_proxy()));
}

View File

@ -103,17 +103,17 @@ class CefCookieStoreProxy : public net::CookieStore {
cookie_store =
reinterpret_cast<CefCookieManagerImpl*>(
manager.get())->cookie_monster();
DCHECK(cookie_store);
DCHECK(cookie_store.get());
}
}
if (!cookie_store) {
if (!cookie_store.get()) {
// Use the global cookie store.
cookie_store = parent_->cookie_store();
}
DCHECK(cookie_store);
return cookie_store;
DCHECK(cookie_store.get());
return cookie_store.get();
}
// This pointer is guaranteed by the CefRequestContextProxy object.
@ -144,7 +144,7 @@ void CefURLRequestContextProxy::Initialize(
// Cookie store that proxies to the browser implementation.
cookie_store_proxy_ = new CefCookieStoreProxy(context, handler);
set_cookie_store(cookie_store_proxy_);
set_cookie_store(cookie_store_proxy_.get());
// All other values refer to the parent request context.
set_net_log(context->net_log());

View File

@ -186,7 +186,7 @@ void CefWindowX11::Focus() {
if (xwindow_ == None || !window_mapped_)
return;
if (browser_) {
if (browser_.get()) {
::Window child = FindChild(xdisplay_, xwindow_);
if (child && ui::IsWindowVisible(child)) {
// Give focus to the child DesktopWindowTreeHostX11.
@ -250,7 +250,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
xev->xconfigure.width, xev->xconfigure.height);
bounds_ = bounds;
if (browser_) {
if (browser_.get()) {
::Window child = FindChild(xdisplay_, xwindow_);
if (child) {
// Resize the child DesktopWindowTreeHostX11 to match this window.
@ -305,7 +305,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]);
if (protocol == atom_cache_.GetAtom(kWMDeleteWindow)) {
// We have received a close message from the window manager.
if (browser_ && browser_->destruction_state() <=
if (browser_.get() && browser_->destruction_state() <=
CefBrowserHostImpl::DESTRUCTION_STATE_PENDING) {
if (browser_->destruction_state() ==
CefBrowserHostImpl::DESTRUCTION_STATE_NONE) {
@ -335,7 +335,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
case DestroyNotify:
xwindow_ = None;
if (browser_) {
if (browser_.get()) {
// Force the browser to be destroyed and release the reference added
// in PlatformCreateWindow().
browser_->WindowDestroyed();
@ -368,7 +368,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
::Atom changed_atom = xev->xproperty.atom;
if (changed_atom == atom_cache_.GetAtom(kNetWMState)) {
// State change event like minimize/maximize.
if (browser_) {
if (browser_.get()) {
::Window child = FindChild(xdisplay_, xwindow_);
if (child) {
// Forward the state change to the child DesktopWindowTreeHostX11
@ -403,7 +403,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
void CefWindowX11::ContinueFocus() {
if (!focus_pending_)
return;
if (browser_)
if (browser_.get())
browser_->SetFocus(true);
focus_pending_ = false;
}

View File

@ -72,7 +72,7 @@ struct ParamTraits<net::UploadElement> {
void ParamTraits<scoped_refptr<net::UploadData> >::Write(Message* m,
const param_type& p) {
WriteParam(m, p.get() != NULL);
if (p) {
if (p.get()) {
WriteParam(m, p->elements());
WriteParam(m, p->identifier());
WriteParam(m, p->is_chunked());

View File

@ -216,6 +216,6 @@ struct ParamTraits<scoped_refptr<net::UploadData> > {
#include "chrome/common/prerender_messages.h"
#include "chrome/common/print_messages.h"
#if defined(WIN_PDF_METAFILE_FOR_PRINTING)
#if defined(OS_WIN)
#include "chrome/common/chrome_utility_printing_messages.h"
#endif

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/common/breakpad_client.h"
#include "libcef/common/crash_reporter_client.h"
#include "libcef/common/cef_switches.h"
#include "include/cef_version.h"
@ -13,11 +13,11 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
CefBreakpadClient::CefBreakpadClient() {}
CefBreakpadClient::~CefBreakpadClient() {}
CefCrashReporterClient::CefCrashReporterClient() {}
CefCrashReporterClient::~CefCrashReporterClient() {}
#if defined(OS_WIN)
void CefBreakpadClient::GetProductNameAndVersion(
void CefCrashReporterClient::GetProductNameAndVersion(
const base::FilePath& exe_path,
base::string16* product_name,
base::string16* version,
@ -32,19 +32,19 @@ void CefBreakpadClient::GetProductNameAndVersion(
#endif
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS)
void CefBreakpadClient::GetProductNameAndVersion(std::string* product_name,
void CefCrashReporterClient::GetProductNameAndVersion(std::string* product_name,
std::string* version) {
*product_name = "cef";
*version = base::StringPrintf(
"%d.%d.%d", CEF_VERSION_MAJOR, CHROME_VERSION_BUILD, CEF_REVISION);
}
base::FilePath CefBreakpadClient::GetReporterLogFilename() {
base::FilePath CefCrashReporterClient::GetReporterLogFilename() {
return base::FilePath(FILE_PATH_LITERAL("uploads.log"));
}
#endif
bool CefBreakpadClient::GetCrashDumpLocation(base::FilePath* crash_dir) {
bool CefCrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) {
#if !defined(OS_WIN)
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kCrashDumpsDir))
return false;

View File

@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_COMMON_BREAKPAD_CLIENT_H_
#define CEF_LIBCEF_COMMON_BREAKPAD_CLIENT_H_
#ifndef CEF_LIBCEF_COMMON_CRASH_REPORTER_CLIENT_H_
#define CEF_LIBCEF_COMMON_CRASH_REPORTER_CLIENT_H_
#include "base/compiler_specific.h"
#include "components/crash/app/breakpad_client.h"
#include "components/crash/app/crash_reporter_client.h"
class CefBreakpadClient : public breakpad::BreakpadClient {
class CefCrashReporterClient : public crash_reporter::CrashReporterClient {
public:
CefBreakpadClient();
virtual ~CefBreakpadClient();
CefCrashReporterClient();
virtual ~CefCrashReporterClient();
#if defined(OS_WIN)
// Returns a textual description of the product type and version to include
@ -37,7 +37,7 @@ class CefBreakpadClient : public breakpad::BreakpadClient {
virtual bool GetCrashDumpLocation(base::FilePath* crash_dir) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(CefBreakpadClient);
DISALLOW_COPY_AND_ASSIGN(CefCrashReporterClient);
};
#endif // CEF_LIBCEF_COMMON_BREAKPAD_CLIENT_H_
#endif // CEF_LIBCEF_COMMON_CRASH_REPORTER_CLIENT_H_

View File

@ -5,9 +5,9 @@
#include "libcef/common/main_delegate.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h"
#include "libcef/common/breakpad_client.h"
#include "libcef/common/cef_switches.h"
#include "libcef/common/command_line_impl.h"
#include "libcef/common/crash_reporter_client.h"
#include "libcef/renderer/content_renderer_client.h"
#include "libcef/utility/content_utility_client.h"
@ -51,7 +51,7 @@
namespace {
base::LazyInstance<CefBreakpadClient>::Leaky g_shell_breakpad_client =
base::LazyInstance<CefCrashReporterClient>::Leaky g_crash_reporter_client =
LAZY_INSTANCE_INITIALIZER;
#if defined(OS_MACOSX)
@ -392,7 +392,7 @@ void CefMainDelegate::PreSandboxStartup() {
command_line.GetSwitchValueASCII(switches::kProcessType);
if (command_line.HasSwitch(switches::kEnableCrashReporter)) {
breakpad::SetBreakpadClient(g_shell_breakpad_client.Pointer());
crash_reporter::SetCrashReporterClient(g_crash_reporter_client.Pointer());
#if defined(OS_MACOSX)
base::mac::DisableOSCrashDumps();
breakpad::InitCrashReporter(process_type);

View File

@ -49,8 +49,8 @@ class BytesElementReader : public net::UploadBytesElementReader {
base::TaskRunner* GetFileTaskRunner() {
scoped_refptr<base::SequencedTaskRunner> task_runner =
CefTaskRunnerImpl::GetTaskRunner(TID_FILE);
DCHECK(task_runner);
return task_runner;
DCHECK(task_runner.get());
return task_runner.get();
}
// A subclass of net::UploadFileElementReader that keeps the associated

View File

@ -21,7 +21,7 @@ bool CefPostTask(CefThreadId threadId, CefRefPtr<CefTask> task) {
CefTaskRunnerImpl::GetTaskRunner(threadId);
if (task_runner.get()) {
return task_runner->PostTask(FROM_HERE,
base::Bind(&CefTask::Execute, task));
base::Bind(&CefTask::Execute, task.get()));
}
return false;
}
@ -31,7 +31,7 @@ bool CefPostDelayedTask(CefThreadId threadId, CefRefPtr<CefTask> task, int64 del
CefTaskRunnerImpl::GetTaskRunner(threadId);
if (task_runner.get()) {
return task_runner->PostDelayedTask(FROM_HERE,
base::Bind(&CefTask::Execute, task),
base::Bind(&CefTask::Execute, task.get()),
base::TimeDelta::FromMilliseconds(delay_ms));
}
return false;

View File

@ -136,12 +136,12 @@ bool CefTaskRunnerImpl::BelongsToThread(CefThreadId threadId) {
bool CefTaskRunnerImpl::PostTask(CefRefPtr<CefTask> task) {
return task_runner_->PostTask(FROM_HERE,
base::Bind(&CefTask::Execute, task));
base::Bind(&CefTask::Execute, task.get()));
}
bool CefTaskRunnerImpl::PostDelayedTask(CefRefPtr<CefTask> task,
int64 delay_ms) {
return task_runner_->PostDelayedTask(FROM_HERE,
base::Bind(&CefTask::Execute, task),
base::Bind(&CefTask::Execute, task.get()),
base::TimeDelta::FromMilliseconds(delay_ms));
}

View File

@ -238,14 +238,14 @@ class CefValueBase : public CefType, public CefValueController::Object {
// Specifying a parent value for a non-reference doesn't make sense.
DCHECK(!(!reference() && parent_value));
if (!reference() && !controller_) {
if (!reference() && !controller_.get()) {
// For owned values default to using a new multi-threaded controller.
controller_ = new CefValueControllerThreadSafe();
SetOwnsController();
}
// A controller is required.
DCHECK(controller_);
DCHECK(controller_.get());
if (reference()) {
// Register the reference with the controller.
@ -257,7 +257,7 @@ class CefValueBase : public CefType, public CefValueController::Object {
}
}
virtual ~CefValueBase() {
if (controller_ && value_)
if (controller_.get() && value_)
Delete();
}
@ -271,10 +271,10 @@ class CefValueBase : public CefType, public CefValueController::Object {
inline bool read_only() const { return read_only_; }
// True if the underlying value has been detached.
inline bool detached() { return (controller_ == NULL); }
inline bool detached() { return !controller_.get(); }
// Returns the controller.
inline CefValueController* controller() { return controller_; }
inline CefValueController* controller() { return controller_.get(); }
// Deletes the underlying value.
void Delete() {
@ -377,7 +377,7 @@ class CefValueBase : public CefType, public CefValueController::Object {
// Used to indicate that this object owns the controller.
inline void SetOwnsController() {
CefValueController::AutoLock lock_scope(controller_);
CefValueController::AutoLock lock_scope(controller_.get());
if (lock_scope.verified())
controller_->SetOwner(value_, this);
}
@ -386,8 +386,8 @@ class CefValueBase : public CefType, public CefValueController::Object {
class AutoLock {
public:
explicit AutoLock(CefValueBase* impl, bool modify)
: auto_lock_(impl->controller()),
verified_(auto_lock_.verified() && impl->VerifyAccess(modify)) {
: auto_lock_(impl->controller()) {
verified_ = (auto_lock_.verified() && impl->VerifyAccess(modify));
}
virtual ~AutoLock() {}

View File

@ -110,8 +110,11 @@ void CefBrowserImpl::GoForward() {
bool CefBrowserImpl::IsLoading() {
CEF_REQUIRE_RT_RETURN(false);
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame())
return render_view()->GetWebView()->mainFrame()->isLoading();
if (render_view()->GetWebView()) {
blink::WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
if (main_frame)
return main_frame->toWebLocalFrame()->isLoading();
}
return false;
}
@ -580,7 +583,7 @@ void CefBrowserImpl::DidCreateDataSource(blink::WebLocalFrame* frame,
content::DocumentState::FromDataSource(ds);
document_state->set_navigation_state(
content::NavigationState::CreateBrowserInitiated(-1, -1, false,
content::PAGE_TRANSITION_LINK));
ui::PAGE_TRANSITION_LINK));
}
if (frame->parent() == 0) {

View File

@ -40,6 +40,7 @@ MSVC_POP_WARNING();
#include "chrome/renderer/pepper/chrome_pdf_print_client.h"
#include "chrome/renderer/printing/print_web_view_helper.h"
#include "components/pdf/renderer/ppb_pdf_impl.h"
#include "components/web_cache/renderer/web_cache_render_process_observer.h"
#include "content/child/child_thread.h"
#include "content/child/worker_task_runner.h"
#include "content/common/frame_messages.h"
@ -412,7 +413,7 @@ void CefContentRendererClient::RunSingleProcessCleanup() {
DCHECK(content::RenderProcessHost::run_renderer_in_process());
// Make sure the render thread was actually started.
if (!render_task_runner_)
if (!render_task_runner_.get())
return;
if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
@ -440,9 +441,11 @@ void CefContentRendererClient::RunSingleProcessCleanup() {
void CefContentRendererClient::RenderThreadStarted() {
render_task_runner_ = base::MessageLoopProxy::current();
observer_.reset(new CefRenderProcessObserver());
web_cache_observer_.reset(new web_cache::WebCacheRenderProcessObserver());
content::RenderThread* thread = content::RenderThread::Get();
thread->AddObserver(observer_.get());
thread->AddObserver(web_cache_observer_.get());
thread->GetChannel()->AddFilter(new CefRenderMessageFilter);
thread->RegisterExtension(extensions_v8::LoadTimesExtension::Get());
@ -503,7 +506,7 @@ bool CefContentRendererClient::OverrideCreatePlugin(
blink::WebPlugin** plugin) {
CefRefPtr<CefBrowserImpl> browser =
CefBrowserImpl::GetBrowserForMainFrame(frame->top());
if (!browser || !browser->is_windowless())
if (!browser.get() || !browser->is_windowless())
return false;
#if defined(ENABLE_PLUGINS)
@ -653,9 +656,7 @@ void CefContentRendererClient::DidCreateScriptContext(
v8::Isolate* isolate = blink::mainThreadIsolate();
v8::HandleScope handle_scope(isolate);
v8::Context::Scope scope(context);
blink::V8RecursionScope recursion_scope(
isolate,
blink::toExecutionContext(context));
blink::V8RecursionScope recursion_scope(isolate);
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(isolate, context));
@ -680,7 +681,9 @@ const void* CefContentRendererClient::CreatePPAPIInterface(
}
void CefContentRendererClient::WillReleaseScriptContext(
blink::WebFrame* frame, v8::Handle<v8::Context> context, int world_id) {
blink::WebLocalFrame* frame,
v8::Handle<v8::Context> context,
int world_id) {
// Notify the render process handler.
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
if (application.get()) {
@ -696,9 +699,7 @@ void CefContentRendererClient::WillReleaseScriptContext(
v8::Isolate* isolate = blink::mainThreadIsolate();
v8::HandleScope handle_scope(isolate);
v8::Context::Scope scope(context);
blink::V8RecursionScope recursion_scope(
isolate,
blink::toExecutionContext(context));
blink::V8RecursionScope recursion_scope(isolate);
CefRefPtr<CefV8Context> contextPtr(
new CefV8ContextImpl(isolate, context));
@ -731,7 +732,7 @@ void CefContentRendererClient::BrowserCreated(
DCHECK_GT(params.browser_id, 0);
// Don't create another browser object if one already exists for the view.
if (GetBrowserForView(render_view))
if (GetBrowserForView(render_view).get())
return;
#if defined(OS_MACOSX)
@ -749,7 +750,7 @@ void CefContentRendererClient::BrowserCreated(
browsers_.insert(std::make_pair(render_view, browser));
new CefPrerendererClient(render_view);
new printing::PrintWebViewHelper(render_view, false, false);
new printing::PrintWebViewHelper(render_view);
// Notify the render process handler.
CefRefPtr<CefApp> application = CefContentClient::Get()->application();

View File

@ -20,6 +20,10 @@
#include "base/sequenced_task_runner.h"
#include "content/public/renderer/content_renderer_client.h"
namespace web_cache {
class WebCacheRenderProcessObserver;
}
class CefRenderProcessObserver;
struct Cef_CrossOriginWhiteListEntry_Params;
class ChromePDFPrintClient;
@ -97,7 +101,7 @@ class CefContentRendererClient : public content::ContentRendererClient,
virtual const void* CreatePPAPIInterface(
const std::string& interface_name) OVERRIDE;
void WillReleaseScriptContext(blink::WebFrame* frame,
void WillReleaseScriptContext(blink::WebLocalFrame* frame,
v8::Handle<v8::Context> context,
int world_id);
@ -113,6 +117,7 @@ class CefContentRendererClient : public content::ContentRendererClient,
scoped_refptr<base::SequencedTaskRunner> render_task_runner_;
scoped_ptr<CefRenderProcessObserver> observer_;
scoped_ptr<web_cache::WebCacheRenderProcessObserver> web_cache_observer_;
// Map of RenderView pointers to CefBrowserImpl references.
typedef std::map<content::RenderView*, CefRefPtr<CefBrowserImpl> > BrowserMap;

View File

@ -216,7 +216,7 @@ CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetOrCreateNode(
// Create the new node object.
CefRefPtr<CefDOMNode> nodeImpl(new CefDOMNodeImpl(this, node));
node_map_.insert(std::make_pair(node, nodeImpl));
node_map_.insert(std::make_pair(node, nodeImpl.get()));
return nodeImpl;
}

View File

@ -702,7 +702,7 @@ bool CefRegisterExtension(const CefString& extension_name,
V8TrackString* code = new V8TrackString(javascript_code);
isolate_manager->AddGlobalTrackObject(code);
if (handler) {
if (handler.get()) {
// The reference will be released when the process exits.
V8TrackObject* object = new V8TrackObject(isolate_manager->isolate());
object->SetHandler(handler);
@ -1280,7 +1280,7 @@ CefV8ValueImpl::CefV8ValueImpl(v8::Isolate* isolate,
CefV8ValueImpl::~CefV8ValueImpl() {
if (type_ == TYPE_STRING)
cef_string_clear(&string_value_);
if (handle_)
if (handle_.get())
handle_->SetWeakIfNecessary();
}

View File

@ -9,7 +9,7 @@
#include "chrome/utility/utility_message_handler.h"
#include "content/public/utility/utility_thread.h"
#if defined(ENABLE_FULL_PRINTING) && defined(WIN_PDF_METAFILE_FOR_PRINTING)
#if defined(OS_WIN)
#include "libcef/utility/printing_handler.h"
#endif
@ -22,7 +22,7 @@ bool Send(IPC::Message* message) {
} // namespace
CefContentUtilityClient::CefContentUtilityClient() {
#if defined(ENABLE_FULL_PRINTING) && defined(WIN_PDF_METAFILE_FOR_PRINTING)
#if defined(OS_WIN)
handlers_.push_back(new PrintingHandler());
#endif
}
@ -49,7 +49,7 @@ bool CefContentUtilityClient::OnMessageReceived(
// static
void CefContentUtilityClient::PreSandboxStartup() {
#if defined(ENABLE_FULL_PRINTING) && defined(WIN_PDF_METAFILE_FOR_PRINTING)
#if defined(OS_WIN)
PrintingHandler::PreSandboxStartup();
#endif
}

View File

@ -4,7 +4,7 @@
#include "libcef/utility/printing_handler.h"
#include "base/file_util.h"
#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/path_service.h"
#include "base/scoped_native_library.h"
@ -20,10 +20,6 @@
#include "ui/gfx/gdi_util.h"
#endif
#if defined(ENABLE_FULL_PRINTING)
#include "printing/backend/print_backend.h"
#endif
namespace {
bool Send(IPC::Message* message) {
@ -256,163 +252,109 @@ void PrintingHandler::PreSandboxStartup() {
bool PrintingHandler::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PrintingHandler, message)
#if defined(WIN_PDF_METAFILE_FOR_PRINTING)
#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles,
OnRenderPDFPagesToMetafile)
#endif
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterCapsAndDefaults,
OnGetPrinterCapsAndDefaults)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults,
OnGetPrinterSemanticCapsAndDefaults)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage,
OnRenderPDFPagesToMetafileGetPage)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop,
OnRenderPDFPagesToMetafileStop)
#endif // OS_WIN
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
#if defined(WIN_PDF_METAFILE_FOR_PRINTING)
#if defined(OS_WIN)
void PrintingHandler::OnRenderPDFPagesToMetafile(
IPC::PlatformFileForTransit pdf_transit,
const base::FilePath& metafile_path,
const printing::PdfRenderSettings& settings,
const std::vector<printing::PageRange>& page_ranges_const) {
bool succeeded = false;
const printing::PdfRenderSettings& settings) {
pdf_rendering_settings_ = settings;
base::File pdf_file = IPC::PlatformFileForTransitToFile(pdf_transit);
int highest_rendered_page_number = 0;
int page_count = LoadPDF(pdf_file.Pass());
Send(
new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount(page_count));
}
void PrintingHandler::OnRenderPDFPagesToMetafileGetPage(
int page_number,
IPC::PlatformFileForTransit output_file) {
base::File emf_file = IPC::PlatformFileForTransitToFile(output_file);
double scale_factor = 1.0;
std::vector<printing::PageRange> page_ranges = page_ranges_const;
succeeded = RenderPDFToWinMetafile(pdf_file.Pass(),
metafile_path,
settings,
&page_ranges,
&highest_rendered_page_number,
&scale_factor);
if (succeeded) {
// TODO(vitalybuka|scottmg): http://crbug.com/170859. These could
// potentially be sent as each page is converted so that the spool could
// start sooner.
Send(new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_Succeeded(
page_ranges, scale_factor));
} else {
Send(new ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Failed());
}
bool success =
RenderPdfPageToMetafile(page_number, emf_file.Pass(), &scale_factor);
Send(new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone(
success, scale_factor));
}
void PrintingHandler::OnRenderPDFPagesToMetafileStop() {
ReleaseProcessIfNeeded();
}
#endif
#if defined(WIN_PDF_METAFILE_FOR_PRINTING)
bool PrintingHandler::RenderPDFToWinMetafile(
base::File pdf_file,
const base::FilePath& metafile_path,
const printing::PdfRenderSettings& settings,
std::vector<printing::PageRange>* page_ranges,
int* highest_rendered_page_number,
double* scale_factor) {
DCHECK(page_ranges);
*highest_rendered_page_number = -1;
*scale_factor = 1.0;
int PrintingHandler::LoadPDF(base::File pdf_file) {
if (!g_pdf_lib.Get().IsValid())
return false;
return 0;
// TODO(sanjeevr): Add a method to the PDF DLL that takes in a file handle
// and a page range array. That way we don't need to read the entire PDF into
// memory.
int64 length = pdf_file.GetLength();
if (length < 0)
return false;
return 0;
std::vector<char> buffer;
buffer.resize(length);
if (length != pdf_file.Read(0, &buffer.front(), length))
return false;
pdf_data_.resize(length);
if (length != pdf_file.Read(0, pdf_data_.data(), pdf_data_.size()))
return 0;
int total_page_count = 0;
if (!g_pdf_lib.Get().GetPDFDocInfo(&buffer.front(), buffer.size(),
&total_page_count, NULL)) {
if (!g_pdf_lib.Get().GetPDFDocInfo(
&pdf_data_.front(), pdf_data_.size(), &total_page_count, NULL)) {
return 0;
}
return total_page_count;
}
bool PrintingHandler::RenderPdfPageToMetafile(int page_number,
base::File output_file,
double* scale_factor) {
printing::Emf metafile;
metafile.Init();
// We need to scale down DC to fit an entire page into DC available area.
// Current metafile is based on screen DC and have current screen size.
// Writing outside of those boundaries will result in the cut-off output.
// On metafiles (this is the case here), scaling down will still record
// original coordinates and we'll be able to print in full resolution.
// Before playback we'll need to counter the scaling up that will happen
// in the service (print_system_win.cc).
*scale_factor =
gfx::CalculatePageScale(metafile.context(),
pdf_rendering_settings_.area().right(),
pdf_rendering_settings_.area().bottom());
gfx::ScaleDC(metafile.context(), *scale_factor);
// The underlying metafile is of type Emf and ignores the arguments passed
// to StartPage.
metafile.StartPage(gfx::Size(), gfx::Rect(), 1);
if (!g_pdf_lib.Get().RenderPDFPageToDC(
&pdf_data_.front(),
pdf_data_.size(),
page_number,
metafile.context(),
pdf_rendering_settings_.dpi(),
pdf_rendering_settings_.dpi(),
pdf_rendering_settings_.area().x(),
pdf_rendering_settings_.area().y(),
pdf_rendering_settings_.area().width(),
pdf_rendering_settings_.area().height(),
true,
false,
true,
true,
pdf_rendering_settings_.autorotate())) {
return false;
}
// If no range supplied, do all pages.
if (page_ranges->empty()) {
printing::PageRange page_range_all;
page_range_all.from = 0;
page_range_all.to = total_page_count - 1;
page_ranges->push_back(page_range_all);
}
bool ret = false;
std::vector<printing::PageRange>::const_iterator iter;
for (iter = page_ranges->begin(); iter != page_ranges->end(); ++iter) {
for (int page_number = iter->from; page_number <= iter->to; ++page_number) {
if (page_number >= total_page_count)
break;
printing::Emf metafile;
metafile.InitToFile(metafile_path.InsertBeforeExtensionASCII(
base::StringPrintf(".%d", page_number)));
// We need to scale down DC to fit an entire page into DC available area.
// Current metafile is based on screen DC and have current screen size.
// Writing outside of those boundaries will result in the cut-off output.
// On metafiles (this is the case here), scaling down will still record
// original coordinates and we'll be able to print in full resolution.
// Before playback we'll need to counter the scaling up that will happen
// in the service (print_system_win.cc).
*scale_factor = gfx::CalculatePageScale(metafile.context(),
settings.area().right(),
settings.area().bottom());
gfx::ScaleDC(metafile.context(), *scale_factor);
// The underlying metafile is of type Emf and ignores the arguments passed
// to StartPage.
metafile.StartPage(gfx::Size(), gfx::Rect(), 1);
if (g_pdf_lib.Get().RenderPDFPageToDC(
&buffer.front(), buffer.size(), page_number, metafile.context(),
settings.dpi(), settings.dpi(), settings.area().x(),
settings.area().y(), settings.area().width(),
settings.area().height(), true, false, true, true,
settings.autorotate())) {
if (*highest_rendered_page_number < page_number)
*highest_rendered_page_number = page_number;
ret = true;
}
metafile.FinishPage();
metafile.FinishDocument();
}
}
return ret;
}
#endif // defined(WIN_PDF_METAFILE_FOR_PRINTING)
void PrintingHandler::OnGetPrinterCapsAndDefaults(
const std::string& printer_name) {
scoped_refptr<printing::PrintBackend> print_backend =
printing::PrintBackend::CreateInstance(NULL);
printing::PrinterCapsAndDefaults printer_info;
if (print_backend->GetPrinterCapsAndDefaults(printer_name, &printer_info)) {
Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded(
printer_name, printer_info));
} else {
Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed(
printer_name));
}
ReleaseProcessIfNeeded();
metafile.FinishPage();
metafile.FinishDocument();
return metafile.SaveTo(&output_file);
}
void PrintingHandler::OnGetPrinterSemanticCapsAndDefaults(
const std::string& printer_name) {
scoped_refptr<printing::PrintBackend> print_backend =
printing::PrintBackend::CreateInstance(NULL);
printing::PrinterSemanticCapsAndDefaults printer_info;
#endif // OS_WIN
if (print_backend->GetPrinterSemanticCapsAndDefaults(printer_name,
&printer_info)) {
Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Succeeded(
printer_name, printer_info));
} else {
Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed(
printer_name));
}
ReleaseProcessIfNeeded();
}

View File

@ -9,13 +9,15 @@
#include "base/macros.h"
#include "chrome/utility/utility_message_handler.h"
#include "ipc/ipc_platform_file.h"
#include "printing/pdf_render_settings.h"
#if !defined(ENABLE_FULL_PRINTING)
#error "Full printing must be enabled"
#if !defined(OS_WIN)
#error "Must be building on Windows."
#endif
namespace printing {
class PdfRenderSettings;
struct PwgRasterSettings;
struct PageRange;
}
@ -32,31 +34,22 @@ class PrintingHandler : public UtilityMessageHandler {
private:
// IPC message handlers.
#if defined(WIN_PDF_METAFILE_FOR_PRINTING)
void OnRenderPDFPagesToMetafile(
IPC::PlatformFileForTransit pdf_transit,
const base::FilePath& metafile_path,
const printing::PdfRenderSettings& settings,
const std::vector<printing::PageRange>& page_ranges);
#endif
#if defined(OS_WIN)
void OnRenderPDFPagesToMetafile(IPC::PlatformFileForTransit pdf_transit,
const printing::PdfRenderSettings& settings);
void OnRenderPDFPagesToMetafileGetPage(
int page_number,
IPC::PlatformFileForTransit output_file);
void OnRenderPDFPagesToMetafileStop();
#if defined(WIN_PDF_METAFILE_FOR_PRINTING)
// Helper method for Windows.
// |highest_rendered_page_number| is set to -1 on failure to render any page.
// |page_ranges| is both input and output. If supplied as input, only the
// specified pages will be rendered. If an empty vector is supplied it will
// be filled with a range of all pages that were rendered.
bool RenderPDFToWinMetafile(
base::File pdf_file,
const base::FilePath& metafile_path,
const printing::PdfRenderSettings& settings,
std::vector<printing::PageRange>* page_ranges,
int* highest_rendered_page_number,
double* scale_factor);
#endif
int LoadPDF(base::File pdf_file);
bool RenderPdfPageToMetafile(int page_number,
base::File output_file,
double* scale_factor);
void OnGetPrinterCapsAndDefaults(const std::string& printer_name);
void OnGetPrinterSemanticCapsAndDefaults(const std::string& printer_name);
std::vector<char> pdf_data_;
printing::PdfRenderSettings pdf_rendering_settings_;
#endif // defined(OS_WIN)
DISALLOW_COPY_AND_ASSIGN(PrintingHandler);
};

View File

@ -9,10 +9,6 @@
namespace base {
namespace internal {
bool CallbackBase::is_null() const {
return bind_state_.get() == NULL;
}
void CallbackBase::Reset() {
polymorphic_invoke_ = NULL;
// NULL the bind_state_ last, since it may be holding the last ref to whatever

View File

@ -44,7 +44,7 @@ class CefCppToC : public CefBase {
return NULL;
// Wrap our object with the CefCppToC class.
ClassName* wrapper = new ClassName(c);
ClassName* wrapper = new ClassName(c.get());
// Add a reference to our wrapper object that will be released once our
// structure arrives on the other side.
wrapper->AddRef();

View File

@ -67,8 +67,8 @@ patches = [
{
# Allow customization of the background color on OS X.
# http://code.google.com/p/chromiumembedded/issues/detail?id=1161
'name': 'renderer_host_1161',
'path': '../content/browser/renderer_host/',
'name': 'browser_1161',
'path': '../content/browser/',
},
{
# Allow customization of the background color with Aura.
@ -106,17 +106,16 @@ patches = [
'path': '../ui/base/dragdrop/',
},
{
# Fix printing on Windows. Reverts portions of the below changes.
# https://codereview.chromium.org/480303002
# https://codereview.chromium.org/488853002
# Fix printing on Windows.
# https://codereview.chromium.org/599633007/
'name': 'printing_win',
'path': '../',
},
{
# Windows: Fix assertion on shutdown with multi-threaded-message-loop.
# https://code.google.com/p/chromiumembedded/issues/detail?id=755
'name': 'media_webrtc_755',
'path': '../content/browser/media/',
# Fix crash in Scheduler::swapQueuesRunPendingTasks...()
# http://crbug.com/415478
'name': 'renderer_415478',
'path': '../content/renderer/',
},
{
# Disable scollbar bounce and overlay on OS X.

View File

@ -1,21 +1,22 @@
diff --git compositing_iosurface_layer_mac.mm compositing_iosurface_layer_mac.mm
index 81a3529..dfcc48d 100644
--- compositing_iosurface_layer_mac.mm
+++ compositing_iosurface_layer_mac.mm
@@ -268,7 +268,7 @@ void CompositingIOSurfaceLayerHelper::EndPumpingFrames() {
TRACE_EVENT0("browser", "CompositingIOSurfaceLayer::drawInCGLContext");
if (!iosurface_->HasIOSurface() || context_->cgl_context() != glContext) {
diff --git compositor/io_surface_layer_mac.mm compositor/io_surface_layer_mac.mm
index bdb3abf..523d372 100644
--- compositor/io_surface_layer_mac.mm
+++ compositor/io_surface_layer_mac.mm
@@ -435,7 +435,7 @@ void IOSurfaceLayerHelper::TimerFired() {
logging::LOG_ERROR,
"IOSurfaceLayer",
std::string("No texture to draw, clearing to white"));
- glClearColor(1, 1, 1, 1);
+ glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
return;
}
diff --git compositing_iosurface_mac.mm compositing_iosurface_mac.mm
index 7012399..47cb9d1 100644
--- compositing_iosurface_mac.mm
+++ compositing_iosurface_mac.mm
@@ -167,7 +167,7 @@ bool CompositingIOSurfaceMac::DrawIOSurface(
diff --git renderer_host/compositing_iosurface_mac.mm renderer_host/compositing_iosurface_mac.mm
index ba67fc9..2c6a410 100644
--- renderer_host/compositing_iosurface_mac.mm
+++ renderer_host/compositing_iosurface_mac.mm
@@ -168,7 +168,7 @@ bool CompositingIOSurfaceMac::DrawIOSurface(
CHECK_AND_SAVE_GL_ERROR();
} else {
// Should match the clear color of RenderWidgetHostViewMac.
@ -24,11 +25,11 @@ index 7012399..47cb9d1 100644
glClear(GL_COLOR_BUFFER_BIT);
}
diff --git render_widget_host_view_aura.cc render_widget_host_view_aura.cc
index 49ee8e4..c49ef82 100644
--- render_widget_host_view_aura.cc
+++ render_widget_host_view_aura.cc
@@ -1615,8 +1615,14 @@ void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) {
diff --git renderer_host/render_widget_host_view_aura.cc renderer_host/render_widget_host_view_aura.cc
index a59880e..e57a421 100644
--- renderer_host/render_widget_host_view_aura.cc
+++ renderer_host/render_widget_host_view_aura.cc
@@ -1622,8 +1622,14 @@ void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) {
// For non-opaque windows, we don't draw anything, since we depend on the
// canvas coming from the compositor to already be initialized as
// transparent.
@ -45,11 +46,11 @@ index 49ee8e4..c49ef82 100644
}
void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged(
diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm
index 4ebbd62..7b3983a 100644
--- render_widget_host_view_mac.mm
+++ render_widget_host_view_mac.mm
@@ -507,7 +507,7 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget)
diff --git renderer_host/render_widget_host_view_mac.mm renderer_host/render_widget_host_view_mac.mm
index 0d4d03c..8615203 100644
--- renderer_host/render_widget_host_view_mac.mm
+++ renderer_host/render_widget_host_view_mac.mm
@@ -541,7 +541,7 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget)
// draw.
background_layer_.reset([[CALayer alloc] init]);
[background_layer_

View File

@ -1,8 +1,8 @@
diff --git web_contents_impl.cc web_contents_impl.cc
index f1a9d02..243bbc8 100644
index 592a72a..caf9331 100644
--- web_contents_impl.cc
+++ web_contents_impl.cc
@@ -1147,22 +1147,29 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
@@ -1195,22 +1195,29 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
params.browser_context, params.site_instance, params.routing_id,
params.main_frame_routing_id);
@ -48,7 +48,7 @@ index f1a9d02..243bbc8 100644
}
CHECK(render_view_host_delegate_view_);
CHECK(view_.get());
@@ -1479,6 +1486,9 @@ void WebContentsImpl::CreateNewWindow(
@@ -1529,6 +1536,9 @@ void WebContentsImpl::CreateNewWindow(
static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace);
CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context));
@ -58,7 +58,7 @@ index f1a9d02..243bbc8 100644
if (delegate_ &&
!delegate_->ShouldCreateWebContents(this,
route_id,
@@ -1486,7 +1496,9 @@ void WebContentsImpl::CreateNewWindow(
@@ -1536,7 +1546,9 @@ void WebContentsImpl::CreateNewWindow(
params.frame_name,
params.target_url,
partition_id,
@ -69,7 +69,7 @@ index f1a9d02..243bbc8 100644
if (route_id != MSG_ROUTING_NONE &&
!RenderViewHost::FromID(render_process_id, route_id)) {
// If the embedder didn't create a WebContents for this route, we need to
@@ -1506,6 +1518,8 @@ void WebContentsImpl::CreateNewWindow(
@@ -1556,6 +1568,8 @@ void WebContentsImpl::CreateNewWindow(
create_params.main_frame_routing_id = main_frame_route_id;
create_params.opener = this;
create_params.opener_suppressed = params.opener_suppressed;

View File

@ -1,5 +1,5 @@
diff --git common.gypi common.gypi
index ea388ac..d0864e3 100644
index d00b6a7..42c6469 100644
--- common.gypi
+++ common.gypi
@@ -9,6 +9,9 @@
@ -12,7 +12,7 @@ index ea388ac..d0864e3 100644
# Putting a variables dict inside another variables dict looks kind of
# weird. This is done so that 'host_arch', 'chromeos', etc are defined as
# variables within the outer variables dict here. This is necessary
@@ -5377,6 +5380,9 @@
@@ -5390,6 +5393,9 @@
4510, # Default constructor could not be generated
4512, # Assignment operator could not be generated
4610, # Object can never be instantiated
@ -23,10 +23,10 @@ index ea388ac..d0864e3 100644
'msvs_settings': {
'VCCLCompilerTool': {
diff --git gyp_chromium gyp_chromium
index b8fe82d..cbc8790 100755
index 326919c0..67d0a00 100755
--- gyp_chromium
+++ gyp_chromium
@@ -262,12 +262,6 @@ if __name__ == '__main__':
@@ -263,12 +263,6 @@ if __name__ == '__main__':
if sys.platform not in ('darwin',):
args.append('--no-circular-check')

View File

@ -1,5 +1,5 @@
diff --git public/renderer/content_renderer_client.cc public/renderer/content_renderer_client.cc
index 6ca2fcc..ed7726d 100644
index 2435d2c..50bb688 100644
--- public/renderer/content_renderer_client.cc
+++ public/renderer/content_renderer_client.cc
@@ -92,7 +92,6 @@ bool ContentRendererClient::AllowPopup() {
@ -19,10 +19,10 @@ index 6ca2fcc..ed7726d 100644
bool ContentRendererClient::ShouldFork(blink::WebFrame* frame,
const GURL& url,
diff --git public/renderer/content_renderer_client.h public/renderer/content_renderer_client.h
index ada672f..e29e9e0 100644
index 55db98c..8f155d6 100644
--- public/renderer/content_renderer_client.h
+++ public/renderer/content_renderer_client.h
@@ -176,7 +176,6 @@ class CONTENT_EXPORT ContentRendererClient {
@@ -182,7 +182,6 @@ class CONTENT_EXPORT ContentRendererClient {
// Returns true if a popup window should be allowed.
virtual bool AllowPopup();
@ -30,7 +30,7 @@ index ada672f..e29e9e0 100644
// TODO(sgurun) This callback is deprecated and will be removed as soon
// as android webview completes implementation of a resource throttle based
// shouldoverrideurl implementation. See crbug.com/325351
@@ -191,7 +190,6 @@ class CONTENT_EXPORT ContentRendererClient {
@@ -197,7 +196,6 @@ class CONTENT_EXPORT ContentRendererClient {
blink::WebNavigationType type,
blink::WebNavigationPolicy default_policy,
bool is_redirect);
@ -39,10 +39,10 @@ index ada672f..e29e9e0 100644
// Returns true if we should fork a new process for the given navigation.
// If |send_referrer| is set to false (which is the default), no referrer
diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc
index 10fd5b5..4c88b4d 100644
index 6337743..4d3f3f9 100644
--- renderer/render_frame_impl.cc
+++ renderer/render_frame_impl.cc
@@ -3380,7 +3380,6 @@ void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) {
@@ -3491,7 +3491,6 @@ void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) {
WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
RenderFrame* render_frame,
const NavigationPolicyInfo& info) {
@ -50,7 +50,7 @@ index 10fd5b5..4c88b4d 100644
// The handlenavigation API is deprecated and will be removed once
// crbug.com/325351 is resolved.
if (info.urlRequest.url() != GURL(kSwappedOutURL) &&
@@ -3395,7 +3394,6 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
@@ -3506,7 +3505,6 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
info.isRedirect)) {
return blink::WebNavigationPolicyIgnore;
}

View File

@ -1,5 +1,5 @@
diff --git resource_ids resource_ids
index 3b8768e..cde0ceb 100644
index 9cd707c..5bb858c 100644
--- resource_ids
+++ resource_ids
@@ -16,6 +16,12 @@
@ -13,5 +13,5 @@ index 3b8768e..cde0ceb 100644
+ "messages": [28000],
+ },
"chrome/browser/browser_resources.grd": {
"includes": [500],
"includes": [400],
"structures": [750],

View File

@ -1,5 +1,5 @@
diff --git gyp/generator/ninja.py gyp/generator/ninja.py
index 4eafb71..83e629c 100644
index 4484f93..8a94869 100644
--- gyp/generator/ninja.py
+++ gyp/generator/ninja.py
@@ -743,7 +743,16 @@ class NinjaWriter:

View File

@ -1,14 +0,0 @@
diff --git webrtc_internals.cc webrtc_internals.cc
index 92ca83c..51c19cb 100644
--- webrtc_internals.cc
+++ webrtc_internals.cc
@@ -61,7 +61,8 @@ WebRTCInternals::~WebRTCInternals() {
}
WebRTCInternals* WebRTCInternals::GetInstance() {
- return Singleton<WebRTCInternals>::get();
+ return Singleton<WebRTCInternals,
+ LeakySingletonTraits<WebRTCInternals> >::get();
}
void WebRTCInternals::OnAddPeerConnection(int render_process_id,

View File

@ -1,13 +1,12 @@
diff --git message_loop.cc message_loop.cc
index ae165ea..cbe5c05 100644
index c01e542..232e7bf 100644
--- message_loop.cc
+++ message_loop.cc
@@ -154,7 +154,7 @@ MessageLoop::MessageLoop(scoped_ptr<MessagePump> pump)
@@ -158,7 +158,6 @@ MessageLoop::MessageLoop(scoped_ptr<MessagePump> pump)
MessageLoop::~MessageLoop() {
DCHECK_EQ(this, current());
- DCHECK(!run_loop_);
+ //DCHECK(!run_loop_);
// Clean up any unprocessed tasks, but take care: deleting a task could
// result in the addition of more tasks (e.g., via DeleteSoon). We set a
#if defined(OS_WIN)
if (in_high_res_mode_)
Time::ActivateHighResolutionTimer(false);

View File

@ -1,5 +1,5 @@
diff --git public/common/common_param_traits_macros.h public/common/common_param_traits_macros.h
index 56b23e4..04de1dc 100644
index 1d045b0..e336118 100644
--- public/common/common_param_traits_macros.h
+++ public/common/common_param_traits_macros.h
@@ -172,6 +172,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
@ -11,7 +11,7 @@ index 56b23e4..04de1dc 100644
IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop)
IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled)
diff --git public/common/web_preferences.cc public/common/web_preferences.cc
index d1e656d..b2ad9e8 100644
index 32f7987..7e166c4 100644
--- public/common/web_preferences.cc
+++ public/common/web_preferences.cc
@@ -135,6 +135,7 @@ WebPreferences::WebPreferences()
@ -20,10 +20,10 @@ index d1e656d..b2ad9e8 100644
navigate_on_drag_drop(true),
+ base_background_color(0xFFFFFFFF), // Color::white
v8_cache_options(V8_CACHE_OPTIONS_OFF),
v8_script_streaming_enabled(false),
cookie_enabled(true),
pepper_accelerated_video_decode_enabled(false)
diff --git public/common/web_preferences.h public/common/web_preferences.h
index 496a347..3916026 100644
index b0a95ca..8c0781e 100644
--- public/common/web_preferences.h
+++ public/common/web_preferences.h
@@ -141,6 +141,7 @@ struct CONTENT_EXPORT WebPreferences {
@ -32,10 +32,10 @@ index 496a347..3916026 100644
bool navigate_on_drag_drop;
+ uint32_t base_background_color;
V8CacheOptions v8_cache_options;
bool v8_script_streaming_enabled;
// This flags corresponds to a Page's Settings' setCookieEnabled state. It
diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc
index 743d8db..617ddf4 100644
index 02d10eef..ba5cf0c 100644
--- renderer/render_view_impl.cc
+++ renderer/render_view_impl.cc
@@ -969,6 +969,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,

View File

@ -1,709 +1,296 @@
diff --git chrome/renderer/printing/print_web_view_helper.cc chrome/renderer/printing/print_web_view_helper.cc
index f1d4cfd..bb4eac4 100644
--- chrome/renderer/printing/print_web_view_helper.cc
+++ chrome/renderer/printing/print_web_view_helper.cc
@@ -767,12 +767,17 @@ void PrepareFrameAndViewForPrint::FinishPrinting() {
on_ready_.Reset();
}
diff --git chrome/common/chrome_utility_printing_messages.h chrome/common/chrome_utility_printing_messages.h
index d5ddd6e..7d90287 100644
--- chrome/common/chrome_utility_printing_messages.h
+++ chrome/common/chrome_utility_printing_messages.h
@@ -16,8 +16,8 @@
-PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view)
+PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view,
+ bool preview_enabled,
+ bool scripted_print_throttling_disabled)
: content::RenderViewObserver(render_view),
content::RenderViewObserverTracker<PrintWebViewHelper>(render_view),
reset_prep_frame_view_(false),
+ is_preview_enabled_(preview_enabled),
+ is_scripted_print_throttling_disabled_(scripted_print_throttling_disabled),
is_print_ready_metafile_sent_(false),
ignore_css_margins_(false),
+ user_cancelled_scripted_print_count_(0),
is_scripted_printing_blocked_(false),
notify_browser_of_print_failure_(true),
print_for_preview_(false),
@@ -791,6 +796,14 @@ bool PrintWebViewHelper::IsScriptInitiatedPrintAllowed(
#endif // defined(OS_ANDROID)
if (is_scripted_printing_blocked_)
#define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart
+// Preview and Cloud Print messages.
#if defined(ENABLE_FULL_PRINTING)
-
IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults)
IPC_STRUCT_TRAITS_MEMBER(printer_capabilities)
IPC_STRUCT_TRAITS_MEMBER(caps_mime_type)
@@ -61,23 +61,6 @@ IPC_STRUCT_TRAITS_END()
// Utility process messages:
// These are messages from the browser to the utility process.
-#if defined(OS_WIN)
-// Tell the utility process to start rendering the given PDF into a metafile.
-// Utility process would be alive until
-// ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop message.
-IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles,
- IPC::PlatformFileForTransit, /* input_file */
- printing::PdfRenderSettings /* settings */)
-
-// Requests conversion of the next page.
-IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage,
- int /* page_number */,
- IPC::PlatformFileForTransit /* output_file */)
-
-// Requests utility process to stop conversion and exit.
-IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop)
-#endif // OS_WIN
-
// Tell the utility process to render the given PDF into a PWGRaster.
IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_RenderPDFPagesToPWGRaster,
IPC::PlatformFileForTransit, /* Input PDF file */
@@ -99,23 +82,32 @@ IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterCapsAndDefaults,
// sandbox. Returns result as printing::PrinterSemanticCapsAndDefaults.
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults,
std::string /* printer name */)
+#endif // ENABLE_FULL_PRINTING
+
+// Windows uses messages for printing even without preview. crbug.com/170859
+// Primary user of Windows without preview is CEF. crbug.com/417967
+#if defined(ENABLE_PRINTING) && defined(OS_WIN)
+// Tell the utility process to start rendering the given PDF into a metafile.
+// Utility process would be alive until
+// ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop message.
+IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles,
+ IPC::PlatformFileForTransit, /* input_file */
+ printing::PdfRenderSettings /* settings */)
+
+// Requests conversion of the next page.
+IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage,
+ int /* page_number */,
+ IPC::PlatformFileForTransit /* output_file */)
+
+// Requests utility process to stop conversion and exit.
+IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop)
+#endif // ENABLE_PRINTING && OS_WIN
//------------------------------------------------------------------------------
// Utility process host messages:
// These are messages from the utility process to the browser.
-#if defined(OS_WIN)
-// Reply when the utility process loaded PDF. |page_count| is 0, if loading
-// failed.
-IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount,
- int /* page_count */)
-
-// Reply when the utility process rendered the PDF page.
-IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone,
- bool /* success */,
- double /* scale_factor */)
-#endif // OS_WIN
-
+#if defined(ENABLE_FULL_PRINTING)
// Reply when the utility process has succeeded in rendering the PDF to PWG.
IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToPWGRaster_Succeeded)
@@ -145,5 +137,16 @@ IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed,
IPC_MESSAGE_CONTROL1(
ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed,
std::string /* printer name */)
-
#endif // ENABLE_FULL_PRINTING
+
+#if defined(ENABLE_PRINTING) && defined(OS_WIN)
+// Reply when the utility process loaded PDF. |page_count| is 0, if loading
+// failed.
+IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount,
+ int /* page_count */)
+
+// Reply when the utility process rendered the PDF page.
+IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone,
+ bool /* success */,
+ double /* scale_factor */)
+#endif // ENABLE_PRINTING && OS_WIN
diff --git content/renderer/pepper/pepper_plugin_instance_impl.cc content/renderer/pepper/pepper_plugin_instance_impl.cc
index 98ca698..2128d55 100644
--- content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -94,9 +94,7 @@
#include "ppapi/thunk/ppb_buffer_api.h"
#include "printing/metafile_skia_wrapper.h"
#include "printing/pdf_metafile_skia.h"
-#include "printing/units.h"
#include "skia/ext/platform_canvas.h"
-#include "skia/ext/platform_device.h"
#include "third_party/WebKit/public/platform/WebCursorInfo.h"
#include "third_party/WebKit/public/platform/WebGamepads.h"
#include "third_party/WebKit/public/platform/WebRect.h"
@@ -120,13 +118,9 @@
#include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/khronos/GLES2/gl2.h"
-#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkRect.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/range/range.h"
-#include "ui/gfx/rect_conversions.h"
-#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
#include "v8/include/v8.h"
#if defined(OS_CHROMEOS)
@@ -137,8 +131,6 @@
#include "base/metrics/histogram.h"
#include "base/win/windows_version.h"
#include "skia/ext/platform_canvas.h"
-#include "ui/gfx/codec/jpeg_codec.h"
-#include "ui/gfx/gdi_util.h"
#endif
using base::StringPrintf;
@@ -186,35 +178,6 @@ using blink::WebView;
namespace content {
-#if defined(OS_WIN)
-// Exported by pdf.dll
-typedef bool (*RenderPDFPageToDCProc)(const unsigned char* pdf_buffer,
- int buffer_size,
- int page_number,
- HDC dc,
- int dpi_x,
- int dpi_y,
- int bounds_origin_x,
- int bounds_origin_y,
- int bounds_width,
- int bounds_height,
- bool fit_to_bounds,
- bool stretch_to_bounds,
- bool keep_aspect_ratio,
- bool center_in_bounds,
- bool autorotate);
-
-void DrawEmptyRectangle(HDC dc) {
- // TODO(sanjeevr): This is a temporary hack. If we output a JPEG
- // to the EMF, the EnumEnhMetaFile call fails in the browser
- // process. The failure also happens if we output nothing here.
- // We need to investigate the reason for this failure and fix it.
- // In the meantime this temporary hack of drawing an empty
- // rectangle in the DC gets us by.
- Rectangle(dc, 0, 0, 0, 0);
-}
-#endif // defined(OS_WIN)
-
namespace {
// Check PP_TextInput_Type and ui::TextInputType are kept in sync.
@@ -1776,7 +1739,7 @@ int PepperPluginInstanceImpl::PrintBegin(const WebPrintParams& print_params) {
bool PepperPluginInstanceImpl::PrintPage(int page_number,
blink::WebCanvas* canvas) {
-#if defined(ENABLE_FULL_PRINTING)
+#if defined(ENABLE_PRINTING)
DCHECK(plugin_print_interface_);
PP_PrintPageNumberRange_Dev page_range;
page_range.first_page_number = page_range.last_page_number = page_number;
@@ -1793,7 +1756,7 @@ bool PepperPluginInstanceImpl::PrintPage(int page_number,
} else {
return PrintPageHelper(&page_range, 1, canvas);
}
-#else // defined(ENABLED_PRINTING)
+#else // ENABLE_PRINTING
return false;
#endif
}
@@ -1960,7 +1923,7 @@ bool PepperPluginInstanceImpl::IsViewAccelerated() {
bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output,
blink::WebCanvas* canvas) {
-#if defined(ENABLE_FULL_PRINTING)
+#if defined(ENABLE_PRINTING)
ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true);
if (enter.failed())
return false;
@@ -1970,91 +1933,15 @@ bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output,
NOTREACHED();
return false;
+ // If preview is enabled, then the print dialog is tab modal, and the user
+ // can always close the tab on a mis-behaving page (the system print dialog
+ // is app modal). If the print was initiated through user action, don't
+ // throttle. Or, if the command line flag to skip throttling has been set.
+ if (!is_scripted_print_throttling_disabled_ &&
+ !is_preview_enabled_ &&
+ !user_initiated)
+ return !IsScriptInitiatedPrintTooFrequent(frame);
return true;
}
@@ -820,8 +833,14 @@ void PrintWebViewHelper::PrintPage(blink::WebLocalFrame* frame,
if (!IsScriptInitiatedPrintAllowed(frame, user_initiated))
return;
- print_preview_context_.InitWithFrame(frame);
- RequestPrintPreview(PRINT_PREVIEW_SCRIPTED);
+ IncrementScriptedPrintCount();
+
+ if (is_preview_enabled_) {
+ print_preview_context_.InitWithFrame(frame);
+ RequestPrintPreview(PRINT_PREVIEW_SCRIPTED);
+ } else {
+ Print(frame, blink::WebNode());
+ }
}
bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
@@ -842,6 +861,7 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
void PrintWebViewHelper::OnPrintForPrintPreview(
const base::DictionaryValue& job_settings) {
+ DCHECK(is_preview_enabled_);
// If still not finished with earlier print request simply ignore.
if (prep_frame_view_)
return;
@@ -975,6 +995,7 @@ bool PrintWebViewHelper::IsPrintToPdfRequested(
}
void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) {
+ DCHECK(is_preview_enabled_);
print_preview_context_.OnPrintPreview();
UMA_HISTOGRAM_ENUMERATION("PrintPreview.PreviewEvent",
@@ -1177,6 +1198,7 @@ void PrintWebViewHelper::SetScriptedPrintBlocked(bool blocked) {
}
void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
+ DCHECK(is_preview_enabled_);
blink::WebLocalFrame* frame = NULL;
GetPrintFrame(&frame);
DCHECK(frame);
@@ -1210,8 +1232,13 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
// Make a copy of the node, in case RenderView::OnContextMenuClosed resets
// its |context_menu_node_|.
- print_preview_context_.InitWithNode(node);
- RequestPrintPreview(PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE);
+ if (is_preview_enabled_) {
+ print_preview_context_.InitWithNode(node);
+ RequestPrintPreview(PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE);
+ } else {
+ blink::WebNode duplicate_node(node);
+ Print(duplicate_node.document().frame(), duplicate_node);
+ }
print_node_in_progress_ = false;
}
@@ -1248,6 +1275,7 @@ void PrintWebViewHelper::Print(blink::WebLocalFrame* frame,
LOG(ERROR) << "RenderPagesForPrint failed";
DidFinishPrinting(FAIL_PRINT);
}
+ ResetScriptedPrintCount();
}
-#if defined(OS_WIN)
- // For Windows, we need the PDF DLL to render the output PDF to a DC.
- HMODULE pdf_module = GetModuleHandle(L"pdf.dll");
- if (!pdf_module)
- return false;
- RenderPDFPageToDCProc render_proc = reinterpret_cast<RenderPDFPageToDCProc>(
- GetProcAddress(pdf_module, "RenderPDFPageToDC"));
- if (!render_proc)
- return false;
-#endif // defined(OS_WIN)
void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
@@ -1267,6 +1295,7 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
break;
case FAIL_PREVIEW:
+ DCHECK(is_preview_enabled_);
int cookie = print_pages_params_ ?
print_pages_params_->params.document_cookie : 0;
if (notify_browser_of_print_failure_) {
@@ -1435,6 +1464,7 @@ bool PrintWebViewHelper::UpdatePrintSettings(
blink::WebLocalFrame* frame,
const blink::WebNode& node,
const base::DictionaryValue& passed_job_settings) {
+ DCHECK(is_preview_enabled_);
const base::DictionaryValue* job_settings = &passed_job_settings;
base::DictionaryValue modified_job_settings;
if (job_settings->empty()) {
@@ -1588,6 +1618,54 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem(
}
#endif // defined(OS_POSIX)
+bool PrintWebViewHelper::IsScriptInitiatedPrintTooFrequent(
+ blink::WebFrame* frame) {
+ const int kMinSecondsToIgnoreJavascriptInitiatedPrint = 2;
+ const int kMaxSecondsToIgnoreJavascriptInitiatedPrint = 32;
+ bool too_frequent = false;
+
+ // Check if there is script repeatedly trying to print and ignore it if too
+ // frequent. The first 3 times, we use a constant wait time, but if this
+ // gets excessive, we switch to exponential wait time. So for a page that
+ // calls print() in a loop the user will need to cancel the print dialog
+ // after: [2, 2, 2, 4, 8, 16, 32, 32, ...] seconds.
+ // This gives the user time to navigate from the page.
+ if (user_cancelled_scripted_print_count_ > 0) {
+ base::TimeDelta diff = base::Time::Now() - last_cancelled_script_print_;
+ int min_wait_seconds = kMinSecondsToIgnoreJavascriptInitiatedPrint;
+ if (user_cancelled_scripted_print_count_ > 3) {
+ min_wait_seconds = std::min(
+ kMinSecondsToIgnoreJavascriptInitiatedPrint <<
+ (user_cancelled_scripted_print_count_ - 3),
+ kMaxSecondsToIgnoreJavascriptInitiatedPrint);
+ }
+ if (diff.InSeconds() < min_wait_seconds) {
+ too_frequent = true;
+ }
+ }
+
+ if (!too_frequent)
+ return false;
+
+ blink::WebString message(
+ blink::WebString::fromUTF8("Ignoring too frequent calls to print()."));
+ frame->addMessageToConsole(
+ blink::WebConsoleMessage(
+ blink::WebConsoleMessage::LevelWarning, message));
+ return true;
+}
+
+void PrintWebViewHelper::ResetScriptedPrintCount() {
+ // Reset cancel counter on successful print.
+ user_cancelled_scripted_print_count_ = 0;
+}
+
+void PrintWebViewHelper::IncrementScriptedPrintCount() {
+ ++user_cancelled_scripted_print_count_;
+ last_cancelled_script_print_ = base::Time::Now();
+}
+
+
void PrintWebViewHelper::ShowScriptedPrintPreview() {
if (is_scripted_preview_delayed_) {
is_scripted_preview_delayed_ = false;
diff --git chrome/renderer/printing/print_web_view_helper.h chrome/renderer/printing/print_web_view_helper.h
index 67bcc73..b8a5126 100644
--- chrome/renderer/printing/print_web_view_helper.h
+++ chrome/renderer/printing/print_web_view_helper.h
@@ -66,7 +66,9 @@ class PrintWebViewHelper
: public content::RenderViewObserver,
public content::RenderViewObserverTracker<PrintWebViewHelper> {
public:
- explicit PrintWebViewHelper(content::RenderView* render_view);
+ PrintWebViewHelper(content::RenderView* render_view,
+ bool preview_enabled,
+ bool scripted_print_throttling_disabled);
virtual ~PrintWebViewHelper();
bool IsPrintingEnabled();
@@ -292,13 +294,24 @@ class PrintWebViewHelper
bool IsScriptInitiatedPrintAllowed(blink::WebFrame* frame,
bool user_initiated);
- // Shows scripted print preview when options from plugin are available.
+ // Returns true if script initiated printing occurs too often.
+ bool IsScriptInitiatedPrintTooFrequent(blink::WebFrame* frame);
+
+ // Reset the counter for script initiated printing.
+ // Scripted printing will be allowed to continue.
+ void ResetScriptedPrintCount();
+
+ // Increment the counter for script initiated printing.
+ // Scripted printing will be blocked for a limited amount of time.
+ void IncrementScriptedPrintCount();
+
+ // Shows scripted print preview when options from plugin are availible.
void ShowScriptedPrintPreview();
void RequestPrintPreview(PrintPreviewRequestType type);
// Checks whether print preview should continue or not.
- // Returns true if canceling, false if continuing.
+ // Returns true if cancelling, false if continuing.
bool CheckForCancel();
// Notifies the browser a print preview page has been rendered.
@@ -315,9 +328,14 @@ class PrintWebViewHelper
bool reset_prep_frame_view_;
scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_;
+ bool is_preview_enabled_;
+ bool is_scripted_print_throttling_disabled_;
bool is_print_ready_metafile_sent_;
bool ignore_css_margins_;
+
// Used for scripted initiated printing blocking.
+ base::Time last_cancelled_script_print_;
+ int user_cancelled_scripted_print_count_;
bool is_scripted_printing_blocked_;
// Let the browser process know of a printing failure. Only set to false when
diff --git printing/printing_context_win.cc printing/printing_context_win.cc
index 4d7ea92..5e53ed2 100644
--- printing/printing_context_win.cc
+++ printing/printing_context_win.cc
@@ -50,7 +50,7 @@ scoped_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) {
}
PrintingContextWin::PrintingContextWin(Delegate* delegate)
- : PrintingContext(delegate), context_(NULL) {
+ : PrintingContext(delegate), context_(NULL), dialog_box_(NULL) {
}
PrintingContextWin::~PrintingContextWin() {
@@ -61,26 +61,63 @@ void PrintingContextWin::AskUserForSettings(
int max_pages,
bool has_selection,
const PrintSettingsCallback& callback) {
- NOTIMPLEMENTED();
+ DCHECK(!in_print_job_);
+ dialog_box_dismissed_ = false;
+
+ HWND window = GetRootWindow(delegate_->GetParentView());
+ DCHECK(window);
+
+ // Show the OS-dependent dialog box.
+ // If the user press
+ // - OK, the settings are reset and reinitialized with the new settings. OK is
+ // returned.
+ // - Apply then Cancel, the settings are reset and reinitialized with the new
+ // settings. CANCEL is returned.
+ // - Cancel, the settings are not changed, the previous setting, if it was
+ // initialized before, are kept. CANCEL is returned.
+ // On failure, the settings are reset and FAILED is returned.
+ PRINTDLGEX dialog_options = { sizeof(PRINTDLGEX) };
+ dialog_options.hwndOwner = window;
+ // Disable options we don't support currently.
+ // TODO(maruel): Reuse the previously loaded settings!
+ dialog_options.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE |
+ PD_NOCURRENTPAGE | PD_HIDEPRINTTOFILE;
+ if (!has_selection)
+ dialog_options.Flags |= PD_NOSELECTION;
+
+ PRINTPAGERANGE ranges[32];
+ dialog_options.nStartPage = START_PAGE_GENERAL;
+ if (max_pages) {
+ // Default initialize to print all the pages.
+ memset(ranges, 0, sizeof(ranges));
+ ranges[0].nFromPage = 1;
+ ranges[0].nToPage = max_pages;
+ dialog_options.nPageRanges = 1;
+ dialog_options.nMaxPageRanges = arraysize(ranges);
+ dialog_options.nMinPage = 1;
+ dialog_options.nMaxPage = max_pages;
+ dialog_options.lpPageRanges = ranges;
+ } else {
+ // No need to bother, we don't know how many pages are available.
+ dialog_options.Flags |= PD_NOPAGENUMS;
+ }
+
+ if (ShowPrintDialog(&dialog_options) != S_OK) {
+ ResetSettings();
+ callback.Run(FAILED);
+ }
+
+ // TODO(maruel): Support PD_PRINTTOFILE.
+ callback.Run(ParseDialogResultEx(dialog_options));
}
PrintingContext::Result PrintingContextWin::UseDefaultSettings() {
DCHECK(!in_print_job_);
- scoped_refptr<PrintBackend> backend = PrintBackend::CreateInstance(NULL);
- base::string16 default_printer =
- base::UTF8ToWide(backend->GetDefaultPrinterName());
- if (!default_printer.empty()) {
- ScopedPrinterHandle printer;
- if (printer.OpenPrinter(default_printer.c_str())) {
- scoped_ptr<DEVMODE, base::FreeDeleter> dev_mode =
- CreateDevMode(printer, NULL);
- if (InitializeSettings(default_printer, dev_mode.get()) == OK)
- return OK;
- }
- }
-
- ReleaseContext();
+ PRINTDLG dialog_options = { sizeof(PRINTDLG) };
+ dialog_options.Flags = PD_RETURNDC | PD_RETURNDEFAULT;
+ if (PrintDlg(&dialog_options))
+ return ParseDialogResult(dialog_options);
// No default printer configured, do we have any printers at all?
DWORD bytes_needed = 0;
@@ -105,15 +142,23 @@ PrintingContext::Result PrintingContextWin::UseDefaultSettings() {
continue;
scoped_ptr<DEVMODE, base::FreeDeleter> dev_mode =
CreateDevMode(printer, NULL);
- if (InitializeSettings(info_2->pPrinterName, dev_mode.get()) == OK)
+ if (!dev_mode || !AllocateContext(info_2->pPrinterName, dev_mode.get(),
+ &context_)) {
+ continue;
+ }
+ if (InitializeSettings(*dev_mode.get(), info_2->pPrinterName, NULL, 0,
+ false)) {
return OK;
+ }
+ ReleaseContext();
}
if (context_)
return OK;
}
}
- return OnError();
+ ResetSettings();
+ return FAILED;
}
gfx::Size PrintingContextWin::GetPdfPaperSizeDeviceUnits() {
@@ -212,14 +257,19 @@ PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(
}
// Update data using DocumentProperties.
- if (show_system_dialog) {
- scoped_dev_mode = ShowPrintDialog(
- printer, delegate_->GetParentView(), scoped_dev_mode.get());
- bool ret = false;
-#if defined(OS_POSIX) && !defined(OS_ANDROID)
printing::PdfMetafileSkia* metafile =
printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas);
- DCHECK(metafile != NULL);
if (metafile)
- ret = metafile->InitFromData(mapper.data(), mapper.size());
-#elif defined(OS_WIN)
- printing::PdfMetafileSkia* metafile =
- printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas);
- if (metafile) {
- // We only have a metafile when doing print preview, so we just want to
- // pass the PDF off to preview.
- ret = metafile->InitFromData(mapper.data(), mapper.size());
- } else {
- scoped_dev_mode = CreateDevMode(printer, scoped_dev_mode.get());
- }
+ scoped_dev_mode = CreateDevMode(printer, scoped_dev_mode.get());
+ if (!scoped_dev_mode)
+ return OnError();
+
// Set printer then refresh printer settings.
- return InitializeSettings(settings_.device_name(), scoped_dev_mode.get());
+ if (!AllocateContext(settings_.device_name(), scoped_dev_mode.get(),
+ &context_)) {
+ return OnError();
+ }
+ PrintSettingsInitializerWin::InitPrintSettings(context_,
+ *scoped_dev_mode.get(),
+ &settings_);
+ return OK;
}
PrintingContext::Result PrintingContextWin::InitWithSettings(
@@ -230,13 +280,18 @@ PrintingContext::Result PrintingContextWin::InitWithSettings(
// TODO(maruel): settings_.ToDEVMODE()
ScopedPrinterHandle printer;
- if (!printer.OpenPrinter(settings_.device_name().c_str()))
+ if (!printer.OpenPrinter(settings_.device_name().c_str())) {
return FAILED;
+ }
- scoped_ptr<DEVMODE, base::FreeDeleter> dev_mode =
- CreateDevMode(printer, NULL);
+ Result status = OK;
+
+ if (!GetPrinterSettings(printer, settings_.device_name()))
+ status = FAILED;
- return InitializeSettings(settings_.device_name(), dev_mode.get());
+ if (status != OK)
+ ResetSettings();
+ return status;
}
PrintingContext::Result PrintingContextWin::NewDocument(
@@ -320,6 +375,10 @@ void PrintingContextWin::Cancel() {
in_print_job_ = false;
if (context_)
CancelDC(context_);
+ if (dialog_box_) {
+ DestroyWindow(dialog_box_);
+ dialog_box_dismissed_ = true;
+ }
}
void PrintingContextWin::ReleaseContext() {
@@ -343,31 +402,154 @@ BOOL PrintingContextWin::AbortProc(HDC hdc, int nCode) {
return true;
}
-PrintingContext::Result PrintingContextWin::InitializeSettings(
- const std::wstring& device_name,
- DEVMODE* dev_mode) {
- if (!dev_mode)
- return OnError();
+bool PrintingContextWin::InitializeSettings(const DEVMODE& dev_mode,
+ const std::wstring& new_device_name,
+ const PRINTPAGERANGE* ranges,
+ int number_ranges,
+ bool selection_only) {
+ skia::InitializeDC(context_);
+ DCHECK(GetDeviceCaps(context_, CLIPCAPS));
+ DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_STRETCHDIB);
+ DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_BITMAP64);
+ // Some printers don't advertise these.
+ // DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_SCALING);
+ // DCHECK(GetDeviceCaps(context_, SHADEBLENDCAPS) & SB_CONST_ALPHA);
+ // DCHECK(GetDeviceCaps(context_, SHADEBLENDCAPS) & SB_PIXEL_ALPHA);
+
+ // StretchDIBits() support is needed for printing.
+ if (!(GetDeviceCaps(context_, RASTERCAPS) & RC_STRETCHDIB) ||
+ !(GetDeviceCaps(context_, RASTERCAPS) & RC_BITMAP64)) {
+ NOTREACHED();
+ ResetSettings();
+ return false;
+ }
- ReleaseContext();
- context_ = CreateDC(L"WINSPOOL", device_name.c_str(), NULL, dev_mode);
- if (!context_)
- return OnError();
+ DCHECK(!in_print_job_);
+ DCHECK(context_);
+ PageRanges ranges_vector;
+ if (!selection_only) {
+ // Convert the PRINTPAGERANGE array to a PrintSettings::PageRanges vector.
+ ranges_vector.reserve(number_ranges);
+ for (int i = 0; i < number_ranges; ++i) {
+ PageRange range;
+ // Transfer from 1-based to 0-based.
+ range.from = ranges[i].nFromPage - 1;
+ range.to = ranges[i].nToPage - 1;
+ ranges_vector.push_back(range);
+ }
+ }
- skia::InitializeDC(context_);
+ settings_.set_ranges(ranges_vector);
+ settings_.set_device_name(new_device_name);
+ settings_.set_selection_only(selection_only);
+ PrintSettingsInitializerWin::InitPrintSettings(context_, dev_mode,
+ &settings_);
+ return true;
+}
+
+bool PrintingContextWin::GetPrinterSettings(HANDLE printer,
+ const std::wstring& device_name) {
DCHECK(!in_print_job_);
- settings_.set_device_name(device_name);
- PrintSettingsInitializerWin::InitPrintSettings(
- context_, *dev_mode, &settings_);
- return OK;
+ scoped_ptr<DEVMODE, base::FreeDeleter> dev_mode =
+ CreateDevMode(printer, NULL);
+
+ if (!dev_mode || !AllocateContext(device_name, dev_mode.get(), &context_)) {
+ ResetSettings();
+ return false;
+ }
+
+ return InitializeSettings(*dev_mode.get(), device_name, NULL, 0, false);
+}
+
+// static
+bool PrintingContextWin::AllocateContext(const std::wstring& device_name,
+ const DEVMODE* dev_mode,
+ gfx::NativeDrawingContext* context) {
+ *context = CreateDC(L"WINSPOOL", device_name.c_str(), NULL, dev_mode);
+ DCHECK(*context);
+ return *context != NULL;
+}
+
+PrintingContext::Result PrintingContextWin::ParseDialogResultEx(
+ const PRINTDLGEX& dialog_options) {
+ // If the user clicked OK or Apply then Cancel, but not only Cancel.
+ if (dialog_options.dwResultAction != PD_RESULT_CANCEL) {
+ // Start fresh.
+ ResetSettings();
+
+ DEVMODE* dev_mode = NULL;
+ if (dialog_options.hDevMode) {
+ dev_mode =
+ reinterpret_cast<DEVMODE*>(GlobalLock(dialog_options.hDevMode));
+ DCHECK(dev_mode);
+ }
+
+ std::wstring device_name;
+ if (dialog_options.hDevNames) {
+ DEVNAMES* dev_names =
+ reinterpret_cast<DEVNAMES*>(GlobalLock(dialog_options.hDevNames));
+ DCHECK(dev_names);
+ if (dev_names) {
+ device_name = reinterpret_cast<const wchar_t*>(dev_names) +
+ dev_names->wDeviceOffset;
+ GlobalUnlock(dialog_options.hDevNames);
+ }
+ }
+
+ bool success = false;
+ if (dev_mode && !device_name.empty()) {
+ context_ = dialog_options.hDC;
+ PRINTPAGERANGE* page_ranges = NULL;
+ DWORD num_page_ranges = 0;
+ bool print_selection_only = false;
+ if (dialog_options.Flags & PD_PAGENUMS) {
+ page_ranges = dialog_options.lpPageRanges;
+ num_page_ranges = dialog_options.nPageRanges;
+ }
+ if (dialog_options.Flags & PD_SELECTION) {
+ print_selection_only = true;
+ }
+ success = InitializeSettings(*dev_mode,
+ device_name,
+ page_ranges,
+ num_page_ranges,
+ print_selection_only);
+ }
+
+ if (!success && dialog_options.hDC) {
+ DeleteDC(dialog_options.hDC);
+ context_ = NULL;
+ }
+
+ if (dev_mode) {
+ GlobalUnlock(dialog_options.hDevMode);
+ }
+ } else {
+ if (dialog_options.hDC) {
+ DeleteDC(dialog_options.hDC);
+ }
+ }
+
+ if (dialog_options.hDevMode != NULL)
+ GlobalFree(dialog_options.hDevMode);
+ if (dialog_options.hDevNames != NULL)
+ GlobalFree(dialog_options.hDevNames);
+
+ switch (dialog_options.dwResultAction) {
+ case PD_RESULT_PRINT:
+ return context_ ? OK : FAILED;
+ case PD_RESULT_APPLY:
+ return context_ ? CANCEL : FAILED;
+ case PD_RESULT_CANCEL:
+ return CANCEL;
+ default:
+ return FAILED;
+ }
}
-scoped_ptr<DEVMODE, base::FreeDeleter> PrintingContextWin::ShowPrintDialog(
- HANDLE printer,
- gfx::NativeView parent_view,
- DEVMODE* dev_mode) {
+HRESULT PrintingContextWin::ShowPrintDialog(PRINTDLGEX* options) {
// Note that this cannot use ui::BaseShellDialog as the print dialog is
// system modal: opening it from a background thread can cause Windows to
// get the wrong Z-order which will make the print dialog appear behind the
@@ -377,20 +559,57 @@ scoped_ptr<DEVMODE, base::FreeDeleter> PrintingContextWin::ShowPrintDialog(
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
- bool canceled = false;
- scoped_ptr<DEVMODE, base::FreeDeleter> result =
- PromptDevMode(printer,
- settings_.device_name(),
- dev_mode,
- GetRootWindow(parent_view),
- &canceled);
- // On Windows, we now need to render the PDF to the DC that backs the
- // supplied canvas.
- HDC dc = skia::BeginPlatformPaint(canvas);
- DrawEmptyRectangle(dc);
- gfx::Size size_in_pixels;
- size_in_pixels.set_width(
- printing::ConvertUnit(current_print_settings_.printable_area.size.width,
- static_cast<int>(printing::kPointsPerInch),
- current_print_settings_.dpi));
- size_in_pixels.set_height(printing::ConvertUnit(
- current_print_settings_.printable_area.size.height,
- static_cast<int>(printing::kPointsPerInch),
- current_print_settings_.dpi));
- // We need to scale down DC to fit an entire page into DC available area.
- // First, we'll try to use default scaling based on the 72dpi that is
- // used in webkit for printing.
- // If default scaling is not enough to fit the entire PDF without
- // Current metafile is based on screen DC and have current screen size.
- // Writing outside of those boundaries will result in the cut-off output.
- // On metafiles (this is the case here), scaling down will still record
- // original coordinates and we'll be able to print in full resolution.
- // Before playback we'll need to counter the scaling up that will happen
- // in the browser (printed_document_win.cc).
- double dynamic_scale = gfx::CalculatePageScale(
- dc, size_in_pixels.width(), size_in_pixels.height());
- double page_scale = static_cast<double>(printing::kPointsPerInch) /
- static_cast<double>(current_print_settings_.dpi);
-
- if (canceled) {
- result.reset();
- abort_printing_ = true;
+ return PrintDlgEx(options);
+}
+
+PrintingContext::Result PrintingContextWin::ParseDialogResult(
+ const PRINTDLG& dialog_options) {
+ // If the user clicked OK or Apply then Cancel, but not only Cancel.
+ // Start fresh.
+ ResetSettings();
+
+ DEVMODE* dev_mode = NULL;
+ if (dialog_options.hDevMode) {
+ dev_mode =
+ reinterpret_cast<DEVMODE*>(GlobalLock(dialog_options.hDevMode));
+ DCHECK(dev_mode);
}
- if (dynamic_scale < page_scale) {
- page_scale = dynamic_scale;
- printing::MetafileSkiaWrapper::SetCustomScaleOnCanvas(*canvas,
- page_scale);
- }
-
- gfx::ScaleDC(dc, page_scale);
-
- ret = render_proc(static_cast<unsigned char*>(mapper.data()),
- mapper.size(),
- 0,
- dc,
- current_print_settings_.dpi,
- current_print_settings_.dpi,
- 0,
- 0,
- size_in_pixels.width(),
- size_in_pixels.height(),
- true,
- false,
- true,
- true,
- true);
- skia::EndPlatformPaint(canvas);
- }
-#endif // defined(OS_WIN)
+ return metafile->InitFromData(mapper.data(), mapper.size());
- return result.Pass();
+ std::wstring device_name;
+ if (dialog_options.hDevNames) {
+ DEVNAMES* dev_names =
+ reinterpret_cast<DEVNAMES*>(GlobalLock(dialog_options.hDevNames));
+ DCHECK(dev_names);
+ if (dev_names) {
+ device_name =
+ reinterpret_cast<const wchar_t*>(
+ reinterpret_cast<const wchar_t*>(dev_names) +
+ dev_names->wDeviceOffset);
+ GlobalUnlock(dialog_options.hDevNames);
+ }
+ }
+
+ bool success = false;
+ if (dev_mode && !device_name.empty()) {
+ context_ = dialog_options.hDC;
+ success = InitializeSettings(*dev_mode, device_name, NULL, 0, false);
+ }
+
+ if (!success && dialog_options.hDC) {
+ DeleteDC(dialog_options.hDC);
+ context_ = NULL;
+ }
+
+ if (dev_mode) {
+ GlobalUnlock(dialog_options.hDevMode);
+ }
+
+ if (dialog_options.hDevMode != NULL)
+ GlobalFree(dialog_options.hDevMode);
+ if (dialog_options.hDevNames != NULL)
+ GlobalFree(dialog_options.hDevNames);
+
+ return context_ ? OK : FAILED;
- return ret;
-#else // defined(ENABLE_FULL_PRINTING)
+ NOTREACHED();
+#endif // ENABLE_PRINTING
return false;
-#endif
}
} // namespace printing
diff --git printing/printing_context_win.h printing/printing_context_win.h
index 99a7e3e..f6222ad 100644
--- printing/printing_context_win.h
+++ printing/printing_context_win.h
@@ -40,24 +40,45 @@ class PRINTING_EXPORT PrintingContextWin : public PrintingContext {
virtual void ReleaseContext() OVERRIDE;
virtual gfx::NativeDrawingContext context() const OVERRIDE;
+ // Allocates the HDC for a specific DEVMODE.
+ static bool AllocateContext(const std::wstring& printer_name,
+ const DEVMODE* dev_mode,
+ gfx::NativeDrawingContext* context);
+
protected:
- virtual scoped_ptr<DEVMODE, base::FreeDeleter> ShowPrintDialog(
- HANDLE printer,
- gfx::NativeView parent_view,
- DEVMODE* dev_mode);
+ virtual HRESULT ShowPrintDialog(PRINTDLGEX* options);
private:
+ // Class that manages the PrintDlgEx() callbacks. This is meant to be a
+ // temporary object used during the Print... dialog display.
+ class CallbackHandler;
+
// Used in response to the user canceling the printing.
static BOOL CALLBACK AbortProc(HDC hdc, int nCode);
// Reads the settings from the selected device context. Updates settings_ and
// its margins.
- virtual Result InitializeSettings(const base::string16& device_name,
- DEVMODE* dev_mode);
+ bool InitializeSettings(const DEVMODE& dev_mode,
+ const std::wstring& new_device_name,
+ const PRINTPAGERANGE* ranges,
+ int number_ranges,
+ bool selection_only);
+
+ // Retrieves the printer's default low-level settings. On Windows, context_ is
+ // allocated with this call.
+ bool GetPrinterSettings(HANDLE printer,
+ const std::wstring& device_name);
+
+ // Parses the result of a PRINTDLGEX result.
+ Result ParseDialogResultEx(const PRINTDLGEX& dialog_options);
+ Result ParseDialogResult(const PRINTDLG& dialog_options);
// The selected printer context.
HDC context_;
+ // The dialog box for the time it is shown.
+ volatile HWND dialog_box_;
+
DISALLOW_COPY_AND_ASSIGN(PrintingContextWin);
};
void PepperPluginInstanceImpl::UpdateLayer(bool device_changed) {

View File

@ -1,5 +1,5 @@
diff --git content_browser_client.cc content_browser_client.cc
index d982b69..9272897 100644
index a72bc67..ff64d68 100644
--- content_browser_client.cc
+++ content_browser_client.cc
@@ -276,6 +276,10 @@ bool ContentBrowserClient::IsFastShutdownPossible() {
@ -14,18 +14,18 @@ index d982b69..9272897 100644
return base::FilePath();
}
diff --git content_browser_client.h content_browser_client.h
index f8253a6..d82c177 100644
index 455bff9..a8c80fc 100644
--- content_browser_client.h
+++ content_browser_client.h
@@ -25,6 +25,7 @@
#include "net/cookies/canonical_cookie.h"
@@ -27,6 +27,7 @@
#include "net/url_request/url_request_interceptor.h"
#include "net/url_request/url_request_job_factory.h"
#include "storage/browser/fileapi/file_system_context.h"
+#include "third_party/skia/include/core/SkColor.h"
#include "third_party/WebKit/public/platform/WebNotificationPermission.h"
#include "ui/base/window_open_disposition.h"
#include "webkit/browser/fileapi/file_system_context.h"
@@ -526,6 +527,9 @@ class CONTENT_EXPORT ContentBrowserClient {
@@ -527,6 +528,9 @@ class CONTENT_EXPORT ContentBrowserClient {
// Clears browser cookies.
virtual void ClearCookies(RenderViewHost* rvh) {}
@ -62,7 +62,7 @@ index 7afc338..c014439 100644
WebContents::CreateParams::~CreateParams() {
}
diff --git web_contents.h web_contents.h
index 80766dc..025c8c7 100644
index 4f0d625..01083ac 100644
--- web_contents.h
+++ web_contents.h
@@ -52,9 +52,11 @@ class PageState;
@ -76,8 +76,8 @@ index 80766dc..025c8c7 100644
+class WebContentsView;
struct CustomContextMenuContext;
struct DropData;
struct RendererPreferences;
@@ -117,6 +119,10 @@ class WebContents : public PageNavigator,
struct Manifest;
@@ -118,6 +120,10 @@ class WebContents : public PageNavigator,
// Used to specify the location context which display the new view should
// belong. This can be NULL if not needed.
gfx::NativeView context;
@ -89,7 +89,7 @@ index 80766dc..025c8c7 100644
// Creates a new WebContents.
diff --git web_contents_delegate.cc web_contents_delegate.cc
index 0028339..477040e 100644
index 72cabb4..32765ba 100644
--- web_contents_delegate.cc
+++ web_contents_delegate.cc
@@ -136,7 +136,9 @@ bool WebContentsDelegate::ShouldCreateWebContents(
@ -104,10 +104,10 @@ index 0028339..477040e 100644
}
diff --git web_contents_delegate.h web_contents_delegate.h
index b9aa02d..d840775 100644
index 457b3c0..734fc87 100644
--- web_contents_delegate.h
+++ web_contents_delegate.h
@@ -37,9 +37,11 @@ class DownloadItem;
@@ -36,9 +36,11 @@ class DownloadItem;
class JavaScriptDialogManager;
class PageState;
class RenderViewHost;
@ -119,7 +119,7 @@ index b9aa02d..d840775 100644
struct ColorSuggestion;
struct ContextMenuParams;
struct DropData;
@@ -312,7 +314,9 @@ class CONTENT_EXPORT WebContentsDelegate {
@@ -314,7 +316,9 @@ class CONTENT_EXPORT WebContentsDelegate {
const base::string16& frame_name,
const GURL& target_url,
const std::string& partition_id,

View File

@ -0,0 +1,15 @@
diff --git render_thread_impl.cc render_thread_impl.cc
index 3842bca..caaa3e3 100644
--- render_thread_impl.cc
+++ render_thread_impl.cc
@@ -834,9 +834,7 @@ void RenderThreadImpl::EnsureWebKitInitialized() {
webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl);
blink::initialize(webkit_platform_support_.get());
- main_thread_compositor_task_runner_ =
- make_scoped_refptr(new SchedulerProxyTaskRunner<
- &blink::WebSchedulerProxy::postCompositorTask>());
+ main_thread_compositor_task_runner_ = base::MessageLoopProxy::current();
v8::Isolate* isolate = blink::mainThreadIsolate();

View File

@ -1,8 +1,8 @@
diff --git core/frame/FrameView.cpp core/frame/FrameView.cpp
index 5d42bda..70e70a6 100644
index db086a2..3bcc736 100644
--- core/frame/FrameView.cpp
+++ core/frame/FrameView.cpp
@@ -126,8 +126,10 @@ FrameView::FrameView(LocalFrame* frame)
@@ -128,8 +128,10 @@ FrameView::FrameView(LocalFrame* frame)
if (!m_frame->isMainFrame())
return;
@ -14,10 +14,10 @@ index 5d42bda..70e70a6 100644
PassRefPtr<FrameView> FrameView::create(LocalFrame* frame)
diff --git platform/scroll/ScrollbarThemeMacCommon.mm platform/scroll/ScrollbarThemeMacCommon.mm
index 309e1e3..b40a19a 100644
index 90abb7c..6bb16c6 100644
--- platform/scroll/ScrollbarThemeMacCommon.mm
+++ platform/scroll/ScrollbarThemeMacCommon.mm
@@ -355,10 +355,14 @@ NSScrollerStyle ScrollbarThemeMacCommon::recommendedScrollerStyle()
@@ -354,10 +354,14 @@ NSScrollerStyle ScrollbarThemeMacCommon::recommendedScrollerStyle()
// static
bool ScrollbarThemeMacCommon::isOverlayAPIAvailable()
{

View File

@ -26,10 +26,10 @@ index f4c03da..bb253cf 100644
//
// You'd think we'd be able to just call window->GetBoundsInScreen(), but we
diff --git desktop_aura/desktop_window_tree_host_win.cc desktop_aura/desktop_window_tree_host_win.cc
index 877e8d1..d3a03c6 100644
index 84ff9e6..4464b8d 100644
--- desktop_aura/desktop_window_tree_host_win.cc
+++ desktop_aura/desktop_window_tree_host_win.cc
@@ -129,7 +129,9 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window,
@@ -131,7 +131,9 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window,
native_widget_delegate_);
HWND parent_hwnd = NULL;
@ -40,7 +40,7 @@ index 877e8d1..d3a03c6 100644
parent_hwnd = params.parent->GetHost()->GetAcceleratedWidget();
message_handler_->set_remove_standard_frame(params.remove_standard_frame);
@@ -769,6 +771,7 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
@@ -814,6 +816,7 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
// TODO(beng): inform the native_widget_delegate_.
@ -48,7 +48,7 @@ index 877e8d1..d3a03c6 100644
InputMethod* input_method = GetInputMethod();
if (input_method)
input_method->OnFocus();
@@ -776,6 +779,7 @@ void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
@@ -821,6 +824,7 @@ void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
void DesktopWindowTreeHostWin::HandleNativeBlur(HWND focused_window) {
// TODO(beng): inform the native_widget_delegate_.
@ -57,10 +57,10 @@ index 877e8d1..d3a03c6 100644
if (input_method)
input_method->OnBlur();
diff --git desktop_aura/desktop_window_tree_host_x11.cc desktop_aura/desktop_window_tree_host_x11.cc
index 03b2cfb..c15798a 100644
index 15c51a0..7d2503d 100644
--- desktop_aura/desktop_window_tree_host_x11.cc
+++ desktop_aura/desktop_window_tree_host_x11.cc
@@ -146,7 +146,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
@@ -147,7 +147,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
window_parent_(NULL),
window_shape_(NULL),
custom_window_shape_(false),
@ -70,7 +70,7 @@ index 03b2cfb..c15798a 100644
}
DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() {
@@ -349,7 +350,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
@@ -350,7 +351,8 @@ void DesktopWindowTreeHostX11::CloseNow() {
// Actually free our native resources.
if (ui::PlatformEventSource::GetInstance())
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
@ -80,7 +80,7 @@ index 03b2cfb..c15798a 100644
xwindow_ = None;
desktop_native_widget_aura_->OnHostClosed();
@@ -446,6 +448,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement(
@@ -444,6 +446,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement(
}
gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const {
@ -89,7 +89,7 @@ index 03b2cfb..c15798a 100644
return bounds_;
}
@@ -458,6 +462,8 @@ gfx::Rect DesktopWindowTreeHostX11::GetClientAreaBoundsInScreen() const {
@@ -456,6 +460,8 @@ gfx::Rect DesktopWindowTreeHostX11::GetClientAreaBoundsInScreen() const {
// Attempts to calculate the rect by asking the NonClientFrameView what it
// thought its GetBoundsForClientView() were broke combobox drop down
// placement.
@ -98,7 +98,7 @@ index 03b2cfb..c15798a 100644
return bounds_;
}
@@ -924,6 +930,8 @@ void DesktopWindowTreeHostX11::SetBounds(const gfx::Rect& requested_bounds) {
@@ -929,6 +935,8 @@ void DesktopWindowTreeHostX11::SetBounds(const gfx::Rect& requested_bounds) {
}
gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const {
@ -107,7 +107,7 @@ index 03b2cfb..c15798a 100644
return bounds_.origin();
}
@@ -1072,10 +1080,14 @@ void DesktopWindowTreeHostX11::InitX11Window(
@@ -1081,10 +1089,14 @@ void DesktopWindowTreeHostX11::InitX11Window(
}
}
@ -123,7 +123,7 @@ index 03b2cfb..c15798a 100644
bounds_.x(), bounds_.y(),
bounds_.width(), bounds_.height(),
0, // border width
@@ -1678,6 +1690,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
@@ -1702,6 +1714,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
}
break;
}
@ -135,7 +135,7 @@ index 03b2cfb..c15798a 100644
if (xev->xfocus.mode != NotifyGrab) {
ReleaseCapture();
diff --git desktop_aura/desktop_window_tree_host_x11.h desktop_aura/desktop_window_tree_host_x11.h
index 1c08221..f0ae19f 100644
index 12bd9a1..8191a25 100644
--- desktop_aura/desktop_window_tree_host_x11.h
+++ desktop_aura/desktop_window_tree_host_x11.h
@@ -85,6 +85,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
@ -157,7 +157,7 @@ index 1c08221..f0ae19f 100644
// Whenever the bounds are set, we keep the previous set of bounds around so
// we can have a better chance of getting the real |restored_bounds_|. Window
// managers tend to send a Configure message with the maximized bounds, and
@@ -336,6 +341,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
@@ -339,6 +344,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
base::CancelableCallback<void()> delayed_resize_task_;
@ -168,7 +168,7 @@ index 1c08221..f0ae19f 100644
};
diff --git widget.cc widget.cc
index d4b16bb..5af6aa1 100644
index 8a9fa71..1e7536e 100644
--- widget.cc
+++ widget.cc
@@ -116,6 +116,7 @@ Widget::InitParams::InitParams()
@ -211,7 +211,7 @@ index d4b16bb..5af6aa1 100644
// This must come after SetContentsView() or it might not be able to find
// the correct NativeTheme (on Linux). See http://crbug.com/384492
diff --git widget.h widget.h
index fad5506..7828ced 100644
index 96ab8b2..1cbd5d8 100644
--- widget.h
+++ widget.h
@@ -225,6 +225,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,

View File

@ -1,5 +1,5 @@
diff --git ThemeMac.mm ThemeMac.mm
index 8da614b..14c865d 100644
index a405ba5..e20144d 100644
--- ThemeMac.mm
+++ ThemeMac.mm
@@ -490,7 +490,7 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext*

View File

@ -1,21 +1,21 @@
diff --git Source/web/ChromeClientImpl.cpp Source/web/ChromeClientImpl.cpp
index 3a2b428..961197c 100644
index ee5bdbe..919addf 100644
--- Source/web/ChromeClientImpl.cpp
+++ Source/web/ChromeClientImpl.cpp
@@ -709,7 +709,7 @@ bool ChromeClientImpl::hasOpenedPopup() const
@@ -728,7 +728,7 @@ bool ChromeClientImpl::hasOpenedPopup() const
PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(LocalFrame& frame, PopupMenuClient* client) const
PassRefPtrWillBeRawPtr<PopupMenu> ChromeClientImpl::createPopupMenu(LocalFrame& frame, PopupMenuClient* client) const
{
- if (WebViewImpl::useExternalPopupMenus())
+ if (m_webView->useExternalPopupMenus())
return adoptRef(new ExternalPopupMenu(frame, client, *m_webView));
return adoptRefWillBeNoop(new ExternalPopupMenu(frame, client, *m_webView));
return adoptRef(new PopupMenuChromium(frame, client));
return adoptRefWillBeNoop(new PopupMenuChromium(frame, client));
diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp
index a953461..2376cfb 100644
index 82d447b..971e3aa 100644
--- Source/web/WebViewImpl.cpp
+++ Source/web/WebViewImpl.cpp
@@ -378,6 +378,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
@@ -388,6 +388,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_fakePageScaleAnimationPageScaleFactor(0)
, m_fakePageScaleAnimationUseAnchor(false)
, m_contextMenuAllowed(false)
@ -23,7 +23,7 @@ index a953461..2376cfb 100644
, m_doingDragAndDrop(false)
, m_ignoreInputEvents(false)
, m_compositorDeviceScaleFactorOverride(0)
@@ -3790,9 +3791,14 @@ void WebViewImpl::deviceOrPageScaleFactorChanged()
@@ -3893,9 +3894,14 @@ void WebViewImpl::deviceOrPageScaleFactorChanged()
m_page->inspectorController().deviceOrPageScaleFactorChanged();
}
@ -40,10 +40,10 @@ index a953461..2376cfb 100644
void WebViewImpl::startDragging(LocalFrame* frame,
diff --git Source/web/WebViewImpl.h Source/web/WebViewImpl.h
index 0db68d6..1aa5c26 100644
index 988352c..81102f1 100644
--- Source/web/WebViewImpl.h
+++ Source/web/WebViewImpl.h
@@ -358,7 +358,8 @@ public:
@@ -368,7 +368,8 @@ public:
// Returns true if popup menus should be rendered by the browser, false if
// they should be rendered by WebKit (which is the default).
@ -53,7 +53,7 @@ index 0db68d6..1aa5c26 100644
bool contextMenuAllowed() const
{
@@ -637,6 +638,8 @@ private:
@@ -654,6 +655,8 @@ private:
bool m_contextMenuAllowed;
@ -63,10 +63,10 @@ index 0db68d6..1aa5c26 100644
bool m_ignoreInputEvents;
diff --git public/web/WebView.h public/web/WebView.h
index 40ff9b3..82c77fe 100644
index db4c090..89ae86d 100644
--- public/web/WebView.h
+++ public/web/WebView.h
@@ -409,6 +409,7 @@ public:
@@ -412,6 +412,7 @@ public:
// Sets whether select popup menus should be rendered by the browser.
BLINK_EXPORT static void setUseExternalPopupMenus(bool);

View File

@ -914,7 +914,7 @@ bool VerifySingleBrowserFrame(CefRefPtr<CefBrowser> browser,
bool frame_should_exist,
const std::string& expected_url) {
V_DECLARE();
V_EXPECT_TRUE(frame);
V_EXPECT_TRUE(frame.get());
V_EXPECT_TRUE(frame->IsValid());
if (frame_should_exist) {
V_EXPECT_TRUE(frame->GetIdentifier() >= 0);
@ -924,7 +924,7 @@ bool VerifySingleBrowserFrame(CefRefPtr<CefBrowser> browser,
V_EXPECT_TRUE(frame->IsValid());
V_EXPECT_TRUE(frame->IsMain());
V_EXPECT_TRUE(frame->IsFocused());
V_EXPECT_FALSE(frame->GetParent());
V_EXPECT_FALSE(frame->GetParent().get());
V_EXPECT_TRUE(frame->GetName().empty());
V_EXPECT_TRUE(browser->GetIdentifier() ==
frame->GetBrowser()->GetIdentifier());
@ -941,10 +941,10 @@ bool VerifySingleBrowserFrames(CefRefPtr<CefBrowser> browser,
bool frame_should_exist,
const std::string& expected_url) {
V_DECLARE();
V_EXPECT_TRUE(browser);
V_EXPECT_TRUE(browser.get());
// |frame| may be NULL for callbacks that don't specify one.
if (frame) {
if (frame.get()) {
V_EXPECT_TRUE(VerifySingleBrowserFrame(browser, frame,
frame_should_exist, expected_url));
}
@ -1781,11 +1781,11 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
// Find frames by name.
frame0 = browser->GetFrame(kFrame0Name);
V_EXPECT_TRUE(frame0);
V_EXPECT_TRUE(frame0.get());
frame1 = browser->GetFrame(kFrame1Name);
V_EXPECT_TRUE(frame1);
V_EXPECT_TRUE(frame1.get());
frame2 = browser->GetFrame(kFrame2Name);
V_EXPECT_TRUE(frame2);
V_EXPECT_TRUE(frame2.get());
// Verify that the name matches.
V_EXPECT_TRUE(frame0->GetName().ToString() == kFrame0Name);
@ -1819,11 +1819,11 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
// Find frames by id.
frame0b = browser->GetFrame(frame0->GetIdentifier());
V_EXPECT_TRUE(frame0b);
V_EXPECT_TRUE(frame0b.get());
frame1b = browser->GetFrame(frame1->GetIdentifier());
V_EXPECT_TRUE(frame1b);
V_EXPECT_TRUE(frame1b.get());
frame2b = browser->GetFrame(frame2->GetIdentifier());
V_EXPECT_TRUE(frame2b);
V_EXPECT_TRUE(frame2b.get());
// Verify that the id matches.
V_EXPECT_TRUE(frame0b->GetIdentifier() == frame0id);
@ -1849,7 +1849,7 @@ bool VerifyBrowserIframe(CefRefPtr<CefBrowser> browser,
V_EXPECT_TRUE(idents[2] == frame2->GetIdentifier());
// Verify parent hierarchy.
V_EXPECT_TRUE(frame0->GetParent() == NULL);
V_EXPECT_FALSE(frame0->GetParent().get());
V_EXPECT_TRUE(frame1->GetParent()->GetIdentifier() == frame0id);
V_EXPECT_TRUE(frame2->GetParent()->GetIdentifier() == frame1id);

View File

@ -218,7 +218,7 @@ class MRTestHandler : public TestHandler {
}
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE {
if (!message_router_) {
if (!message_router_.get()) {
// Create the browser-side router for query handling.
CefMessageRouterConfig config;
SetRouterConfig(config);
@ -263,7 +263,7 @@ class MRTestHandler : public TestHandler {
const int64 frame_id = CefInt64Set(args->GetInt(0), args->GetInt(1));
CefRefPtr<CefFrame> frame = browser->GetFrame(frame_id);
EXPECT_TRUE(frame);
EXPECT_TRUE(frame.get());
OnNotify(browser, frame, args->GetString(2));
return true;
@ -1312,7 +1312,7 @@ class MultiQueryManager : public CefMessageRouterBrowserSide::Handler {
// Verify a successful/expected result.
EXPECT_TRUE(WillCancel(query.type)) << i;
EXPECT_TRUE(query.callback) << i;
EXPECT_TRUE(query.callback.get()) << i;
// Release the callback.
query.callback = NULL;
@ -1374,7 +1374,7 @@ class MultiQueryManager : public CefMessageRouterBrowserSide::Handler {
else
EXPECT_FALSE(query.got_error);
EXPECT_FALSE(query.callback) << i;
EXPECT_FALSE(query.callback.get()) << i;
}
}
@ -2101,7 +2101,7 @@ class MultiQueryMultiHandlerTestHandler :
EXPECT_TRUE(manager_.HasAutoQueries());
CefMessageRouterBrowserSide* router = GetRouter();
CefRefPtr<CefMessageRouterBrowserSide> router = GetRouter();
// Remove one handler to cancel a query.

View File

@ -77,7 +77,7 @@ const CefRect kExpectedRectLI[] = {
const CefRect kEditBoxRect(412, 245, 60, 22);
const CefRect kNavigateButtonRect(360, 271, 140, 22);
const CefRect kSelectRect(467, 22, 75, 20);
const CefRect kExpandedSelectRect(465, 42, 82, 302);
const CefRect kExpandedSelectRect(465, 42, 81, 302);
const CefRect kDropDivRect(8, 332, 52, 52);
const CefRect kDragDivRect(71, 342, 30, 30);
const int kDefaultVerticalScrollbarWidth = 17;

View File

@ -15,6 +15,9 @@
#include "tests/unittests/test_handler.h"
#include "tests/unittests/test_util.h"
// Comment out this define to disable the unit test timeout.
#define TIMEOUT_ENABLED 1
// Verify Set/Get methods for CefRequest, CefPostData and CefPostDataElement.
TEST(RequestTest, SetGet) {
// CefRequest CreateRequest
@ -231,7 +234,9 @@ static struct TypeExpected {
{"script.js", true, false, TT_LINK, RT_SCRIPT, 1},
// Image load.
{"image.png", true, false, TT_LINK, RT_IMAGE, 1},
// TODO(cef): Should be RT_IMAGE, see http://crbug.com/415253#c23 for the
// regression source.
{"image.png", true, false, TT_LINK, RT_PREFETCH, 1},
// Font load.
{"font.ttf", true, false, TT_LINK, RT_FONT_RESOURCE, 1},
@ -434,9 +439,11 @@ class TypeTestHandler : public TestHandler {
CreateBrowser(std::string(kTypeTestOrigin) + "main.html");
#if defined(TIMEOUT_ENABLED)
// Time out the test after a reasonable period of time.
CefPostDelayedTask(TID_UI, base::Bind(&TypeTestHandler::DestroyTest, this),
2000);
#endif
}
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,

View File

@ -62,7 +62,7 @@ RoutingTestHandler::RoutingTestHandler() {
}
void RoutingTestHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
if (!message_router_) {
if (!message_router_.get()) {
// Create the browser-side router for query handling.
CefMessageRouterConfig config;
SetRouterConfig(config);

View File

@ -195,7 +195,7 @@ class ClientSchemeHandler : public CefResourceHandler {
if (test_results_->delay > 0) {
// Continue after the delay.
CefPostDelayedTask(TID_IO,
base::Bind(&CefCallback::Continue, callback),
base::Bind(&CefCallback::Continue, callback.get()),
test_results_->delay);
} else {
// Continue immediately.

View File

@ -439,7 +439,7 @@ class RequestClient : public CefURLRequestClient {
status_ = request->GetRequestStatus();
error_code_ = request->GetRequestError();
response_ = request->GetResponse();
EXPECT_TRUE(response_);
EXPECT_TRUE(response_.get());
EXPECT_TRUE(response_->IsReadOnly());
delegate_->OnRequestComplete(this);
@ -456,7 +456,7 @@ class RequestClient : public CefURLRequestClient {
uint64 current,
uint64 total) OVERRIDE {
response_ = request->GetResponse();
EXPECT_TRUE(response_);
EXPECT_TRUE(response_.get());
EXPECT_TRUE(response_->IsReadOnly());
download_progress_ct_++;
download_total_ = total;
@ -466,7 +466,7 @@ class RequestClient : public CefURLRequestClient {
const void* data,
size_t data_length) OVERRIDE {
response_ = request->GetResponse();
EXPECT_TRUE(response_);
EXPECT_TRUE(response_.get());
EXPECT_TRUE(response_->IsReadOnly());
download_data_ct_++;
download_data_ += std::string(static_cast<const char*>(data), data_length);
@ -763,7 +763,7 @@ class RequestTestRunner {
};
CefRefPtr<CefRequest> request;
if (settings_.redirect_request)
if (settings_.redirect_request.get())
request = settings_.redirect_request;
else
request = settings_.request;