diff --git a/blinq.pri b/blinq.pri index f7d86109fa182c4ce783c03c293cbf7005d9dc08..3283ebafd6a4ae38fb0484c9e85aed3392a6c82b 100644 --- a/blinq.pri +++ b/blinq.pri @@ -3,7 +3,8 @@ isEmpty(CHROMIUM_SRC_DIR): error("Set CHROMIUM_SRC_DIR please...") INCLUDEPATH += $$CHROMIUM_SRC_DIR/ -BUILD_DIR = $$CHROMIUM_SRC_DIR/out/Release +CONFIG(debug, debug|release): BUILD_DIR = $$CHROMIUM_SRC_DIR/out/Debug +else: BUILD_DIR = $$CHROMIUM_SRC_DIR/out/Release exists($$BUILD_DIR/obj/content/libcontent_app.a): CONFIG += chromium_is_static @@ -225,5 +226,50 @@ for (dir, DIRS) { QMAKE_LIBDIR += $$BUILD_DIR/$$dir } +QMAKE_CXXFLAGS += -D_FILE_OFFSET_BITS=64 -DUSE_LINUX_BREAKPAD -DDISABLE_NACL -DCHROMIUM_BUILD -DUSE_DEFAULT_RENDER_THEME=1 -DUSE_LIBJPEG_TURBO=1 -DUSE_NSS=1 -DENABLE_ONE_CLICK_SIGNIN -DGTK_DISABLE_SINGLE_INCLUDES=1 -DENABLE_REMOTING=1 -DENABLE_WEBRTC=1 -DENABLE_CONFIGURATION_POLICY -DENABLE_INPUT_SPEECH -DENABLE_NOTIFICATIONS -DENABLE_GPU=1 -DENABLE_EGLIMAGE=1 -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PLUGIN_INSTALLATION=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_BACKGROUND=1 -DENABLE_AUTOMATION=1 -DENABLE_GOOGLE_NOW=1 -DENABLE_LANGUAGE_DETECTION=1 -DENABLE_PRINTING=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_MANAGED_USERS=1 '-DCONTENT_SHELL_VERSION="19.77.34.5"' -DGL_GLEXT_PROTOTYPES -DLIBPEERCONNECTION_LIB=1 -DSK_BUILD_NO_IMAGE_ENCODE -DSK_DEFERRED_CANVAS_USES_GPIPE=1 '-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"' -DGR_AGGRESSIVE_SHADER_OPTS=1 -DSK_ENABLE_INST_COUNT=0 -DSK_USE_POSIX_THREADS -DU_USING_ICU_NAMESPACE=0 -DU_STATIC_IMPLEMENTATION -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -D_FORTIFY_SOURCE=2 + +cr_inc_paths += \ + ../../third_party/icu/public/common \ + ../../third_party/icu/public/i18n \ + ../.. -I../../third_party/khronos \ + ../../gpu \ + gen/content \ + gen/net \ + ../../skia/config \ + ../../third_party/skia/src/core \ + ../../third_party/skia/include/config \ + ../../third_party/skia/include/core \ + ../../third_party/skia/include/effects \ + ../../third_party/skia/include/pdf \ + ../../third_party/skia/include/gpu \ + ../../third_party/skia/include/gpu/gl \ + ../../third_party/skia/include/pipe \ + ../../third_party/skia/include/ports \ + ../../third_party/skia/include/utils \ + ../../skia/ext \ + gen/ui/gl \ + ../../third_party/mesa/MesaLib/include \ + ../../v8/include \ + gen/webkit \ + ../../third_party/WebKit/Source/Platform/chromium \ + ../../third_party/WebKit/Source/Platform/chromium \ + gen/webcore_headers \ + ../../third_party/npapi \ + ../../third_party/npapi/bindings \ + ../../third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public \ + ../../third_party/WebKit/Source \ + ../../third_party/freetype2/include \ + ../../third_party/freetype2/src/include + +for (inc, cr_inc_paths) { + INCLUDEPATH += $$BUILD_DIR/$$inc +} + +CONFIG += link_pkgconfig +PKGCONFIG_PRIVATE = gdk-2.0 + +DEFINES += QT_NO_KEYWORDS + !chromium_is_static: QMAKE_RPATHDIR += $${BUILD_DIR}/lib +QMAKE_CXXFLAGS += -fno-rtti diff --git a/blinq.pro b/blinq.pro index 1212f825b39256ab2a3d78bdecbac18b3a3d6887..b995b45fbc4415be702abb4d8a269cb952a63512 100644 --- a/blinq.pro +++ b/blinq.pro @@ -2,4 +2,5 @@ TEMPLATE = subdirs # Directories SUBDIRS = process \ - lib + lib \ + example diff --git a/example/example.pro b/example/example.pro new file mode 100644 index 0000000000000000000000000000000000000000..2a8e83614e0df023dd6722698c0e196cecf775a6 --- /dev/null +++ b/example/example.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +TARGET = example + +SOURCES = main.cpp + +INCLUDEPATH += ../lib + +LIBS += -L../lib -lblinq + +QT += widgets + +QMAKE_RPATHDIR += ../lib diff --git a/example/main.cpp b/example/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..566adf7e931689e98918e36cf6a3141789937e58 --- /dev/null +++ b/example/main.cpp @@ -0,0 +1,15 @@ +#include <QtGui> + +#include <blinqpage.h> + +int main(int argc, char **argv) +{ + printf("main called\n"); + QGuiApplication app(argc, argv); + + BlinqPage page; + page.window()->show(); + + return app.exec(); +} + diff --git a/lib/blinqpage.cpp b/lib/blinqpage.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f499472efcbbf0a0d2d825519007ed07ac96d34e --- /dev/null +++ b/lib/blinqpage.cpp @@ -0,0 +1,113 @@ +#include "blinqpage.h" + +#include "content/public/browser/web_contents.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/resource_context.h" +#include "content/public/browser/storage_partition.h" +#include "content/public/app/content_main_runner.h" +#include "net/url_request/url_request_context_getter.h" + +namespace { + +class Context; + +class ResourceContext : public content::ResourceContext +{ +public: + ResourceContext(Context *ctx) + : context(ctx) + {} + + virtual net::HostResolver* GetHostResolver() { return 0; } + + inline virtual net::URLRequestContext* GetRequestContext(); + +private: + Context *context; +}; + + +class Context : public content::BrowserContext +{ +public: + Context() + { + resourceContext.reset(new ResourceContext(this)); + } + virtual ~Context() {} + + virtual base::FilePath GetPath() + { + return base::FilePath(); + } + + virtual bool IsOffTheRecord() const + { + return false; + } + + virtual net::URLRequestContextGetter* GetRequestContext() + { + return GetDefaultStoragePartition(this)->GetURLRequestContext(); + } + virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(int) { return GetRequestContext(); } + virtual net::URLRequestContextGetter* GetMediaRequestContext() { return GetRequestContext(); } + virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(int) { return GetRequestContext(); } + virtual net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition(const base::FilePath&, bool) { return GetRequestContext(); } + + virtual content::ResourceContext* GetResourceContext() + { + return resourceContext.get(); + } + + virtual content::DownloadManagerDelegate* GetDownloadManagerDelegate() { return 0; } + virtual content::GeolocationPermissionContext* GetGeolocationPermissionContext() { return 0; } + virtual content::SpeechRecognitionPreferences* GetSpeechRecognitionPreferences() { return 0; } + virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() { return 0; } + +private: + scoped_ptr<content::ResourceContext> resourceContext; + + DISALLOW_COPY_AND_ASSIGN(Context); +}; + +inline net::URLRequestContext* ResourceContext::GetRequestContext() +{ + return context->GetRequestContext()->GetURLRequestContext(); +} + +} + +class BlinqPagePrivate +{ +public: + QWindow *window; + scoped_ptr<content::BrowserContext> context; + scoped_ptr<content::WebContents> contents; +}; + +BlinqPage::BlinqPage() +{ + static content::ContentMainRunner *runner = 0; + if (!runner) { + runner = content::ContentMainRunner::Create(); + runner->Initialize(0, 0, 0); + } + + d.reset(new BlinqPagePrivate); + d->window = 0; + d->context.reset(new Context); + d->contents.reset(content::WebContents::Create(content::WebContents::CreateParams(d->context.get()))); +} + +BlinqPage::~BlinqPage() +{ +} + +QWindow *BlinqPage::window() +{ + if (!d->window) { + } + return d->window; +} + diff --git a/lib/blinqpage.h b/lib/blinqpage.h new file mode 100644 index 0000000000000000000000000000000000000000..3bc15d341e0ce31c1406bb3ee5c80f72634eafb1 --- /dev/null +++ b/lib/blinqpage.h @@ -0,0 +1,23 @@ +#ifndef BLINQPAGE_H +#define BLINQPAGE_H + +#include <QObject> +#include <QScopedPointer> + +class QWindow; + +class BlinqPagePrivate; + +class BlinqPage +{ +public: + BlinqPage(); + ~BlinqPage(); + + QWindow *window(); + +private: + QScopedPointer<BlinqPagePrivate> d; +}; + +#endif // BLINQPAGE_H diff --git a/lib/lib.pro b/lib/lib.pro index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..faedab916aa66c7cb7278fb7a6800823e8cda321 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -0,0 +1,9 @@ +TEMPLATE = lib +TARGET = blinq +VERSION = 0.0.1 + +SOURCES = blinqpage.cpp + +include(../blinq.pri) + +