forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebview_window_manager.h
52 lines (38 loc) · 1.64 KB
/
webview_window_manager.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
// Copyright 2019 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_WEBVIEW_WEBVIEW_WINDOW_MANAGER_H_
#define CHROMECAST_BROWSER_WEBVIEW_WEBVIEW_WINDOW_MANAGER_H_
#include "base/observer_list.h"
#include "ui/aura/env_observer.h"
#include "ui/aura/window_observer.h"
namespace chromecast {
// Keeps track of new aura::Windows and listen for window property events to
// find Exo windows with the |exo::kClientSurfaceIdKey| property set.
class WebviewWindowManager : public aura::EnvObserver,
public aura::WindowObserver {
public:
class Observer {
public:
virtual ~Observer() = default;
// Notifies the observer when a window's |exo::kClientSurfaceIdKey| property
// is updated.
virtual void OnNewWebviewContainerWindow(aura::Window* window,
int app_id) = 0;
};
explicit WebviewWindowManager();
~WebviewWindowManager() override;
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
private:
void OnWindowInitialized(aura::Window* window) override;
void OnWindowDestroying(aura::Window* window) override;
void OnWindowPropertyChanged(aura::Window* window,
const void* key,
intptr_t old) override;
std::vector<aura::Window*> observed_windows_;
base::ObserverList<Observer>::Unchecked observers_;
DISALLOW_COPY_AND_ASSIGN(WebviewWindowManager);
};
} // namespace chromecast
#endif // CHROMECAST_BROWSER_WEBVIEW_WEBVIEW_WINDOW_MANAGER_H_