blob: 754e548d3fa64c0cf4d921b5c9c09e134c6349ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MANDOLINE_UI_DESKTOP_UI_BROWSER_MANAGER_H_
#define MANDOLINE_UI_DESKTOP_UI_BROWSER_MANAGER_H_
#include <set>
#include "base/macros.h"
#include "components/mus/public/interfaces/window_tree_host.mojom.h"
#include "mandoline/ui/desktop_ui/public/interfaces/launch_handler.mojom.h"
#include "mojo/common/weak_binding_set.h"
#include "mojo/services/tracing/public/cpp/tracing_impl.h"
#include "mojo/shell/public/cpp/application_delegate.h"
#include "mojo/shell/public/cpp/application_impl.h"
#include "mojo/shell/public/cpp/connect.h"
#include "url/gurl.h"
namespace mojo {
class View;
}
namespace mandoline {
class BrowserWindow;
// BrowserManager creates and manages the lifetime of Browsers.
class BrowserManager : public mojo::ApplicationDelegate,
public LaunchHandler,
public mojo::InterfaceFactory<LaunchHandler> {
public:
BrowserManager();
~BrowserManager() override;
// BrowserManager owns the returned BrowserWindow.
BrowserWindow* CreateBrowser(const GURL& default_url);
void BrowserWindowClosed(BrowserWindow* browser);
// Get the time recorded just before the application message loop was started.
const base::TimeTicks& startup_ticks() const { return startup_ticks_; }
private:
// Overridden from LaunchHandler:
void LaunchURL(const mojo::String& url) override;
// Overridden from mojo::ApplicationDelegate:
void Initialize(mojo::ApplicationImpl* app) override;
bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) override;
// Overridden from mojo::InterfaceFactory<LaunchHandler>:
void Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<LaunchHandler> request) override;
mojo::ApplicationImpl* app_;
mojo::TracingImpl tracing_;
mus::mojom::WindowTreeHostFactoryPtr host_factory_;
mojo::WeakBindingSet<LaunchHandler> launch_handler_bindings_;
std::set<BrowserWindow*> browsers_;
const base::TimeTicks startup_ticks_;
DISALLOW_COPY_AND_ASSIGN(BrowserManager);
};
} // namespace mandoline
#endif // MANDOLINE_UI_DESKTOP_UI_BROWSER_MANAGER_H_
|