forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cast_web_view_factory.h
66 lines (49 loc) · 1.88 KB
/
cast_web_view_factory.h
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
// Copyright 2018 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 CHROMECAST_BROWSER_CAST_WEB_VIEW_FACTORY_H_
#define CHROMECAST_BROWSER_CAST_WEB_VIEW_FACTORY_H_
#include <memory>
#include <vector>
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
#include "chromecast/browser/cast_web_view.h"
#include "url/gurl.h"
namespace content {
class BrowserContext;
class SiteInstance;
} // namespace content
namespace chromecast {
class CastWebContentsManager;
class CastWebViewFactory : public CastWebView::Observer {
public:
class Observer : public base::CheckedObserver {
public:
virtual void OnCastWebViewCreated(CastWebView* web_view) {}
virtual void OnCastWebViewDestroyed(CastWebView* web_view) {}
protected:
~Observer() override {}
};
explicit CastWebViewFactory(content::BrowserContext* browser_context);
~CastWebViewFactory() override;
virtual std::unique_ptr<CastWebView> CreateWebView(
const CastWebView::CreateParams& params,
CastWebContentsManager* web_contents_manager,
scoped_refptr<content::SiteInstance> site_instance,
const GURL& initial_url);
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
content::BrowserContext* browser_context() const { return browser_context_; }
protected:
// CastWebView::Observer implementation:
void OnPageDestroyed(CastWebView* web_view) override;
content::BrowserContext* const browser_context_;
base::RepeatingCallback<void(CastWebView*, int)> register_callback_;
base::ObserverList<Observer> observer_list_;
DISALLOW_COPY_AND_ASSIGN(CastWebViewFactory);
};
} // namespace chromecast
#endif // CHROMECAST_BROWSER_CAST_WEB_VIEW_FACTORY_H_