Fix API changes

This commit is contained in:
Cheng Zhao 2015-09-02 15:16:49 +08:00
parent 1db843244d
commit 45491ca7ab
21 changed files with 81 additions and 74 deletions

View file

@ -46,7 +46,8 @@ ui::ClipboardType ConvertClipboardType(uint32_t type) {
// assume all data that is placed on the clipboard is UTF16 and pepper allows
// arbitrary data so this change would require some reworking of the chrome
// clipboard interface for custom data.
bool JumpToFormatInPickle(const base::string16& format, PickleIterator* iter) {
bool JumpToFormatInPickle(const base::string16& format,
base::PickleIterator* iter) {
size_t size = 0;
if (!iter->ReadSizeT(&size))
return false;
@ -66,22 +67,22 @@ bool JumpToFormatInPickle(const base::string16& format, PickleIterator* iter) {
}
bool IsFormatAvailableInPickle(const base::string16& format,
const Pickle& pickle) {
PickleIterator iter(pickle);
const base::Pickle& pickle) {
base::PickleIterator iter(pickle);
return JumpToFormatInPickle(format, &iter);
}
std::string ReadDataFromPickle(const base::string16& format,
const Pickle& pickle) {
const base::Pickle& pickle) {
std::string result;
PickleIterator iter(pickle);
base::PickleIterator iter(pickle);
if (!JumpToFormatInPickle(format, &iter) || !iter.ReadString(&result))
return std::string();
return result;
}
bool WriteDataToPickle(const std::map<base::string16, std::string>& data,
Pickle* pickle) {
base::Pickle* pickle) {
pickle->WriteSizeT(data.size());
for (std::map<base::string16, std::string>::const_iterator it = data.begin();
it != data.end();
@ -187,7 +188,7 @@ int32_t PepperFlashClipboardMessageFilter::OnMsgIsFormatAvailable(
std::string clipboard_data;
clipboard->ReadData(ui::Clipboard::GetPepperCustomDataFormatType(),
&clipboard_data);
Pickle pickle(clipboard_data.data(), clipboard_data.size());
base::Pickle pickle(clipboard_data.data(), clipboard_data.size());
available =
IsFormatAvailableInPickle(base::UTF8ToUTF16(format_name), pickle);
}
@ -265,7 +266,7 @@ int32_t PepperFlashClipboardMessageFilter::OnMsgReadData(
std::string clipboard_data;
clipboard->ReadData(ui::Clipboard::GetPepperCustomDataFormatType(),
&clipboard_data);
Pickle pickle(clipboard_data.data(), clipboard_data.size());
base::Pickle pickle(clipboard_data.data(), clipboard_data.size());
if (IsFormatAvailableInPickle(format_name, pickle)) {
result = PP_OK;
clipboard_string = ReadDataFromPickle(format_name, pickle);
@ -340,7 +341,7 @@ int32_t PepperFlashClipboardMessageFilter::OnMsgWriteData(
}
if (custom_data_map.size() > 0) {
Pickle pickle;
base::Pickle pickle;
if (WriteDataToPickle(custom_data_map, &pickle)) {
scw.WritePickledData(pickle,
ui::Clipboard::GetPepperCustomDataFormatType());

View file

@ -56,17 +56,9 @@ void PepperSharedMemoryMessageFilter::OnHostMsgCreateSharedMemory(
->GetVarTracker()
->TrackSharedMemoryHandle(instance, host_shm_handle, size);
base::PlatformFile host_handle =
#if defined(OS_WIN)
host_shm_handle;
#elif defined(OS_POSIX)
host_shm_handle.fd;
#else
#error Not implemented.
#endif
// We set auto_close to false since we need our file descriptor to
// actually be duplicated on linux. The shared memory destructor will
// close the original handle for us.
plugin_handle->set_shmem(host_->ShareHandleWithRemote(host_handle, false),
size);
plugin_handle->set_shmem(
host_->ShareSharedMemoryHandleWithRemote(host_shm_handle), size);
}

View file

@ -427,9 +427,10 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
// blink::WebFrameClient override:
virtual blink::WebFrame* createChildFrame(
blink::WebLocalFrame* parent,
blink::WebTreeScopeType scope,
const blink::WebString& name,
blink::WebSandboxFlags sandboxFlags);
virtual void frameDetached(blink::WebFrame* frame);
virtual void frameDetached(blink::WebFrame* frame, DetachType type);
private:
void CallOnReady();
@ -548,7 +549,8 @@ void PrepareFrameAndViewForPrint::CopySelection(
blink::WebView* web_view = blink::WebView::create(this);
owns_web_view_ = true;
content::RenderView::ApplyWebPreferences(prefs, web_view);
web_view->setMainFrame(blink::WebLocalFrame::create(this));
web_view->setMainFrame(
blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this));
frame_.Reset(web_view->mainFrame()->toWebLocalFrame());
node_to_print_.reset();
@ -573,14 +575,17 @@ void PrepareFrameAndViewForPrint::didStopLoading() {
blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame(
blink::WebLocalFrame* parent,
blink::WebTreeScopeType scope,
const blink::WebString& name,
blink::WebSandboxFlags sandboxFlags) {
blink::WebFrame* frame = blink::WebLocalFrame::create(this);
blink::WebFrame* frame = blink::WebLocalFrame::create(scope, this);
parent->appendChild(frame);
return frame;
}
void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame) {
void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame,
DetachType type) {
DCHECK(type == DetachType::Remove);
if (frame->parent())
frame->parent()->removeChild(frame);
frame->close();