Update to Chromium revision 167921.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@909 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-11-16 18:28:07 +00:00
parent f9b937e42e
commit 8a504d3d25
19 changed files with 101 additions and 335 deletions

View File

@ -17,5 +17,5 @@
{
'chromium_url': 'http://src.chromium.org/svn/trunk/src',
'chromium_revision': '165669',
'chromium_revision': '167921',
}

View File

@ -212,10 +212,10 @@ void BrowserDragDelegate::PrepareDragForDownload(
// Provide the data as file (CF_HDROP). A temporary download file with the
// Zone.Identifier ADS (Alternate Data Stream) attached will be created.
linked_ptr<net::FileStream> empty_file_stream;
scoped_ptr<net::FileStream> empty_file_stream;
scoped_refptr<DragDownloadFile> download_file =
new DragDownloadFile(generated_file_name,
empty_file_stream,
empty_file_stream.Pass(),
download_url,
page_url,
page_encoding,

View File

@ -34,6 +34,7 @@
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/proxy/proxy_resolver.h"
#include "net/proxy/proxy_service.h"
#include "net/url_request/http_user_agent_settings.h"
#include "net/url_request/url_request_job_factory_impl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h"
@ -127,6 +128,27 @@ net::ProxyConfigService* CreateProxyConfigService() {
#endif
}
class CefHttpUserAgentSettings : public net::HttpUserAgentSettings {
public:
CefHttpUserAgentSettings() {}
virtual ~CefHttpUserAgentSettings() {}
// hard-code A-L and A-C for test shells
virtual std::string GetAcceptLanguage() const OVERRIDE {
return "en-us,en";
}
virtual std::string GetAcceptCharset() const OVERRIDE {
return "iso-8859-1,*,utf-8";
}
virtual std::string GetUserAgent(const GURL& url) const OVERRIDE {
return webkit_glue::GetUserAgent(url);
}
private:
DISALLOW_COPY_AND_ASSIGN(CefHttpUserAgentSettings);
};
} // namespace
@ -153,9 +175,7 @@ void BrowserRequestContext::Init(
new net::DefaultServerBoundCertStore(NULL),
base::WorkerPool::GetTaskRunner(true)));
// hard-code A-L and A-C for test shells
set_accept_language("en-us,en");
set_accept_charset("iso-8859-1,*,utf-8");
storage_.set_http_user_agent_settings(new CefHttpUserAgentSettings);
CefRefPtr<CefApp> app = _Context->application();
if (app.get()) {
@ -309,8 +329,3 @@ void BrowserRequestContext::SetCookieStoragePath(const FilePath& path) {
new net::CookieMonster(persistent_store.get(), NULL));
cookie_store_path_ = new_path;
}
const std::string& BrowserRequestContext::GetUserAgent(
const GURL& url) const {
return webkit_glue::GetUserAgent(url);
}

View File

@ -34,8 +34,6 @@ class BrowserRequestContext : public net::URLRequestContext {
net::HttpCache::Mode cache_mode,
bool no_proxy);
virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE;
// Set the path used for cookie storage. If |path| is empty memory only
// storage will be used. If the old cookie data is being stored on disk it
// will be flushed and closed.

View File

@ -33,12 +33,7 @@ BrowserRequestContextProxy::BrowserRequestContextProxy(
set_network_delegate(context->network_delegate());
set_http_server_properties(context->http_server_properties());
set_transport_security_state(context->transport_security_state());
set_accept_charset(context->accept_charset());
set_accept_language(context->accept_language());
set_http_user_agent_settings(const_cast<net::HttpUserAgentSettings*>(
context->http_user_agent_settings()));
set_job_factory(context->job_factory());
}
const std::string&
BrowserRequestContextProxy::GetUserAgent(const GURL& url) const {
return context_->GetUserAgent(url);
}

View File

@ -20,8 +20,6 @@ class BrowserRequestContextProxy : public net::URLRequestContext {
BrowserRequestContextProxy(BrowserRequestContext* context,
CefBrowserImpl* browser);
virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE;
private:
BrowserRequestContext* context_;
CefRefPtr<CefBrowserImpl> browser_;

View File

@ -201,7 +201,6 @@ class RequestProxy : public net::URLRequest::Delegate,
// Takes ownership of the params.
explicit RequestProxy(CefRefPtr<CefBrowserImpl> browser)
: download_to_file_(false),
file_stream_(NULL),
buf_(new net::IOBuffer(kDataSize)),
browser_(browser),
owner_loop_(NULL),
@ -611,7 +610,8 @@ class RequestProxy : public net::URLRequest::Delegate,
downloaded_file_ = ShareableFileReference::GetOrCreate(
path, ShareableFileReference::DELETE_ON_FINAL_RELEASE,
base::MessageLoopProxy::current());
file_stream_.OpenSync(
file_stream_.reset(new net::FileStream(NULL));
file_stream_->OpenSync(
path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE);
}
}
@ -747,7 +747,7 @@ class RequestProxy : public net::URLRequest::Delegate,
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
if (download_to_file_) {
file_stream_.WriteSync(buf_->data(), bytes_read);
file_stream_->WriteSync(buf_->data(), bytes_read);
owner_loop_->PostTask(FROM_HERE, base::Bind(
&RequestProxy::NotifyDownloadedData, this, bytes_read));
return;
@ -763,7 +763,7 @@ class RequestProxy : public net::URLRequest::Delegate,
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
if (download_to_file_)
file_stream_.CloseSync();
file_stream_.reset();
owner_loop_->PostTask(FROM_HERE, base::Bind(
&RequestProxy::NotifyCompletedRequest, this, error_code, security_info,
@ -926,7 +926,7 @@ class RequestProxy : public net::URLRequest::Delegate,
// Support for request.download_to_file behavior.
bool download_to_file_;
net::FileStream file_stream_;
scoped_ptr<net::FileStream> file_stream_;
scoped_refptr<ShareableFileReference> downloaded_file_;
// Size of our async IO data buffers. Limited by the sanity check in
@ -1006,7 +1006,7 @@ class SyncRequestProxy : public RequestProxy {
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
if (download_to_file_)
file_stream_.WriteSync(buf_->data(), bytes_read);
file_stream_->WriteSync(buf_->data(), bytes_read);
else
result_->data.append(buf_->data(), bytes_read);
AsyncReadData(); // read more (may recurse)
@ -1018,7 +1018,7 @@ class SyncRequestProxy : public RequestProxy {
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
if (download_to_file_)
file_stream_.CloseSync();
file_stream_.reset();
result_->error_code = error_code;
event_.Signal();

View File

@ -143,13 +143,17 @@ void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web) {
web.experimental_webgl_enabled = !cef.webgl_disabled;
web.show_composited_layer_borders = false;
web.accelerated_compositing_enabled = cef.accelerated_compositing_enabled;
web.accelerated_layers_enabled = !cef.accelerated_layers_disabled;
web.accelerated_animation_enabled = !cef.accelerated_layers_disabled;
web.accelerated_video_enabled = !cef.accelerated_video_disabled;
web.accelerated_compositing_for_3d_transforms_enabled =
!cef.accelerated_layers_disabled;
web.accelerated_compositing_for_animation_enabled =
!cef.accelerated_layers_disabled;
web.accelerated_compositing_for_video_enabled =
!cef.accelerated_video_disabled;
web.accelerated_2d_canvas_enabled = !cef.accelerated_2d_canvas_disabled;
web.accelerated_painting_enabled = !cef.accelerated_painting_disabled;
web.accelerated_filters_enabled = !cef.accelerated_filters_disabled;
web.accelerated_plugins_enabled = !cef.accelerated_plugins_disabled;
web.accelerated_compositing_for_plugins_enabled =
!cef.accelerated_plugins_disabled;
web.memory_info_enabled = false;
web.fullscreen_enabled = cef.fullscreen_enabled;
}

View File

@ -28,15 +28,6 @@ struct WebPluginInfo;
namespace webkit_glue {
#if defined(OS_WIN)
// Capture a bitmap of the web view.
void CaptureWebViewBitmap(HWND mainWnd, WebKit::WebView* webview,
HBITMAP& bitmap, SIZE& size);
// Save a bitmap image to file, providing optional alternative data in |lpBits|
BOOL SaveBitmapToFile(HBITMAP hBmp, HDC hDC, LPCTSTR file, LPBYTE lpBits);
#endif
// Text encoding objects must be initialized on the main thread.
void InitializeTextEncoding();

View File

@ -4,255 +4,12 @@
// found in the LICENSE file.
#include "libcef/browser_webkit_glue.h"
#include <atlcore.h>
#include <atlbase.h>
#include <commdlg.h>
#include "third_party/WebKit/Source/WebCore/config.h"
MSVC_PUSH_WARNING_LEVEL(0);
#include "PlatformContextSkia.h" // NOLINT(build/include)
MSVC_POP_WARNING();
#undef LOG
#include "base/logging.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/gfx/gdi_util.h"
#include "webkit/glue/webkit_glue.h"
using WebKit::WebRect;
using WebKit::WebSize;
using WebKit::WebView;
namespace webkit_glue {
bool EnsureFontLoaded(HFONT font) {
return true;
}
void CaptureWebViewBitmap(HWND mainWnd, WebView* webview, HBITMAP& bitmap,
SIZE& size) {
WebKit::WebSize webSize = webview->size();
size.cx = webSize.width;
size.cy = webSize.height;
skia::PlatformCanvas canvas(size.cx, size.cy, true);
canvas.drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode);
WebCore::PlatformContextSkia context(&canvas);
WebKit::WebRect rect(0, 0, size.cx, size.cy);
webview->layout();
webview->paint(&canvas, rect);
HDC hRefDC = GetDC(mainWnd);
HDC hDC = CreateCompatibleDC(hRefDC);
bitmap = CreateCompatibleBitmap(hRefDC, size.cx, size.cy);
DCHECK(bitmap != NULL);
HBITMAP hOldBmp = (HBITMAP)SelectObject(hDC, bitmap);
// Create a BMP v4 header that we can serialize.
BITMAPV4HEADER bitmap_header;
gfx::CreateBitmapV4Header(size.cx, size.cy, &bitmap_header);
const SkBitmap& src_bmp = canvas.getDevice()->accessBitmap(true);
SkAutoLockPixels src_lock(src_bmp);
int retval = StretchDIBits(hDC,
0,
0,
size.cx, size.cy,
0, 0,
size.cx, size.cy,
src_bmp.getPixels(),
reinterpret_cast<BITMAPINFO*>(&bitmap_header),
DIB_RGB_COLORS,
SRCCOPY);
DCHECK(retval != GDI_ERROR);
SelectObject(hDC, hOldBmp);
DeleteDC(hDC);
ReleaseDC(mainWnd, hRefDC);
}
static PBITMAPINFO BmpCreateInfo(HBITMAP hBmp) {
BITMAP bmp;
PBITMAPINFO pbmi;
WORD cClrBits;
// Retrieve the bitmap color format, width, and height.
if (!GetObject(hBmp, sizeof(BITMAP), (LPSTR)&bmp)) {
NOTREACHED();
return NULL;
}
// Convert the color format to a count of bits.
cClrBits = (WORD)(bmp.bmPlanes * bmp.bmBitsPixel);
if (cClrBits == 1)
cClrBits = 1;
else if (cClrBits <= 4)
cClrBits = 4;
else if (cClrBits <= 8)
cClrBits = 8;
else if (cClrBits <= 16)
cClrBits = 16;
else if (cClrBits <= 24)
cClrBits = 24;
else
cClrBits = 32;
// Allocate memory for the BITMAPINFO structure. (This structure
// contains a BITMAPINFOHEADER structure and an array of RGBQUAD
// data structures.)
if (cClrBits != 24) {
pbmi = (PBITMAPINFO) LocalAlloc(LPTR,
sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * (1<< cClrBits));
} else { // There is no RGBQUAD array for the 24-bit-per-pixel format.
pbmi = (PBITMAPINFO) LocalAlloc(LPTR, sizeof(BITMAPINFOHEADER));
}
// Initialize the fields in the BITMAPINFO structure.
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pbmi->bmiHeader.biWidth = bmp.bmWidth;
pbmi->bmiHeader.biHeight = bmp.bmHeight;
pbmi->bmiHeader.biPlanes = bmp.bmPlanes;
pbmi->bmiHeader.biBitCount = bmp.bmBitsPixel;
if (cClrBits < 24) {
pbmi->bmiHeader.biClrUsed = (1<<cClrBits);
}
// If the bitmap is not compressed, set the BI_RGB flag.
pbmi->bmiHeader.biCompression = BI_RGB;
// Compute the number of bytes in the array of color
// indices and store the result in biSizeImage.
// For Windows NT, the width must be DWORD aligned unless
// the bitmap is RLE compressed. This example shows this.
// For Windows 95/98/Me, the width must be WORD aligned unless the
// bitmap is RLE compressed.
pbmi->bmiHeader.biSizeImage =
((pbmi->bmiHeader.biWidth * cClrBits +31) & ~31) /8
* pbmi->bmiHeader.biHeight;
// Set biClrImportant to 0, indicating that all of the
// device colors are important.
pbmi->bmiHeader.biClrImportant = 0;
return pbmi;
}
static BOOL BmpSaveFile(LPCTSTR pszFile, PBITMAPINFO pbi, HBITMAP hBMP,
HDC hDC, LPBYTE lpBits = NULL) {
HANDLE hf = INVALID_HANDLE_VALUE; // file handle
BITMAPFILEHEADER hdr; // bitmap file-header
PBITMAPINFOHEADER pbih; // bitmap info-header
DWORD dwTotal; // total count of bytes
DWORD cb; // incremental count of bytes
BYTE* hp; // byte pointer
DWORD dwTmp;
BOOL ret = FALSE;
BOOL bitsAlloc = FALSE;
pbih = (PBITMAPINFOHEADER) pbi;
if (!lpBits) {
// The bits have not been provided, so retrieve from the bitmap file
lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbih->biSizeImage);
if (!lpBits) {
// Memory could not be allocated
NOTREACHED();
return FALSE;
}
bitsAlloc = TRUE;
// Retrieve the color table (RGBQUAD array) and the bits
// (array of palette indices) from the DIB.
if (!GetDIBits(hDC, hBMP, 0, (WORD) pbih->biHeight, lpBits, pbi,
DIB_RGB_COLORS)) {
NOTREACHED();
goto end;
}
}
// Create the bitmap file.
hf = CreateFile(pszFile,
GENERIC_READ | GENERIC_WRITE,
(DWORD) 0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL);
if (hf == INVALID_HANDLE_VALUE) {
// Could not create the bitmap file
NOTREACHED();
goto end;
}
hdr.bfType = 0x4d42; // 0x42 = "B", 0x4d = "M"
// Compute the size of the entire file.
hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) +
pbih->biSize + pbih->biClrUsed
* sizeof(RGBQUAD) + pbih->biSizeImage);
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
// Compute the offset to the array of color indices.
hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) +
pbih->biSize + pbih->biClrUsed * sizeof(RGBQUAD);
// Copy the BITMAPFILEHEADER into the bitmap file.
if (!WriteFile(hf, (LPVOID) &hdr, sizeof(BITMAPFILEHEADER),
(LPDWORD) &dwTmp, NULL)) {
// Could not write bitmap file header to file
NOTREACHED();
goto end;
}
// Copy the BITMAPINFOHEADER and RGBQUAD array into the file.
if (!WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER)
+ pbih->biClrUsed * sizeof(RGBQUAD),
(LPDWORD) &dwTmp, NULL)) {
// Could not write bitmap info header to file
NOTREACHED();
goto end;
}
// Copy the array of color indices into the .BMP file.
dwTotal = cb = pbih->biSizeImage;
hp = lpBits;
if (!WriteFile(hf, (LPSTR) hp, (DWORD) cb, (LPDWORD) &dwTmp, NULL)) {
// Could not write bitmap data to file
NOTREACHED();
goto end;
}
ret = TRUE;
end: // NOLINT(whitespace/labels)
// Close the bitmap file.
if (hf != INVALID_HANDLE_VALUE) {
CloseHandle(hf);
if (!ret)
DeleteFile(pszFile);
}
if (bitsAlloc) {
// Free memory.
GlobalFree((HGLOBAL)lpBits);
}
return ret;
}
BOOL SaveBitmapToFile(HBITMAP hBmp, HDC hDC, LPCTSTR file, LPBYTE lpBits) {
PBITMAPINFO pbmi = BmpCreateInfo(hBmp);
BOOL ret = FALSE;
if (pbmi) {
ret = BmpSaveFile(file, pbmi, hBmp, hDC, lpBits);
LocalFree(pbmi);
}
return ret;
}
} // namespace webkit_glue

View File

@ -14,12 +14,12 @@
DragDownloadFile::DragDownloadFile(
const FilePath& file_name_or_path,
linked_ptr<net::FileStream> file_stream,
scoped_ptr<net::FileStream> file_stream,
const GURL& url,
const GURL& referrer,
const std::string& referrer_encoding,
BrowserWebViewDelegate* view)
: file_stream_(file_stream),
: file_stream_(file_stream.Pass()),
url_(url),
referrer_(referrer),
referrer_encoding_(referrer_encoding),

View File

@ -10,7 +10,7 @@
#include <string>
#include "base/file_path.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/run_loop.h"
#include "googleurl/src/gurl.h"
@ -34,7 +34,7 @@ class DragDownloadFile : public ui::DownloadFileProvider {
// The file path and file stream should be provided as the first two
// parameters.
DragDownloadFile(const FilePath& file_name_or_path,
linked_ptr<net::FileStream> file_stream,
scoped_ptr<net::FileStream> file_stream,
const GURL& url,
const GURL& referrer,
const std::string& referrer_encoding,
@ -66,7 +66,7 @@ class DragDownloadFile : public ui::DownloadFileProvider {
// Accessed on UI thread (MacOSX).
FilePath file_path_;
FilePath file_name_;
linked_ptr<net::FileStream> file_stream_;
scoped_ptr<net::FileStream> file_stream_;
GURL url_;
GURL referrer_;
std::string referrer_encoding_;

View File

@ -296,11 +296,11 @@ void CefPostDataImpl::Set(const net::UploadData& data) {
CefRefPtr<CefPostDataElement> postelem;
const std::vector<net::UploadElement>* elements = data.elements();
std::vector<net::UploadElement>::const_iterator it = elements->begin();
for (; it != elements->end(); ++it) {
const ScopedVector<net::UploadElement>& elements = data.elements();
ScopedVector<net::UploadElement>::const_iterator it = elements.begin();
for (; it != elements.end(); ++it) {
postelem = CefPostDataElement::CreatePostDataElement();
static_cast<CefPostDataElementImpl*>(postelem.get())->Set(*it);
static_cast<CefPostDataElementImpl*>(postelem.get())->Set(**it);
AddElement(postelem);
}
}
@ -308,14 +308,14 @@ void CefPostDataImpl::Set(const net::UploadData& data) {
void CefPostDataImpl::Get(net::UploadData& data) {
AutoLock lock_scope(this);
net::UploadElement element;
std::vector<net::UploadElement> data_elements;
ScopedVector<net::UploadElement> data_elements;
ElementVector::iterator it = elements_.begin();
for (; it != elements_.end(); ++it) {
static_cast<CefPostDataElementImpl*>(it->get())->Get(element);
net::UploadElement* element = new net::UploadElement();
static_cast<CefPostDataElementImpl*>(it->get())->Get(*element);
data_elements.push_back(element);
}
data.SetElements(data_elements);
data.swap_elements(&data_elements);
}
void CefPostDataImpl::Set(const WebKit::WebHTTPBody& data) {

View File

@ -28,6 +28,7 @@
#include "net/base/upload_data.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
#include "net/url_request/http_user_agent_settings.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_about_job.h"
#include "net/url_request/url_request_data_job.h"
@ -104,6 +105,21 @@ std::string ToLower(const std::string& str) {
return str;
}
bool SetHeaderIfMissing(CefRequest::HeaderMap& headerMap,
const std::string& name,
const std::string& value) {
if (value.empty())
return false;
CefRequest::HeaderMap::const_iterator it = headerMap.find(name);
if (it == headerMap.end()) {
headerMap.insert(std::make_pair(name, value));
return true;
}
return false;
}
// net::URLRequestJob implementation.
class CefUrlRequestJob : public net::URLRequestJob {
@ -132,37 +148,30 @@ class CefUrlRequestJob : public net::URLRequestJob {
// Add default headers if not already specified.
const net::URLRequestContext* context = request_->context();
if (context) {
CefRequest::HeaderMap::const_iterator it;
CefRequest::HeaderMap headerMap;
cef_request_->GetHeaderMap(headerMap);
bool changed = false;
if (!context->accept_language().empty()) {
it = headerMap.find(net::HttpRequestHeaders::kAcceptLanguage);
if (it == headerMap.end()) {
headerMap.insert(
std::make_pair(net::HttpRequestHeaders::kAcceptLanguage,
context->accept_language()));
const net::HttpUserAgentSettings* ua_settings =
context->http_user_agent_settings();
if (ua_settings) {
if (SetHeaderIfMissing(headerMap,
net::HttpRequestHeaders::kAcceptLanguage,
ua_settings->GetAcceptLanguage())) {
changed = true;
}
changed = true;
}
if (!context->accept_charset().empty()) {
it = headerMap.find(net::HttpRequestHeaders::kAcceptCharset);
if (it == headerMap.end()) {
headerMap.insert(
std::make_pair(net::HttpRequestHeaders::kAcceptCharset,
context->accept_charset()));
if (SetHeaderIfMissing(headerMap,
net::HttpRequestHeaders::kAcceptCharset,
ua_settings->GetAcceptCharset())) {
changed = true;
}
changed = true;
}
it = headerMap.find(net::HttpRequestHeaders::kUserAgent);
if (it == headerMap.end()) {
headerMap.insert(
std::make_pair(net::HttpRequestHeaders::kUserAgent,
context->GetUserAgent(request_->url())));
changed = true;
if (SetHeaderIfMissing(headerMap,
net::HttpRequestHeaders::kUserAgent,
ua_settings->GetUserAgent(request_->url()))) {
changed = true;
}
}
if (changed)

View File

@ -76,12 +76,10 @@ FilePath GetFileNameFromDragData(const WebDropData& drop_data) {
// is responsible for opening the file. It takes the drop data and an open file
// stream.
void PromiseWriterHelper(const WebDropData& drop_data,
net::FileStream* file_stream) {
scoped_ptr<net::FileStream> file_stream) {
DCHECK(file_stream);
file_stream->WriteSync(drop_data.file_contents.data(),
drop_data.file_contents.length());
file_stream->CloseSync();
}
} // namespace
@ -314,9 +312,9 @@ void PromiseWriterHelper(const WebDropData& drop_data,
// which is blocking. Since this operation is already blocking the
// UI thread on OSX, it should be reasonable to let it happen.
base::ThreadRestrictions::ScopedAllowIO allowIO;
FileStream* fileStream =
drag_download_util::CreateFileStreamForDrop(&filePath);
if (!fileStream)
scoped_ptr<FileStream> fileStream(
drag_download_util::CreateFileStreamForDrop(&filePath));
if (!fileStream.get())
return nil;
if (downloadURL_.is_valid()) {
@ -327,7 +325,7 @@ void PromiseWriterHelper(const WebDropData& drop_data,
scoped_refptr<DragDownloadFile> dragFileDownloader(new DragDownloadFile(
filePath,
linked_ptr<net::FileStream>(fileStream),
fileStream.Pass(),
downloadURL_,
page_url,
page_encoding,
@ -339,7 +337,8 @@ void PromiseWriterHelper(const WebDropData& drop_data,
} else {
// The writer will take care of closing and deletion.
CefThread::PostTask(CefThread::FILE, FROM_HERE,
base::Bind(PromiseWriterHelper, *dropData_, base::Owned(fileStream)));
base::Bind(PromiseWriterHelper, *dropData_,
base::Passed(fileStream.Pass())));
}
// Once we've created the file, we should return the file name.

View File

@ -63,7 +63,7 @@ bool WebWidgetHost::GetImage(int width, int height, void* rgba_buffer) {
// Create a new canvas of the requested size.
scoped_ptr<skia::PlatformCanvas> new_canvas(
new skia::PlatformCanvas(width, height, true));
skia::CreatePlatformCanvas(width, height, true));
new_canvas->writePixels(bitmap, 0, 0);
const SkBitmap& new_bitmap = new_canvas->getDevice()->accessBitmap(false);

View File

@ -335,7 +335,7 @@ void WebWidgetHost::Paint() {
// Resize the canvas to be within a reasonable size of the client area.
canvas_w_ = client_rect.width() + kCanvasGrowSize;
canvas_h_ = client_rect.height() + kCanvasGrowSize;
canvas_.reset(new skia::PlatformCanvas(canvas_w_, canvas_h_, true));
canvas_.reset(skia::CreatePlatformCanvas(canvas_w_, canvas_h_, true));
if (!canvas_.get()) {
// memory allocation failed, we can't paint.
LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height;

View File

@ -188,7 +188,7 @@ void WebWidgetHost::Paint(SkRegion& update_rgn) {
if (!canvas_.get() || too_small || too_large) {
canvas_w_ = client_rect.width() + extra_w;
canvas_h_ = client_rect.height() + extra_h;
canvas_.reset(new skia::PlatformCanvas(canvas_w_, canvas_h_, true));
canvas_.reset(skia::CreatePlatformCanvas(canvas_w_, canvas_h_, true));
paint_rgn_.setRect(convertToSkiaRect(client_rect));
}
} else if (!canvas_.get() || canvas_w_ != client_rect.width() ||
@ -198,7 +198,7 @@ void WebWidgetHost::Paint(SkRegion& update_rgn) {
// The canvas must be the exact size of the client area.
canvas_w_ = client_rect.width();
canvas_h_ = client_rect.height();
canvas_.reset(new skia::PlatformCanvas(canvas_w_, canvas_h_, true));
canvas_.reset(skia::CreatePlatformCanvas(canvas_w_, canvas_h_, true));
}
webwidget_->animate(0.0);

View File

@ -385,7 +385,7 @@ void WebWidgetHost::Paint() {
// Resize the canvas to be within a reasonable size of the client area.
canvas_w_ = client_rect.width() + kCanvasGrowSize;
canvas_h_ = client_rect.height() + kCanvasGrowSize;
canvas_.reset(new skia::PlatformCanvas(canvas_w_, canvas_h_, true));
canvas_.reset(skia::CreatePlatformCanvas(canvas_w_, canvas_h_, true));
}
} else if (!canvas_.get() || canvas_w_ != client_rect.width() ||
canvas_h_ != client_rect.height()) {
@ -394,7 +394,7 @@ void WebWidgetHost::Paint() {
// The canvas must be the exact size of the client area.
canvas_w_ = client_rect.width();
canvas_h_ = client_rect.height();
canvas_.reset(new skia::PlatformCanvas(canvas_w_, canvas_h_, true));
canvas_.reset(skia::CreatePlatformCanvas(canvas_w_, canvas_h_, true));
}
webwidget_->animate(0.0);