2015-01-30 19:07:13 +01:00
|
|
|
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2016-11-18 00:52:42 +01:00
|
|
|
#include "tests/cefclient/browser/root_window.h"
|
2015-01-30 19:07:13 +01:00
|
|
|
|
2021-06-19 21:54:45 +02:00
|
|
|
#include "include/base/cef_callback_helpers.h"
|
|
|
|
|
2016-11-18 00:52:42 +01:00
|
|
|
#include "tests/cefclient/browser/main_context.h"
|
|
|
|
#include "tests/cefclient/browser/root_window_manager.h"
|
2023-11-29 02:33:44 +01:00
|
|
|
#include "tests/shared/common/client_switches.h"
|
2015-01-30 19:07:13 +01:00
|
|
|
|
|
|
|
namespace client {
|
|
|
|
|
2023-11-29 02:33:44 +01:00
|
|
|
RootWindowConfig::RootWindowConfig(CefRefPtr<CefCommandLine> cmd)
|
|
|
|
: command_line(cmd ? cmd : MainContext::Get()->GetCommandLine()),
|
|
|
|
with_controls(!command_line->HasSwitch(switches::kHideControls)),
|
|
|
|
url(MainContext::Get()->GetMainURL(command_line)) {}
|
2017-08-04 00:55:19 +02:00
|
|
|
|
2020-01-15 15:28:12 +01:00
|
|
|
RootWindow::RootWindow() : delegate_(nullptr) {}
|
2017-08-04 00:55:19 +02:00
|
|
|
|
|
|
|
RootWindow::~RootWindow() {}
|
|
|
|
|
2015-01-30 19:07:13 +01:00
|
|
|
// static
|
2015-01-30 19:55:55 +01:00
|
|
|
scoped_refptr<RootWindow> RootWindow::GetForBrowser(int browser_id) {
|
2015-01-30 19:07:13 +01:00
|
|
|
return MainContext::Get()->GetRootWindowManager()->GetWindowForBrowser(
|
|
|
|
browser_id);
|
|
|
|
}
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
void RootWindow::OnExtensionsChanged(const ExtensionSet& extensions) {
|
|
|
|
REQUIRE_MAIN_THREAD();
|
|
|
|
DCHECK(delegate_);
|
|
|
|
DCHECK(!WithExtension());
|
|
|
|
|
2023-01-02 23:59:03 +01:00
|
|
|
if (extensions.empty()) {
|
2017-08-04 00:55:19 +02:00
|
|
|
return;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2017-08-04 00:55:19 +02:00
|
|
|
|
|
|
|
ExtensionSet::const_iterator it = extensions.begin();
|
|
|
|
for (; it != extensions.end(); ++it) {
|
2021-06-19 21:54:45 +02:00
|
|
|
delegate_->CreateExtensionWindow(*it, CefRect(), nullptr, base::DoNothing(),
|
2017-08-04 00:55:19 +02:00
|
|
|
WithWindowlessRendering());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-30 19:07:13 +01:00
|
|
|
} // namespace client
|