Fix API changes of FrameSubscriber
This commit is contained in:
parent
6da696b6f2
commit
d85b58fdb5
4 changed files with 21 additions and 9 deletions
|
@ -76,6 +76,7 @@
|
||||||
#include "third_party/WebKit/public/platform/WebInputEvent.h"
|
#include "third_party/WebKit/public/platform/WebInputEvent.h"
|
||||||
#include "third_party/WebKit/public/web/WebFindOptions.h"
|
#include "third_party/WebKit/public/web/WebFindOptions.h"
|
||||||
#include "ui/display/screen.h"
|
#include "ui/display/screen.h"
|
||||||
|
#include "ui/events/base_event_utils.h"
|
||||||
|
|
||||||
#if !defined(OS_MACOSX)
|
#if !defined(OS_MACOSX)
|
||||||
#include "ui/aura/window.h"
|
#include "ui/aura/window.h"
|
||||||
|
@ -1306,7 +1307,7 @@ void WebContents::SelectAll() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::Unselect() {
|
void WebContents::Unselect() {
|
||||||
web_contents()->Unselect();
|
web_contents()->CollapseSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::Replace(const base::string16& word) {
|
void WebContents::Replace(const base::string16& word) {
|
||||||
|
@ -1396,7 +1397,10 @@ void WebContents::SendInputEvent(v8::Isolate* isolate,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (blink::WebInputEvent::isKeyboardEventType(type)) {
|
} else if (blink::WebInputEvent::isKeyboardEventType(type)) {
|
||||||
content::NativeWebKeyboardEvent keyboard_event;
|
content::NativeWebKeyboardEvent keyboard_event(
|
||||||
|
blink::WebKeyboardEvent::RawKeyDown,
|
||||||
|
blink::WebInputEvent::NoModifiers,
|
||||||
|
ui::EventTimeForNow());
|
||||||
if (mate::ConvertFromV8(isolate, input_event, &keyboard_event)) {
|
if (mate::ConvertFromV8(isolate, input_event, &keyboard_event)) {
|
||||||
host->ForwardKeyboardEvent(keyboard_event);
|
host->ForwardKeyboardEvent(keyboard_event);
|
||||||
return;
|
return;
|
||||||
|
@ -1486,8 +1490,7 @@ void WebContents::CapturePage(mate::Arguments* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
const auto view = web_contents()->GetRenderWidgetHostView();
|
||||||
const auto host = view ? view->GetRenderWidgetHost() : nullptr;
|
if (!view) {
|
||||||
if (!view || !host) {
|
|
||||||
callback.Run(gfx::Image());
|
callback.Run(gfx::Image());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1507,10 +1510,10 @@ void WebContents::CapturePage(mate::Arguments* args) {
|
||||||
if (scale > 1.0f)
|
if (scale > 1.0f)
|
||||||
bitmap_size = gfx::ScaleToCeiledSize(view_size, scale);
|
bitmap_size = gfx::ScaleToCeiledSize(view_size, scale);
|
||||||
|
|
||||||
host->CopyFromBackingStore(gfx::Rect(rect.origin(), view_size),
|
view->CopyFromSurface(gfx::Rect(rect.origin(), view_size),
|
||||||
bitmap_size,
|
bitmap_size,
|
||||||
base::Bind(&OnCapturePageDone, callback),
|
base::Bind(&OnCapturePageDone, callback),
|
||||||
kBGRA_8888_SkColorType);
|
kBGRA_8888_SkColorType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
|
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ FrameSubscriber::FrameSubscriber(v8::Isolate* isolate,
|
||||||
view_(view),
|
view_(view),
|
||||||
callback_(callback),
|
callback_(callback),
|
||||||
only_dirty_(only_dirty),
|
only_dirty_(only_dirty),
|
||||||
|
source_id_for_copy_request_(base::UnguessableToken::Create()),
|
||||||
weak_factory_(this) {
|
weak_factory_(this) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +64,10 @@ bool FrameSubscriber::ShouldCaptureFrame(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const base::UnguessableToken& FrameSubscriber::GetSourceIdForCopyRequest() {
|
||||||
|
return source_id_for_copy_request_;
|
||||||
|
}
|
||||||
|
|
||||||
void FrameSubscriber::OnFrameDelivered(const FrameCaptureCallback& callback,
|
void FrameSubscriber::OnFrameDelivered(const FrameCaptureCallback& callback,
|
||||||
const gfx::Rect& damage_rect,
|
const gfx::Rect& damage_rect,
|
||||||
const SkBitmap& bitmap,
|
const SkBitmap& bitmap,
|
||||||
|
|
|
@ -32,6 +32,7 @@ class FrameSubscriber : public content::RenderWidgetHostViewFrameSubscriber {
|
||||||
base::TimeTicks present_time,
|
base::TimeTicks present_time,
|
||||||
scoped_refptr<media::VideoFrame>* storage,
|
scoped_refptr<media::VideoFrame>* storage,
|
||||||
DeliverFrameCallback* callback) override;
|
DeliverFrameCallback* callback) override;
|
||||||
|
const base::UnguessableToken& GetSourceIdForCopyRequest() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnFrameDelivered(const FrameCaptureCallback& callback,
|
void OnFrameDelivered(const FrameCaptureCallback& callback,
|
||||||
|
@ -44,6 +45,8 @@ class FrameSubscriber : public content::RenderWidgetHostViewFrameSubscriber {
|
||||||
FrameCaptureCallback callback_;
|
FrameCaptureCallback callback_;
|
||||||
bool only_dirty_;
|
bool only_dirty_;
|
||||||
|
|
||||||
|
base::UnguessableToken source_id_for_copy_request_;
|
||||||
|
|
||||||
base::WeakPtrFactory<FrameSubscriber> weak_factory_;
|
base::WeakPtrFactory<FrameSubscriber> weak_factory_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(FrameSubscriber);
|
DISALLOW_COPY_AND_ASSIGN(FrameSubscriber);
|
||||||
|
|
|
@ -203,7 +203,8 @@ PdfViewerUI::PdfViewerUI(content::BrowserContext* browser_context,
|
||||||
content::WebContentsObserver(web_ui->GetWebContents()),
|
content::WebContentsObserver(web_ui->GetWebContents()),
|
||||||
src_(src) {
|
src_(src) {
|
||||||
pdf_handler_ = new PdfViewerHandler(src);
|
pdf_handler_ = new PdfViewerHandler(src);
|
||||||
web_ui->AddMessageHandler(pdf_handler_);
|
web_ui->AddMessageHandler(
|
||||||
|
std::unique_ptr<content::WebUIMessageHandler>(pdf_handler_));
|
||||||
content::URLDataSource::Add(browser_context, new BundledDataSource);
|
content::URLDataSource::Add(browser_context, new BundledDataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue