Merge pull request #24 from hlwhl/refine
Refine code for futher development
2
.gitignore
vendored
@@ -41,7 +41,7 @@ migrate_working_dir/
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "simple_app.h"
|
||||
#include "webview_app.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -76,11 +76,11 @@ private:
|
||||
|
||||
} // namespace
|
||||
|
||||
SimpleApp::SimpleApp(CefRefPtr<SimpleHandler> handler) {
|
||||
WebviewApp::WebviewApp(CefRefPtr<WebviewHandler> handler) {
|
||||
m_handler = handler;
|
||||
}
|
||||
|
||||
void SimpleApp::OnContextInitialized() {
|
||||
void WebviewApp::OnContextInitialized() {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
// Specify CEF browser settings here.
|
||||
@@ -97,7 +97,7 @@ void SimpleApp::OnContextInitialized() {
|
||||
nullptr, nullptr);
|
||||
}
|
||||
|
||||
CefRefPtr<CefClient> SimpleApp::GetDefaultClient() {
|
||||
CefRefPtr<CefClient> WebviewApp::GetDefaultClient() {
|
||||
// Called when a new browser window is created via the Chrome runtime UI.
|
||||
return SimpleHandler::GetInstance();
|
||||
return WebviewHandler::GetInstance();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
#include "include/cef_app.h"
|
||||
#include <functional>
|
||||
#include "simple_handler.h"
|
||||
#include "webview_handler.h"
|
||||
|
||||
// Implement application-level callbacks for the browser process.
|
||||
class SimpleApp : public CefApp, public CefBrowserProcessHandler {
|
||||
class WebviewApp : public CefApp, public CefBrowserProcessHandler {
|
||||
public:
|
||||
SimpleApp(CefRefPtr<SimpleHandler> handler);
|
||||
WebviewApp(CefRefPtr<WebviewHandler> handler);
|
||||
|
||||
// CefApp methods:
|
||||
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override {
|
||||
@@ -34,9 +34,9 @@ public:
|
||||
CefRefPtr<CefClient> GetDefaultClient() override;
|
||||
|
||||
private:
|
||||
CefRefPtr<SimpleHandler> m_handler;
|
||||
CefRefPtr<WebviewHandler> m_handler;
|
||||
// Include the default reference counting implementation.
|
||||
IMPLEMENT_REFCOUNTING(SimpleApp);
|
||||
IMPLEMENT_REFCOUNTING(WebviewApp);
|
||||
};
|
||||
|
||||
#endif // CEF_TESTS_CEFSIMPLE_SIMPLE_APP_H_
|
||||
@@ -2,7 +2,7 @@
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "simple_handler.h"
|
||||
#include "webview_handler.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
SimpleHandler* g_instance = nullptr;
|
||||
WebviewHandler* g_instance = nullptr;
|
||||
|
||||
// Returns a data: URI with the specified contents.
|
||||
std::string GetDataURI(const std::string& data, const std::string& mime_type) {
|
||||
@@ -29,64 +29,40 @@ std::string GetDataURI(const std::string& data, const std::string& mime_type) {
|
||||
|
||||
} // namespace
|
||||
|
||||
SimpleHandler::SimpleHandler(bool use_views)
|
||||
: use_views_(use_views), is_closing_(false) {
|
||||
WebviewHandler::WebviewHandler() {
|
||||
DCHECK(!g_instance);
|
||||
g_instance = this;
|
||||
}
|
||||
|
||||
SimpleHandler::~SimpleHandler() {
|
||||
WebviewHandler::~WebviewHandler() {
|
||||
g_instance = nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
SimpleHandler* SimpleHandler::GetInstance() {
|
||||
WebviewHandler* WebviewHandler::GetInstance() {
|
||||
return g_instance;
|
||||
}
|
||||
|
||||
void SimpleHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
void WebviewHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
if (use_views_) {
|
||||
// Set the title of the window using the Views framework.
|
||||
CefRefPtr<CefBrowserView> browser_view =
|
||||
CefBrowserView::GetForBrowser(browser);
|
||||
if (browser_view) {
|
||||
CefRefPtr<CefWindow> window = browser_view->GetWindow();
|
||||
if (window)
|
||||
window->SetTitle(title);
|
||||
}
|
||||
} else if (!IsChromeRuntimeEnabled()) {
|
||||
// Set the title of the window using platform APIs.
|
||||
PlatformTitleChange(browser, title);
|
||||
}
|
||||
//todo: title change
|
||||
}
|
||||
|
||||
void SimpleHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
||||
void WebviewHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
// Add to the list of existing browsers.
|
||||
browser_list_.push_back(browser);
|
||||
}
|
||||
|
||||
bool SimpleHandler::DoClose(CefRefPtr<CefBrowser> browser) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
// Closing the main window requires special handling. See the DoClose()
|
||||
// documentation in the CEF header for a detailed destription of this
|
||||
// process.
|
||||
if (browser_list_.size() == 1) {
|
||||
// Set a flag to indicate that the window close should be allowed.
|
||||
is_closing_ = true;
|
||||
}
|
||||
|
||||
bool WebviewHandler::DoClose(CefRefPtr<CefBrowser> browser) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
// Allow the close. For windowed browsers this will result in the OS close
|
||||
// event being sent.
|
||||
return false;
|
||||
}
|
||||
|
||||
void SimpleHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
||||
void WebviewHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
// Remove from the list of existing browsers.
|
||||
@@ -104,7 +80,7 @@ void SimpleHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
||||
}
|
||||
}
|
||||
|
||||
bool SimpleHandler::OnBeforePopup(CefRefPtr<CefBrowser> browser,
|
||||
bool WebviewHandler::OnBeforePopup(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& target_url,
|
||||
const CefString& target_frame_name,
|
||||
@@ -120,7 +96,7 @@ bool SimpleHandler::OnBeforePopup(CefRefPtr<CefBrowser> browser,
|
||||
return true;
|
||||
}
|
||||
|
||||
void SimpleHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
void WebviewHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
@@ -145,7 +121,7 @@ void SimpleHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
frame->LoadURL(GetDataURI(ss.str(), "text/html"));
|
||||
}
|
||||
|
||||
void SimpleHandler::CloseAllBrowsers(bool force_close) {
|
||||
void WebviewHandler::CloseAllBrowsers(bool force_close) {
|
||||
if (!CefCurrentlyOn(TID_UI)) {
|
||||
// Execute on the UI thread.
|
||||
// CefPostTask(TID_UI, base::BindOnce(&SimpleHandler::CloseAllBrowsers, this,
|
||||
@@ -162,7 +138,7 @@ void SimpleHandler::CloseAllBrowsers(bool force_close) {
|
||||
}
|
||||
|
||||
// static
|
||||
bool SimpleHandler::IsChromeRuntimeEnabled() {
|
||||
bool WebviewHandler::IsChromeRuntimeEnabled() {
|
||||
static int value = -1;
|
||||
if (value == -1) {
|
||||
CefRefPtr<CefCommandLine> command_line =
|
||||
@@ -172,7 +148,7 @@ bool SimpleHandler::IsChromeRuntimeEnabled() {
|
||||
return value == 1;
|
||||
}
|
||||
|
||||
void SimpleHandler::sendScrollEvent(int x, int y, int deltaX, int deltaY) {
|
||||
void WebviewHandler::sendScrollEvent(int x, int y, int deltaX, int deltaY) {
|
||||
BrowserList::const_iterator it = browser_list_.begin();
|
||||
if (it != browser_list_.end()) {
|
||||
CefMouseEvent ev;
|
||||
@@ -182,7 +158,7 @@ void SimpleHandler::sendScrollEvent(int x, int y, int deltaX, int deltaY) {
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleHandler::changeSize(float a_dpi, int w, int h)
|
||||
void WebviewHandler::changeSize(float a_dpi, int w, int h)
|
||||
{
|
||||
this->dpi = a_dpi;
|
||||
this->width = w;
|
||||
@@ -193,7 +169,7 @@ void SimpleHandler::changeSize(float a_dpi, int w, int h)
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleHandler::cursorClick(int x, int y, bool up)
|
||||
void WebviewHandler::cursorClick(int x, int y, bool up)
|
||||
{
|
||||
BrowserList::const_iterator it = browser_list_.begin();
|
||||
if (it != browser_list_.end()) {
|
||||
@@ -211,7 +187,7 @@ void SimpleHandler::cursorClick(int x, int y, bool up)
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleHandler::cursorMove(int x , int y, bool dragging)
|
||||
void WebviewHandler::cursorMove(int x , int y, bool dragging)
|
||||
{
|
||||
BrowserList::const_iterator it = browser_list_.begin();
|
||||
if (it != browser_list_.end()) {
|
||||
@@ -229,7 +205,7 @@ void SimpleHandler::cursorMove(int x , int y, bool dragging)
|
||||
}
|
||||
}
|
||||
|
||||
bool SimpleHandler::StartDragging(CefRefPtr<CefBrowser> browser,
|
||||
bool WebviewHandler::StartDragging(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDragData> drag_data,
|
||||
DragOperationsMask allowed_ops,
|
||||
int x,
|
||||
@@ -246,7 +222,7 @@ bool SimpleHandler::StartDragging(CefRefPtr<CefBrowser> browser,
|
||||
return true;
|
||||
}
|
||||
|
||||
void SimpleHandler::sendKeyEvent(CefKeyEvent ev)
|
||||
void WebviewHandler::sendKeyEvent(CefKeyEvent ev)
|
||||
{
|
||||
BrowserList::const_iterator it = browser_list_.begin();
|
||||
if (it != browser_list_.end()) {
|
||||
@@ -254,7 +230,7 @@ void SimpleHandler::sendKeyEvent(CefKeyEvent ev)
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleHandler::loadUrl(std::string url)
|
||||
void WebviewHandler::loadUrl(std::string url)
|
||||
{
|
||||
BrowserList::const_iterator it = browser_list_.begin();
|
||||
if (it != browser_list_.end()) {
|
||||
@@ -262,28 +238,28 @@ void SimpleHandler::loadUrl(std::string url)
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleHandler::goForward() {
|
||||
void WebviewHandler::goForward() {
|
||||
BrowserList::const_iterator it = browser_list_.begin();
|
||||
if (it != browser_list_.end()) {
|
||||
(*it)->GetMainFrame()->GetBrowser()->GoForward();
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleHandler::goBack() {
|
||||
void WebviewHandler::goBack() {
|
||||
BrowserList::const_iterator it = browser_list_.begin();
|
||||
if (it != browser_list_.end()) {
|
||||
(*it)->GetMainFrame()->GetBrowser()->GoBack();
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleHandler::reload() {
|
||||
void WebviewHandler::reload() {
|
||||
BrowserList::const_iterator it = browser_list_.begin();
|
||||
if (it != browser_list_.end()) {
|
||||
(*it)->GetMainFrame()->GetBrowser()->Reload();
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleHandler::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect) {
|
||||
void WebviewHandler::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
rect.x = rect.y = 0;
|
||||
@@ -301,17 +277,13 @@ void SimpleHandler::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect) {
|
||||
}
|
||||
}
|
||||
|
||||
bool SimpleHandler::GetScreenInfo(CefRefPtr<CefBrowser> browser, CefScreenInfo& screen_info) {
|
||||
bool WebviewHandler::GetScreenInfo(CefRefPtr<CefBrowser> browser, CefScreenInfo& screen_info) {
|
||||
//todo: hi dpi support
|
||||
screen_info.device_scale_factor = this->dpi;
|
||||
return false;
|
||||
}
|
||||
|
||||
void SimpleHandler::OnPaint(CefRefPtr<CefBrowser> browser, CefRenderHandler::PaintElementType type,
|
||||
void WebviewHandler::OnPaint(CefRefPtr<CefBrowser> browser, CefRenderHandler::PaintElementType type,
|
||||
const CefRenderHandler::RectList &dirtyRects, const void *buffer, int w, int h) {
|
||||
onPaintCallback(buffer, w, h);
|
||||
}
|
||||
|
||||
void SimpleHandler::PlatformTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) {
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
||||
class SimpleHandler : public CefClient,
|
||||
class WebviewHandler : public CefClient,
|
||||
public CefDisplayHandler,
|
||||
public CefLifeSpanHandler,
|
||||
public CefLoadHandler,
|
||||
@@ -18,11 +18,11 @@ public CefRenderHandler{
|
||||
public:
|
||||
std::function<void(const void*, int32_t width, int32_t height)> onPaintCallback;
|
||||
|
||||
explicit SimpleHandler(bool use_views);
|
||||
~SimpleHandler();
|
||||
explicit WebviewHandler();
|
||||
~WebviewHandler();
|
||||
|
||||
// Provide access to the single global instance of this object.
|
||||
static SimpleHandler* GetInstance();
|
||||
static WebviewHandler* GetInstance();
|
||||
|
||||
// CefClient methods:
|
||||
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() override {
|
||||
@@ -75,8 +75,6 @@ public:
|
||||
// Request that all existing browser windows close.
|
||||
void CloseAllBrowsers(bool force_close);
|
||||
|
||||
bool IsClosing() const { return is_closing_; }
|
||||
|
||||
// Returns true if the Chrome runtime is enabled.
|
||||
static bool IsChromeRuntimeEnabled();
|
||||
|
||||
@@ -96,21 +94,12 @@ private:
|
||||
float dpi = 1.0;
|
||||
bool is_dragging = false;
|
||||
|
||||
// Platform-specific implementation.
|
||||
void PlatformTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title);
|
||||
|
||||
// True if the application is using the Views framework.
|
||||
const bool use_views_;
|
||||
|
||||
// List of existing browser windows. Only accessed on the CEF UI thread.
|
||||
typedef std::list<CefRefPtr<CefBrowser>> BrowserList;
|
||||
BrowserList browser_list_;
|
||||
|
||||
bool is_closing_;
|
||||
|
||||
// Include the default reference counting implementation.
|
||||
IMPLEMENT_REFCOUNTING(SimpleHandler);
|
||||
IMPLEMENT_REFCOUNTING(WebviewHandler);
|
||||
};
|
||||
|
||||
#endif // CEF_TESTS_CEFSIMPLE_SIMPLE_HANDLER_H_
|
||||
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
BIN
example/macos/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
Normal file
|
After Width: | Height: | Size: 520 B |
|
After Width: | Height: | Size: 14 KiB |
BIN
example/macos/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 36 KiB |
BIN
example/macos/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
@@ -22,11 +22,10 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
|
||||
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
|
||||
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
|
||||
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
|
||||
6593CD652897C523004EBBFE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6593CD642897C523004EBBFE /* AppDelegate.m */; };
|
||||
6593CD672897C681004EBBFE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6593CD662897C681004EBBFE /* main.m */; };
|
||||
65A31E7828F94DC70084A313 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A31E7728F94DC70084A313 /* AppDelegate.swift */; };
|
||||
65A31E7A28F94DF70084A313 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 65A31E7928F94DF70084A313 /* Assets.xcassets */; };
|
||||
9BEC192FBCCC4448BE9CCEC2 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4B5197F4C8A9CD3178DC66E /* Pods_Runner.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@@ -58,7 +57,6 @@
|
||||
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
||||
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
||||
33CC10ED2044A3C60003C045 /* webview_cef_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = webview_cef_example.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
||||
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = "<group>"; };
|
||||
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = "<group>"; };
|
||||
@@ -70,9 +68,8 @@
|
||||
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
|
||||
45472515FD3D18C36021F832 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
5C516FEBF47E87731E22BEE4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
6593CD632897C523004EBBFE /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
6593CD642897C523004EBBFE /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
6593CD662897C681004EBBFE /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
65A31E7728F94DC70084A313 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = ../../../../untitled/macos/Runner/AppDelegate.swift; sourceTree = "<group>"; };
|
||||
65A31E7928F94DF70084A313 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
||||
A4B5197F4C8A9CD3178DC66E /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -123,7 +120,7 @@
|
||||
33CC11242044D66E0003C045 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
33CC10F22044A3C60003C045 /* Assets.xcassets */,
|
||||
65A31E7928F94DF70084A313 /* Assets.xcassets */,
|
||||
33CC10F42044A3C60003C045 /* MainMenu.xib */,
|
||||
33CC10F72044A3C60003C045 /* Info.plist */,
|
||||
);
|
||||
@@ -145,9 +142,7 @@
|
||||
33FAB671232836740065AC1E /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6593CD662897C681004EBBFE /* main.m */,
|
||||
6593CD632897C523004EBBFE /* AppDelegate.h */,
|
||||
6593CD642897C523004EBBFE /* AppDelegate.m */,
|
||||
65A31E7728F94DC70084A313 /* AppDelegate.swift */,
|
||||
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */,
|
||||
33E51913231747F40026EE4D /* DebugProfile.entitlements */,
|
||||
33E51914231749380026EE4D /* Release.entitlements */,
|
||||
@@ -250,7 +245,7 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
|
||||
65A31E7A28F94DF70084A313 /* Assets.xcassets in Resources */,
|
||||
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -343,8 +338,7 @@
|
||||
files = (
|
||||
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */,
|
||||
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */,
|
||||
6593CD672897C681004EBBFE /* main.m in Sources */,
|
||||
6593CD652897C523004EBBFE /* AppDelegate.m in Sources */,
|
||||
65A31E7828F94DC70084A313 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
//
|
||||
// AppDelegate.h
|
||||
// test
|
||||
//
|
||||
// Created by Hao Linwei on 2022/8/1.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <FlutterMacOS/FlutterMacOS.h>
|
||||
|
||||
@interface AppDelegate : FlutterAppDelegate
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
//
|
||||
// AppDelegate.m
|
||||
// test
|
||||
//
|
||||
// Created by Hao Linwei on 2022/8/1.
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@interface AppDelegate ()
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation FlutterAppDelegate
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||
// Insert code here to initialize your application
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
||||
// Insert code here to tear down your application
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app {
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -13,7 +13,7 @@
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Runner" customModuleProvider="target">
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="webview_cef_example" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="applicationMenu" destination="uQy-DD-JDr" id="XBo-yE-nKs"/>
|
||||
<outlet property="mainFlutterWindow" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
|
||||
@@ -330,14 +330,15 @@
|
||||
</items>
|
||||
<point key="canvasLocation" x="142" y="-258"/>
|
||||
</menu>
|
||||
<window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="Runner" customModuleProvider="target">
|
||||
<window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="webview_cef_example" customModuleProvider="target">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<rect key="contentRect" x="335" y="390" width="800" height="600"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1577"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
|
||||
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="800" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</view>
|
||||
<point key="canvasLocation" x="45" y="125"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
//
|
||||
// main.m
|
||||
// test
|
||||
//
|
||||
// Created by Hao Linwei on 2022/8/1.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
@autoreleasepool {
|
||||
// Setup code that might create autoreleased objects goes here.
|
||||
}
|
||||
return NSApplicationMain(argc, argv);
|
||||
}
|
||||
@@ -9,13 +9,13 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "include/wrapper/cef_library_loader.h"
|
||||
#import "include/cef_app.h"
|
||||
#import "../../common/simple_app.h"
|
||||
#import "../../common/simple_handler.h"
|
||||
#import "../../common/webview_app.h"
|
||||
#import "../../common/webview_handler.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
CefRefPtr<SimpleHandler> handler(new SimpleHandler(true));
|
||||
CefRefPtr<SimpleApp> app(new SimpleApp(handler));
|
||||
CefRefPtr<WebviewHandler> handler(new WebviewHandler());
|
||||
CefRefPtr<WebviewApp> app(new WebviewApp(handler));
|
||||
CefMainArgs mainArgs;
|
||||
|
||||
NSObject<FlutterTextureRegistry>* tr;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#ifndef CefBridge_h
|
||||
#define CefBridge_h
|
||||
|
||||
#include "../../common/simple_app.cc"
|
||||
#include "../../common/simple_handler.cc"
|
||||
#include "../../common/webview_app.cc"
|
||||
#include "../../common/webview_handler.cc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,10 +23,10 @@ set(PLUGIN_NAME "webview_cef_plugin")
|
||||
list(APPEND PLUGIN_SOURCES
|
||||
"webview_cef_plugin.cpp"
|
||||
"webview_cef_plugin.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../common/simple_app.cc"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../common/simple_app.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../common/simple_handler.cc"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../common/simple_handler.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../common/webview_app.cc"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../common/webview_app.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../common/webview_handler.cc"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../common/webview_handler.h"
|
||||
)
|
||||
|
||||
# Define the plugin library target. Its name must not be changed (see comment
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include<iostream>
|
||||
#include <mutex>
|
||||
|
||||
#include "simple_app.h"
|
||||
#include "webview_app.h"
|
||||
|
||||
namespace webview_cef {
|
||||
bool init = false;
|
||||
@@ -35,8 +35,8 @@ namespace webview_cef {
|
||||
}
|
||||
return buffer;
|
||||
}));
|
||||
CefRefPtr<SimpleHandler> handler(new SimpleHandler(false));
|
||||
CefRefPtr<SimpleApp> app(new SimpleApp(handler));
|
||||
CefRefPtr<WebviewHandler> handler(new WebviewHandler());
|
||||
CefRefPtr<WebviewApp> app(new WebviewApp(handler));
|
||||
CefMainArgs mainArgs;
|
||||
|
||||
|
||||
|
||||