From 9a1a09bf82ea98a2b69b351120619c787ce990a8 Mon Sep 17 00:00:00 2001 From: Andras Becsi Date: Thu, 20 Mar 2014 16:05:49 +0100 Subject: Adapt to API changes in new stable branch 1750 Change-Id: If0cc263f36d396fd505c1d8b026e2493bfc29cc4 Reviewed-by: Pierre Rossi Reviewed-by: Zeno Albisser --- src/core/browser_context_qt.cpp | 8 +- src/core/browser_context_qt.h | 3 +- src/core/chromium_overrides.cpp | 10 +- src/core/chromium_overrides.h | 2 +- src/core/clipboard_qt.cpp | 58 +++---- src/core/dev_tools_http_handler_delegate_qt.cpp | 22 +-- src/core/dev_tools_http_handler_delegate_qt.h | 7 +- src/core/gyp_run.pro | 2 + src/core/qtwebengine.gypi | 5 +- src/core/render_widget_host_view_qt.cpp | 203 ++++++++++++++---------- src/core/render_widget_host_view_qt.h | 15 +- src/core/url_request_context_getter_qt.cpp | 7 +- src/core/web_contents_adapter.cpp | 9 +- src/core/web_contents_delegate_qt.cpp | 4 +- src/core/web_contents_delegate_qt.h | 4 +- src/core/web_contents_view_qt.cpp | 2 +- src/core/web_contents_view_qt.h | 4 +- src/core/web_event_factory.cpp | 6 +- src/core/web_event_factory.h | 6 +- 19 files changed, 216 insertions(+), 161 deletions(-) (limited to 'src/core') diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp index c2c17cd70..48fd8ce26 100644 --- a/src/core/browser_context_qt.cpp +++ b/src/core/browser_context_qt.cpp @@ -111,12 +111,16 @@ net::URLRequestContextGetter *BrowserContextQt::GetMediaRequestContextForStorage return GetRequestContext(); } -void BrowserContextQt::RequestMIDISysExPermission(int render_process_id, int render_view_id, const GURL &requesting_frame, const MIDISysExPermissionCallback &callback) +void BrowserContextQt::RequestMIDISysExPermission(int, int, int, const GURL &, const MIDISysExPermissionCallback &callback) { - // Always reject requests for testing. callback.Run(false); } +void BrowserContextQt::CancelMIDISysExPermissionRequest(int, int, int, const GURL &) +{ + +} + content::ResourceContext *BrowserContextQt::GetResourceContext() { return resourceContext.get(); diff --git a/src/core/browser_context_qt.h b/src/core/browser_context_qt.h index c9b8df238..933440f4a 100644 --- a/src/core/browser_context_qt.h +++ b/src/core/browser_context_qt.h @@ -63,7 +63,8 @@ public: virtual net::URLRequestContextGetter *GetMediaRequestContext() Q_DECL_OVERRIDE; virtual net::URLRequestContextGetter *GetMediaRequestContextForRenderProcess(int) Q_DECL_OVERRIDE; virtual net::URLRequestContextGetter *GetMediaRequestContextForStoragePartition(const base::FilePath&, bool) Q_DECL_OVERRIDE; - virtual void RequestMIDISysExPermission(int render_process_id, int render_view_id, const GURL &requesting_frame, const MIDISysExPermissionCallback &callback) Q_DECL_OVERRIDE; + virtual void RequestMIDISysExPermission(int render_process_id, int render_view_id, int bridge_id, const GURL &requesting_frame, const MIDISysExPermissionCallback&) Q_DECL_OVERRIDE; + virtual void CancelMIDISysExPermissionRequest(int render_process_id, int render_view_id, int bridge_id, const GURL &requesting_frame) Q_DECL_OVERRIDE; virtual content::ResourceContext *GetResourceContext() Q_DECL_OVERRIDE; virtual content::DownloadManagerDelegate *GetDownloadManagerDelegate() Q_DECL_OVERRIDE; virtual content::GeolocationPermissionContext *GetGeolocationPermissionContext() Q_DECL_OVERRIDE; diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index be97bc089..b0f8702d0 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -57,20 +57,20 @@ #include #endif -void GetScreenInfoFromNativeWindow(QWindow* window, WebKit::WebScreenInfo* results) +void GetScreenInfoFromNativeWindow(QWindow* window, blink::WebScreenInfo* results) { QScreen* screen = window->screen(); - WebKit::WebScreenInfo r; + blink::WebScreenInfo r; r.deviceScaleFactor = screen->devicePixelRatio(); r.depthPerComponent = 8; r.depth = screen->depth(); r.isMonochrome = (r.depth == 1); QRect screenGeometry = screen->geometry(); - r.rect = WebKit::WebRect(screenGeometry.x(), screenGeometry.y(), screenGeometry.width(), screenGeometry.height()); + r.rect = blink::WebRect(screenGeometry.x(), screenGeometry.y(), screenGeometry.width(), screenGeometry.height()); QRect available = screen->availableGeometry(); - r.availableRect = WebKit::WebRect(available.x(), available.y(), available.width(), available.height()); + r.availableRect = blink::WebRect(available.x(), available.y(), available.width(), available.height()); *results = r; } @@ -111,7 +111,7 @@ RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost } // static -void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebKit::WebScreenInfo* results) { +void RenderWidgetHostViewPort::GetDefaultScreenInfo(blink::WebScreenInfo* results) { QWindow dummy; GetScreenInfoFromNativeWindow(&dummy, results); } diff --git a/src/core/chromium_overrides.h b/src/core/chromium_overrides.h index cda4d7e66..b0d122750 100644 --- a/src/core/chromium_overrides.h +++ b/src/core/chromium_overrides.h @@ -49,6 +49,6 @@ QT_BEGIN_NAMESPACE class QWindow; QT_END_NAMESPACE -void GetScreenInfoFromNativeWindow(QWindow* window, WebKit::WebScreenInfo* results); +void GetScreenInfoFromNativeWindow(QWindow* window, blink::WebScreenInfo* results); #endif diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 6d2d28359..701ccacb1 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -124,23 +124,24 @@ Clipboard::~Clipboard() { } -void Clipboard::WriteObjects(Buffer buffer, const ObjectMap& objects) +void Clipboard::WriteObjects(ClipboardType type, const ObjectMap& objects) { DCHECK(CalledOnValidThread()); + DCHECK(IsSupportedClipboardType(type)); for (ObjectMap::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) DispatchObject(static_cast(iter->first), iter->second); // Commit the accumulated data. if (uncommittedData) - QGuiApplication::clipboard()->setMimeData(uncommittedData.take(), buffer == BUFFER_STANDARD ? QClipboard::Clipboard : QClipboard::Selection); + QGuiApplication::clipboard()->setMimeData(uncommittedData.take(), type == CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); - if (buffer == BUFFER_STANDARD) { + if (type == CLIPBOARD_TYPE_COPY_PASTE) { ObjectMap::const_iterator text_iter = objects.find(CBF_TEXT); if (text_iter != objects.end()) { // Copy text and SourceTag to the selection clipboard. ObjectMap::const_iterator next_iter = text_iter; - WriteObjects(BUFFER_SELECTION, ObjectMap(text_iter, ++next_iter)); + WriteObjects(CLIPBOARD_TYPE_SELECTION, ObjectMap(text_iter, ++next_iter)); } } } @@ -165,10 +166,9 @@ void Clipboard::WriteWebSmartPaste() getUncommittedData()->setData(QString::fromLatin1(kMimeTypeWebkitSmartPaste), QByteArray()); } -void Clipboard::WriteBitmap(const char* pixel_data, const char* size_data) +void Clipboard::WriteBitmap(const SkBitmap& bitmap) { - const gfx::Size* size = reinterpret_cast(size_data); - QImage image(reinterpret_cast(pixel_data), size->width(), size->height(), QImage::Format_ARGB32); + QImage image(reinterpret_cast(bitmap.getPixels()), bitmap.width(), bitmap.height(), QImage::Format_ARGB32); getUncommittedData()->setImageData(image.copy()); } @@ -191,18 +191,18 @@ void Clipboard::WriteData(const FormatType& format, const char* data_data, size_ getUncommittedData()->setData(QString::fromStdString(format.data_), QByteArray(data_data, data_len)); } -bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format, Clipboard::Buffer buffer) const +bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format, ClipboardType type) const { - const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(buffer == BUFFER_STANDARD ? QClipboard::Clipboard : QClipboard::Selection); + const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(type == CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); return mimeData->hasFormat(QString::fromStdString(format.data_)); } -void Clipboard::Clear(Clipboard::Buffer buffer) +void Clipboard::Clear(ClipboardType type) { - QGuiApplication::clipboard()->clear(buffer == BUFFER_STANDARD ? QClipboard::Clipboard : QClipboard::Selection); + QGuiApplication::clipboard()->clear(type == CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); } -void Clipboard::ReadAvailableTypes(Clipboard::Buffer buffer, std::vector* types, bool* contains_filenames) const +void Clipboard::ReadAvailableTypes(ui::ClipboardType type, std::vector* types, bool* contains_filenames) const { if (!types || !contains_filenames) { NOTREACHED(); @@ -210,7 +210,7 @@ void Clipboard::ReadAvailableTypes(Clipboard::Buffer buffer, std::vectorclear(); - const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(buffer == BUFFER_STANDARD ? QClipboard::Clipboard : QClipboard::Selection); + const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(type == CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); Q_FOREACH (const QString &mimeType, mimeData->formats()) types->push_back(toString16(mimeType)); *contains_filenames = false; @@ -220,19 +220,19 @@ void Clipboard::ReadAvailableTypes(Clipboard::Buffer buffer, std::vectormimeData(buffer == BUFFER_STANDARD ? QClipboard::Clipboard : QClipboard::Selection); + const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(type == CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); *result = toString16(mimeData->text()); } -void Clipboard::ReadAsciiText(Clipboard::Buffer buffer, std::string* result) const +void Clipboard::ReadAsciiText(ClipboardType type, std::string* result) const { - const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(buffer == BUFFER_STANDARD ? QClipboard::Clipboard : QClipboard::Selection); + const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(type == CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); *result = mimeData->text().toStdString(); } -void Clipboard::ReadHTML(Clipboard::Buffer buffer, string16* markup, std::string* src_url, uint32* fragment_start, uint32* fragment_end) const +void Clipboard::ReadHTML(ClipboardType type, string16* markup, std::string* src_url, uint32* fragment_start, uint32* fragment_end) const { markup->clear(); if (src_url) @@ -240,23 +240,23 @@ void Clipboard::ReadHTML(Clipboard::Buffer buffer, string16* markup, std::string *fragment_start = 0; *fragment_end = 0; - const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(buffer == BUFFER_STANDARD ? QClipboard::Clipboard : QClipboard::Selection); + const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(type == CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); *markup = toString16(mimeData->html()); *fragment_end = static_cast(markup->length()); } -void Clipboard::ReadRTF(Buffer buffer, std::string* result) const +void Clipboard::ReadRTF(ClipboardType type, std::string* result) const { - const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(buffer == BUFFER_STANDARD ? QClipboard::Clipboard : QClipboard::Selection); + const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(type == CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); const QByteArray byteArray = mimeData->data(QString::fromLatin1(kMimeTypeRTF)); *result = std::string(byteArray.constData(), byteArray.length()); } -SkBitmap Clipboard::ReadImage(Buffer buffer) const +SkBitmap Clipboard::ReadImage(ClipboardType type) const { // FIXME: Untested, pasting image data seems to only be supported through // FileReader.readAsDataURL in JavaScript and this isn't working down the pipe for some reason. - const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(buffer == BUFFER_STANDARD ? QClipboard::Clipboard : QClipboard::Selection); + const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(type == CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); QImage image = qvariant_cast(mimeData->imageData()); Q_ASSERT(image.format() == QImage::Format_ARGB32); @@ -270,9 +270,9 @@ SkBitmap Clipboard::ReadImage(Buffer buffer) const return copy; } -void Clipboard::ReadCustomData(Buffer buffer, const string16& type, string16* result) const +void Clipboard::ReadCustomData(ClipboardType clipboard_type, const string16& type, string16* result) const { - const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(buffer == BUFFER_STANDARD ? QClipboard::Clipboard : QClipboard::Selection); + const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(clipboard_type == CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); const QByteArray customData = mimeData->data(QString::fromLatin1(kMimeTypeWebCustomDataCopy)); ReadCustomDataForType(customData.constData(), customData.size(), type, result); } @@ -289,9 +289,9 @@ void Clipboard::ReadData(const FormatType& format, std::string* result) const *result = std::string(byteArray.constData(), byteArray.length()); } -uint64 Clipboard::GetSequenceNumber(Buffer buffer) +uint64 Clipboard::GetSequenceNumber(ClipboardType type) { - return clipboardChangeObserver()->getSequenceNumber(buffer == BUFFER_STANDARD ? QClipboard::Clipboard : QClipboard::Selection); + return clipboardChangeObserver()->getSequenceNumber(type == CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); } Clipboard::FormatType Clipboard::GetFormatType(const std::string& format_string) @@ -357,7 +357,7 @@ const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() } #if defined(TOOLKIT_GTK) -void Clipboard::SetGtkClipboard(Buffer buffer) +void Clipboard::SetGtkClipboard(ClipboardType type) { } @@ -365,7 +365,7 @@ void Clipboard::InsertMapping(const char* key, char* data, size_t data_len) { } -GtkClipboard* Clipboard::LookupBackingClipboard(Buffer clipboard) const +GtkClipboard* Clipboard::LookupBackingClipboard(ClipboardType type) const { return NULL; } diff --git a/src/core/dev_tools_http_handler_delegate_qt.cpp b/src/core/dev_tools_http_handler_delegate_qt.cpp index 6470a60bd..7fa525dc1 100644 --- a/src/core/dev_tools_http_handler_delegate_qt.cpp +++ b/src/core/dev_tools_http_handler_delegate_qt.cpp @@ -47,12 +47,17 @@ #include "base/command_line.h" #include "base/files/file_path.h" #include "base/strings/string_number_conversions.h" +#include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_http_handler.h" +#include "content/public/browser/devtools_target.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" #include "net/socket/stream_listen_socket.h" #include "net/socket/tcp_listen_socket.h" -DevToolsHttpHandlerDelegateQt::DevToolsHttpHandlerDelegateQt(content::BrowserContext* browser_context) +using namespace content; + +DevToolsHttpHandlerDelegateQt::DevToolsHttpHandlerDelegateQt(BrowserContext* browser_context) : m_browserContext(browser_context) { const int defaultPort = 1337; @@ -65,7 +70,7 @@ DevToolsHttpHandlerDelegateQt::DevToolsHttpHandlerDelegateQt(content::BrowserCon if (base::StringToInt(portString, &portInt) && portInt > 0 && portInt < 65535) listeningPort = portInt; } - m_devtoolsHttpHandler = content::DevToolsHttpHandler::Start(new net::TCPListenSocketFactory("0.0.0.0", listeningPort), std::string(), this); + m_devtoolsHttpHandler = DevToolsHttpHandler::Start(new net::TCPListenSocketFactory("0.0.0.0", listeningPort), std::string(), this); } DevToolsHttpHandlerDelegateQt::~DevToolsHttpHandlerDelegateQt() @@ -100,19 +105,14 @@ std::string DevToolsHttpHandlerDelegateQt::GetPageThumbnailData(const GURL& url) return std::string(); } -content::RenderViewHost* DevToolsHttpHandlerDelegateQt::CreateNewTarget() +scoped_ptr DevToolsHttpHandlerDelegateQt::CreateNewTarget(const GURL&) { - return NULL; + return scoped_ptr(); } -content::DevToolsHttpHandlerDelegate::TargetType DevToolsHttpHandlerDelegateQt::GetTargetType(content::RenderViewHost*) +void DevToolsHttpHandlerDelegateQt::EnumerateTargets(TargetCallback callback) { - return kTargetTypeTab; -} - -std::string DevToolsHttpHandlerDelegateQt::GetViewDescription(content::RenderViewHost*) -{ - return std::string(); + callback.Run(TargetList()); } scoped_ptr DevToolsHttpHandlerDelegateQt::CreateSocketForTethering(net::StreamListenSocket::Delegate* delegate, std::string* name) diff --git a/src/core/dev_tools_http_handler_delegate_qt.h b/src/core/dev_tools_http_handler_delegate_qt.h index 9d9212e6d..be6e97419 100644 --- a/src/core/dev_tools_http_handler_delegate_qt.h +++ b/src/core/dev_tools_http_handler_delegate_qt.h @@ -67,9 +67,10 @@ public: virtual bool BundlesFrontendResources() Q_DECL_OVERRIDE; virtual base::FilePath GetDebugFrontendDir() Q_DECL_OVERRIDE; virtual std::string GetPageThumbnailData(const GURL& url) Q_DECL_OVERRIDE; - virtual content::RenderViewHost* CreateNewTarget() Q_DECL_OVERRIDE; - virtual TargetType GetTargetType(content::RenderViewHost*) Q_DECL_OVERRIDE; - virtual std::string GetViewDescription(content::RenderViewHost*) Q_DECL_OVERRIDE; + virtual scoped_ptr CreateNewTarget(const GURL&) Q_DECL_OVERRIDE; + // Requests the list of all inspectable targets. + // The caller gets the ownership of the returned targets. + virtual void EnumerateTargets(TargetCallback callback) Q_DECL_OVERRIDE; virtual scoped_ptr CreateSocketForTethering(net::StreamListenSocket::Delegate* delegate, std::string* name) Q_DECL_OVERRIDE; private: diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index dd820f6b5..82f18331b 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -69,6 +69,8 @@ cross_compile { GYP_ARGS += "-D CXX=\"$$which($$QMAKE_CXX)\"" } +mac: GYP_ARGS += "-D mac_sdk_path=\"$${QMAKE_MAC_SDK_PATH}\"" + win32 { # Libvpx build needs additional search path on Windows. git_chromium_src_dir = $$system("git config qtwebengine.chromiumsrcdir") diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi index 0e1ab52b2..ec8c97c8e 100644 --- a/src/core/qtwebengine.gypi +++ b/src/core/qtwebengine.gypi @@ -23,7 +23,7 @@ '<(chromium_src_dir)/ui/ui.gyp:ui', '<(chromium_src_dir)/url/url.gyp:url_lib', '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', - '<(chromium_src_dir)/webkit/support/webkit_support.gyp:glue', + '<(chromium_src_dir)/webkit/glue/webkit_glue.gyp:*', '<(chromium_src_dir)/third_party/WebKit/Source/web/web.gyp:webkit', ], 'include_dirs': [ @@ -104,9 +104,8 @@ 'dependencies': [ '<(chromium_src_dir)/ui/aura/aura.gyp:aura', '<(chromium_src_dir)/ui/base/strings/ui_strings.gyp:ui_strings', - '<(chromium_src_dir)/ui/views/controls/webview/webview.gyp:webview', '<(chromium_src_dir)/ui/views/views.gyp:views', - '<(chromium_src_dir)/ui/ui.gyp:ui_resources', + '<(chromium_src_dir)/ui/ui.gyp:ui', ], }], # use_aura==1 ], diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index dc2e1c155..d179fbe70 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -49,15 +49,17 @@ #include "web_contents_adapter_client.h" #include "web_event_factory.h" +#include "base/command_line.h" #include "cc/output/compositor_frame_ack.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/ui_events_helper.h" +#include "content/public/common/content_switches.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/view_messages.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/WebKit/public/platform/WebColor.h" +#include "third_party/WebKit/public/platform/WebCursorInfo.h" #include "third_party/WebKit/public/web/WebCompositionUnderline.h" -#include "third_party/WebKit/public/web/WebCursorInfo.h" #include "ui/events/event.h" #include "ui/gfx/size_conversions.h" #include "webkit/common/cursors/webcursor.h" @@ -132,9 +134,9 @@ static inline gfx::Point toGfxPoint(const QPoint& point) return gfx::Point(point.x(), point.y()); } -static void UpdateWebTouchEventAfterDispatch(WebKit::WebTouchEvent* event, WebKit::WebTouchPoint* point) { - if (point->state != WebKit::WebTouchPoint::StateReleased && - point->state != WebKit::WebTouchPoint::StateCancelled) +static void UpdateWebTouchEventAfterDispatch(blink::WebTouchEvent* event, blink::WebTouchPoint* point) { + if (point->state != blink::WebTouchPoint::StateReleased && + point->state != blink::WebTouchPoint::StateCancelled) return; --event->touchesLength; for (unsigned i = point - event->touches; i < event->touchesLength; ++i) { @@ -142,18 +144,24 @@ static void UpdateWebTouchEventAfterDispatch(WebKit::WebTouchEvent* event, WebKi } } -static WebKit::WebGestureEvent createFlingCancelEvent(double time_stamp) +static blink::WebGestureEvent createFlingCancelEvent(double time_stamp) { - WebKit::WebGestureEvent gesture_event; + blink::WebGestureEvent gesture_event; gesture_event.timeStampSeconds = time_stamp; - gesture_event.type = WebKit::WebGestureEvent::GestureFlingCancel; - gesture_event.sourceDevice = WebKit::WebGestureEvent::Touchscreen; + gesture_event.type = blink::WebGestureEvent::GestureFlingCancel; + gesture_event.sourceDevice = blink::WebGestureEvent::Touchscreen; return gesture_event; } +static bool shouldSendPinchGesture() +{ + static bool pinchAllowed = CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePinch); + return pinchAllowed; +} + RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget) : m_host(content::RenderWidgetHostImpl::From(widget)) - , m_gestureRecognizer(ui::GestureRecognizer::Create(this)) + , m_gestureRecognizer(ui::GestureRecognizer::Create()) , m_backingStore(0) , m_frameNodeData(new DelegatedFrameNodeData) , m_needsDelegatedFrameAck(false) @@ -163,10 +171,12 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget , m_initPending(false) { m_host->SetView(this); + m_gestureRecognizer->AddGestureEventHelper(this); } RenderWidgetHostViewQt::~RenderWidgetHostViewQt() { + m_gestureRecognizer->RemoveGestureEventHelper(this); } void RenderWidgetHostViewQt::setDelegate(RenderWidgetHostViewQtDelegate* delegate) @@ -373,87 +383,87 @@ void RenderWidgetHostViewQt::UpdateCursor(const WebCursor &webCursor) webCursor.GetCursorInfo(&cursorInfo); Qt::CursorShape shape; switch (cursorInfo.type) { - case WebKit::WebCursorInfo::TypePointer: + case blink::WebCursorInfo::TypePointer: shape = Qt::ArrowCursor; break; - case WebKit::WebCursorInfo::TypeCross: + case blink::WebCursorInfo::TypeCross: shape = Qt::CrossCursor; break; - case WebKit::WebCursorInfo::TypeHand: + case blink::WebCursorInfo::TypeHand: shape = Qt::PointingHandCursor; break; - case WebKit::WebCursorInfo::TypeIBeam: + case blink::WebCursorInfo::TypeIBeam: shape = Qt::IBeamCursor; break; - case WebKit::WebCursorInfo::TypeWait: + case blink::WebCursorInfo::TypeWait: shape = Qt::WaitCursor; break; - case WebKit::WebCursorInfo::TypeHelp: + case blink::WebCursorInfo::TypeHelp: shape = Qt::WhatsThisCursor; break; - case WebKit::WebCursorInfo::TypeEastResize: - case WebKit::WebCursorInfo::TypeWestResize: - case WebKit::WebCursorInfo::TypeEastWestResize: - case WebKit::WebCursorInfo::TypeEastPanning: - case WebKit::WebCursorInfo::TypeWestPanning: + case blink::WebCursorInfo::TypeEastResize: + case blink::WebCursorInfo::TypeWestResize: + case blink::WebCursorInfo::TypeEastWestResize: + case blink::WebCursorInfo::TypeEastPanning: + case blink::WebCursorInfo::TypeWestPanning: shape = Qt::SizeHorCursor; break; - case WebKit::WebCursorInfo::TypeNorthResize: - case WebKit::WebCursorInfo::TypeSouthResize: - case WebKit::WebCursorInfo::TypeNorthSouthResize: - case WebKit::WebCursorInfo::TypeNorthPanning: - case WebKit::WebCursorInfo::TypeSouthPanning: + case blink::WebCursorInfo::TypeNorthResize: + case blink::WebCursorInfo::TypeSouthResize: + case blink::WebCursorInfo::TypeNorthSouthResize: + case blink::WebCursorInfo::TypeNorthPanning: + case blink::WebCursorInfo::TypeSouthPanning: shape = Qt::SizeVerCursor; break; - case WebKit::WebCursorInfo::TypeNorthEastResize: - case WebKit::WebCursorInfo::TypeSouthWestResize: - case WebKit::WebCursorInfo::TypeNorthEastSouthWestResize: - case WebKit::WebCursorInfo::TypeNorthEastPanning: - case WebKit::WebCursorInfo::TypeSouthWestPanning: + case blink::WebCursorInfo::TypeNorthEastResize: + case blink::WebCursorInfo::TypeSouthWestResize: + case blink::WebCursorInfo::TypeNorthEastSouthWestResize: + case blink::WebCursorInfo::TypeNorthEastPanning: + case blink::WebCursorInfo::TypeSouthWestPanning: shape = Qt::SizeBDiagCursor; break; - case WebKit::WebCursorInfo::TypeNorthWestResize: - case WebKit::WebCursorInfo::TypeSouthEastResize: - case WebKit::WebCursorInfo::TypeNorthWestSouthEastResize: - case WebKit::WebCursorInfo::TypeNorthWestPanning: - case WebKit::WebCursorInfo::TypeSouthEastPanning: + case blink::WebCursorInfo::TypeNorthWestResize: + case blink::WebCursorInfo::TypeSouthEastResize: + case blink::WebCursorInfo::TypeNorthWestSouthEastResize: + case blink::WebCursorInfo::TypeNorthWestPanning: + case blink::WebCursorInfo::TypeSouthEastPanning: shape = Qt::SizeFDiagCursor; break; - case WebKit::WebCursorInfo::TypeColumnResize: + case blink::WebCursorInfo::TypeColumnResize: shape = Qt::SplitHCursor; break; - case WebKit::WebCursorInfo::TypeRowResize: + case blink::WebCursorInfo::TypeRowResize: shape = Qt::SplitVCursor; break; - case WebKit::WebCursorInfo::TypeMiddlePanning: - case WebKit::WebCursorInfo::TypeMove: + case blink::WebCursorInfo::TypeMiddlePanning: + case blink::WebCursorInfo::TypeMove: shape = Qt::SizeAllCursor; break; - case WebKit::WebCursorInfo::TypeVerticalText: - case WebKit::WebCursorInfo::TypeCell: - case WebKit::WebCursorInfo::TypeContextMenu: - case WebKit::WebCursorInfo::TypeAlias: - case WebKit::WebCursorInfo::TypeProgress: - case WebKit::WebCursorInfo::TypeCopy: - case WebKit::WebCursorInfo::TypeZoomIn: - case WebKit::WebCursorInfo::TypeZoomOut: + case blink::WebCursorInfo::TypeVerticalText: + case blink::WebCursorInfo::TypeCell: + case blink::WebCursorInfo::TypeContextMenu: + case blink::WebCursorInfo::TypeAlias: + case blink::WebCursorInfo::TypeProgress: + case blink::WebCursorInfo::TypeCopy: + case blink::WebCursorInfo::TypeZoomIn: + case blink::WebCursorInfo::TypeZoomOut: // FIXME: Load from the resource bundle. shape = Qt::ArrowCursor; break; - case WebKit::WebCursorInfo::TypeNoDrop: - case WebKit::WebCursorInfo::TypeNotAllowed: + case blink::WebCursorInfo::TypeNoDrop: + case blink::WebCursorInfo::TypeNotAllowed: shape = Qt::ForbiddenCursor; break; - case WebKit::WebCursorInfo::TypeNone: + case blink::WebCursorInfo::TypeNone: shape = Qt::BlankCursor; break; - case WebKit::WebCursorInfo::TypeGrab: + case blink::WebCursorInfo::TypeGrab: shape = Qt::OpenHandCursor; break; - case WebKit::WebCursorInfo::TypeGrabbing: + case blink::WebCursorInfo::TypeGrabbing: shape = Qt::ClosedHandCursor; break; - case WebKit::WebCursorInfo::TypeCustom: + case blink::WebCursorInfo::TypeCustom: // FIXME: Extract from the CursorInfo. shape = Qt::ArrowCursor; break; @@ -562,11 +572,16 @@ void RenderWidgetHostViewQt::OnAcceleratedCompositingStateChange() QT_NOT_YET_IMPLEMENTED } +void RenderWidgetHostViewQt::AcceleratedSurfaceInitialized(int host_id, int route_id) +{ +} + void RenderWidgetHostViewQt::AcceleratedSurfaceBuffersSwapped(const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, int gpu_host_id) { AcceleratedSurfaceMsg_BufferPresented_Params ack_params; ack_params.sync_point = 0; content::RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, gpu_host_id, ack_params); + content::RenderWidgetHostImpl::CompositorFrameDrawn(params.latency_info); } void RenderWidgetHostViewQt::AcceleratedSurfacePostSubBuffer(const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, int gpu_host_id) @@ -574,6 +589,7 @@ void RenderWidgetHostViewQt::AcceleratedSurfacePostSubBuffer(const GpuHostMsg_Ac AcceleratedSurfaceMsg_BufferPresented_Params ack_params; ack_params.sync_point = 0; content::RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, gpu_host_id, ack_params); + content::RenderWidgetHostImpl::CompositorFrameDrawn(params.latency_info); } void RenderWidgetHostViewQt::AcceleratedSurfaceSuspend() @@ -603,7 +619,7 @@ void RenderWidgetHostViewQt::OnSwapCompositorFrame(uint32 output_surface_id, sco m_delegate->update(); } -void RenderWidgetHostViewQt::GetScreenInfo(WebKit::WebScreenInfo* results) +void RenderWidgetHostViewQt::GetScreenInfo(blink::WebScreenInfo* results) { QWindow* window = m_delegate->window(); if (!window) @@ -644,14 +660,26 @@ void RenderWidgetHostViewQt::SelectionChanged(const string16 &text, size_t offse m_adapterClient->selectionChanged(); } -bool RenderWidgetHostViewQt::DispatchLongPressGestureEvent(ui::GestureEvent *) +bool RenderWidgetHostViewQt::CanDispatchToConsumer(ui::GestureConsumer *consumer) { - return false; + Q_ASSERT(static_cast(consumer) == this); + return true; } -bool RenderWidgetHostViewQt::DispatchCancelTouchEvent(ui::TouchEvent *) +void RenderWidgetHostViewQt::DispatchPostponedGestureEvent(ui::GestureEvent* event) { - return false; + ForwardGestureEventToRenderer(event); +} + +void RenderWidgetHostViewQt::DispatchCancelTouchEvent(ui::TouchEvent *event) +{ + if (!m_host) + return; + + blink::WebTouchEvent cancelEvent; + cancelEvent.type = blink::WebInputEvent::TouchCancel; + cancelEvent.timeStampSeconds = event->time_stamp().InSecondsF(); + m_host->ForwardTouchEventWithLatencyInfo(cancelEvent, *event->latency()); } void RenderWidgetHostViewQt::paint(QPainter *painter, const QRectF& boundingRect) @@ -769,7 +797,7 @@ void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWit ui::EventResult result = (ack_result == content::INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; for (ScopedVector::iterator iter = events.begin(), end = events.end(); iter != end; ++iter) { - (*iter)->latency()->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACKED_COMPONENT, static_cast(ack_result), 0); + (*iter)->latency()->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, static_cast(ack_result), 0); scoped_ptr gestures; gestures.reset(m_gestureRecognizer->ProcessTouchEventForGesture(*(*iter), result, this)); ProcessGestures(gestures.get()); @@ -791,25 +819,40 @@ void RenderWidgetHostViewQt::Paint(const gfx::Rect& damage_rect) m_delegate->update(r); } +void RenderWidgetHostViewQt::ForwardGestureEventToRenderer(ui::GestureEvent* gesture) +{ + if ((gesture->type() == ui::ET_GESTURE_PINCH_BEGIN + || gesture->type() == ui::ET_GESTURE_PINCH_UPDATE + || gesture->type() == ui::ET_GESTURE_PINCH_END) + && !shouldSendPinchGesture() + ) { + return; + } + + blink::WebGestureEvent webGestureEvent = content::MakeWebGestureEventFromUIEvent(*gesture); + + if (webGestureEvent.type == blink::WebInputEvent::Undefined) + return; + + if (webGestureEvent.type == blink::WebGestureEvent::GestureTapDown) { + // Chromium does not stop a fling-scroll on tap-down. + // So explicitly send an event to stop any in-progress flings. + m_host->ForwardGestureEvent(createFlingCancelEvent(gesture->time_stamp().InSecondsF())); + } + + webGestureEvent.x = gesture->x(); + webGestureEvent.y = gesture->y(); + m_host->ForwardGestureEvent(webGestureEvent); + + return; +} + void RenderWidgetHostViewQt::ProcessGestures(ui::GestureRecognizer::Gestures *gestures) { if (!gestures || gestures->empty()) return; for (ui::GestureRecognizer::Gestures::iterator g_it = gestures->begin(); g_it != gestures->end(); ++g_it) { - const ui::GestureEvent &uiGestureEvent = **g_it; - WebKit::WebGestureEvent webGestureEvent = content::MakeWebGestureEventFromUIEvent(uiGestureEvent); - if (webGestureEvent.type == WebKit::WebInputEvent::Undefined) - continue; - - if (webGestureEvent.type == WebKit::WebGestureEvent::GestureTapDown) { - // Chromium does not stop a fling-scroll on tap-down. - // So explicitly send an event to stop any in-progress flings. - m_host->ForwardGestureEvent(createFlingCancelEvent(uiGestureEvent.time_stamp().InSecondsF())); - } - - webGestureEvent.x = uiGestureEvent.x(); - webGestureEvent.y = uiGestureEvent.y(); - m_host->ForwardGestureEvent(webGestureEvent); + ForwardGestureEventToRenderer(*g_it); } } @@ -848,7 +891,7 @@ float RenderWidgetHostViewQt::dpiScale() const bool RenderWidgetHostViewQt::IsPopup() const { - return popup_type_ != WebKit::WebPopupTypeNone; + return popup_type_ != blink::WebPopupTypeNone; } void RenderWidgetHostViewQt::handleMouseEvent(QMouseEvent* event) @@ -857,7 +900,7 @@ void RenderWidgetHostViewQt::handleMouseEvent(QMouseEvent* event) if (eventType == QEvent::MouseButtonDblClick) return; - WebKit::WebMouseEvent webEvent = WebEventFactory::toWebMouseEvent(event, dpiScale()); + blink::WebMouseEvent webEvent = WebEventFactory::toWebMouseEvent(event, dpiScale()); if (eventType == QMouseEvent::MouseButtonPress) { if (event->button() != m_clickHelper.lastPressButton || (event->timestamp() - m_clickHelper.lastPressTimestamp > static_cast(qGuiApp->styleHints()->mouseDoubleClickInterval())) @@ -893,7 +936,7 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) gfx::Range selectionRange = gfx::Range::InvalidRange(); const QList &attributes = ev->attributes(); - std::vector underlines; + std::vector underlines; Q_FOREACH (const QInputMethodEvent::Attribute &attribute, attributes) { switch (attribute.type) { @@ -903,10 +946,10 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) QTextCharFormat textCharFormat = attribute.value.value().toCharFormat(); QColor qcolor = textCharFormat.underlineColor(); - WebKit::WebColor color = SkColorSetARGB(qcolor.alpha(), qcolor.red(), qcolor.green(), qcolor.blue()); + blink::WebColor color = SkColorSetARGB(qcolor.alpha(), qcolor.red(), qcolor.green(), qcolor.blue()); int start = qMin(attribute.start, (attribute.start + attribute.length)); int end = qMax(attribute.start, (attribute.start + attribute.length)); - underlines.push_back(WebKit::WebCompositionUnderline(start, end, color, false)); + underlines.push_back(blink::WebCompositionUnderline(start, end, color, false)); break; } case QInputMethodEvent::Cursor: @@ -946,7 +989,7 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev) { // Convert each of our QTouchEvent::TouchPoint to the simpler ui::TouchEvent to // be able to use the same code path for both gesture recognition and WebTouchEvents. - // It's a waste to do a double QTouchEvent -> ui::TouchEvent -> WebKit::WebTouchEvent + // It's a waste to do a double QTouchEvent -> ui::TouchEvent -> blink::WebTouchEvent // conversion but this should hopefully avoid a few bugs in the future. // FIXME: Carry Qt::TouchCancel from the event to each TouchPoint. base::TimeDelta timestamp = base::TimeDelta::FromMilliseconds(ev->timestamp()); @@ -965,7 +1008,7 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev) 0, // angle touchPoint.pressure()); - WebKit::WebTouchPoint *point = content::UpdateWebTouchEventFromUIEvent(uiEvent, &m_accumTouchEvent); + blink::WebTouchPoint *point = content::UpdateWebTouchEventFromUIEvent(uiEvent, &m_accumTouchEvent); if (point) { if (m_host->ShouldForwardTouchEvent()) // This will come back through ProcessAckedTouchEvent if the page didn't want it. diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 541df7d9a..ef8b45755 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -49,8 +49,8 @@ #include "cc/resources/transferable_resource.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "delegated_frame_node.h" -#include "ui/base/gestures/gesture_recognizer.h" -#include "ui/base/gestures/gesture_types.h" +#include "ui/events/gestures/gesture_recognizer.h" +#include "ui/events/gestures/gesture_types.h" #include #include #include @@ -147,13 +147,14 @@ public: virtual void CopyFromCompositingSurfaceToVideoFrame(const gfx::Rect& src_subrect, const scoped_refptr& target, const base::Callback& callback) Q_DECL_OVERRIDE; virtual bool CanCopyToVideoFrame() const Q_DECL_OVERRIDE; virtual void OnAcceleratedCompositingStateChange() Q_DECL_OVERRIDE; + virtual void AcceleratedSurfaceInitialized(int host_id, int route_id) Q_DECL_OVERRIDE; virtual void AcceleratedSurfaceBuffersSwapped(const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, int gpu_host_id) Q_DECL_OVERRIDE; virtual void AcceleratedSurfacePostSubBuffer(const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, int gpu_host_id) Q_DECL_OVERRIDE; virtual void AcceleratedSurfaceSuspend() Q_DECL_OVERRIDE; virtual void AcceleratedSurfaceRelease() Q_DECL_OVERRIDE; virtual bool HasAcceleratedSurface(const gfx::Size&) Q_DECL_OVERRIDE; virtual void OnSwapCompositorFrame(uint32 output_surface_id, scoped_ptr frame) Q_DECL_OVERRIDE; - virtual void GetScreenInfo(WebKit::WebScreenInfo* results) Q_DECL_OVERRIDE; + virtual void GetScreenInfo(blink::WebScreenInfo* results) Q_DECL_OVERRIDE; virtual gfx::Rect GetBoundsInRootWindow() Q_DECL_OVERRIDE; virtual gfx::GLSurfaceHandle GetCompositingSurface() Q_DECL_OVERRIDE; virtual void SetHasHorizontalScrollbar(bool) Q_DECL_OVERRIDE; @@ -165,8 +166,9 @@ public: virtual void SelectionChanged(const string16 &text, size_t offset, const gfx::Range &range) Q_DECL_OVERRIDE; // Overridden from ui::GestureEventHelper. - virtual bool DispatchLongPressGestureEvent(ui::GestureEvent *event) Q_DECL_OVERRIDE; - virtual bool DispatchCancelTouchEvent(ui::TouchEvent *event) Q_DECL_OVERRIDE; + virtual bool CanDispatchToConsumer(ui::GestureConsumer*) Q_DECL_OVERRIDE; + virtual void DispatchPostponedGestureEvent(ui::GestureEvent*) Q_DECL_OVERRIDE; + virtual void DispatchCancelTouchEvent(ui::TouchEvent*) Q_DECL_OVERRIDE; // Overridden from RenderWidgetHostViewQtDelegateClient. virtual void paint(QPainter *, const QRectF& boundingRect) Q_DECL_OVERRIDE; @@ -213,6 +215,7 @@ private: void sendDelegatedFrameAck(); void Paint(const gfx::Rect& damage_rect); void ProcessGestures(ui::GestureRecognizer::Gestures *gestures); + void ForwardGestureEventToRenderer(ui::GestureEvent* gesture); int GetMappedTouch(int qtTouchId); void RemoveExpiredMappings(QTouchEvent *ev); float dpiScale() const; @@ -222,7 +225,7 @@ private: content::RenderWidgetHostImpl *m_host; scoped_ptr m_gestureRecognizer; QMap m_touchIdMapping; - WebKit::WebTouchEvent m_accumTouchEvent; + blink::WebTouchEvent m_accumTouchEvent; scoped_ptr m_delegate; BackingStoreQt *m_backingStore; diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 75ec94e6e..cfa6b0ae6 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -45,6 +45,7 @@ #include "base/threading/worker_pool.h" #include "base/threading/sequenced_worker_pool.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/cookie_crypto_delegate.h" #include "content/public/browser/cookie_store_factory.h" #include "net/base/cache_type.h" #include "net/cert/cert_verifier.h" @@ -96,7 +97,7 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext() m_urlRequestContext->set_network_delegate(m_networkDelegate.get()); base::FilePath cookiesPath = m_basePath.Append(FILE_PATH_LITERAL("Cookies")); - scoped_refptr cookieStore = content::CreatePersistentCookieStore(cookiesPath, true, NULL, NULL, scoped_refptr()); + scoped_refptr cookieStore = content::CreatePersistentCookieStore(cookiesPath, true, NULL, NULL, scoped_ptr()); cookieStore->GetCookieMonster()->SetPersistSessionCookies(true); m_storage.reset(new net::URLRequestContextStorage(m_urlRequestContext.get())); @@ -105,7 +106,7 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext() new net::DefaultServerBoundCertStore(NULL), base::WorkerPool::GetTaskRunner(true))); m_storage->set_http_user_agent_settings( - new net::StaticHttpUserAgentSettings("en-us,en", EmptyString())); + new net::StaticHttpUserAgentSettings("en-us,en", base::EmptyString())); scoped_ptr host_resolver( net::HostResolver::CreateDefaultResolver(NULL)); @@ -168,7 +169,7 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext() chrome::kFileScheme, new net::FileProtocolHandler(content::BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); m_jobFactory->SetProtocolHandler(kQrcSchemeQt, new QrcProtocolHandlerQt()); - m_jobFactory->SetProtocolHandler(chrome::kFtpScheme, new net::FtpProtocolHandler( + m_jobFactory->SetProtocolHandler(content::kFtpScheme, new net::FtpProtocolHandler( new net::FtpNetworkLayer(m_urlRequestContext->host_resolver()))); m_urlRequestContext->set_job_factory(m_jobFactory.get()); } diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 4b5af4cef..465c7be9d 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -418,15 +418,14 @@ QString WebContentsAdapter::getNavigationEntryTitle(int index) void WebContentsAdapter::clearNavigationHistory() { Q_D(WebContentsAdapter); - if (d->webContents->GetController().CanPruneAllButVisible()) - d->webContents->GetController().PruneAllButVisible(); + if (d->webContents->GetController().CanPruneAllButLastCommitted()) + d->webContents->GetController().PruneAllButLastCommitted(); } void WebContentsAdapter::setZoomFactor(qreal factor) { Q_D(WebContentsAdapter); - if (content::RenderViewHost *rvh = d->webContents->GetRenderViewHost()) - rvh->SetZoomLevel(content::ZoomFactorToZoomLevel(static_cast(factor))); + d->webContents->SetZoomLevel(content::ZoomFactorToZoomLevel(static_cast(factor))); } qreal WebContentsAdapter::currentZoomFactor() const @@ -475,7 +474,7 @@ quint64 WebContentsAdapter::fetchDocumentInnerText() quint64 WebContentsAdapter::findText(const QString &subString, bool caseSensitively, bool findBackward) { Q_D(WebContentsAdapter); - WebKit::WebFindOptions options; + blink::WebFindOptions options; options.forward = !findBackward; options.matchCase = caseSensitively; options.findNext = subString == d->lastSearchedString; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 30497e5de..057201721 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -102,13 +102,13 @@ void WebContentsDelegateQt::DidStartProvisionalLoadForFrame(int64, int64, bool i m_viewClient->loadStarted(toQt(validated_url)); } -void WebContentsDelegateQt::DidCommitProvisionalLoadForFrame(int64, bool is_main_frame, const GURL& url, content::PageTransition transition_type, content::RenderViewHost *render_view_host) +void WebContentsDelegateQt::DidCommitProvisionalLoadForFrame(int64 frame_id, const base::string16& frame_unique_name, bool is_main_frame, const GURL& url, content::PageTransition transition_type, content::RenderViewHost* render_view_host) { // This is currently used for canGoBack/Forward values, which is flattened across frames. For other purposes we might have to pass is_main_frame. m_viewClient->loadCommitted(); } -void WebContentsDelegateQt::DidFailProvisionalLoad(int64 frame_id, bool is_main_frame, const GURL& validated_url, int error_code, const string16& error_description, content::RenderViewHost *render_view_host) +void WebContentsDelegateQt::DidFailProvisionalLoad(int64 frame_id, const base::string16& frame_unique_name, bool is_main_frame, const GURL& validated_url, int error_code, const base::string16& error_description, content::RenderViewHost* render_view_host) { DidFailLoad(frame_id, validated_url, is_main_frame, error_code, error_description, render_view_host); } diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index ac787f50c..089ba6644 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -68,8 +68,8 @@ public: virtual void CloseContents(content::WebContents *source) Q_DECL_OVERRIDE; virtual void LoadProgressChanged(content::WebContents* source, double progress) Q_DECL_OVERRIDE; virtual void DidStartProvisionalLoadForFrame(int64 frame_id, int64 parent_frame_id, bool is_main_frame, const GURL &validated_url, bool is_error_page, bool is_iframe_srcdoc, content::RenderViewHost *render_view_host) Q_DECL_OVERRIDE; - virtual void DidCommitProvisionalLoadForFrame(int64 frame_id, bool is_main_frame, const GURL &url, content::PageTransition transition_type, content::RenderViewHost *render_view_host) Q_DECL_OVERRIDE; - virtual void DidFailProvisionalLoad(int64 frame_id, bool is_main_frame, const GURL &validated_url, int error_code, const string16& error_description, content::RenderViewHost *render_view_host) Q_DECL_OVERRIDE; + virtual void DidCommitProvisionalLoadForFrame(int64 frame_id, const base::string16& frame_unique_name, bool is_main_frame, const GURL& url, content::PageTransition transition_type, content::RenderViewHost* render_view_host) Q_DECL_OVERRIDE; + virtual void DidFailProvisionalLoad(int64 frame_id, const base::string16& frame_unique_name, bool is_main_frame, const GURL& validated_url, int error_code, const base::string16& error_description, content::RenderViewHost* render_view_host) Q_DECL_OVERRIDE; virtual void DidFailLoad(int64 frame_id, const GURL &validated_url, bool is_main_frame, int error_code, const string16 &error_description, content::RenderViewHost *render_view_host) Q_DECL_OVERRIDE; virtual void DidFinishLoad(int64 frame_id, const GURL &validated_url, bool is_main_frame, content::RenderViewHost *render_view_host) Q_DECL_OVERRIDE; virtual void DidUpdateFaviconURL(int32 page_id, const std::vector& candidates) Q_DECL_OVERRIDE; diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index 5ae238b21..e3cc5963b 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -126,7 +126,7 @@ void WebContentsViewQt::ShowContextMenu(const content::ContextMenuParams ¶ms m_client->contextMenuRequested(contextMenuData); } -void WebContentsViewQt::StartDragging(const content::DropData& drop_data, WebKit::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, const content::DragEventSourceInfo& event_info) +void WebContentsViewQt::StartDragging(const content::DropData& drop_data, blink::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, const content::DragEventSourceInfo& event_info) { Q_UNUSED(&drop_data); Q_UNUSED(allowed_ops); diff --git a/src/core/web_contents_view_qt.h b/src/core/web_contents_view_qt.h index e8a0f6b1f..f53476172 100644 --- a/src/core/web_contents_view_qt.h +++ b/src/core/web_contents_view_qt.h @@ -110,7 +110,7 @@ public: virtual void ShowPopupMenu(const gfx::Rect& bounds, int item_height, double item_font_size, int selected_item, const std::vector& items, bool right_aligned, bool allow_multiple_selection) Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } - virtual void StartDragging(const content::DropData& drop_data, WebKit::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, const content::DragEventSourceInfo& event_info) Q_DECL_OVERRIDE; + virtual void StartDragging(const content::DropData& drop_data, blink::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, const content::DragEventSourceInfo& event_info) Q_DECL_OVERRIDE; virtual void ShowContextMenu(const content::ContextMenuParams ¶ms) Q_DECL_OVERRIDE; @@ -121,6 +121,8 @@ public: virtual void CloseTabAfterEventTracking() Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED } virtual bool GetAllowOverlappingViews() const Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED; return false; } virtual bool IsEventTracking() const Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED; return false; } + virtual void SetOverlayView(WebContentsView* overlay, const gfx::Point& offset) { QT_NOT_YET_IMPLEMENTED } + virtual void RemoveOverlayView() { QT_NOT_YET_IMPLEMENTED } #endif // defined(OS_MACOSX) private: diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index febad0a3a..544ac83f6 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -41,7 +41,7 @@ ****************************************************************************/ #include "web_event_factory.h" -#include "third_party/WebKit/Source/core/platform/WindowsKeyboardCodes.h" +#include "third_party/WebKit/Source/platform/WindowsKeyboardCodes.h" #include #include @@ -50,7 +50,7 @@ static const int wheelScrollLines = 3; // FIXME: Still not available in QStyleHints in 5.1 -using namespace WebKit; +using namespace blink; static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad) { @@ -558,7 +558,7 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QHoverEvent *ev, double dpiScale) return webKitEvent; } -WebKit::WebMouseWheelEvent WebEventFactory::toWebWheelEvent(QWheelEvent *ev, double dpiScale) +blink::WebMouseWheelEvent WebEventFactory::toWebWheelEvent(QWheelEvent *ev, double dpiScale) { WebMouseWheelEvent webEvent; webEvent.type = webEventTypeForEvent(ev); diff --git a/src/core/web_event_factory.h b/src/core/web_event_factory.h index 29a75a285..14c375bc2 100644 --- a/src/core/web_event_factory.h +++ b/src/core/web_event_factory.h @@ -57,9 +57,9 @@ QT_END_NAMESPACE class WebEventFactory { public: - static WebKit::WebMouseEvent toWebMouseEvent(QMouseEvent*, double dpiScale); - static WebKit::WebMouseEvent toWebMouseEvent(QHoverEvent*, double dpiScale); - static WebKit::WebMouseWheelEvent toWebWheelEvent(QWheelEvent*, double dpiScale); + static blink::WebMouseEvent toWebMouseEvent(QMouseEvent*, double dpiScale); + static blink::WebMouseEvent toWebMouseEvent(QHoverEvent*, double dpiScale); + static blink::WebMouseWheelEvent toWebWheelEvent(QWheelEvent*, double dpiScale); static content::NativeWebKeyboardEvent toWebKeyboardEvent(QKeyEvent*); }; -- cgit v1.2.3