mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
tests: Format with clang-tidy (see #3632)
This commit is contained in:
@ -9,8 +9,7 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::binding_test {
|
||||||
namespace binding_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -20,10 +19,10 @@ const char kTestMessageName[] = "BindingTest";
|
|||||||
// Handle messages in the browser process.
|
// Handle messages in the browser process.
|
||||||
class Handler : public CefMessageRouterBrowserSide::Handler {
|
class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||||
public:
|
public:
|
||||||
Handler() {}
|
Handler() = default;
|
||||||
|
|
||||||
// Called due to cefQuery execution in binding.html.
|
// Called due to cefQuery execution in binding.html.
|
||||||
virtual bool OnQuery(CefRefPtr<CefBrowser> browser,
|
bool OnQuery(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
int64_t query_id,
|
int64_t query_id,
|
||||||
const CefString& request,
|
const CefString& request,
|
||||||
@ -54,5 +53,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) {
|
|||||||
handlers.insert(new Handler());
|
handlers.insert(new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace binding_test
|
} // namespace client::binding_test
|
||||||
} // namespace client
|
|
||||||
|
@ -8,13 +8,11 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::binding_test {
|
||||||
namespace binding_test {
|
|
||||||
|
|
||||||
// Create message handlers. Called from test_runner.cc.
|
// Create message handlers. Called from test_runner.cc.
|
||||||
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
||||||
|
|
||||||
} // namespace binding_test
|
} // namespace client::binding_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_BINDING_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_BINDING_TEST_H_
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
|
|
||||||
namespace client {
|
namespace client {
|
||||||
|
|
||||||
BrowserWindow::BrowserWindow(Delegate* delegate)
|
BrowserWindow::BrowserWindow(Delegate* delegate) : delegate_(delegate) {
|
||||||
: delegate_(delegate), is_closing_(false) {
|
|
||||||
DCHECK(delegate_);
|
DCHECK(delegate_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class BrowserWindow : public ClientHandler::Delegate {
|
|||||||
const std::vector<CefDraggableRegion>& regions) = 0;
|
const std::vector<CefDraggableRegion>& regions) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Delegate() {}
|
virtual ~Delegate() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create a new browser and native window.
|
// Create a new browser and native window.
|
||||||
@ -135,7 +135,7 @@ class BrowserWindow : public ClientHandler::Delegate {
|
|||||||
Delegate* delegate_;
|
Delegate* delegate_;
|
||||||
CefRefPtr<CefBrowser> browser_;
|
CefRefPtr<CefBrowser> browser_;
|
||||||
CefRefPtr<ClientHandler> client_handler_;
|
CefRefPtr<ClientHandler> client_handler_;
|
||||||
bool is_closing_;
|
bool is_closing_ = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(BrowserWindow);
|
DISALLOW_COPY_AND_ASSIGN(BrowserWindow);
|
||||||
|
@ -12,7 +12,7 @@ BrowserWindowOsrWin::BrowserWindowOsrWin(BrowserWindow::Delegate* delegate,
|
|||||||
bool with_controls,
|
bool with_controls,
|
||||||
const std::string& startup_url,
|
const std::string& startup_url,
|
||||||
const OsrRendererSettings& settings)
|
const OsrRendererSettings& settings)
|
||||||
: BrowserWindow(delegate), osr_hwnd_(nullptr), device_scale_factor_(0) {
|
: BrowserWindow(delegate) {
|
||||||
osr_window_ = new OsrWindowWin(this, settings);
|
osr_window_ = new OsrWindowWin(this, settings);
|
||||||
client_handler_ =
|
client_handler_ =
|
||||||
new ClientHandlerOsr(this, osr_window_.get(), with_controls, startup_url);
|
new ClientHandlerOsr(this, osr_window_.get(), with_controls, startup_url);
|
||||||
|
@ -56,9 +56,9 @@ class BrowserWindowOsrWin : public BrowserWindow,
|
|||||||
|
|
||||||
// The below members are only accessed on the main thread.
|
// The below members are only accessed on the main thread.
|
||||||
scoped_refptr<OsrWindowWin> osr_window_;
|
scoped_refptr<OsrWindowWin> osr_window_;
|
||||||
HWND osr_hwnd_;
|
HWND osr_hwnd_ = nullptr;
|
||||||
|
|
||||||
float device_scale_factor_;
|
float device_scale_factor_ = 0;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(BrowserWindowOsrWin);
|
DISALLOW_COPY_AND_ASSIGN(BrowserWindowOsrWin);
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace client {
|
namespace client {
|
||||||
|
|
||||||
BytesWriteHandler::BytesWriteHandler(size_t grow)
|
BytesWriteHandler::BytesWriteHandler(size_t grow)
|
||||||
: grow_(grow), datasize_(grow), offset_(0) {
|
: grow_(grow), datasize_(grow) {
|
||||||
DCHECK_GT(grow, 0U);
|
DCHECK_GT(grow, 0U);
|
||||||
data_ = malloc(grow);
|
data_ = malloc(grow);
|
||||||
DCHECK(data_ != nullptr);
|
DCHECK(data_ != nullptr);
|
||||||
|
@ -14,7 +14,7 @@ namespace client {
|
|||||||
class BytesWriteHandler : public CefWriteHandler {
|
class BytesWriteHandler : public CefWriteHandler {
|
||||||
public:
|
public:
|
||||||
explicit BytesWriteHandler(size_t grow);
|
explicit BytesWriteHandler(size_t grow);
|
||||||
~BytesWriteHandler();
|
~BytesWriteHandler() override;
|
||||||
|
|
||||||
size_t Write(const void* ptr, size_t size, size_t n) override;
|
size_t Write(const void* ptr, size_t size, size_t n) override;
|
||||||
int Seek(int64_t offset, int whence) override;
|
int Seek(int64_t offset, int whence) override;
|
||||||
@ -31,7 +31,7 @@ class BytesWriteHandler : public CefWriteHandler {
|
|||||||
size_t grow_;
|
size_t grow_;
|
||||||
void* data_;
|
void* data_;
|
||||||
int64_t datasize_;
|
int64_t datasize_;
|
||||||
int64_t offset_;
|
int64_t offset_ = 0;
|
||||||
|
|
||||||
base::Lock lock_;
|
base::Lock lock_;
|
||||||
|
|
||||||
|
@ -15,14 +15,13 @@
|
|||||||
#include "tests/cefclient/browser/root_window_manager.h"
|
#include "tests/cefclient/browser/root_window_manager.h"
|
||||||
#include "tests/shared/common/client_switches.h"
|
#include "tests/shared/common/client_switches.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::browser {
|
||||||
namespace browser {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class ClientBrowserDelegate : public ClientAppBrowser::Delegate {
|
class ClientBrowserDelegate : public ClientAppBrowser::Delegate {
|
||||||
public:
|
public:
|
||||||
ClientBrowserDelegate() {}
|
ClientBrowserDelegate() = default;
|
||||||
|
|
||||||
void OnRegisterCustomPreferences(
|
void OnRegisterCustomPreferences(
|
||||||
CefRefPtr<client::ClientAppBrowser> app,
|
CefRefPtr<client::ClientAppBrowser> app,
|
||||||
@ -75,10 +74,9 @@ class ClientBrowserDelegate : public ClientAppBrowser::Delegate {
|
|||||||
switches::kOffScreenRenderingEnabled,
|
switches::kOffScreenRenderingEnabled,
|
||||||
switches::kUseViews,
|
switches::kUseViews,
|
||||||
};
|
};
|
||||||
for (size_t i = 0;
|
for (auto& kIgnoredSwitche : kIgnoredSwitches) {
|
||||||
i < sizeof(kIgnoredSwitches) / sizeof(kIgnoredSwitches[0]); ++i) {
|
if (command_line->HasSwitch(kIgnoredSwitche)) {
|
||||||
if (command_line->HasSwitch(kIgnoredSwitches[i])) {
|
LOG(WARNING) << "The --" << kIgnoredSwitche
|
||||||
LOG(WARNING) << "The --" << kIgnoredSwitches[i]
|
|
||||||
<< " command-line switch is ignored on app relaunch.";
|
<< " command-line switch is ignored on app relaunch.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,5 +110,4 @@ void CreateDelegates(ClientAppBrowser::DelegateSet& delegates) {
|
|||||||
delegates.insert(new ClientBrowserDelegate);
|
delegates.insert(new ClientBrowserDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace browser
|
} // namespace client::browser
|
||||||
} // namespace client
|
|
||||||
|
@ -9,13 +9,11 @@
|
|||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include "tests/shared/browser/client_app_browser.h"
|
#include "tests/shared/browser/client_app_browser.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::browser {
|
||||||
namespace browser {
|
|
||||||
|
|
||||||
// Create the browser delegate. Called from client_app_delegates_browser.cc.
|
// Create the browser delegate. Called from client_app_delegates_browser.cc.
|
||||||
void CreateDelegates(ClientAppBrowser::DelegateSet& delegates);
|
void CreateDelegates(ClientAppBrowser::DelegateSet& delegates);
|
||||||
|
|
||||||
} // namespace browser
|
} // namespace client::browser
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_BROWSER_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_BROWSER_H_
|
||||||
|
@ -353,8 +353,8 @@ bool IsAllowedAppMenuCommandId(int command_id) {
|
|||||||
IDC_OPTIONS,
|
IDC_OPTIONS,
|
||||||
IDC_EXIT,
|
IDC_EXIT,
|
||||||
};
|
};
|
||||||
for (size_t i = 0; i < std::size(kAllowedCommandIds); ++i) {
|
for (int kAllowedCommandId : kAllowedCommandIds) {
|
||||||
if (command_id == kAllowedCommandIds[i]) {
|
if (command_id == kAllowedCommandId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,8 +397,8 @@ bool IsAllowedContextMenuCommandId(int command_id) {
|
|||||||
IDC_CONTENT_CONTEXT_UNDO,
|
IDC_CONTENT_CONTEXT_UNDO,
|
||||||
IDC_CONTENT_CONTEXT_REDO,
|
IDC_CONTENT_CONTEXT_REDO,
|
||||||
};
|
};
|
||||||
for (size_t i = 0; i < std::size(kAllowedCommandIds); ++i) {
|
for (int kAllowedCommandId : kAllowedCommandIds) {
|
||||||
if (command_id == kAllowedCommandIds[i]) {
|
if (command_id == kAllowedCommandId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ class ClientHandler : public CefClient,
|
|||||||
virtual void OnBeforeContextMenu(CefRefPtr<CefMenuModel> model) {}
|
virtual void OnBeforeContextMenu(CefRefPtr<CefMenuModel> model) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Delegate() {}
|
virtual ~Delegate() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::set<CefMessageRouterBrowserSide::Handler*> MessageHandlerSet;
|
typedef std::set<CefMessageRouterBrowserSide::Handler*> MessageHandlerSet;
|
||||||
@ -439,9 +439,9 @@ class ClientHandler : public CefClient,
|
|||||||
|
|
||||||
// Track state information for the text context menu.
|
// Track state information for the text context menu.
|
||||||
struct TestMenuState {
|
struct TestMenuState {
|
||||||
TestMenuState() : check_item(true), radio_item(0) {}
|
TestMenuState() = default;
|
||||||
bool check_item;
|
bool check_item = true;
|
||||||
int radio_item;
|
int radio_item = 0;
|
||||||
} test_menu_state_;
|
} test_menu_state_;
|
||||||
|
|
||||||
// The current number of browsers using this handler.
|
// The current number of browsers using this handler.
|
||||||
|
@ -72,7 +72,7 @@ class ClientHandlerOsr : public ClientHandler,
|
|||||||
virtual void UpdateAccessibilityLocation(CefRefPtr<CefValue> value) = 0;
|
virtual void UpdateAccessibilityLocation(CefRefPtr<CefValue> value) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~OsrDelegate() {}
|
virtual ~OsrDelegate() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
ClientHandlerOsr(Delegate* delegate,
|
ClientHandlerOsr(Delegate* delegate,
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
#include "tests/shared/common/client_switches.h"
|
#include "tests/shared/common/client_switches.h"
|
||||||
#include "tests/shared/common/string_util.h"
|
#include "tests/shared/common/string_util.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::prefs {
|
||||||
namespace prefs {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -41,18 +40,18 @@ static struct {
|
|||||||
|
|
||||||
std::optional<cef_show_state_t> ShowStateFromString(const std::string& str) {
|
std::optional<cef_show_state_t> ShowStateFromString(const std::string& str) {
|
||||||
const auto strLower = AsciiStrToLower(str);
|
const auto strLower = AsciiStrToLower(str);
|
||||||
for (size_t i = 0; i < std::size(kWindowRestoreStateValueMap); ++i) {
|
for (auto i : kWindowRestoreStateValueMap) {
|
||||||
if (strLower == kWindowRestoreStateValueMap[i].str) {
|
if (strLower == i.str) {
|
||||||
return kWindowRestoreStateValueMap[i].state;
|
return i.state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ShowStateToString(cef_show_state_t show_state) {
|
const char* ShowStateToString(cef_show_state_t show_state) {
|
||||||
for (size_t i = 0; i < std::size(kWindowRestoreStateValueMap); ++i) {
|
for (auto i : kWindowRestoreStateValueMap) {
|
||||||
if (show_state == kWindowRestoreStateValueMap[i].state) {
|
if (show_state == i.state) {
|
||||||
return kWindowRestoreStateValueMap[i].str;
|
return i.str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
@ -202,5 +201,4 @@ bool SaveWindowRestorePreferences(cef_show_state_t show_state,
|
|||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace prefs
|
} // namespace client::prefs
|
||||||
} // namespace client
|
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include "include/cef_preference.h"
|
#include "include/cef_preference.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::prefs {
|
||||||
namespace prefs {
|
|
||||||
|
|
||||||
// Register global preferences with default values.
|
// Register global preferences with default values.
|
||||||
void RegisterGlobalPreferences(CefRawPtr<CefPreferenceRegistrar> registrar);
|
void RegisterGlobalPreferences(CefRawPtr<CefPreferenceRegistrar> registrar);
|
||||||
@ -23,7 +22,6 @@ bool LoadWindowRestorePreferences(cef_show_state_t& show_state,
|
|||||||
bool SaveWindowRestorePreferences(cef_show_state_t show_state,
|
bool SaveWindowRestorePreferences(cef_show_state_t show_state,
|
||||||
std::optional<CefRect> dip_bounds);
|
std::optional<CefRect> dip_bounds);
|
||||||
|
|
||||||
} // namespace prefs
|
} // namespace client::prefs
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_PREFS_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_PREFS_H_
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
#include "tests/shared/browser/file_util.h"
|
#include "tests/shared/browser/file_util.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::dialog_test {
|
||||||
namespace dialog_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -26,11 +25,11 @@ const char kFileSaveMessageName[] = "DialogTest.FileSave";
|
|||||||
// Store persistent dialog state information.
|
// Store persistent dialog state information.
|
||||||
class DialogState : public base::RefCountedThreadSafe<DialogState> {
|
class DialogState : public base::RefCountedThreadSafe<DialogState> {
|
||||||
public:
|
public:
|
||||||
DialogState() : mode_(FILE_DIALOG_OPEN), pending_(false) {}
|
DialogState() = default;
|
||||||
|
|
||||||
cef_file_dialog_mode_t mode_;
|
cef_file_dialog_mode_t mode_ = FILE_DIALOG_OPEN;
|
||||||
CefString last_file_;
|
CefString last_file_;
|
||||||
bool pending_;
|
bool pending_ = false;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(DialogState);
|
DISALLOW_COPY_AND_ASSIGN(DialogState);
|
||||||
};
|
};
|
||||||
@ -43,7 +42,7 @@ class DialogCallback : public CefRunFileDialogCallback {
|
|||||||
scoped_refptr<DialogState> dialog_state)
|
scoped_refptr<DialogState> dialog_state)
|
||||||
: router_callback_(router_callback), dialog_state_(dialog_state) {}
|
: router_callback_(router_callback), dialog_state_(dialog_state) {}
|
||||||
|
|
||||||
virtual void OnFileDialogDismissed(
|
void OnFileDialogDismissed(
|
||||||
const std::vector<CefString>& file_paths) override {
|
const std::vector<CefString>& file_paths) override {
|
||||||
CEF_REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
DCHECK(dialog_state_->pending_);
|
DCHECK(dialog_state_->pending_);
|
||||||
@ -63,11 +62,11 @@ class DialogCallback : public CefRunFileDialogCallback {
|
|||||||
|
|
||||||
// Send a message back to the render process with the list of file paths.
|
// Send a message back to the render process with the list of file paths.
|
||||||
std::string response;
|
std::string response;
|
||||||
for (int i = 0; i < static_cast<int>(file_paths.size()); ++i) {
|
for (const auto& file_path : file_paths) {
|
||||||
if (!response.empty()) {
|
if (!response.empty()) {
|
||||||
response += "|"; // Use a delimiter disallowed in file paths.
|
response += "|"; // Use a delimiter disallowed in file paths.
|
||||||
}
|
}
|
||||||
response += file_paths[i];
|
response += file_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
router_callback_->Success(response);
|
router_callback_->Success(response);
|
||||||
@ -88,10 +87,10 @@ class DialogCallback : public CefRunFileDialogCallback {
|
|||||||
// Handle messages in the browser process.
|
// Handle messages in the browser process.
|
||||||
class Handler : public CefMessageRouterBrowserSide::Handler {
|
class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||||
public:
|
public:
|
||||||
Handler() {}
|
Handler() = default;
|
||||||
|
|
||||||
// Called due to cefQuery execution in dialogs.html.
|
// Called due to cefQuery execution in dialogs.html.
|
||||||
virtual bool OnQuery(CefRefPtr<CefBrowser> browser,
|
bool OnQuery(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
int64_t query_id,
|
int64_t query_id,
|
||||||
const CefString& request,
|
const CefString& request,
|
||||||
@ -174,5 +173,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) {
|
|||||||
handlers.insert(new Handler());
|
handlers.insert(new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace dialog_test
|
} // namespace client::dialog_test
|
||||||
} // namespace client
|
|
||||||
|
@ -8,13 +8,11 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::dialog_test {
|
||||||
namespace dialog_test {
|
|
||||||
|
|
||||||
// Create message handlers. Called from test_runner.cc.
|
// Create message handlers. Called from test_runner.cc.
|
||||||
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
||||||
|
|
||||||
} // namespace dialog_test
|
} // namespace client::dialog_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_DIALOG_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_DIALOG_TEST_H_
|
||||||
|
@ -18,7 +18,7 @@ const char kEmptyId[] = "__empty";
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ImageCache::ImageCache() {}
|
ImageCache::ImageCache() = default;
|
||||||
|
|
||||||
ImageCache::~ImageCache() {
|
ImageCache::~ImageCache() {
|
||||||
CEF_REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
@ -54,7 +54,7 @@ ImageCache::ImageInfo ImageCache::ImageInfo::Create1x(
|
|||||||
const std::string& path_1x,
|
const std::string& path_1x,
|
||||||
bool internal) {
|
bool internal) {
|
||||||
ImageRepSet reps;
|
ImageRepSet reps;
|
||||||
reps.push_back(ImageRep(path_1x, 1.0f));
|
reps.emplace_back(path_1x, 1.0f);
|
||||||
return ImageInfo(id, reps, internal, false);
|
return ImageInfo(id, reps, internal, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,8 +65,8 @@ ImageCache::ImageInfo ImageCache::ImageInfo::Create2x(
|
|||||||
const std::string& path_2x,
|
const std::string& path_2x,
|
||||||
bool internal) {
|
bool internal) {
|
||||||
ImageRepSet reps;
|
ImageRepSet reps;
|
||||||
reps.push_back(ImageRep(path_1x, 1.0f));
|
reps.emplace_back(path_1x, 1.0f);
|
||||||
reps.push_back(ImageRep(path_2x, 2.0f));
|
reps.emplace_back(path_2x, 2.0f);
|
||||||
return ImageInfo(id, reps, internal, false);
|
return ImageInfo(id, reps, internal, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ ImageCache::ImageInfo ImageCache::ImageInfo::Create2x(const std::string& id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct ImageCache::ImageContent {
|
struct ImageCache::ImageContent {
|
||||||
ImageContent() {}
|
ImageContent() = default;
|
||||||
|
|
||||||
struct RepContent {
|
struct RepContent {
|
||||||
RepContent(ImageType type, float scale_factor, const std::string& contents)
|
RepContent(ImageType type, float scale_factor, const std::string& contents)
|
||||||
@ -217,8 +217,7 @@ bool ImageCache::LoadImageContents(const ImageInfo& info,
|
|||||||
<< rep.path_;
|
<< rep.path_;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
content->contents_.push_back(
|
content->contents_.emplace_back(rep_type, rep.scale_factor_, rep_contents);
|
||||||
ImageContent::RepContent(rep_type, rep.scale_factor_, rep_contents));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "tests/cefclient/browser/main_context_impl.h"
|
#include "tests/cefclient/browser/main_context_impl.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "include/cef_parser.h"
|
#include "include/cef_parser.h"
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
@ -288,8 +289,8 @@ bool MainContextImpl::Initialize(const CefMainArgs& args,
|
|||||||
|
|
||||||
// Need to create the RootWindowManager after calling CefInitialize because
|
// Need to create the RootWindowManager after calling CefInitialize because
|
||||||
// TempWindowX11 uses cef_get_xdisplay().
|
// TempWindowX11 uses cef_get_xdisplay().
|
||||||
root_window_manager_.reset(
|
root_window_manager_ =
|
||||||
new RootWindowManager(terminate_when_all_windows_closed_));
|
std::make_unique<RootWindowManager>(terminate_when_all_windows_closed_);
|
||||||
|
|
||||||
initialized_ = true;
|
initialized_ = true;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class MainContextImpl : public MainContext {
|
|||||||
// Allow deletion via std::unique_ptr only.
|
// Allow deletion via std::unique_ptr only.
|
||||||
friend std::default_delete<MainContextImpl>;
|
friend std::default_delete<MainContextImpl>;
|
||||||
|
|
||||||
~MainContextImpl();
|
~MainContextImpl() override;
|
||||||
|
|
||||||
// Returns true if the context is in a valid state (initialized and not yet
|
// Returns true if the context is in a valid state (initialized and not yet
|
||||||
// shut down).
|
// shut down).
|
||||||
|
@ -21,9 +21,7 @@ const wchar_t kTaskMessageName[] = L"Client_CustomTask";
|
|||||||
|
|
||||||
MainMessageLoopMultithreadedWin::MainMessageLoopMultithreadedWin()
|
MainMessageLoopMultithreadedWin::MainMessageLoopMultithreadedWin()
|
||||||
: thread_id_(base::PlatformThread::CurrentId()),
|
: thread_id_(base::PlatformThread::CurrentId()),
|
||||||
task_message_id_(RegisterWindowMessage(kTaskMessageName)),
|
task_message_id_(RegisterWindowMessage(kTaskMessageName)) {}
|
||||||
dialog_hwnd_(nullptr),
|
|
||||||
message_hwnd_(nullptr) {}
|
|
||||||
|
|
||||||
MainMessageLoopMultithreadedWin::~MainMessageLoopMultithreadedWin() {
|
MainMessageLoopMultithreadedWin::~MainMessageLoopMultithreadedWin() {
|
||||||
DCHECK(RunsTasksOnCurrentThread());
|
DCHECK(RunsTasksOnCurrentThread());
|
||||||
@ -118,8 +116,8 @@ HWND MainMessageLoopMultithreadedWin::CreateMessageWindow(HINSTANCE hInstance) {
|
|||||||
wc.lpszClassName = kWndClass;
|
wc.lpszClassName = kWndClass;
|
||||||
RegisterClassEx(&wc);
|
RegisterClassEx(&wc);
|
||||||
|
|
||||||
return CreateWindow(kWndClass, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hInstance,
|
return CreateWindow(kWndClass, nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr,
|
||||||
0);
|
hInstance, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
@ -22,7 +22,7 @@ namespace client {
|
|||||||
class MainMessageLoopMultithreadedWin : public MainMessageLoop {
|
class MainMessageLoopMultithreadedWin : public MainMessageLoop {
|
||||||
public:
|
public:
|
||||||
MainMessageLoopMultithreadedWin();
|
MainMessageLoopMultithreadedWin();
|
||||||
~MainMessageLoopMultithreadedWin();
|
~MainMessageLoopMultithreadedWin() override;
|
||||||
|
|
||||||
// MainMessageLoop methods.
|
// MainMessageLoop methods.
|
||||||
int Run() override;
|
int Run() override;
|
||||||
@ -47,12 +47,12 @@ class MainMessageLoopMultithreadedWin : public MainMessageLoop {
|
|||||||
UINT task_message_id_;
|
UINT task_message_id_;
|
||||||
|
|
||||||
// Only accessed on the main thread.
|
// Only accessed on the main thread.
|
||||||
HWND dialog_hwnd_;
|
HWND dialog_hwnd_ = nullptr;
|
||||||
|
|
||||||
base::Lock lock_;
|
base::Lock lock_;
|
||||||
|
|
||||||
// Must be protected by |lock_|.
|
// Must be protected by |lock_|.
|
||||||
HWND message_hwnd_;
|
HWND message_hwnd_ = nullptr;
|
||||||
std::queue<CefRefPtr<CefTask>> queued_tasks_;
|
std::queue<CefRefPtr<CefTask>> queued_tasks_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MainMessageLoopMultithreadedWin);
|
DISALLOW_COPY_AND_ASSIGN(MainMessageLoopMultithreadedWin);
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
#include "include/cef_parser.h"
|
#include "include/cef_parser.h"
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::media_router_test {
|
||||||
namespace media_router_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -93,10 +92,7 @@ class MediaObserver : public CefMediaObserver {
|
|||||||
MediaObserver(CefRefPtr<CefMediaRouter> media_router,
|
MediaObserver(CefRefPtr<CefMediaRouter> media_router,
|
||||||
CefRefPtr<CallbackType> subscription_callback)
|
CefRefPtr<CallbackType> subscription_callback)
|
||||||
: media_router_(media_router),
|
: media_router_(media_router),
|
||||||
subscription_callback_(subscription_callback),
|
subscription_callback_(subscription_callback) {}
|
||||||
next_sink_query_id_(0),
|
|
||||||
pending_sink_query_id_(-1),
|
|
||||||
pending_sink_callbacks_(0U) {}
|
|
||||||
|
|
||||||
~MediaObserver() override { ClearSinkInfoMap(); }
|
~MediaObserver() override { ClearSinkInfoMap(); }
|
||||||
|
|
||||||
@ -351,12 +347,12 @@ class MediaObserver : public CefMediaObserver {
|
|||||||
|
|
||||||
// Used to uniquely identify a call to OnSinks(), for the purpose of
|
// Used to uniquely identify a call to OnSinks(), for the purpose of
|
||||||
// associating OnMediaSinkDeviceInfo() callbacks.
|
// associating OnMediaSinkDeviceInfo() callbacks.
|
||||||
int next_sink_query_id_;
|
int next_sink_query_id_ = 0;
|
||||||
|
|
||||||
// State from the most recent call to OnSinks().
|
// State from the most recent call to OnSinks().
|
||||||
SinkInfoMap sink_info_map_;
|
SinkInfoMap sink_info_map_;
|
||||||
int pending_sink_query_id_;
|
int pending_sink_query_id_ = -1;
|
||||||
size_t pending_sink_callbacks_;
|
size_t pending_sink_callbacks_ = 0U;
|
||||||
|
|
||||||
// State from the most recent call to OnRoutes().
|
// State from the most recent call to OnRoutes().
|
||||||
typedef std::map<std::string, CefRefPtr<CefMediaRoute>> RouteMap;
|
typedef std::map<std::string, CefRefPtr<CefMediaRoute>> RouteMap;
|
||||||
@ -373,7 +369,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
|
|
||||||
Handler() { CEF_REQUIRE_UI_THREAD(); }
|
Handler() { CEF_REQUIRE_UI_THREAD(); }
|
||||||
|
|
||||||
virtual ~Handler() {
|
~Handler() override {
|
||||||
SubscriptionStateMap::iterator it = subscription_state_map_.begin();
|
SubscriptionStateMap::iterator it = subscription_state_map_.begin();
|
||||||
for (; it != subscription_state_map_.end(); ++it) {
|
for (; it != subscription_state_map_.end(); ++it) {
|
||||||
delete it->second;
|
delete it->second;
|
||||||
@ -598,5 +594,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) {
|
|||||||
handlers.insert(new Handler());
|
handlers.insert(new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace media_router_test
|
} // namespace client::media_router_test
|
||||||
} // namespace client
|
|
||||||
|
@ -8,13 +8,11 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::media_router_test {
|
||||||
namespace media_router_test {
|
|
||||||
|
|
||||||
// Create message handlers. Called from test_runner.cc.
|
// Create message handlers. Called from test_runner.cc.
|
||||||
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
||||||
|
|
||||||
} // namespace media_router_test
|
} // namespace client::media_router_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_MEDIA_ROUTER_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_MEDIA_ROUTER_TEST_H_
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
namespace client {
|
namespace client {
|
||||||
|
|
||||||
OsrAXTree::OsrAXTree() : root_node_id_(-1) {}
|
OsrAXTree::OsrAXTree() = default;
|
||||||
|
|
||||||
OsrAXNode* OsrAXTree::GetNode(int nodeId) const {
|
OsrAXNode* OsrAXTree::GetNode(int nodeId) const {
|
||||||
auto result = node_map_.find(nodeId);
|
auto result = node_map_.find(nodeId);
|
||||||
@ -38,7 +38,7 @@ void OsrAXTree::UpdateTreeData(CefRefPtr<CefDictionaryValue> value) {
|
|||||||
|
|
||||||
OsrAccessibilityHelper::OsrAccessibilityHelper(CefRefPtr<CefValue> value,
|
OsrAccessibilityHelper::OsrAccessibilityHelper(CefRefPtr<CefValue> value,
|
||||||
CefRefPtr<CefBrowser> browser)
|
CefRefPtr<CefBrowser> browser)
|
||||||
: focused_node_id_(-1), browser_(browser) {
|
: browser_(browser) {
|
||||||
UpdateAccessibilityTree(value);
|
UpdateAccessibilityTree(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class OsrAXTree {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
CefString parent_tree_id_;
|
CefString parent_tree_id_;
|
||||||
int root_node_id_;
|
int root_node_id_ = -1;
|
||||||
std::map<int, OsrAXNode*> node_map_;
|
std::map<int, OsrAXNode*> node_map_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class OsrAccessibilityHelper {
|
|||||||
void DestroyNode(OsrAXNode* node);
|
void DestroyNode(OsrAXNode* node);
|
||||||
CefString root_tree_id_;
|
CefString root_tree_id_;
|
||||||
CefString focused_tree_id_;
|
CefString focused_tree_id_;
|
||||||
int focused_node_id_;
|
int focused_node_id_ = -1;
|
||||||
CefRefPtr<CefBrowser> browser_;
|
CefRefPtr<CefBrowser> browser_;
|
||||||
std::map<CefString, OsrAXTree> accessibility_node_map_;
|
std::map<CefString, OsrAXTree> accessibility_node_map_;
|
||||||
};
|
};
|
||||||
|
@ -17,9 +17,7 @@ OsrAXNode::OsrAXNode(const CefString& treeId,
|
|||||||
OsrAccessibilityHelper* helper)
|
OsrAccessibilityHelper* helper)
|
||||||
: tree_id_(treeId),
|
: tree_id_(treeId),
|
||||||
node_id_(nodeId),
|
node_id_(nodeId),
|
||||||
platform_accessibility_(nullptr),
|
|
||||||
parent_(nullptr),
|
|
||||||
offset_container_id_(-1),
|
|
||||||
accessibility_helper_(helper) {
|
accessibility_helper_(helper) {
|
||||||
UpdateValue(value);
|
UpdateValue(value);
|
||||||
}
|
}
|
||||||
|
@ -111,9 +111,9 @@ class OsrAXNode {
|
|||||||
CefRect location_;
|
CefRect location_;
|
||||||
CefPoint scroll_;
|
CefPoint scroll_;
|
||||||
std::vector<int> child_ids_;
|
std::vector<int> child_ids_;
|
||||||
CefNativeAccessible* platform_accessibility_;
|
CefNativeAccessible* platform_accessibility_ = nullptr;
|
||||||
OsrAXNode* parent_;
|
OsrAXNode* parent_ = nullptr;
|
||||||
int offset_container_id_;
|
int offset_container_id_ = -1;
|
||||||
OsrAccessibilityHelper* accessibility_helper_;
|
OsrAccessibilityHelper* accessibility_helper_;
|
||||||
CefRefPtr<CefDictionaryValue> attributes_;
|
CefRefPtr<CefDictionaryValue> attributes_;
|
||||||
};
|
};
|
||||||
|
@ -247,17 +247,17 @@ struct CefIAccessible : public IAccessible {
|
|||||||
EXCEPINFO FAR* pExcepInfo,
|
EXCEPINFO FAR* pExcepInfo,
|
||||||
unsigned int FAR* puArgErr) override;
|
unsigned int FAR* puArgErr) override;
|
||||||
|
|
||||||
CefIAccessible(OsrAXNode* node) : ref_count_(0), node_(node) {}
|
explicit CefIAccessible(OsrAXNode* node) : node_(node) {}
|
||||||
|
|
||||||
// Remove the node reference when OsrAXNode is destroyed, so that
|
// Remove the node reference when OsrAXNode is destroyed, so that
|
||||||
// MSAA clients get CO_E_OBJNOTCONNECTED
|
// MSAA clients get CO_E_OBJNOTCONNECTED
|
||||||
void MarkDestroyed() { node_ = nullptr; }
|
void MarkDestroyed() { node_ = nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~CefIAccessible() {}
|
virtual ~CefIAccessible() = default;
|
||||||
|
|
||||||
// Ref Count
|
// Ref Count
|
||||||
ULONG ref_count_;
|
ULONG ref_count_ = 0;
|
||||||
// OsrAXNode* proxy object
|
// OsrAXNode* proxy object
|
||||||
OsrAXNode* node_;
|
OsrAXNode* node_;
|
||||||
};
|
};
|
||||||
|
@ -28,8 +28,7 @@
|
|||||||
#include "include/internal/cef_string.h"
|
#include "include/internal/cef_string.h"
|
||||||
#include "tests/shared/browser/util_win.h"
|
#include "tests/shared/browser/util_win.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::d3d11 {
|
||||||
namespace d3d11 {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -63,9 +62,7 @@ SwapChain::SwapChain(IDXGISwapChain* swapchain,
|
|||||||
: sampler_(to_com_ptr(sampler)),
|
: sampler_(to_com_ptr(sampler)),
|
||||||
blender_(to_com_ptr(blender)),
|
blender_(to_com_ptr(blender)),
|
||||||
swapchain_(to_com_ptr(swapchain)),
|
swapchain_(to_com_ptr(swapchain)),
|
||||||
rtv_(to_com_ptr(rtv)),
|
rtv_(to_com_ptr(rtv)) {}
|
||||||
width_(0),
|
|
||||||
height_(0) {}
|
|
||||||
|
|
||||||
void SwapChain::bind(const std::shared_ptr<Context>& ctx) {
|
void SwapChain::bind(const std::shared_ptr<Context>& ctx) {
|
||||||
ctx_ = ctx;
|
ctx_ = ctx;
|
||||||
@ -113,7 +110,7 @@ void SwapChain::resize(int width, int height) {
|
|||||||
ID3D11DeviceContext* d3d11_ctx = (ID3D11DeviceContext*)(*ctx_);
|
ID3D11DeviceContext* d3d11_ctx = (ID3D11DeviceContext*)(*ctx_);
|
||||||
CHECK(d3d11_ctx);
|
CHECK(d3d11_ctx);
|
||||||
|
|
||||||
d3d11_ctx->OMSetRenderTargets(0, 0, 0);
|
d3d11_ctx->OMSetRenderTargets(0, nullptr, nullptr);
|
||||||
rtv_.reset();
|
rtv_.reset();
|
||||||
|
|
||||||
DXGI_SWAP_CHAIN_DESC desc;
|
DXGI_SWAP_CHAIN_DESC desc;
|
||||||
@ -505,16 +502,15 @@ std::shared_ptr<SwapChain> Device::create_swapchain(HWND window,
|
|||||||
D3D11_BLEND_DESC desc;
|
D3D11_BLEND_DESC desc;
|
||||||
desc.AlphaToCoverageEnable = FALSE;
|
desc.AlphaToCoverageEnable = FALSE;
|
||||||
desc.IndependentBlendEnable = FALSE;
|
desc.IndependentBlendEnable = FALSE;
|
||||||
const auto count = sizeof(desc.RenderTarget) / sizeof(desc.RenderTarget[0]);
|
for (auto& n : desc.RenderTarget) {
|
||||||
for (size_t n = 0; n < count; ++n) {
|
n.BlendEnable = TRUE;
|
||||||
desc.RenderTarget[n].BlendEnable = TRUE;
|
n.SrcBlend = D3D11_BLEND_ONE;
|
||||||
desc.RenderTarget[n].SrcBlend = D3D11_BLEND_ONE;
|
n.DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
|
||||||
desc.RenderTarget[n].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
|
n.SrcBlendAlpha = D3D11_BLEND_ONE;
|
||||||
desc.RenderTarget[n].SrcBlendAlpha = D3D11_BLEND_ONE;
|
n.DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
|
||||||
desc.RenderTarget[n].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
|
n.BlendOp = D3D11_BLEND_OP_ADD;
|
||||||
desc.RenderTarget[n].BlendOp = D3D11_BLEND_OP_ADD;
|
n.BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
||||||
desc.RenderTarget[n].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
n.RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
|
||||||
desc.RenderTarget[n].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
|
|
||||||
}
|
}
|
||||||
device_->CreateBlendState(&desc, &blender);
|
device_->CreateBlendState(&desc, &blender);
|
||||||
}
|
}
|
||||||
@ -787,7 +783,7 @@ Layer::Layer(const std::shared_ptr<Device>& device, bool flip)
|
|||||||
bounds_.x = bounds_.y = bounds_.width = bounds_.height = 0.0f;
|
bounds_.x = bounds_.y = bounds_.width = bounds_.height = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
Layer::~Layer() {}
|
Layer::~Layer() = default;
|
||||||
|
|
||||||
void Layer::attach(const std::shared_ptr<Composition>& parent) {
|
void Layer::attach(const std::shared_ptr<Composition>& parent) {
|
||||||
composition_ = parent;
|
composition_ = parent;
|
||||||
@ -842,7 +838,7 @@ void Layer::render_texture(const std::shared_ptr<Context>& ctx,
|
|||||||
Composition::Composition(const std::shared_ptr<Device>& device,
|
Composition::Composition(const std::shared_ptr<Device>& device,
|
||||||
int width,
|
int width,
|
||||||
int height)
|
int height)
|
||||||
: width_(width), height_(height), vsync_(true), device_(device) {
|
: width_(width), height_(height), device_(device) {
|
||||||
fps_ = 0.0;
|
fps_ = 0.0;
|
||||||
time_ = 0.0;
|
time_ = 0.0;
|
||||||
frame_ = 0;
|
frame_ = 0;
|
||||||
@ -932,5 +928,4 @@ void FrameBuffer::on_paint(void* shared_handle) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace d3d11
|
} // namespace client::d3d11
|
||||||
} // namespace client
|
|
||||||
|
@ -26,8 +26,7 @@
|
|||||||
|
|
||||||
#include "include/base/cef_macros.h"
|
#include "include/base/cef_macros.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::d3d11 {
|
||||||
namespace d3d11 {
|
|
||||||
|
|
||||||
class Composition;
|
class Composition;
|
||||||
class Context;
|
class Context;
|
||||||
@ -68,11 +67,11 @@ class ScopedBinder {
|
|||||||
|
|
||||||
class Context {
|
class Context {
|
||||||
public:
|
public:
|
||||||
Context(ID3D11DeviceContext*);
|
explicit Context(ID3D11DeviceContext*);
|
||||||
|
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
operator ID3D11DeviceContext*() { return ctx_.get(); }
|
explicit operator ID3D11DeviceContext*() { return ctx_.get(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::shared_ptr<ID3D11DeviceContext> ctx_;
|
const std::shared_ptr<ID3D11DeviceContext> ctx_;
|
||||||
@ -87,7 +86,7 @@ class Device {
|
|||||||
|
|
||||||
std::string adapter_name() const;
|
std::string adapter_name() const;
|
||||||
|
|
||||||
operator ID3D11Device*() { return device_.get(); }
|
explicit operator ID3D11Device*() { return device_.get(); }
|
||||||
|
|
||||||
std::shared_ptr<Context> immedidate_context();
|
std::shared_ptr<Context> immedidate_context();
|
||||||
|
|
||||||
@ -157,8 +156,8 @@ class SwapChain {
|
|||||||
const std::shared_ptr<IDXGISwapChain> swapchain_;
|
const std::shared_ptr<IDXGISwapChain> swapchain_;
|
||||||
std::shared_ptr<ID3D11RenderTargetView> rtv_;
|
std::shared_ptr<ID3D11RenderTargetView> rtv_;
|
||||||
std::shared_ptr<Context> ctx_;
|
std::shared_ptr<Context> ctx_;
|
||||||
int width_;
|
int width_ = 0;
|
||||||
int height_;
|
int height_ = 0;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(SwapChain);
|
DISALLOW_COPY_AND_ASSIGN(SwapChain);
|
||||||
};
|
};
|
||||||
@ -273,7 +272,7 @@ class Layer {
|
|||||||
// A collection of layers. Will render 1-N layers to a D3D11 device.
|
// A collection of layers. Will render 1-N layers to a D3D11 device.
|
||||||
class Composition : public std::enable_shared_from_this<Composition> {
|
class Composition : public std::enable_shared_from_this<Composition> {
|
||||||
public:
|
public:
|
||||||
Composition(const std::shared_ptr<Device>& device,
|
explicit Composition(const std::shared_ptr<Device>& device,
|
||||||
int width = 0,
|
int width = 0,
|
||||||
int height = 0);
|
int height = 0);
|
||||||
|
|
||||||
@ -299,7 +298,7 @@ class Composition : public std::enable_shared_from_this<Composition> {
|
|||||||
int64_t fps_start_;
|
int64_t fps_start_;
|
||||||
double fps_;
|
double fps_;
|
||||||
double time_;
|
double time_;
|
||||||
bool vsync_;
|
bool vsync_ = true;
|
||||||
|
|
||||||
const std::shared_ptr<Device> device_;
|
const std::shared_ptr<Device> device_;
|
||||||
std::vector<std::shared_ptr<Layer>> layers_;
|
std::vector<std::shared_ptr<Layer>> layers_;
|
||||||
@ -324,7 +323,6 @@ class FrameBuffer {
|
|||||||
DISALLOW_COPY_AND_ASSIGN(FrameBuffer);
|
DISALLOW_COPY_AND_ASSIGN(FrameBuffer);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace d3d11
|
} // namespace client::d3d11
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_OSR_D3D11_WIN_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_OSR_D3D11_WIN_H_
|
||||||
|
@ -29,7 +29,7 @@ class OsrDragEvents {
|
|||||||
CefBrowserHost::DragOperationsMask effect) = 0;
|
CefBrowserHost::DragOperationsMask effect) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~OsrDragEvents() {}
|
virtual ~OsrDragEvents() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace client
|
} // namespace client
|
||||||
|
@ -342,7 +342,8 @@ CefRefPtr<CefDragData> DataObjectToDragData(IDataObject* data_object) {
|
|||||||
if (format == CF_HDROP) {
|
if (format == CF_HDROP) {
|
||||||
HDROP hdrop = (HDROP)hGlobal;
|
HDROP hdrop = (HDROP)hGlobal;
|
||||||
const int kMaxFilenameLen = 4096;
|
const int kMaxFilenameLen = 4096;
|
||||||
const unsigned num_files = DragQueryFileW(hdrop, 0xffffffff, 0, 0);
|
const unsigned num_files =
|
||||||
|
DragQueryFileW(hdrop, 0xffffffff, nullptr, 0);
|
||||||
for (unsigned int x = 0; x < num_files; ++x) {
|
for (unsigned int x = 0; x < num_files; ++x) {
|
||||||
wchar_t filename[kMaxFilenameLen];
|
wchar_t filename[kMaxFilenameLen];
|
||||||
if (!DragQueryFileW(hdrop, x, filename, kMaxFilenameLen)) {
|
if (!DragQueryFileW(hdrop, x, filename, kMaxFilenameLen)) {
|
||||||
@ -475,7 +476,7 @@ HRESULT DragEnumFormatEtc::CreateEnumFormatEtc(
|
|||||||
UINT cfmt,
|
UINT cfmt,
|
||||||
FORMATETC* afmt,
|
FORMATETC* afmt,
|
||||||
IEnumFORMATETC** ppEnumFormatEtc) {
|
IEnumFORMATETC** ppEnumFormatEtc) {
|
||||||
if (cfmt == 0 || afmt == 0 || ppEnumFormatEtc == 0) {
|
if (cfmt == 0 || afmt == nullptr || ppEnumFormatEtc == nullptr) {
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,7 +498,7 @@ HRESULT DragEnumFormatEtc::Next(ULONG celt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// store result
|
// store result
|
||||||
if (pceltFetched != 0) {
|
if (pceltFetched != nullptr) {
|
||||||
*pceltFetched = copied;
|
*pceltFetched = copied;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,7 +509,7 @@ HRESULT DragEnumFormatEtc::Skip(ULONG celt) {
|
|||||||
m_nIndex += celt;
|
m_nIndex += celt;
|
||||||
return (m_nIndex <= m_nNumFormats) ? S_OK : S_FALSE;
|
return (m_nIndex <= m_nNumFormats) ? S_OK : S_FALSE;
|
||||||
}
|
}
|
||||||
HRESULT DragEnumFormatEtc::Reset(void) {
|
HRESULT DragEnumFormatEtc::Reset() {
|
||||||
m_nIndex = 0;
|
m_nIndex = 0;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -620,7 +621,7 @@ HRESULT DataObjectWin::GetData(FORMATETC* pFormatEtc, STGMEDIUM* pMedium) {
|
|||||||
|
|
||||||
// found a match - transfer data into supplied storage medium
|
// found a match - transfer data into supplied storage medium
|
||||||
pMedium->tymed = m_pFormatEtc[idx].tymed;
|
pMedium->tymed = m_pFormatEtc[idx].tymed;
|
||||||
pMedium->pUnkForRelease = 0;
|
pMedium->pUnkForRelease = nullptr;
|
||||||
|
|
||||||
// copy the data into the caller's storage medium
|
// copy the data into the caller's storage medium
|
||||||
switch (m_pFormatEtc[idx].tymed) {
|
switch (m_pFormatEtc[idx].tymed) {
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
namespace client {
|
namespace client {
|
||||||
|
|
||||||
#define DEFAULT_QUERY_INTERFACE(__Class) \
|
#define DEFAULT_QUERY_INTERFACE(__Class) \
|
||||||
HRESULT __stdcall QueryInterface(const IID& iid, void** object) { \
|
HRESULT __stdcall QueryInterface(const IID& iid, void** object) override { \
|
||||||
*object = nullptr; \
|
*object = nullptr; \
|
||||||
if (IsEqualIID(iid, IID_IUnknown)) { \
|
if (IsEqualIID(iid, IID_IUnknown)) { \
|
||||||
IUnknown* obj = this; \
|
IUnknown* obj = this; \
|
||||||
@ -38,10 +38,10 @@ namespace client {
|
|||||||
return S_OK; \
|
return S_OK; \
|
||||||
}
|
}
|
||||||
#define IUNKNOWN_IMPLEMENTATION \
|
#define IUNKNOWN_IMPLEMENTATION \
|
||||||
ULONG __stdcall AddRef() { \
|
ULONG __stdcall AddRef() override { \
|
||||||
return ++ref_count_; \
|
return ++ref_count_; \
|
||||||
} \
|
} \
|
||||||
ULONG __stdcall Release() { \
|
ULONG __stdcall Release() override { \
|
||||||
if (--ref_count_ == 0) { \
|
if (--ref_count_ == 0) { \
|
||||||
delete this; \
|
delete this; \
|
||||||
return 0U; \
|
return 0U; \
|
||||||
@ -67,18 +67,18 @@ class DropTargetWin : public IDropTarget {
|
|||||||
HRESULT __stdcall DragEnter(IDataObject* data_object,
|
HRESULT __stdcall DragEnter(IDataObject* data_object,
|
||||||
DWORD key_state,
|
DWORD key_state,
|
||||||
POINTL cursor_position,
|
POINTL cursor_position,
|
||||||
DWORD* effect);
|
DWORD* effect) override;
|
||||||
|
|
||||||
HRESULT __stdcall DragOver(DWORD key_state,
|
HRESULT __stdcall DragOver(DWORD key_state,
|
||||||
POINTL cursor_position,
|
POINTL cursor_position,
|
||||||
DWORD* effect);
|
DWORD* effect) override;
|
||||||
|
|
||||||
HRESULT __stdcall DragLeave();
|
HRESULT __stdcall DragLeave() override;
|
||||||
|
|
||||||
HRESULT __stdcall Drop(IDataObject* data_object,
|
HRESULT __stdcall Drop(IDataObject* data_object,
|
||||||
DWORD key_state,
|
DWORD key_state,
|
||||||
POINTL cursor_position,
|
POINTL cursor_position,
|
||||||
DWORD* effect);
|
DWORD* effect) override;
|
||||||
|
|
||||||
DEFAULT_QUERY_INTERFACE(IDropTarget)
|
DEFAULT_QUERY_INTERFACE(IDropTarget)
|
||||||
IUNKNOWN_IMPLEMENTATION
|
IUNKNOWN_IMPLEMENTATION
|
||||||
@ -86,7 +86,7 @@ class DropTargetWin : public IDropTarget {
|
|||||||
protected:
|
protected:
|
||||||
DropTargetWin(OsrDragEvents* callback, HWND hWnd)
|
DropTargetWin(OsrDragEvents* callback, HWND hWnd)
|
||||||
: ref_count_(0), callback_(callback), hWnd_(hWnd) {}
|
: ref_count_(0), callback_(callback), hWnd_(hWnd) {}
|
||||||
virtual ~DropTargetWin() {}
|
virtual ~DropTargetWin() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OsrDragEvents* callback_;
|
OsrDragEvents* callback_;
|
||||||
@ -100,16 +100,17 @@ class DropSourceWin : public IDropSource {
|
|||||||
static CComPtr<DropSourceWin> Create();
|
static CComPtr<DropSourceWin> Create();
|
||||||
|
|
||||||
// IDropSource implementation:
|
// IDropSource implementation:
|
||||||
HRESULT __stdcall GiveFeedback(DWORD dwEffect);
|
HRESULT __stdcall GiveFeedback(DWORD dwEffect) override;
|
||||||
|
|
||||||
HRESULT __stdcall QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState);
|
HRESULT __stdcall QueryContinueDrag(BOOL fEscapePressed,
|
||||||
|
DWORD grfKeyState) override;
|
||||||
|
|
||||||
DEFAULT_QUERY_INTERFACE(IDropSource)
|
DEFAULT_QUERY_INTERFACE(IDropSource)
|
||||||
IUNKNOWN_IMPLEMENTATION
|
IUNKNOWN_IMPLEMENTATION
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit DropSourceWin() : ref_count_(0) {}
|
explicit DropSourceWin() : ref_count_(0) {}
|
||||||
virtual ~DropSourceWin() {}
|
virtual ~DropSourceWin() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DragEnumFormatEtc : public IEnumFORMATETC {
|
class DragEnumFormatEtc : public IEnumFORMATETC {
|
||||||
@ -123,10 +124,10 @@ class DragEnumFormatEtc : public IEnumFORMATETC {
|
|||||||
//
|
//
|
||||||
HRESULT __stdcall Next(ULONG celt,
|
HRESULT __stdcall Next(ULONG celt,
|
||||||
FORMATETC* pFormatEtc,
|
FORMATETC* pFormatEtc,
|
||||||
ULONG* pceltFetched);
|
ULONG* pceltFetched) override;
|
||||||
HRESULT __stdcall Skip(ULONG celt);
|
HRESULT __stdcall Skip(ULONG celt) override;
|
||||||
HRESULT __stdcall Reset(void);
|
HRESULT __stdcall Reset() override;
|
||||||
HRESULT __stdcall Clone(IEnumFORMATETC** ppEnumFormatEtc);
|
HRESULT __stdcall Clone(IEnumFORMATETC** ppEnumFormatEtc) override;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Construction / Destruction
|
// Construction / Destruction
|
||||||
@ -152,23 +153,24 @@ class DataObjectWin : public IDataObject {
|
|||||||
int count);
|
int count);
|
||||||
|
|
||||||
// IDataObject memberS
|
// IDataObject memberS
|
||||||
HRESULT __stdcall GetDataHere(FORMATETC* pFormatEtc, STGMEDIUM* pmedium);
|
HRESULT __stdcall GetDataHere(FORMATETC* pFormatEtc,
|
||||||
HRESULT __stdcall QueryGetData(FORMATETC* pFormatEtc);
|
STGMEDIUM* pmedium) override;
|
||||||
|
HRESULT __stdcall QueryGetData(FORMATETC* pFormatEtc) override;
|
||||||
HRESULT __stdcall GetCanonicalFormatEtc(FORMATETC* pFormatEct,
|
HRESULT __stdcall GetCanonicalFormatEtc(FORMATETC* pFormatEct,
|
||||||
FORMATETC* pFormatEtcOut);
|
FORMATETC* pFormatEtcOut) override;
|
||||||
HRESULT __stdcall SetData(FORMATETC* pFormatEtc,
|
HRESULT __stdcall SetData(FORMATETC* pFormatEtc,
|
||||||
STGMEDIUM* pMedium,
|
STGMEDIUM* pMedium,
|
||||||
BOOL fRelease);
|
BOOL fRelease) override;
|
||||||
HRESULT __stdcall DAdvise(FORMATETC* pFormatEtc,
|
HRESULT __stdcall DAdvise(FORMATETC* pFormatEtc,
|
||||||
DWORD advf,
|
DWORD advf,
|
||||||
IAdviseSink*,
|
IAdviseSink*,
|
||||||
DWORD*);
|
DWORD*) override;
|
||||||
HRESULT __stdcall DUnadvise(DWORD dwConnection);
|
HRESULT __stdcall DUnadvise(DWORD dwConnection) override;
|
||||||
HRESULT __stdcall EnumDAdvise(IEnumSTATDATA** ppEnumAdvise);
|
HRESULT __stdcall EnumDAdvise(IEnumSTATDATA** ppEnumAdvise) override;
|
||||||
|
|
||||||
HRESULT __stdcall EnumFormatEtc(DWORD dwDirection,
|
HRESULT __stdcall EnumFormatEtc(DWORD dwDirection,
|
||||||
IEnumFORMATETC** ppEnumFormatEtc);
|
IEnumFORMATETC** ppEnumFormatEtc) override;
|
||||||
HRESULT __stdcall GetData(FORMATETC* pFormatEtc, STGMEDIUM* pMedium);
|
HRESULT __stdcall GetData(FORMATETC* pFormatEtc, STGMEDIUM* pMedium) override;
|
||||||
|
|
||||||
DEFAULT_QUERY_INTERFACE(IDataObject)
|
DEFAULT_QUERY_INTERFACE(IDataObject)
|
||||||
IUNKNOWN_IMPLEMENTATION
|
IUNKNOWN_IMPLEMENTATION
|
||||||
@ -183,7 +185,7 @@ class DataObjectWin : public IDataObject {
|
|||||||
int LookupFormatEtc(FORMATETC* pFormatEtc);
|
int LookupFormatEtc(FORMATETC* pFormatEtc);
|
||||||
|
|
||||||
explicit DataObjectWin(FORMATETC* fmtetc, STGMEDIUM* stgmed, int count);
|
explicit DataObjectWin(FORMATETC* fmtetc, STGMEDIUM* stgmed, int count);
|
||||||
virtual ~DataObjectWin() {}
|
virtual ~DataObjectWin() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace client
|
} // namespace client
|
||||||
|
@ -97,9 +97,8 @@ void GetCompositionUnderlines(
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
OsrImeHandlerWin::OsrImeHandlerWin(HWND hwnd)
|
OsrImeHandlerWin::OsrImeHandlerWin(HWND hwnd)
|
||||||
: is_composing_(false),
|
: input_language_id_(LANG_USER_DEFAULT),
|
||||||
input_language_id_(LANG_USER_DEFAULT),
|
|
||||||
system_caret_(false),
|
|
||||||
cursor_index_(std::numeric_limits<uint32_t>::max()),
|
cursor_index_(std::numeric_limits<uint32_t>::max()),
|
||||||
hwnd_(hwnd) {
|
hwnd_(hwnd) {
|
||||||
ime_rect_ = {-1, -1, 0, 0};
|
ime_rect_ = {-1, -1, 0, 0};
|
||||||
|
@ -83,7 +83,7 @@ class OsrImeHandlerWin {
|
|||||||
bool GetString(HIMC imm_context, WPARAM lparam, int type, CefString& result);
|
bool GetString(HIMC imm_context, WPARAM lparam, int type, CefString& result);
|
||||||
|
|
||||||
// Represents whether or not there is an ongoing composition.
|
// Represents whether or not there is an ongoing composition.
|
||||||
bool is_composing_;
|
bool is_composing_ = false;
|
||||||
|
|
||||||
// The current composition character range and its bounds.
|
// The current composition character range and its bounds.
|
||||||
std::vector<CefRect> composition_bounds_;
|
std::vector<CefRect> composition_bounds_;
|
||||||
@ -94,7 +94,7 @@ class OsrImeHandlerWin {
|
|||||||
|
|
||||||
// Represents whether or not the current input context has created a system
|
// Represents whether or not the current input context has created a system
|
||||||
// caret to set the position of its IME candidate window.
|
// caret to set the position of its IME candidate window.
|
||||||
bool system_caret_;
|
bool system_caret_ = false;
|
||||||
|
|
||||||
// The rectangle of the input caret retrieved from a renderer process.
|
// The rectangle of the input caret retrieved from a renderer process.
|
||||||
CefRect ime_rect_;
|
CefRect ime_rect_;
|
||||||
|
@ -15,7 +15,7 @@ OsrRenderHandlerWin::OsrRenderHandlerWin(const OsrRendererSettings& settings,
|
|||||||
HWND hwnd)
|
HWND hwnd)
|
||||||
: settings_(settings),
|
: settings_(settings),
|
||||||
hwnd_(hwnd),
|
hwnd_(hwnd),
|
||||||
begin_frame_pending_(false),
|
|
||||||
weak_factory_(this) {
|
weak_factory_(this) {
|
||||||
CEF_REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
DCHECK(hwnd_);
|
DCHECK(hwnd_);
|
||||||
|
@ -68,7 +68,7 @@ class OsrRenderHandlerWin {
|
|||||||
// The below members are only accessed on the UI thread.
|
// The below members are only accessed on the UI thread.
|
||||||
const OsrRendererSettings settings_;
|
const OsrRendererSettings settings_;
|
||||||
const HWND hwnd_;
|
const HWND hwnd_;
|
||||||
bool begin_frame_pending_;
|
bool begin_frame_pending_ = false;
|
||||||
CefRefPtr<CefBrowser> browser_;
|
CefRefPtr<CefBrowser> browser_;
|
||||||
|
|
||||||
// Must be the last member.
|
// Must be the last member.
|
||||||
|
@ -80,7 +80,7 @@ void PopupLayer::set_bounds(const CefRect& bounds) {
|
|||||||
OsrRenderHandlerWinD3D11::OsrRenderHandlerWinD3D11(
|
OsrRenderHandlerWinD3D11::OsrRenderHandlerWinD3D11(
|
||||||
const OsrRendererSettings& settings,
|
const OsrRendererSettings& settings,
|
||||||
HWND hwnd)
|
HWND hwnd)
|
||||||
: OsrRenderHandlerWin(settings, hwnd), start_time_(0) {}
|
: OsrRenderHandlerWin(settings, hwnd) {}
|
||||||
|
|
||||||
bool OsrRenderHandlerWinD3D11::Initialize(CefRefPtr<CefBrowser> browser,
|
bool OsrRenderHandlerWinD3D11::Initialize(CefRefPtr<CefBrowser> browser,
|
||||||
int width,
|
int width,
|
||||||
|
@ -75,7 +75,7 @@ class OsrRenderHandlerWinD3D11 : public OsrRenderHandlerWin {
|
|||||||
private:
|
private:
|
||||||
void Render() override;
|
void Render() override;
|
||||||
|
|
||||||
uint64_t start_time_;
|
uint64_t start_time_ = 0;
|
||||||
std::shared_ptr<d3d11::Device> device_;
|
std::shared_ptr<d3d11::Device> device_;
|
||||||
std::shared_ptr<d3d11::SwapChain> swap_chain_;
|
std::shared_ptr<d3d11::SwapChain> swap_chain_;
|
||||||
std::shared_ptr<d3d11::Composition> composition_;
|
std::shared_ptr<d3d11::Composition> composition_;
|
||||||
|
@ -40,11 +40,7 @@ class ScopedGLContext {
|
|||||||
OsrRenderHandlerWinGL::OsrRenderHandlerWinGL(
|
OsrRenderHandlerWinGL::OsrRenderHandlerWinGL(
|
||||||
const OsrRendererSettings& settings,
|
const OsrRendererSettings& settings,
|
||||||
HWND hwnd)
|
HWND hwnd)
|
||||||
: OsrRenderHandlerWin(settings, hwnd),
|
: OsrRenderHandlerWin(settings, hwnd), renderer_(settings) {}
|
||||||
renderer_(settings),
|
|
||||||
hdc_(nullptr),
|
|
||||||
hrc_(nullptr),
|
|
||||||
painting_popup_(false) {}
|
|
||||||
|
|
||||||
void OsrRenderHandlerWinGL::Initialize(CefRefPtr<CefBrowser> browser) {
|
void OsrRenderHandlerWinGL::Initialize(CefRefPtr<CefBrowser> browser) {
|
||||||
CEF_REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
@ -14,7 +14,7 @@ namespace client {
|
|||||||
class OsrRenderHandlerWinGL : public OsrRenderHandlerWin {
|
class OsrRenderHandlerWinGL : public OsrRenderHandlerWin {
|
||||||
public:
|
public:
|
||||||
OsrRenderHandlerWinGL(const OsrRendererSettings& settings, HWND hwnd);
|
OsrRenderHandlerWinGL(const OsrRendererSettings& settings, HWND hwnd);
|
||||||
virtual ~OsrRenderHandlerWinGL();
|
~OsrRenderHandlerWinGL() override;
|
||||||
|
|
||||||
// Must be called immediately after object creation.
|
// Must be called immediately after object creation.
|
||||||
void Initialize(CefRefPtr<CefBrowser> browser);
|
void Initialize(CefRefPtr<CefBrowser> browser);
|
||||||
@ -45,9 +45,9 @@ class OsrRenderHandlerWinGL : public OsrRenderHandlerWin {
|
|||||||
|
|
||||||
// The below members are only accessed on the UI thread.
|
// The below members are only accessed on the UI thread.
|
||||||
OsrRenderer renderer_;
|
OsrRenderer renderer_;
|
||||||
HDC hdc_;
|
HDC hdc_ = nullptr;
|
||||||
HGLRC hrc_;
|
HGLRC hrc_ = nullptr;
|
||||||
bool painting_popup_;
|
bool painting_popup_ = false;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(OsrRenderHandlerWinGL);
|
DISALLOW_COPY_AND_ASSIGN(OsrRenderHandlerWinGL);
|
||||||
};
|
};
|
||||||
|
@ -11,26 +11,21 @@
|
|||||||
namespace client {
|
namespace client {
|
||||||
|
|
||||||
struct OsrRendererSettings {
|
struct OsrRendererSettings {
|
||||||
OsrRendererSettings()
|
OsrRendererSettings() = default;
|
||||||
: show_update_rect(false),
|
|
||||||
background_color(0),
|
|
||||||
shared_texture_enabled(false),
|
|
||||||
external_begin_frame_enabled(false),
|
|
||||||
begin_frame_rate(0) {}
|
|
||||||
|
|
||||||
// If true draw a border around update rectangles.
|
// If true draw a border around update rectangles.
|
||||||
bool show_update_rect;
|
bool show_update_rect = false;
|
||||||
|
|
||||||
// Background color. Enables transparency if the alpha component is 0.
|
// Background color. Enables transparency if the alpha component is 0.
|
||||||
cef_color_t background_color;
|
cef_color_t background_color = 0;
|
||||||
|
|
||||||
// Render using shared textures. Supported on Windows only via D3D11.
|
// Render using shared textures. Supported on Windows only via D3D11.
|
||||||
bool shared_texture_enabled;
|
bool shared_texture_enabled = false;
|
||||||
|
|
||||||
// Client implements a BeginFrame timer by calling
|
// Client implements a BeginFrame timer by calling
|
||||||
// CefBrowserHost::SendExternalBeginFrame at the specified frame rate.
|
// CefBrowserHost::SendExternalBeginFrame at the specified frame rate.
|
||||||
bool external_begin_frame_enabled;
|
bool external_begin_frame_enabled = false;
|
||||||
int begin_frame_rate;
|
int begin_frame_rate = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace client
|
} // namespace client
|
||||||
|
@ -5,10 +5,13 @@
|
|||||||
#include "tests/cefclient/browser/osr_window_win.h"
|
#include "tests/cefclient/browser/osr_window_win.h"
|
||||||
|
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
#if defined(CEF_USE_ATL)
|
#if defined(CEF_USE_ATL)
|
||||||
#include <oleacc.h>
|
#include <oleacc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
#include "tests/cefclient/browser/main_context.h"
|
#include "tests/cefclient/browser/main_context.h"
|
||||||
#include "tests/cefclient/browser/osr_accessibility_helper.h"
|
#include "tests/cefclient/browser/osr_accessibility_helper.h"
|
||||||
@ -85,19 +88,9 @@ OsrWindowWin::OsrWindowWin(Delegate* delegate,
|
|||||||
const OsrRendererSettings& settings)
|
const OsrRendererSettings& settings)
|
||||||
: delegate_(delegate),
|
: delegate_(delegate),
|
||||||
settings_(settings),
|
settings_(settings),
|
||||||
hwnd_(nullptr),
|
|
||||||
device_scale_factor_(0),
|
|
||||||
hidden_(false),
|
|
||||||
last_mouse_pos_(),
|
last_mouse_pos_(),
|
||||||
current_mouse_pos_(),
|
current_mouse_pos_() {
|
||||||
mouse_rotation_(false),
|
|
||||||
mouse_tracking_(false),
|
|
||||||
last_click_x_(0),
|
|
||||||
last_click_y_(0),
|
|
||||||
last_click_button_(MBT_LEFT),
|
|
||||||
last_click_count_(1),
|
|
||||||
last_click_time_(0),
|
|
||||||
last_mouse_down_on_view_(false) {
|
|
||||||
DCHECK(delegate_);
|
DCHECK(delegate_);
|
||||||
client_rect_ = {0};
|
client_rect_ = {0};
|
||||||
}
|
}
|
||||||
@ -299,10 +292,10 @@ void OsrWindowWin::Create(HWND parent_hwnd, const RECT& rect) {
|
|||||||
// Create the native window with a border so it's easier to visually identify
|
// Create the native window with a border so it's easier to visually identify
|
||||||
// OSR windows.
|
// OSR windows.
|
||||||
hwnd_ = ::CreateWindowEx(
|
hwnd_ = ::CreateWindowEx(
|
||||||
ex_style, kWndClass, 0,
|
ex_style, kWndClass, nullptr,
|
||||||
WS_BORDER | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE,
|
WS_BORDER | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE,
|
||||||
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
|
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
|
||||||
parent_hwnd, 0, hInst, 0);
|
parent_hwnd, nullptr, hInst, nullptr);
|
||||||
CHECK(hwnd_);
|
CHECK(hwnd_);
|
||||||
|
|
||||||
client_rect_ = rect;
|
client_rect_ = rect;
|
||||||
@ -319,7 +312,7 @@ void OsrWindowWin::Create(HWND parent_hwnd, const RECT& rect) {
|
|||||||
DCHECK_EQ(register_res, S_OK);
|
DCHECK_EQ(register_res, S_OK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ime_handler_.reset(new OsrImeHandlerWin(hwnd_));
|
ime_handler_ = std::make_unique<OsrImeHandlerWin>(hwnd_);
|
||||||
|
|
||||||
// Enable Touch Events if requested
|
// Enable Touch Events if requested
|
||||||
if (client::MainContext::Get()->TouchEventsEnabled()) {
|
if (client::MainContext::Get()->TouchEventsEnabled()) {
|
||||||
@ -1135,7 +1128,8 @@ void OsrWindowWin::UpdateAccessibilityTree(CefRefPtr<CefValue> value) {
|
|||||||
|
|
||||||
#if defined(CEF_USE_ATL)
|
#if defined(CEF_USE_ATL)
|
||||||
if (!accessibility_handler_) {
|
if (!accessibility_handler_) {
|
||||||
accessibility_handler_.reset(new OsrAccessibilityHelper(value, browser_));
|
accessibility_handler_ =
|
||||||
|
std::make_unique<OsrAccessibilityHelper>(value, browser_);
|
||||||
} else {
|
} else {
|
||||||
accessibility_handler_->UpdateAccessibilityTree(value);
|
accessibility_handler_->UpdateAccessibilityTree(value);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ class OsrWindowWin
|
|||||||
virtual void OnOsrNativeWindowCreated(HWND hwnd) = 0;
|
virtual void OnOsrNativeWindowCreated(HWND hwnd) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Delegate() {}
|
virtual ~Delegate() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
// |delegate| must outlive this object.
|
// |delegate| must outlive this object.
|
||||||
@ -72,7 +72,7 @@ class OsrWindowWin
|
|||||||
friend struct CefDeleteOnThread<TID_UI>;
|
friend struct CefDeleteOnThread<TID_UI>;
|
||||||
friend class base::RefCountedThreadSafe<OsrWindowWin, CefDeleteOnUIThread>;
|
friend class base::RefCountedThreadSafe<OsrWindowWin, CefDeleteOnUIThread>;
|
||||||
|
|
||||||
~OsrWindowWin();
|
~OsrWindowWin() override;
|
||||||
|
|
||||||
// Manage native window lifespan.
|
// Manage native window lifespan.
|
||||||
void Create(HWND parent_hwnd, const RECT& rect);
|
void Create(HWND parent_hwnd, const RECT& rect);
|
||||||
@ -172,14 +172,14 @@ class OsrWindowWin
|
|||||||
Delegate* delegate_;
|
Delegate* delegate_;
|
||||||
|
|
||||||
const OsrRendererSettings settings_;
|
const OsrRendererSettings settings_;
|
||||||
HWND hwnd_;
|
HWND hwnd_ = nullptr;
|
||||||
std::unique_ptr<OsrRenderHandlerWin> render_handler_;
|
std::unique_ptr<OsrRenderHandlerWin> render_handler_;
|
||||||
|
|
||||||
// Class that encapsulates IMM32 APIs and controls IMEs attached to a window.
|
// Class that encapsulates IMM32 APIs and controls IMEs attached to a window.
|
||||||
std::unique_ptr<OsrImeHandlerWin> ime_handler_;
|
std::unique_ptr<OsrImeHandlerWin> ime_handler_;
|
||||||
|
|
||||||
RECT client_rect_;
|
RECT client_rect_;
|
||||||
float device_scale_factor_;
|
float device_scale_factor_ = 0;
|
||||||
|
|
||||||
CefRefPtr<CefBrowser> browser_;
|
CefRefPtr<CefBrowser> browser_;
|
||||||
|
|
||||||
@ -193,19 +193,19 @@ class OsrWindowWin
|
|||||||
IAccessible* accessibility_root_;
|
IAccessible* accessibility_root_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool hidden_;
|
bool hidden_ = false;
|
||||||
|
|
||||||
// Mouse state tracking.
|
// Mouse state tracking.
|
||||||
POINT last_mouse_pos_;
|
POINT last_mouse_pos_;
|
||||||
POINT current_mouse_pos_;
|
POINT current_mouse_pos_;
|
||||||
bool mouse_rotation_;
|
bool mouse_rotation_ = false;
|
||||||
bool mouse_tracking_;
|
bool mouse_tracking_ = false;
|
||||||
int last_click_x_;
|
int last_click_x_ = 0;
|
||||||
int last_click_y_;
|
int last_click_y_ = 0;
|
||||||
CefBrowserHost::MouseButtonType last_click_button_;
|
CefBrowserHost::MouseButtonType last_click_button_ = MBT_LEFT;
|
||||||
int last_click_count_;
|
int last_click_count_ = 1;
|
||||||
double last_click_time_;
|
double last_click_time_ = 0;
|
||||||
bool last_mouse_down_on_view_;
|
bool last_mouse_down_on_view_ = false;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(OsrWindowWin);
|
DISALLOW_COPY_AND_ASSIGN(OsrWindowWin);
|
||||||
};
|
};
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
#include "include/cef_parser.h"
|
#include "include/cef_parser.h"
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::preferences_test {
|
||||||
namespace preferences_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -263,8 +262,8 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
|
|
||||||
CefDictionaryValue::KeyList keys;
|
CefDictionaryValue::KeyList keys;
|
||||||
dict->GetKeys(keys);
|
dict->GetKeys(keys);
|
||||||
for (size_t i = 0; i < keys.size(); ++i) {
|
for (const auto& i : keys) {
|
||||||
const std::string& key = keys[i];
|
const std::string& key = i;
|
||||||
const std::string& current_name = name.empty() ? key : name + "." + key;
|
const std::string& current_name = name.empty() ? key : name + "." + key;
|
||||||
if (!ApplyPrefs(context, current_name, dict->GetValue(key), error,
|
if (!ApplyPrefs(context, current_name, dict->GetValue(key), error,
|
||||||
changed_names)) {
|
changed_names)) {
|
||||||
@ -342,5 +341,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) {
|
|||||||
handlers.insert(new Handler());
|
handlers.insert(new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace preferences_test
|
} // namespace client::preferences_test
|
||||||
} // namespace client
|
|
||||||
|
@ -8,13 +8,11 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::preferences_test {
|
||||||
namespace preferences_test {
|
|
||||||
|
|
||||||
// Create message handlers. Called from test_runner.cc.
|
// Create message handlers. Called from test_runner.cc.
|
||||||
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
||||||
|
|
||||||
} // namespace preferences_test
|
} // namespace client::preferences_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_PREFERENCES_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_PREFERENCES_TEST_H_
|
||||||
|
@ -49,9 +49,9 @@ int GetResourceId(const char* resource_name) {
|
|||||||
{"xmlhttprequest.html", IDS_XMLHTTPREQUEST_HTML},
|
{"xmlhttprequest.html", IDS_XMLHTTPREQUEST_HTML},
|
||||||
{"xmlhttprequest.html", IDS_XMLHTTPREQUEST_HTML}};
|
{"xmlhttprequest.html", IDS_XMLHTTPREQUEST_HTML}};
|
||||||
|
|
||||||
for (size_t i = 0; i < sizeof(resource_map) / sizeof(_resource_map); ++i) {
|
for (auto& i : resource_map) {
|
||||||
if (!strcmp(resource_map[i].name, resource_name)) {
|
if (!strcmp(i.name, resource_name)) {
|
||||||
return resource_map[i].id;
|
return i.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
#include "tests/shared/common/client_switches.h"
|
#include "tests/shared/common/client_switches.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::response_filter_test {
|
||||||
namespace response_filter_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -31,10 +30,7 @@ const char kReplaceString[] = "This is the replaced string!";
|
|||||||
// the logic in this implementation.
|
// the logic in this implementation.
|
||||||
class FindReplaceResponseFilter : public CefResponseFilter {
|
class FindReplaceResponseFilter : public CefResponseFilter {
|
||||||
public:
|
public:
|
||||||
FindReplaceResponseFilter()
|
FindReplaceResponseFilter() = default;
|
||||||
: find_match_offset_(0U),
|
|
||||||
replace_overflow_size_(0U),
|
|
||||||
replace_count_(0U) {}
|
|
||||||
|
|
||||||
bool InitFilter() override {
|
bool InitFilter() override {
|
||||||
const size_t find_size = sizeof(kFindString) - 1;
|
const size_t find_size = sizeof(kFindString) - 1;
|
||||||
@ -158,16 +154,16 @@ class FindReplaceResponseFilter : public CefResponseFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The portion of the find string that is currently matching.
|
// The portion of the find string that is currently matching.
|
||||||
size_t find_match_offset_;
|
size_t find_match_offset_ = 0U;
|
||||||
|
|
||||||
// The likely amount of overflow.
|
// The likely amount of overflow.
|
||||||
size_t replace_overflow_size_;
|
size_t replace_overflow_size_ = 0U;
|
||||||
|
|
||||||
// Overflow from the output buffer.
|
// Overflow from the output buffer.
|
||||||
std::string overflow_;
|
std::string overflow_;
|
||||||
|
|
||||||
// Number of times the the string was found/replaced.
|
// Number of times the the string was found/replaced.
|
||||||
size_t replace_count_;
|
size_t replace_count_ = 0U;
|
||||||
|
|
||||||
IMPLEMENT_REFCOUNTING(FindReplaceResponseFilter);
|
IMPLEMENT_REFCOUNTING(FindReplaceResponseFilter);
|
||||||
};
|
};
|
||||||
@ -175,7 +171,7 @@ class FindReplaceResponseFilter : public CefResponseFilter {
|
|||||||
// Filter that writes out all of the contents unchanged.
|
// Filter that writes out all of the contents unchanged.
|
||||||
class PassThruResponseFilter : public CefResponseFilter {
|
class PassThruResponseFilter : public CefResponseFilter {
|
||||||
public:
|
public:
|
||||||
PassThruResponseFilter() {}
|
PassThruResponseFilter() = default;
|
||||||
|
|
||||||
bool InitFilter() override { return true; }
|
bool InitFilter() override { return true; }
|
||||||
|
|
||||||
@ -242,5 +238,4 @@ CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace response_filter_test
|
} // namespace client::response_filter_test
|
||||||
} // namespace client
|
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
#include "include/cef_response.h"
|
#include "include/cef_response.h"
|
||||||
#include "include/cef_response_filter.h"
|
#include "include/cef_response_filter.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::response_filter_test {
|
||||||
namespace response_filter_test {
|
|
||||||
|
|
||||||
// Create a resource response filter. Called from test_runner.cc.
|
// Create a resource response filter. Called from test_runner.cc.
|
||||||
CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
|
CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
|
||||||
@ -21,7 +20,6 @@ CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
|
|||||||
CefRefPtr<CefRequest> request,
|
CefRefPtr<CefRequest> request,
|
||||||
CefRefPtr<CefResponse> response);
|
CefRefPtr<CefResponse> response);
|
||||||
|
|
||||||
} // namespace response_filter_test
|
} // namespace client::response_filter_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_RESPONSE_FILTER_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_RESPONSE_FILTER_TEST_H_
|
||||||
|
@ -17,9 +17,9 @@ RootWindowConfig::RootWindowConfig(CefRefPtr<CefCommandLine> cmd)
|
|||||||
with_controls(!command_line->HasSwitch(switches::kHideControls)),
|
with_controls(!command_line->HasSwitch(switches::kHideControls)),
|
||||||
url(MainContext::Get()->GetMainURL(command_line)) {}
|
url(MainContext::Get()->GetMainURL(command_line)) {}
|
||||||
|
|
||||||
RootWindow::RootWindow() : delegate_(nullptr) {}
|
RootWindow::RootWindow() = default;
|
||||||
|
|
||||||
RootWindow::~RootWindow() {}
|
RootWindow::~RootWindow() = default;
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_refptr<RootWindow> RootWindow::GetForBrowser(int browser_id) {
|
scoped_refptr<RootWindow> RootWindow::GetForBrowser(int browser_id) {
|
||||||
|
@ -39,7 +39,7 @@ struct RootWindowConfig {
|
|||||||
// |command_line| will be non-nullptr when used for new window creation via
|
// |command_line| will be non-nullptr when used for new window creation via
|
||||||
// OnAlreadyRunningAppRelaunch. Otherwise, the global command-line will be
|
// OnAlreadyRunningAppRelaunch. Otherwise, the global command-line will be
|
||||||
// used.
|
// used.
|
||||||
RootWindowConfig(CefRefPtr<CefCommandLine> command_line = nullptr);
|
explicit RootWindowConfig(CefRefPtr<CefCommandLine> command_line = nullptr);
|
||||||
|
|
||||||
// Associated command-line.
|
// Associated command-line.
|
||||||
CefRefPtr<CefCommandLine> command_line;
|
CefRefPtr<CefCommandLine> command_line;
|
||||||
@ -129,7 +129,7 @@ class RootWindow
|
|||||||
bool with_osr) = 0;
|
bool with_osr) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Delegate() {}
|
virtual ~Delegate() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create a new RootWindow object. This method may be called on any thread.
|
// Create a new RootWindow object. This method may be called on any thread.
|
||||||
@ -223,7 +223,7 @@ class RootWindow
|
|||||||
RootWindow();
|
RootWindow();
|
||||||
virtual ~RootWindow();
|
virtual ~RootWindow();
|
||||||
|
|
||||||
Delegate* delegate_;
|
Delegate* delegate_ = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace client
|
} // namespace client
|
||||||
|
@ -24,7 +24,7 @@ namespace {
|
|||||||
class ClientRequestContextHandler : public CefRequestContextHandler,
|
class ClientRequestContextHandler : public CefRequestContextHandler,
|
||||||
public CefExtensionHandler {
|
public CefExtensionHandler {
|
||||||
public:
|
public:
|
||||||
ClientRequestContextHandler() {}
|
ClientRequestContextHandler() = default;
|
||||||
|
|
||||||
// CefRequestContextHandler methods:
|
// CefRequestContextHandler methods:
|
||||||
void OnRequestContextInitialized(
|
void OnRequestContextInitialized(
|
||||||
|
@ -88,7 +88,7 @@ class RootWindowManager : public RootWindow::Delegate {
|
|||||||
// Allow deletion via std::unique_ptr only.
|
// Allow deletion via std::unique_ptr only.
|
||||||
friend std::default_delete<RootWindowManager>;
|
friend std::default_delete<RootWindowManager>;
|
||||||
|
|
||||||
~RootWindowManager();
|
~RootWindowManager() override;
|
||||||
|
|
||||||
void OnRootWindowCreated(scoped_refptr<RootWindow> root_window);
|
void OnRootWindowCreated(scoped_refptr<RootWindow> root_window);
|
||||||
void NotifyExtensionsChanged();
|
void NotifyExtensionsChanged();
|
||||||
|
@ -543,8 +543,8 @@ void RootWindowViews::InitOnUIThread(
|
|||||||
|
|
||||||
// Populate the default image cache.
|
// Populate the default image cache.
|
||||||
ImageCache::ImageInfoSet image_set;
|
ImageCache::ImageInfoSet image_set;
|
||||||
for (size_t i = 0U; i < std::size(kDefaultImageCache); ++i) {
|
for (auto& i : kDefaultImageCache) {
|
||||||
image_set.push_back(ImageCache::ImageInfo::Create2x(kDefaultImageCache[i]));
|
image_set.push_back(ImageCache::ImageInfo::Create2x(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
image_cache_->LoadImages(
|
image_cache_->LoadImages(
|
||||||
|
@ -26,7 +26,7 @@ class RootWindowViews : public RootWindow,
|
|||||||
// non-nullptr for popup browsers with a RootWindow parent (called on the UI
|
// non-nullptr for popup browsers with a RootWindow parent (called on the UI
|
||||||
// thread only).
|
// thread only).
|
||||||
explicit RootWindowViews(RootWindowViews* parent_window);
|
explicit RootWindowViews(RootWindowViews* parent_window);
|
||||||
~RootWindowViews();
|
~RootWindowViews() override;
|
||||||
|
|
||||||
void SetTitlebarHeight(const std::optional<float>& height);
|
void SetTitlebarHeight(const std::optional<float>& height);
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <shellscalingapi.h>
|
#include <shellscalingapi.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
@ -323,11 +324,11 @@ void RootWindowWin::CreateBrowserWindow(const std::string& startup_url) {
|
|||||||
if (with_osr_) {
|
if (with_osr_) {
|
||||||
OsrRendererSettings settings = {};
|
OsrRendererSettings settings = {};
|
||||||
MainContext::Get()->PopulateOsrSettings(&settings);
|
MainContext::Get()->PopulateOsrSettings(&settings);
|
||||||
browser_window_.reset(
|
browser_window_ = std::make_unique<BrowserWindowOsrWin>(
|
||||||
new BrowserWindowOsrWin(this, with_controls_, startup_url, settings));
|
this, with_controls_, startup_url, settings);
|
||||||
} else {
|
} else {
|
||||||
browser_window_.reset(
|
browser_window_ = std::make_unique<BrowserWindowStdWin>(
|
||||||
new BrowserWindowStdWin(this, with_controls_, startup_url));
|
this, with_controls_, startup_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -944,38 +945,39 @@ void RootWindowWin::OnCreate(LPCREATESTRUCT lpCreateStruct) {
|
|||||||
back_hwnd_ = CreateWindow(
|
back_hwnd_ = CreateWindow(
|
||||||
L"BUTTON", L"Back", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
L"BUTTON", L"Back", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
||||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
x_offset, 0, button_width, urlbar_height, hwnd_,
|
||||||
reinterpret_cast<HMENU>(IDC_NAV_BACK), hInstance, 0);
|
reinterpret_cast<HMENU>(IDC_NAV_BACK), hInstance, nullptr);
|
||||||
CHECK(back_hwnd_);
|
CHECK(back_hwnd_);
|
||||||
x_offset += button_width;
|
x_offset += button_width;
|
||||||
|
|
||||||
forward_hwnd_ =
|
forward_hwnd_ = CreateWindow(
|
||||||
CreateWindow(L"BUTTON", L"Forward",
|
L"BUTTON", L"Forward",
|
||||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED, x_offset, 0,
|
||||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
button_width, urlbar_height, hwnd_,
|
||||||
reinterpret_cast<HMENU>(IDC_NAV_FORWARD), hInstance, 0);
|
reinterpret_cast<HMENU>(IDC_NAV_FORWARD), hInstance, nullptr);
|
||||||
CHECK(forward_hwnd_);
|
CHECK(forward_hwnd_);
|
||||||
x_offset += button_width;
|
x_offset += button_width;
|
||||||
|
|
||||||
reload_hwnd_ =
|
reload_hwnd_ = CreateWindow(
|
||||||
CreateWindow(L"BUTTON", L"Reload",
|
L"BUTTON", L"Reload",
|
||||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED, x_offset, 0,
|
||||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
button_width, urlbar_height, hwnd_,
|
||||||
reinterpret_cast<HMENU>(IDC_NAV_RELOAD), hInstance, 0);
|
reinterpret_cast<HMENU>(IDC_NAV_RELOAD), hInstance, nullptr);
|
||||||
CHECK(reload_hwnd_);
|
CHECK(reload_hwnd_);
|
||||||
x_offset += button_width;
|
x_offset += button_width;
|
||||||
|
|
||||||
stop_hwnd_ = CreateWindow(
|
stop_hwnd_ = CreateWindow(
|
||||||
L"BUTTON", L"Stop", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
L"BUTTON", L"Stop", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
||||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
x_offset, 0, button_width, urlbar_height, hwnd_,
|
||||||
reinterpret_cast<HMENU>(IDC_NAV_STOP), hInstance, 0);
|
reinterpret_cast<HMENU>(IDC_NAV_STOP), hInstance, nullptr);
|
||||||
CHECK(stop_hwnd_);
|
CHECK(stop_hwnd_);
|
||||||
x_offset += button_width;
|
x_offset += button_width;
|
||||||
|
|
||||||
edit_hwnd_ = CreateWindow(L"EDIT", 0,
|
edit_hwnd_ =
|
||||||
|
CreateWindow(L"EDIT", nullptr,
|
||||||
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
|
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
|
||||||
ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_DISABLED,
|
ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_DISABLED,
|
||||||
x_offset, 0, rect.right - button_width * 4,
|
x_offset, 0, rect.right - button_width * 4, urlbar_height,
|
||||||
urlbar_height, hwnd_, 0, hInstance, 0);
|
hwnd_, nullptr, hInstance, nullptr);
|
||||||
CHECK(edit_hwnd_);
|
CHECK(edit_hwnd_);
|
||||||
|
|
||||||
// Override the edit control's window procedure.
|
// Override the edit control's window procedure.
|
||||||
|
@ -25,7 +25,7 @@ class RootWindowWin : public RootWindow, public BrowserWindow::Delegate {
|
|||||||
public:
|
public:
|
||||||
// Constructor may be called on any thread.
|
// Constructor may be called on any thread.
|
||||||
RootWindowWin();
|
RootWindowWin();
|
||||||
~RootWindowWin();
|
~RootWindowWin() override;
|
||||||
|
|
||||||
// RootWindow methods.
|
// RootWindow methods.
|
||||||
void Init(RootWindow::Delegate* delegate,
|
void Init(RootWindow::Delegate* delegate,
|
||||||
|
@ -18,15 +18,14 @@
|
|||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
#include "tests/shared/browser/resource_util.h"
|
#include "tests/shared/browser/resource_util.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::scheme_test {
|
||||||
namespace scheme_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Implementation of the schema handler for client:// requests.
|
// Implementation of the schema handler for client:// requests.
|
||||||
class ClientSchemeHandler : public CefResourceHandler {
|
class ClientSchemeHandler : public CefResourceHandler {
|
||||||
public:
|
public:
|
||||||
ClientSchemeHandler() : offset_(0) {}
|
ClientSchemeHandler() = default;
|
||||||
|
|
||||||
bool Open(CefRefPtr<CefRequest> request,
|
bool Open(CefRefPtr<CefRequest> request,
|
||||||
bool& handle_request,
|
bool& handle_request,
|
||||||
@ -119,7 +118,7 @@ class ClientSchemeHandler : public CefResourceHandler {
|
|||||||
private:
|
private:
|
||||||
std::string data_;
|
std::string data_;
|
||||||
std::string mime_type_;
|
std::string mime_type_;
|
||||||
size_t offset_;
|
size_t offset_ = 0;
|
||||||
|
|
||||||
IMPLEMENT_REFCOUNTING(ClientSchemeHandler);
|
IMPLEMENT_REFCOUNTING(ClientSchemeHandler);
|
||||||
DISALLOW_COPY_AND_ASSIGN(ClientSchemeHandler);
|
DISALLOW_COPY_AND_ASSIGN(ClientSchemeHandler);
|
||||||
@ -128,7 +127,7 @@ class ClientSchemeHandler : public CefResourceHandler {
|
|||||||
// Implementation of the factory for for creating schema handlers.
|
// Implementation of the factory for for creating schema handlers.
|
||||||
class ClientSchemeHandlerFactory : public CefSchemeHandlerFactory {
|
class ClientSchemeHandlerFactory : public CefSchemeHandlerFactory {
|
||||||
public:
|
public:
|
||||||
ClientSchemeHandlerFactory() {}
|
ClientSchemeHandlerFactory() = default;
|
||||||
|
|
||||||
// Return a new scheme handler instance to handle the request.
|
// Return a new scheme handler instance to handle the request.
|
||||||
CefRefPtr<CefResourceHandler> Create(CefRefPtr<CefBrowser> browser,
|
CefRefPtr<CefResourceHandler> Create(CefRefPtr<CefBrowser> browser,
|
||||||
@ -150,5 +149,4 @@ void RegisterSchemeHandlers() {
|
|||||||
new ClientSchemeHandlerFactory());
|
new ClientSchemeHandlerFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace scheme_test
|
} // namespace client::scheme_test
|
||||||
} // namespace client
|
|
||||||
|
@ -6,15 +6,13 @@
|
|||||||
#define CEF_TESTS_CEFCLIENT_BROWSER_SCHEME_TEST_H_
|
#define CEF_TESTS_CEFCLIENT_BROWSER_SCHEME_TEST_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace client {
|
namespace client::scheme_test {
|
||||||
namespace scheme_test {
|
|
||||||
|
|
||||||
// Create and register the custom scheme handler. See
|
// Create and register the custom scheme handler. See
|
||||||
// common/scheme_handler_common.h for registration of the custom scheme
|
// common/scheme_handler_common.h for registration of the custom scheme
|
||||||
// name/type which must occur in all processes. Called from test_runner.cc.
|
// name/type which must occur in all processes. Called from test_runner.cc.
|
||||||
void RegisterSchemeHandlers();
|
void RegisterSchemeHandlers();
|
||||||
|
|
||||||
} // namespace scheme_test
|
} // namespace client::scheme_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_SCHEME_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_SCHEME_TEST_H_
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
#include "include/wrapper/cef_closure_task.h"
|
#include "include/wrapper/cef_closure_task.h"
|
||||||
#include "tests/shared/browser/resource_util.h"
|
#include "tests/shared/browser/resource_util.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::server_test {
|
||||||
namespace server_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ class ServerHandler : public CefServerHandler {
|
|||||||
public:
|
public:
|
||||||
using CompleteCallback = base::OnceCallback<void(bool /* success */)>;
|
using CompleteCallback = base::OnceCallback<void(bool /* success */)>;
|
||||||
|
|
||||||
ServerHandler() {}
|
ServerHandler() = default;
|
||||||
|
|
||||||
// |complete_callback| will be executed on the UI thread after completion.
|
// |complete_callback| will be executed on the UI thread after completion.
|
||||||
void StartServer(int port, CompleteCallback complete_callback) {
|
void StartServer(int port, CompleteCallback complete_callback) {
|
||||||
@ -213,7 +212,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
public:
|
public:
|
||||||
Handler() : weak_ptr_factory_(this) {}
|
Handler() : weak_ptr_factory_(this) {}
|
||||||
|
|
||||||
virtual ~Handler() {
|
~Handler() override {
|
||||||
if (handler_) {
|
if (handler_) {
|
||||||
handler_->StopServer(ServerHandler::CompleteCallback());
|
handler_->StopServer(ServerHandler::CompleteCallback());
|
||||||
handler_ = nullptr;
|
handler_ = nullptr;
|
||||||
@ -221,7 +220,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Called due to cefQuery execution in server.html.
|
// Called due to cefQuery execution in server.html.
|
||||||
virtual bool OnQuery(CefRefPtr<CefBrowser> browser,
|
bool OnQuery(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
int64_t query_id,
|
int64_t query_id,
|
||||||
const CefString& request,
|
const CefString& request,
|
||||||
@ -388,5 +387,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) {
|
|||||||
handlers.insert(new Handler());
|
handlers.insert(new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace server_test
|
} // namespace client::server_test
|
||||||
} // namespace client
|
|
||||||
|
@ -8,13 +8,11 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::server_test {
|
||||||
namespace server_test {
|
|
||||||
|
|
||||||
// Create message handlers. Called from test_runner.cc.
|
// Create message handlers. Called from test_runner.cc.
|
||||||
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
||||||
|
|
||||||
} // namespace server_test
|
} // namespace client::server_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_SERVER_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_SERVER_TEST_H_
|
||||||
|
@ -26,8 +26,8 @@ HWND CreateTempWindow() {
|
|||||||
RegisterClassEx(&wc);
|
RegisterClassEx(&wc);
|
||||||
|
|
||||||
// Create a 1x1 pixel hidden window.
|
// Create a 1x1 pixel hidden window.
|
||||||
return CreateWindow(kWndClass, 0, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 0, 0,
|
return CreateWindow(kWndClass, nullptr, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
|
||||||
1, 1, nullptr, nullptr, hInstance, nullptr);
|
0, 0, 1, 1, nullptr, nullptr, hInstance, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
TempWindowWin* g_temp_window = nullptr;
|
TempWindowWin* g_temp_window = nullptr;
|
||||||
|
@ -33,8 +33,7 @@
|
|||||||
#include "tests/shared/browser/resource_util.h"
|
#include "tests/shared/browser/resource_util.h"
|
||||||
#include "tests/shared/common/string_util.h"
|
#include "tests/shared/common/string_util.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::test_runner {
|
||||||
namespace test_runner {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ void RunGetSourceTest(CefRefPtr<CefBrowser> browser) {
|
|||||||
class Visitor : public CefStringVisitor {
|
class Visitor : public CefStringVisitor {
|
||||||
public:
|
public:
|
||||||
explicit Visitor(CefRefPtr<CefBrowser> browser) : browser_(browser) {}
|
explicit Visitor(CefRefPtr<CefBrowser> browser) : browser_(browser) {}
|
||||||
virtual void Visit(const CefString& string) override {
|
void Visit(const CefString& string) override {
|
||||||
std::string source = AsciiStrReplace(string, "<", "<");
|
std::string source = AsciiStrReplace(string, "<", "<");
|
||||||
source = AsciiStrReplace(source, ">", ">");
|
source = AsciiStrReplace(source, ">", ">");
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@ -82,7 +81,7 @@ void RunGetTextTest(CefRefPtr<CefBrowser> browser) {
|
|||||||
class Visitor : public CefStringVisitor {
|
class Visitor : public CefStringVisitor {
|
||||||
public:
|
public:
|
||||||
explicit Visitor(CefRefPtr<CefBrowser> browser) : browser_(browser) {}
|
explicit Visitor(CefRefPtr<CefBrowser> browser) : browser_(browser) {}
|
||||||
virtual void Visit(const CefString& string) override {
|
void Visit(const CefString& string) override {
|
||||||
std::string text = AsciiStrReplace(string, "<", "<");
|
std::string text = AsciiStrReplace(string, "<", "<");
|
||||||
text = AsciiStrReplace(text, ">", ">");
|
text = AsciiStrReplace(text, ">", ">");
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@ -168,10 +167,10 @@ const char kPromptDSF[] = "DSF";
|
|||||||
// Handles execution of prompt results.
|
// Handles execution of prompt results.
|
||||||
class PromptHandler : public CefMessageRouterBrowserSide::Handler {
|
class PromptHandler : public CefMessageRouterBrowserSide::Handler {
|
||||||
public:
|
public:
|
||||||
PromptHandler() {}
|
PromptHandler() = default;
|
||||||
|
|
||||||
// Called due to cefQuery execution.
|
// Called due to cefQuery execution.
|
||||||
virtual bool OnQuery(CefRefPtr<CefBrowser> browser,
|
bool OnQuery(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
int64_t query_id,
|
int64_t query_id,
|
||||||
const CefString& request,
|
const CefString& request,
|
||||||
@ -883,5 +882,4 @@ CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
|
|||||||
request, response);
|
request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace test_runner
|
} // namespace client::test_runner
|
||||||
} // namespace client
|
|
||||||
|
@ -14,8 +14,7 @@
|
|||||||
#include "include/wrapper/cef_message_router.h"
|
#include "include/wrapper/cef_message_router.h"
|
||||||
#include "include/wrapper/cef_resource_manager.h"
|
#include "include/wrapper/cef_resource_manager.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::test_runner {
|
||||||
namespace test_runner {
|
|
||||||
|
|
||||||
// Run a test.
|
// Run a test.
|
||||||
void RunTest(CefRefPtr<CefBrowser> browser, int id);
|
void RunTest(CefRefPtr<CefBrowser> browser, int id);
|
||||||
@ -66,7 +65,6 @@ CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
|
|||||||
CefRefPtr<CefRequest> request,
|
CefRefPtr<CefRequest> request,
|
||||||
CefRefPtr<CefResponse> response);
|
CefRefPtr<CefResponse> response);
|
||||||
|
|
||||||
} // namespace test_runner
|
} // namespace client::test_runner
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_TEST_RUNNER_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_TEST_RUNNER_H_
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
#include "include/wrapper/cef_helpers.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::urlrequest_test {
|
||||||
namespace urlrequest_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -86,7 +85,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
public:
|
public:
|
||||||
Handler() { CEF_REQUIRE_UI_THREAD(); }
|
Handler() { CEF_REQUIRE_UI_THREAD(); }
|
||||||
|
|
||||||
~Handler() { CancelPendingRequest(); }
|
~Handler() override { CancelPendingRequest(); }
|
||||||
|
|
||||||
// Called due to cefQuery execution in urlrequest.html.
|
// Called due to cefQuery execution in urlrequest.html.
|
||||||
bool OnQuery(CefRefPtr<CefBrowser> browser,
|
bool OnQuery(CefRefPtr<CefBrowser> browser,
|
||||||
@ -184,5 +183,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) {
|
|||||||
handlers.insert(new Handler());
|
handlers.insert(new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace urlrequest_test
|
} // namespace client::urlrequest_test
|
||||||
} // namespace client
|
|
||||||
|
@ -8,13 +8,11 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::urlrequest_test {
|
||||||
namespace urlrequest_test {
|
|
||||||
|
|
||||||
// Create message handlers. Called from test_runner.cc.
|
// Create message handlers. Called from test_runner.cc.
|
||||||
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
||||||
|
|
||||||
} // namespace urlrequest_test
|
} // namespace client::urlrequest_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_URLREQUEST_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_URLREQUEST_TEST_H_
|
||||||
|
@ -50,8 +50,7 @@ ViewsMenuBar::ViewsMenuBar(Delegate* delegate,
|
|||||||
: delegate_(delegate),
|
: delegate_(delegate),
|
||||||
id_start_(menu_id_start),
|
id_start_(menu_id_start),
|
||||||
use_bottom_controls_(use_bottom_controls),
|
use_bottom_controls_(use_bottom_controls),
|
||||||
id_next_(menu_id_start),
|
id_next_(menu_id_start) {
|
||||||
last_nav_with_keyboard_(false) {
|
|
||||||
DCHECK(delegate_);
|
DCHECK(delegate_);
|
||||||
DCHECK_GT(id_start_, 0);
|
DCHECK_GT(id_start_, 0);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class ViewsMenuBar : public CefMenuButtonDelegate, public CefMenuModelDelegate {
|
|||||||
cef_event_flags_t event_flags) = 0;
|
cef_event_flags_t event_flags) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Delegate() {}
|
virtual ~Delegate() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
// |delegate| must outlive this object.
|
// |delegate| must outlive this object.
|
||||||
@ -110,7 +110,7 @@ class ViewsMenuBar : public CefMenuButtonDelegate, public CefMenuModelDelegate {
|
|||||||
int id_next_;
|
int id_next_;
|
||||||
CefRefPtr<CefPanel> panel_;
|
CefRefPtr<CefPanel> panel_;
|
||||||
std::vector<CefRefPtr<CefMenuModel>> models_;
|
std::vector<CefRefPtr<CefMenuModel>> models_;
|
||||||
bool last_nav_with_keyboard_;
|
bool last_nav_with_keyboard_ = false;
|
||||||
|
|
||||||
// Map of mnemonic to MenuButton ID.
|
// Map of mnemonic to MenuButton ID.
|
||||||
typedef std::map<char16_t, int> MnemonicMap;
|
typedef std::map<char16_t, int> MnemonicMap;
|
||||||
|
@ -182,18 +182,18 @@ void ViewsOverlayControls::UpdateControls() {
|
|||||||
void ViewsOverlayControls::UpdateDraggableRegions(
|
void ViewsOverlayControls::UpdateDraggableRegions(
|
||||||
std::vector<CefDraggableRegion>& window_regions) {
|
std::vector<CefDraggableRegion>& window_regions) {
|
||||||
if (panel_controller_ && panel_controller_->IsVisible()) {
|
if (panel_controller_ && panel_controller_->IsVisible()) {
|
||||||
window_regions.push_back(CefDraggableRegion(panel_controller_->GetBounds(),
|
window_regions.emplace_back(panel_controller_->GetBounds(),
|
||||||
/*draggable=*/false));
|
/*draggable=*/false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu_controller_ && menu_controller_->IsVisible()) {
|
if (menu_controller_ && menu_controller_->IsVisible()) {
|
||||||
window_regions.push_back(
|
window_regions.emplace_back(menu_controller_->GetBounds(),
|
||||||
CefDraggableRegion(menu_controller_->GetBounds(), /*draggable=*/false));
|
/*draggable=*/false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location_controller_ && location_controller_->IsVisible()) {
|
if (location_controller_ && location_controller_->IsVisible()) {
|
||||||
window_regions.push_back(CefDraggableRegion(
|
window_regions.emplace_back(location_controller_->GetBounds(),
|
||||||
location_controller_->GetBounds(), /*draggable=*/false));
|
/*draggable=*/false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,9 +6,7 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/main_context.h"
|
#include "tests/cefclient/browser/main_context.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::views_style {
|
||||||
|
|
||||||
namespace views_style {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -113,6 +111,4 @@ void ApplyTo(CefRefPtr<CefMenuModel> menu_model) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace views_style
|
} // namespace client::views_style
|
||||||
|
|
||||||
} // namespace client
|
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
#include "include/views/cef_panel.h"
|
#include "include/views/cef_panel.h"
|
||||||
#include "include/views/cef_textfield.h"
|
#include "include/views/cef_textfield.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::views_style {
|
||||||
|
|
||||||
namespace views_style {
|
|
||||||
|
|
||||||
// Returns true if a style is set.
|
// Returns true if a style is set.
|
||||||
bool IsSet();
|
bool IsSet();
|
||||||
@ -25,8 +23,6 @@ void ApplyTo(CefRefPtr<CefLabelButton> label_button);
|
|||||||
void ApplyTo(CefRefPtr<CefTextfield> textfield);
|
void ApplyTo(CefRefPtr<CefTextfield> textfield);
|
||||||
void ApplyTo(CefRefPtr<CefMenuModel> menu_model);
|
void ApplyTo(CefRefPtr<CefMenuModel> menu_model);
|
||||||
|
|
||||||
} // namespace views_style
|
} // namespace client::views_style
|
||||||
|
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_VIEWS_STYLE_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_VIEWS_STYLE_H_
|
||||||
|
@ -66,8 +66,8 @@ void MakeButtonsSameSize(const LabelButtons& buttons) {
|
|||||||
CefSize size;
|
CefSize size;
|
||||||
|
|
||||||
// Determine the largest button size.
|
// Determine the largest button size.
|
||||||
for (size_t i = 0U; i < buttons.size(); ++i) {
|
for (const auto& button : buttons) {
|
||||||
const CefSize& button_size = buttons[i]->GetPreferredSize();
|
const CefSize& button_size = button->GetPreferredSize();
|
||||||
if (size.width < button_size.width) {
|
if (size.width < button_size.width) {
|
||||||
size.width = button_size.width;
|
size.width = button_size.width;
|
||||||
}
|
}
|
||||||
@ -76,12 +76,12 @@ void MakeButtonsSameSize(const LabelButtons& buttons) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0U; i < buttons.size(); ++i) {
|
for (const auto& button : buttons) {
|
||||||
// Set the button's minimum size.
|
// Set the button's minimum size.
|
||||||
buttons[i]->SetMinimumSize(size);
|
button->SetMinimumSize(size);
|
||||||
|
|
||||||
// Re-layout the button and all parent Views.
|
// Re-layout the button and all parent Views.
|
||||||
buttons[i]->InvalidateLayout();
|
button->InvalidateLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1040,11 +1040,7 @@ ViewsWindow::ViewsWindow(WindowType type,
|
|||||||
Delegate* delegate,
|
Delegate* delegate,
|
||||||
CefRefPtr<CefBrowserView> browser_view,
|
CefRefPtr<CefBrowserView> browser_view,
|
||||||
CefRefPtr<CefCommandLine> command_line)
|
CefRefPtr<CefCommandLine> command_line)
|
||||||
: type_(type),
|
: type_(type), delegate_(delegate), command_line_(command_line) {
|
||||||
delegate_(delegate),
|
|
||||||
command_line_(command_line),
|
|
||||||
menu_has_focus_(false),
|
|
||||||
last_focused_view_(false) {
|
|
||||||
DCHECK(delegate_);
|
DCHECK(delegate_);
|
||||||
|
|
||||||
if (browser_view) {
|
if (browser_view) {
|
||||||
@ -1411,7 +1407,7 @@ void ViewsWindow::OnExtensionIconsLoaded(const ExtensionSet& extensions,
|
|||||||
if (!icon) {
|
if (!icon) {
|
||||||
icon = delegate_->GetImageCache()->GetCachedImage(kDefaultExtensionIcon);
|
icon = delegate_->GetImageCache()->GetCachedImage(kDefaultExtensionIcon);
|
||||||
}
|
}
|
||||||
extensions_.push_back(ExtensionInfo(*it1, icon));
|
extensions_.emplace_back(*it1, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateExtensionControls();
|
UpdateExtensionControls();
|
||||||
|
@ -94,7 +94,7 @@ class ViewsWindow : public CefBrowserViewDelegate,
|
|||||||
virtual void OnExit() = 0;
|
virtual void OnExit() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Delegate() {}
|
virtual ~Delegate() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create a new top-level ViewsWindow hosting a browser with the specified
|
// Create a new top-level ViewsWindow hosting a browser with the specified
|
||||||
@ -272,8 +272,8 @@ class ViewsWindow : public CefBrowserViewDelegate,
|
|||||||
CefRefPtr<CefView> toolbar_;
|
CefRefPtr<CefView> toolbar_;
|
||||||
CefRefPtr<CefMenuButton> menu_button_;
|
CefRefPtr<CefMenuButton> menu_button_;
|
||||||
CefRefPtr<CefView> location_bar_;
|
CefRefPtr<CefView> location_bar_;
|
||||||
bool menu_has_focus_;
|
bool menu_has_focus_ = false;
|
||||||
int last_focused_view_;
|
int last_focused_view_ = false;
|
||||||
std::optional<CefRect> last_visible_bounds_;
|
std::optional<CefRect> last_visible_bounds_;
|
||||||
|
|
||||||
CefSize minimum_window_size_;
|
CefSize minimum_window_size_;
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
#include "tests/cefclient/browser/window_test_runner_mac.h"
|
#include "tests/cefclient/browser/window_test_runner_mac.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace client {
|
namespace client::window_test {
|
||||||
namespace window_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -86,7 +85,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
Handler() : runner_(CreateWindowTestRunner()) {}
|
Handler() : runner_(CreateWindowTestRunner()) {}
|
||||||
|
|
||||||
// Called due to cefBroadcast execution in window.html.
|
// Called due to cefBroadcast execution in window.html.
|
||||||
virtual bool OnQuery(CefRefPtr<CefBrowser> browser,
|
bool OnQuery(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
int64_t query_id,
|
int64_t query_id,
|
||||||
const CefString& request,
|
const CefString& request,
|
||||||
@ -133,5 +132,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) {
|
|||||||
handlers.insert(new Handler());
|
handlers.insert(new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace window_test
|
} // namespace client::window_test
|
||||||
} // namespace client
|
|
||||||
|
@ -8,13 +8,11 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/test_runner.h"
|
#include "tests/cefclient/browser/test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::window_test {
|
||||||
namespace window_test {
|
|
||||||
|
|
||||||
// Create message handlers. Called from test_runner.cc.
|
// Create message handlers. Called from test_runner.cc.
|
||||||
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
|
||||||
|
|
||||||
} // namespace window_test
|
} // namespace client::window_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_H_
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/window_test_runner.h"
|
#include "tests/cefclient/browser/window_test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::window_test {
|
||||||
namespace window_test {
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void WindowTestRunner::ModifyBounds(const CefRect& display, CefRect& window) {
|
void WindowTestRunner::ModifyBounds(const CefRect& display, CefRect& window) {
|
||||||
@ -45,5 +44,4 @@ void WindowTestRunner::SetTitleBarHeight(CefRefPtr<CefBrowser> browser,
|
|||||||
NOTIMPLEMENTED();
|
NOTIMPLEMENTED();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace window_test
|
} // namespace client::window_test
|
||||||
} // namespace client
|
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
namespace client {
|
namespace client::window_test {
|
||||||
namespace window_test {
|
|
||||||
|
|
||||||
// Implement this interface for different platforms. Methods will be called on
|
// Implement this interface for different platforms. Methods will be called on
|
||||||
// the browser process UI thread unless otherwise indicated.
|
// the browser process UI thread unless otherwise indicated.
|
||||||
@ -37,7 +36,6 @@ class WindowTestRunner {
|
|||||||
const std::optional<float>& height);
|
const std::optional<float>& height);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace window_test
|
} // namespace client::window_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_RUNNER_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_RUNNER_H_
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
#include "tests/cefclient/browser/root_window_views.h"
|
#include "tests/cefclient/browser/root_window_views.h"
|
||||||
#include "tests/cefclient/browser/views_window.h"
|
#include "tests/cefclient/browser/views_window.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::window_test {
|
||||||
namespace window_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ void SetTitlebarHeight(const CefRefPtr<CefBrowser>& browser,
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
WindowTestRunnerViews::WindowTestRunnerViews() {}
|
WindowTestRunnerViews::WindowTestRunnerViews() = default;
|
||||||
|
|
||||||
void WindowTestRunnerViews::SetPos(CefRefPtr<CefBrowser> browser,
|
void WindowTestRunnerViews::SetPos(CefRefPtr<CefBrowser> browser,
|
||||||
int x,
|
int x,
|
||||||
@ -86,5 +85,4 @@ void WindowTestRunnerViews::SetTitleBarHeight(
|
|||||||
SetTitlebarHeight(browser, height);
|
SetTitlebarHeight(browser, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace window_test
|
} // namespace client::window_test
|
||||||
} // namespace client
|
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/window_test_runner.h"
|
#include "tests/cefclient/browser/window_test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::window_test {
|
||||||
namespace window_test {
|
|
||||||
|
|
||||||
// Views platform implementation.
|
// Views platform implementation.
|
||||||
class WindowTestRunnerViews : public WindowTestRunner {
|
class WindowTestRunnerViews : public WindowTestRunner {
|
||||||
@ -29,7 +28,6 @@ class WindowTestRunnerViews : public WindowTestRunner {
|
|||||||
const std::optional<float>& height) override;
|
const std::optional<float>& height) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace window_test
|
} // namespace client::window_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_RUNNER_VIEWS_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_RUNNER_VIEWS_H_
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
#include "tests/shared/browser/main_message_loop.h"
|
#include "tests/shared/browser/main_message_loop.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::window_test {
|
||||||
namespace window_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -99,7 +98,7 @@ void RestoreImpl(CefRefPtr<CefBrowser> browser) {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
WindowTestRunnerWin::WindowTestRunnerWin() {}
|
WindowTestRunnerWin::WindowTestRunnerWin() = default;
|
||||||
|
|
||||||
void WindowTestRunnerWin::SetPos(CefRefPtr<CefBrowser> browser,
|
void WindowTestRunnerWin::SetPos(CefRefPtr<CefBrowser> browser,
|
||||||
int x,
|
int x,
|
||||||
@ -141,5 +140,4 @@ void WindowTestRunnerWin::Restore(CefRefPtr<CefBrowser> browser) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace window_test
|
} // namespace client::window_test
|
||||||
} // namespace client
|
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
|
|
||||||
#include "tests/cefclient/browser/window_test_runner.h"
|
#include "tests/cefclient/browser/window_test_runner.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::window_test {
|
||||||
namespace window_test {
|
|
||||||
|
|
||||||
// Windows platform implementation. Methods are safe to call on any browser
|
// Windows platform implementation. Methods are safe to call on any browser
|
||||||
// process thread.
|
// process thread.
|
||||||
@ -27,7 +26,6 @@ class WindowTestRunnerWin : public WindowTestRunner {
|
|||||||
void Restore(CefRefPtr<CefBrowser> browser) override;
|
void Restore(CefRefPtr<CefBrowser> browser) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace window_test
|
} // namespace client::window_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_RUNNER_WIN_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_RUNNER_WIN_H_
|
||||||
|
@ -88,11 +88,11 @@ int RunMain(HINSTANCE hInstance, int nCmdShow) {
|
|||||||
// Create the main message loop object.
|
// Create the main message loop object.
|
||||||
std::unique_ptr<MainMessageLoop> message_loop;
|
std::unique_ptr<MainMessageLoop> message_loop;
|
||||||
if (settings.multi_threaded_message_loop) {
|
if (settings.multi_threaded_message_loop) {
|
||||||
message_loop.reset(new MainMessageLoopMultithreadedWin);
|
message_loop = std::make_unique<MainMessageLoopMultithreadedWin>();
|
||||||
} else if (settings.external_message_pump) {
|
} else if (settings.external_message_pump) {
|
||||||
message_loop = MainMessageLoopExternalPump::Create();
|
message_loop = MainMessageLoopExternalPump::Create();
|
||||||
} else {
|
} else {
|
||||||
message_loop.reset(new MainMessageLoopStd);
|
message_loop = std::make_unique<MainMessageLoopStd>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the CEF browser process. May return false if initialization
|
// Initialize the CEF browser process. May return false if initialization
|
||||||
|
@ -6,13 +6,11 @@
|
|||||||
|
|
||||||
#include "include/cef_scheme.h"
|
#include "include/cef_scheme.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::scheme_test {
|
||||||
namespace scheme_test {
|
|
||||||
|
|
||||||
void RegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar) {
|
void RegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar) {
|
||||||
registrar->AddCustomScheme(
|
registrar->AddCustomScheme(
|
||||||
"client", CEF_SCHEME_OPTION_STANDARD | CEF_SCHEME_OPTION_CORS_ENABLED);
|
"client", CEF_SCHEME_OPTION_STANDARD | CEF_SCHEME_OPTION_CORS_ENABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace scheme_test
|
} // namespace client::scheme_test
|
||||||
} // namespace client
|
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
|
|
||||||
#include "include/cef_scheme.h"
|
#include "include/cef_scheme.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::scheme_test {
|
||||||
namespace scheme_test {
|
|
||||||
|
|
||||||
// Register the custom scheme name/type. This must be done in all processes.
|
// Register the custom scheme name/type. This must be done in all processes.
|
||||||
// See browser/scheme_test.h for creation/registration of the custom scheme
|
// See browser/scheme_test.h for creation/registration of the custom scheme
|
||||||
@ -19,7 +18,6 @@ namespace scheme_test {
|
|||||||
// client_app_delegates_common.cc.
|
// client_app_delegates_common.cc.
|
||||||
void RegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar);
|
void RegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar);
|
||||||
|
|
||||||
} // namespace scheme_test
|
} // namespace client::scheme_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_COMMON_SCHEME_TEST_COMMON_H_
|
#endif // CEF_TESTS_CEFCLIENT_COMMON_SCHEME_TEST_COMMON_H_
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
#include "include/wrapper/cef_helpers.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "include/wrapper/cef_message_router.h"
|
#include "include/wrapper/cef_message_router.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::renderer {
|
||||||
namespace renderer {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -22,7 +21,7 @@ const char kFocusedNodeChangedMessage[] = "ClientRenderer.FocusedNodeChanged";
|
|||||||
|
|
||||||
class ClientRenderDelegate : public ClientAppRenderer::Delegate {
|
class ClientRenderDelegate : public ClientAppRenderer::Delegate {
|
||||||
public:
|
public:
|
||||||
ClientRenderDelegate() : last_node_is_editable_(false) {}
|
ClientRenderDelegate() = default;
|
||||||
|
|
||||||
void OnWebKitInitialized(CefRefPtr<ClientAppRenderer> app) override {
|
void OnWebKitInitialized(CefRefPtr<ClientAppRenderer> app) override {
|
||||||
if (CefCrashReportingEnabled()) {
|
if (CefCrashReportingEnabled()) {
|
||||||
@ -80,7 +79,7 @@ class ClientRenderDelegate : public ClientAppRenderer::Delegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool last_node_is_editable_;
|
bool last_node_is_editable_ = false;
|
||||||
|
|
||||||
// Handles the renderer side of query routing.
|
// Handles the renderer side of query routing.
|
||||||
CefRefPtr<CefMessageRouterRendererSide> message_router_;
|
CefRefPtr<CefMessageRouterRendererSide> message_router_;
|
||||||
@ -95,5 +94,4 @@ void CreateDelegates(ClientAppRenderer::DelegateSet& delegates) {
|
|||||||
delegates.insert(new ClientRenderDelegate);
|
delegates.insert(new ClientRenderDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace renderer
|
} // namespace client::renderer
|
||||||
} // namespace client
|
|
||||||
|
@ -9,13 +9,11 @@
|
|||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include "tests/shared/renderer/client_app_renderer.h"
|
#include "tests/shared/renderer/client_app_renderer.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::renderer {
|
||||||
namespace renderer {
|
|
||||||
|
|
||||||
// Create the renderer delegate. Called from client_app_delegates_renderer.cc.
|
// Create the renderer delegate. Called from client_app_delegates_renderer.cc.
|
||||||
void CreateDelegates(ClientAppRenderer::DelegateSet& delegates);
|
void CreateDelegates(ClientAppRenderer::DelegateSet& delegates);
|
||||||
|
|
||||||
} // namespace renderer
|
} // namespace client::renderer
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_RENDERER_CLIENT_RENDERER_H_
|
#endif // CEF_TESTS_CEFCLIENT_RENDERER_CLIENT_RENDERER_H_
|
||||||
|
@ -240,12 +240,10 @@ class IpcDelegate final : public client::ClientAppRenderer::Delegate {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace client {
|
namespace client::ipc_performance_test {
|
||||||
namespace ipc_performance_test {
|
|
||||||
|
|
||||||
void CreateDelegates(ClientAppRenderer::DelegateSet& delegates) {
|
void CreateDelegates(ClientAppRenderer::DelegateSet& delegates) {
|
||||||
delegates.insert(new IpcDelegate());
|
delegates.insert(new IpcDelegate());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ipc_performance_test
|
} // namespace client::ipc_performance_test
|
||||||
} // namespace client
|
|
||||||
|
@ -8,12 +8,10 @@
|
|||||||
|
|
||||||
#include "tests/shared/renderer/client_app_renderer.h"
|
#include "tests/shared/renderer/client_app_renderer.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::ipc_performance_test {
|
||||||
namespace ipc_performance_test {
|
|
||||||
|
|
||||||
void CreateDelegates(ClientAppRenderer::DelegateSet& delegates);
|
void CreateDelegates(ClientAppRenderer::DelegateSet& delegates);
|
||||||
|
|
||||||
} // namespace ipc_performance_test
|
} // namespace client::ipc_performance_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_RENDERER_IPC_PERFORMANCE_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_RENDERER_IPC_PERFORMANCE_TEST_H_
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
#include "include/wrapper/cef_stream_resource_handler.h"
|
#include "include/wrapper/cef_stream_resource_handler.h"
|
||||||
#include "tests/cefclient/renderer/performance_test_setup.h"
|
#include "tests/cefclient/renderer/performance_test_setup.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::performance_test {
|
||||||
namespace performance_test {
|
|
||||||
|
|
||||||
// Use more interations for a Release build.
|
// Use more interations for a Release build.
|
||||||
#if DCHECK_IS_ON()
|
#if DCHECK_IS_ON()
|
||||||
@ -29,9 +28,9 @@ const char kPerfTestReturnValue[] = "PerfTestReturnValue";
|
|||||||
|
|
||||||
class V8Handler : public CefV8Handler {
|
class V8Handler : public CefV8Handler {
|
||||||
public:
|
public:
|
||||||
V8Handler() {}
|
V8Handler() = default;
|
||||||
|
|
||||||
virtual bool Execute(const CefString& name,
|
bool Execute(const CefString& name,
|
||||||
CefRefPtr<CefV8Value> object,
|
CefRefPtr<CefV8Value> object,
|
||||||
const CefV8ValueList& arguments,
|
const CefV8ValueList& arguments,
|
||||||
CefRefPtr<CefV8Value>& retval,
|
CefRefPtr<CefV8Value>& retval,
|
||||||
@ -126,9 +125,9 @@ class V8Handler : public CefV8Handler {
|
|||||||
// Handle bindings in the render process.
|
// Handle bindings in the render process.
|
||||||
class RenderDelegate : public ClientAppRenderer::Delegate {
|
class RenderDelegate : public ClientAppRenderer::Delegate {
|
||||||
public:
|
public:
|
||||||
RenderDelegate() {}
|
RenderDelegate() = default;
|
||||||
|
|
||||||
virtual void OnContextCreated(CefRefPtr<ClientAppRenderer> app,
|
void OnContextCreated(CefRefPtr<ClientAppRenderer> app,
|
||||||
CefRefPtr<CefBrowser> browser,
|
CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
CefRefPtr<CefV8Context> context) override {
|
CefRefPtr<CefV8Context> context) override {
|
||||||
@ -158,5 +157,4 @@ void CreateDelegates(ClientAppRenderer::DelegateSet& delegates) {
|
|||||||
delegates.insert(new RenderDelegate);
|
delegates.insert(new RenderDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace performance_test
|
} // namespace client::performance_test
|
||||||
} // namespace client
|
|
||||||
|
@ -8,13 +8,11 @@
|
|||||||
|
|
||||||
#include "tests/shared/renderer/client_app_renderer.h"
|
#include "tests/shared/renderer/client_app_renderer.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::performance_test {
|
||||||
namespace performance_test {
|
|
||||||
|
|
||||||
// Create the renderer delegate. Called from client_app_delegates_renderer.cc.
|
// Create the renderer delegate. Called from client_app_delegates_renderer.cc.
|
||||||
void CreateDelegates(ClientAppRenderer::DelegateSet& delegates);
|
void CreateDelegates(ClientAppRenderer::DelegateSet& delegates);
|
||||||
|
|
||||||
} // namespace performance_test
|
} // namespace client::performance_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_RENDERER_PERFORMANCE_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_RENDERER_PERFORMANCE_TEST_H_
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
#include "include/base/cef_logging.h"
|
#include "include/base/cef_logging.h"
|
||||||
#include "include/base/cef_macros.h"
|
#include "include/base/cef_macros.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::performance_test {
|
||||||
namespace performance_test {
|
|
||||||
|
|
||||||
// Default number of iterations.
|
// Default number of iterations.
|
||||||
extern const int kDefaultIterations;
|
extern const int kDefaultIterations;
|
||||||
@ -35,7 +34,7 @@ typedef PERF_TEST_RESULT(PerfTest(PERF_TEST_PARAMS));
|
|||||||
|
|
||||||
class CefTimer {
|
class CefTimer {
|
||||||
public:
|
public:
|
||||||
CefTimer() : running_(false) {}
|
CefTimer() = default;
|
||||||
|
|
||||||
bool IsRunning() { return running_; }
|
bool IsRunning() { return running_; }
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ class CefTimer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool running_;
|
bool running_ = false;
|
||||||
CefTime start_;
|
CefTime start_;
|
||||||
CefTime stop_;
|
CefTime stop_;
|
||||||
|
|
||||||
@ -96,7 +95,6 @@ struct PerfTestEntry {
|
|||||||
extern const PerfTestEntry kPerfTests[];
|
extern const PerfTestEntry kPerfTests[];
|
||||||
extern const int kPerfTestsCount;
|
extern const int kPerfTestsCount;
|
||||||
|
|
||||||
} // namespace performance_test
|
} // namespace client::performance_test
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_RENDERER_PERFORMANCE_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_RENDERER_PERFORMANCE_TEST_H_
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
#include "tests/cefclient/renderer/performance_test.h"
|
#include "tests/cefclient/renderer/performance_test.h"
|
||||||
#include "tests/cefclient/renderer/performance_test_setup.h"
|
#include "tests/cefclient/renderer/performance_test_setup.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::performance_test {
|
||||||
namespace performance_test {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -92,8 +91,8 @@ PERF_TEST_FUNC(V8ArrayGetValue) {
|
|||||||
PERF_TEST_FUNC(V8FunctionCreate) {
|
PERF_TEST_FUNC(V8FunctionCreate) {
|
||||||
class Handler : public CefV8Handler {
|
class Handler : public CefV8Handler {
|
||||||
public:
|
public:
|
||||||
Handler() {}
|
Handler() = default;
|
||||||
virtual bool Execute(const CefString& name,
|
bool Execute(const CefString& name,
|
||||||
CefRefPtr<CefV8Value> object,
|
CefRefPtr<CefV8Value> object,
|
||||||
const CefV8ValueList& arguments,
|
const CefV8ValueList& arguments,
|
||||||
CefRefPtr<CefV8Value>& retval,
|
CefRefPtr<CefV8Value>& retval,
|
||||||
@ -114,8 +113,8 @@ PERF_TEST_FUNC(V8FunctionCreate) {
|
|||||||
PERF_TEST_FUNC(V8FunctionExecute) {
|
PERF_TEST_FUNC(V8FunctionExecute) {
|
||||||
class Handler : public CefV8Handler {
|
class Handler : public CefV8Handler {
|
||||||
public:
|
public:
|
||||||
Handler() {}
|
Handler() = default;
|
||||||
virtual bool Execute(const CefString& name,
|
bool Execute(const CefString& name,
|
||||||
CefRefPtr<CefV8Value> object,
|
CefRefPtr<CefV8Value> object,
|
||||||
const CefV8ValueList& arguments,
|
const CefV8ValueList& arguments,
|
||||||
CefRefPtr<CefV8Value>& retval,
|
CefRefPtr<CefV8Value>& retval,
|
||||||
@ -139,8 +138,8 @@ PERF_TEST_FUNC(V8FunctionExecute) {
|
|||||||
PERF_TEST_FUNC(V8FunctionExecuteWithContext) {
|
PERF_TEST_FUNC(V8FunctionExecuteWithContext) {
|
||||||
class Handler : public CefV8Handler {
|
class Handler : public CefV8Handler {
|
||||||
public:
|
public:
|
||||||
Handler() {}
|
Handler() = default;
|
||||||
virtual bool Execute(const CefString& name,
|
bool Execute(const CefString& name,
|
||||||
CefRefPtr<CefV8Value> object,
|
CefRefPtr<CefV8Value> object,
|
||||||
const CefV8ValueList& arguments,
|
const CefV8ValueList& arguments,
|
||||||
CefRefPtr<CefV8Value>& retval,
|
CefRefPtr<CefV8Value>& retval,
|
||||||
@ -171,14 +170,14 @@ PERF_TEST_FUNC(V8ObjectCreate) {
|
|||||||
PERF_TEST_FUNC(V8ObjectCreateWithAccessor) {
|
PERF_TEST_FUNC(V8ObjectCreateWithAccessor) {
|
||||||
class Accessor : public CefV8Accessor {
|
class Accessor : public CefV8Accessor {
|
||||||
public:
|
public:
|
||||||
Accessor() {}
|
Accessor() = default;
|
||||||
virtual bool Get(const CefString& name,
|
bool Get(const CefString& name,
|
||||||
const CefRefPtr<CefV8Value> object,
|
const CefRefPtr<CefV8Value> object,
|
||||||
CefRefPtr<CefV8Value>& retval,
|
CefRefPtr<CefV8Value>& retval,
|
||||||
CefString& exception) override {
|
CefString& exception) override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual bool Set(const CefString& name,
|
bool Set(const CefString& name,
|
||||||
const CefRefPtr<CefV8Value> object,
|
const CefRefPtr<CefV8Value> object,
|
||||||
const CefRefPtr<CefV8Value> value,
|
const CefRefPtr<CefV8Value> value,
|
||||||
CefString& exception) override {
|
CefString& exception) override {
|
||||||
@ -197,26 +196,26 @@ PERF_TEST_FUNC(V8ObjectCreateWithAccessor) {
|
|||||||
PERF_TEST_FUNC(V8ObjectCreateWithInterceptor) {
|
PERF_TEST_FUNC(V8ObjectCreateWithInterceptor) {
|
||||||
class Interceptor : public CefV8Interceptor {
|
class Interceptor : public CefV8Interceptor {
|
||||||
public:
|
public:
|
||||||
Interceptor() {}
|
Interceptor() = default;
|
||||||
virtual bool Get(const CefString& name,
|
bool Get(const CefString& name,
|
||||||
const CefRefPtr<CefV8Value> object,
|
const CefRefPtr<CefV8Value> object,
|
||||||
CefRefPtr<CefV8Value>& retval,
|
CefRefPtr<CefV8Value>& retval,
|
||||||
CefString& exception) override {
|
CefString& exception) override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual bool Get(int index,
|
bool Get(int index,
|
||||||
const CefRefPtr<CefV8Value> object,
|
const CefRefPtr<CefV8Value> object,
|
||||||
CefRefPtr<CefV8Value>& retval,
|
CefRefPtr<CefV8Value>& retval,
|
||||||
CefString& exception) override {
|
CefString& exception) override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual bool Set(const CefString& name,
|
bool Set(const CefString& name,
|
||||||
const CefRefPtr<CefV8Value> object,
|
const CefRefPtr<CefV8Value> object,
|
||||||
const CefRefPtr<CefV8Value> value,
|
const CefRefPtr<CefV8Value> value,
|
||||||
CefString& exception) override {
|
CefString& exception) override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual bool Set(int index,
|
bool Set(int index,
|
||||||
const CefRefPtr<CefV8Value> object,
|
const CefRefPtr<CefV8Value> object,
|
||||||
const CefRefPtr<CefV8Value> value,
|
const CefRefPtr<CefV8Value> value,
|
||||||
CefString& exception) override {
|
CefString& exception) override {
|
||||||
@ -257,14 +256,14 @@ PERF_TEST_FUNC(V8ObjectGetValue) {
|
|||||||
PERF_TEST_FUNC(V8ObjectSetValueWithAccessor) {
|
PERF_TEST_FUNC(V8ObjectSetValueWithAccessor) {
|
||||||
class Accessor : public CefV8Accessor {
|
class Accessor : public CefV8Accessor {
|
||||||
public:
|
public:
|
||||||
Accessor() {}
|
Accessor() = default;
|
||||||
virtual bool Get(const CefString& name,
|
bool Get(const CefString& name,
|
||||||
const CefRefPtr<CefV8Value> object,
|
const CefRefPtr<CefV8Value> object,
|
||||||
CefRefPtr<CefV8Value>& retval,
|
CefRefPtr<CefV8Value>& retval,
|
||||||
CefString& exception) override {
|
CefString& exception) override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual bool Set(const CefString& name,
|
bool Set(const CefString& name,
|
||||||
const CefRefPtr<CefV8Value> object,
|
const CefRefPtr<CefV8Value> object,
|
||||||
const CefRefPtr<CefV8Value> value,
|
const CefRefPtr<CefV8Value> value,
|
||||||
CefString& exception) override {
|
CefString& exception) override {
|
||||||
@ -292,14 +291,14 @@ PERF_TEST_FUNC(V8ObjectGetValueWithAccessor) {
|
|||||||
class Accessor : public CefV8Accessor {
|
class Accessor : public CefV8Accessor {
|
||||||
public:
|
public:
|
||||||
Accessor() : val_(CefV8Value::CreateBool(true)) {}
|
Accessor() : val_(CefV8Value::CreateBool(true)) {}
|
||||||
virtual bool Get(const CefString& name,
|
bool Get(const CefString& name,
|
||||||
const CefRefPtr<CefV8Value> object,
|
const CefRefPtr<CefV8Value> object,
|
||||||
CefRefPtr<CefV8Value>& retval,
|
CefRefPtr<CefV8Value>& retval,
|
||||||
CefString& exception) override {
|
CefString& exception) override {
|
||||||
retval = val_;
|
retval = val_;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual bool Set(const CefString& name,
|
bool Set(const CefString& name,
|
||||||
const CefRefPtr<CefV8Value> object,
|
const CefRefPtr<CefV8Value> object,
|
||||||
const CefRefPtr<CefV8Value> value,
|
const CefRefPtr<CefV8Value> value,
|
||||||
CefString& exception) override {
|
CefString& exception) override {
|
||||||
@ -392,5 +391,4 @@ const PerfTestEntry kPerfTests[] = {
|
|||||||
|
|
||||||
const int kPerfTestsCount = (sizeof(kPerfTests) / sizeof(kPerfTests[0]));
|
const int kPerfTestsCount = (sizeof(kPerfTests) / sizeof(kPerfTests[0]));
|
||||||
|
|
||||||
} // namespace performance_test
|
} // namespace client::performance_test
|
||||||
} // namespace client
|
|
||||||
|
@ -57,7 +57,7 @@ class SimpleWindowDelegate : public CefWindowDelegate {
|
|||||||
|
|
||||||
class SimpleBrowserViewDelegate : public CefBrowserViewDelegate {
|
class SimpleBrowserViewDelegate : public CefBrowserViewDelegate {
|
||||||
public:
|
public:
|
||||||
SimpleBrowserViewDelegate() {}
|
SimpleBrowserViewDelegate() = default;
|
||||||
|
|
||||||
bool OnPopupBrowserViewCreated(CefRefPtr<CefBrowserView> browser_view,
|
bool OnPopupBrowserViewCreated(CefRefPtr<CefBrowserView> browser_view,
|
||||||
CefRefPtr<CefBrowserView> popup_browser_view,
|
CefRefPtr<CefBrowserView> popup_browser_view,
|
||||||
@ -78,7 +78,7 @@ class SimpleBrowserViewDelegate : public CefBrowserViewDelegate {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
SimpleApp::SimpleApp() {}
|
SimpleApp::SimpleApp() = default;
|
||||||
|
|
||||||
void SimpleApp::OnContextInitialized() {
|
void SimpleApp::OnContextInitialized() {
|
||||||
CEF_REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
@ -28,8 +28,7 @@ std::string GetDataURI(const std::string& data, const std::string& mime_type) {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
SimpleHandler::SimpleHandler(bool use_views)
|
SimpleHandler::SimpleHandler(bool use_views) : use_views_(use_views) {
|
||||||
: use_views_(use_views), is_closing_(false) {
|
|
||||||
DCHECK(!g_instance);
|
DCHECK(!g_instance);
|
||||||
g_instance = this;
|
g_instance = this;
|
||||||
}
|
}
|
||||||
|
@ -15,31 +15,27 @@ class SimpleHandler : public CefClient,
|
|||||||
public CefLoadHandler {
|
public CefLoadHandler {
|
||||||
public:
|
public:
|
||||||
explicit SimpleHandler(bool use_views);
|
explicit SimpleHandler(bool use_views);
|
||||||
~SimpleHandler();
|
~SimpleHandler() override;
|
||||||
|
|
||||||
// Provide access to the single global instance of this object.
|
// Provide access to the single global instance of this object.
|
||||||
static SimpleHandler* GetInstance();
|
static SimpleHandler* GetInstance();
|
||||||
|
|
||||||
// CefClient methods:
|
// CefClient methods:
|
||||||
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() override {
|
CefRefPtr<CefDisplayHandler> GetDisplayHandler() override { return this; }
|
||||||
return this;
|
CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override { return this; }
|
||||||
}
|
CefRefPtr<CefLoadHandler> GetLoadHandler() override { return this; }
|
||||||
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() override { return this; }
|
|
||||||
|
|
||||||
// CefDisplayHandler methods:
|
// CefDisplayHandler methods:
|
||||||
virtual void OnTitleChange(CefRefPtr<CefBrowser> browser,
|
void OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& title) override;
|
const CefString& title) override;
|
||||||
|
|
||||||
// CefLifeSpanHandler methods:
|
// CefLifeSpanHandler methods:
|
||||||
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
|
void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
|
||||||
virtual bool DoClose(CefRefPtr<CefBrowser> browser) override;
|
bool DoClose(CefRefPtr<CefBrowser> browser) override;
|
||||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
|
void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
|
||||||
|
|
||||||
// CefLoadHandler methods:
|
// CefLoadHandler methods:
|
||||||
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
|
void OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
ErrorCode errorCode,
|
ErrorCode errorCode,
|
||||||
const CefString& errorText,
|
const CefString& errorText,
|
||||||
@ -65,7 +61,7 @@ class SimpleHandler : public CefClient,
|
|||||||
typedef std::list<CefRefPtr<CefBrowser>> BrowserList;
|
typedef std::list<CefRefPtr<CefBrowser>> BrowserList;
|
||||||
BrowserList browser_list_;
|
BrowserList browser_list_;
|
||||||
|
|
||||||
bool is_closing_;
|
bool is_closing_ = false;
|
||||||
|
|
||||||
// Include the default reference counting implementation.
|
// Include the default reference counting implementation.
|
||||||
IMPLEMENT_REFCOUNTING(SimpleHandler);
|
IMPLEMENT_REFCOUNTING(SimpleHandler);
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
#include "tests/shared/browser/resource_util.h"
|
#include "tests/shared/browser/resource_util.h"
|
||||||
#include "tests/shared/common/string_util.h"
|
#include "tests/shared/common/string_util.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::extension_util {
|
||||||
namespace extension_util {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -124,9 +123,9 @@ bool IsInternalExtension(const std::string& extension_path) {
|
|||||||
static const char* extensions[] = {"set_page_color"};
|
static const char* extensions[] = {"set_page_color"};
|
||||||
|
|
||||||
const std::string& internal_path = GetInternalPath(extension_path);
|
const std::string& internal_path = GetInternalPath(extension_path);
|
||||||
for (size_t i = 0; i < std::size(extensions); ++i) {
|
for (auto& i : extensions) {
|
||||||
// Exact match or first directory component.
|
// Exact match or first directory component.
|
||||||
const std::string& extension = extensions[i];
|
const std::string& extension = i;
|
||||||
if (internal_path == extension ||
|
if (internal_path == extension ||
|
||||||
internal_path.find(extension + '/') == 0) {
|
internal_path.find(extension + '/') == 0) {
|
||||||
return true;
|
return true;
|
||||||
@ -253,5 +252,4 @@ std::string GetExtensionIconPath(CefRefPtr<CefExtension> extension,
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace extension_util
|
} // namespace client::extension_util
|
||||||
} // namespace client
|
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
#include "include/cef_extension_handler.h"
|
#include "include/cef_extension_handler.h"
|
||||||
#include "include/wrapper/cef_resource_manager.h"
|
#include "include/wrapper/cef_resource_manager.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::extension_util {
|
||||||
namespace extension_util {
|
|
||||||
|
|
||||||
// Returns true if |extension_path| can be handled internally via
|
// Returns true if |extension_path| can be handled internally via
|
||||||
// LoadBinaryResource. This checks a hard-coded list of allowed extension path
|
// LoadBinaryResource. This checks a hard-coded list of allowed extension path
|
||||||
@ -74,7 +73,6 @@ std::string GetExtensionURL(CefRefPtr<CefExtension> extension);
|
|||||||
std::string GetExtensionIconPath(CefRefPtr<CefExtension> extension,
|
std::string GetExtensionIconPath(CefRefPtr<CefExtension> extension,
|
||||||
bool* internal);
|
bool* internal);
|
||||||
|
|
||||||
} // namespace extension_util
|
} // namespace client::extension_util
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_EXTENSION_UTIL_H_
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_EXTENSION_UTIL_H_
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
#include "include/cef_task.h"
|
#include "include/cef_task.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client::file_util {
|
||||||
namespace file_util {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -129,5 +128,4 @@ std::string GetFileExtension(const std::string& path) {
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace file_util
|
} // namespace client::file_util
|
||||||
} // namespace client
|
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace client {
|
namespace client::file_util {
|
||||||
namespace file_util {
|
|
||||||
|
|
||||||
// Platform-specific path separator.
|
// Platform-specific path separator.
|
||||||
extern const char kPathSep;
|
extern const char kPathSep;
|
||||||
@ -39,7 +38,6 @@ std::string JoinPath(const std::string& path1, const std::string& path2);
|
|||||||
// Extracts the file extension from |path|.
|
// Extracts the file extension from |path|.
|
||||||
std::string GetFileExtension(const std::string& path);
|
std::string GetFileExtension(const std::string& path);
|
||||||
|
|
||||||
} // namespace file_util
|
} // namespace client::file_util
|
||||||
} // namespace client
|
|
||||||
|
|
||||||
#endif // CEF_TESTS_SHARED_BROWSER_FILE_UTIL_H_
|
#endif // CEF_TESTS_SHARED_BROWSER_FILE_UTIL_H_
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user