1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MANDOLINE_UI_DESKTOP_UI_BROWSER_MANAGER_H_
6 #define MANDOLINE_UI_DESKTOP_UI_BROWSER_MANAGER_H_
10 #include "mandoline/ui/desktop_ui/public/interfaces/launch_handler.mojom.h"
11 #include "mojo/application/public/cpp/application_delegate.h"
12 #include "mojo/application/public/cpp/application_impl.h"
13 #include "mojo/application/public/cpp/connect.h"
14 #include "mojo/common/weak_binding_set.h"
25 // BrowserManager creates and manages the lifetime of Browsers.
26 class BrowserManager
: public mojo::ApplicationDelegate
,
28 public mojo::InterfaceFactory
<LaunchHandler
> {
31 ~BrowserManager() override
;
33 // BrowserManager owns the returned BrowserWindow.
34 BrowserWindow
* CreateBrowser(const GURL
& default_url
);
36 void BrowserWindowClosed(BrowserWindow
* browser
);
39 // Overridden from LaunchHandler:
40 void LaunchURL(const mojo::String
& url
) override
;
42 // Overridden from mojo::ApplicationDelegate:
43 void Initialize(mojo::ApplicationImpl
* app
) override
;
44 bool ConfigureIncomingConnection(
45 mojo::ApplicationConnection
* connection
) override
;
47 // Overridden from mojo::InterfaceFactory<LaunchHandler>:
48 void Create(mojo::ApplicationConnection
* connection
,
49 mojo::InterfaceRequest
<LaunchHandler
> request
) override
;
51 mojo::ApplicationImpl
* app_
;
52 mojo::WeakBindingSet
<LaunchHandler
> launch_handler_bindings_
;
53 std::set
<BrowserWindow
*> browsers_
;
55 DISALLOW_COPY_AND_ASSIGN(BrowserManager
);
58 } // namespace mandoline
60 #endif // MANDOLINE_UI_DESKTOP_UI_BROWSER_MANAGER_H_