• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 
5 #include "tests/cefclient/browser/root_window.h"
6 
7 #include "include/base/cef_callback_helpers.h"
8 
9 #include "tests/cefclient/browser/main_context.h"
10 #include "tests/cefclient/browser/root_window_manager.h"
11 
12 namespace client {
13 
RootWindowConfig()14 RootWindowConfig::RootWindowConfig()
15     : always_on_top(false),
16       with_controls(true),
17       with_osr(false),
18       with_extension(false),
19       initially_hidden(false),
20       url(MainContext::Get()->GetMainURL()) {}
21 
RootWindow()22 RootWindow::RootWindow() : delegate_(nullptr) {}
23 
~RootWindow()24 RootWindow::~RootWindow() {}
25 
26 // static
GetForBrowser(int browser_id)27 scoped_refptr<RootWindow> RootWindow::GetForBrowser(int browser_id) {
28   return MainContext::Get()->GetRootWindowManager()->GetWindowForBrowser(
29       browser_id);
30 }
31 
OnExtensionsChanged(const ExtensionSet & extensions)32 void RootWindow::OnExtensionsChanged(const ExtensionSet& extensions) {
33   REQUIRE_MAIN_THREAD();
34   DCHECK(delegate_);
35   DCHECK(!WithExtension());
36 
37   if (extensions.empty())
38     return;
39 
40   ExtensionSet::const_iterator it = extensions.begin();
41   for (; it != extensions.end(); ++it) {
42     delegate_->CreateExtensionWindow(*it, CefRect(), nullptr, base::DoNothing(),
43                                      WithWindowlessRendering());
44   }
45 }
46 
47 }  // namespace client
48