Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: ui/aura/mus/capture_synchronizer.h

Issue 2626013005: Change CaptureSynchronizer and PointerWatcherEventRouter to support multiple CaptureClients. (Closed)
Patch Set: separate out changes for removing GetCaptureClient() Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_AURA_MUS_CAPTURE_SYNCHRONIZER_H_ 5 #ifndef UI_AURA_MUS_CAPTURE_SYNCHRONIZER_H_
6 #define UI_AURA_MUS_CAPTURE_SYNCHRONIZER_H_ 6 #define UI_AURA_MUS_CAPTURE_SYNCHRONIZER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "ui/aura/aura_export.h" 11 #include "ui/aura/aura_export.h"
12 #include "ui/aura/client/capture_client_observer.h" 12 #include "ui/aura/client/capture_client_observer.h"
13 #include "ui/aura/window_observer.h" 13 #include "ui/aura/window_observer.h"
14 14
15 namespace ui { 15 namespace ui {
16 namespace mojom { 16 namespace mojom {
17 class WindowTree; 17 class WindowTree;
18 } 18 }
19 } 19 }
20 20
21 namespace aura { 21 namespace aura {
22 class CaptureSynchronizerDelegate; 22 class CaptureSynchronizerDelegate;
23 class WindowMus; 23 class WindowMus;
24 24
25 namespace client {
26 class CaptureClient;
27 }
28
29 // CaptureSynchronizer is resonsible for keeping capture in sync between aura 25 // CaptureSynchronizer is resonsible for keeping capture in sync between aura
30 // and the mus server. 26 // and the mus server.
31 class CaptureSynchronizer : public WindowObserver, 27 class CaptureSynchronizer : public WindowObserver,
32 public client::CaptureClientObserver { 28 public client::CaptureClientObserver {
33 public: 29 public:
34 CaptureSynchronizer(CaptureSynchronizerDelegate* delegate, 30 CaptureSynchronizer(CaptureSynchronizerDelegate* delegate,
35 ui::mojom::WindowTree* window_tree, 31 ui::mojom::WindowTree* window_tree);
36 client::CaptureClient* capture_client);
37 ~CaptureSynchronizer() override; 32 ~CaptureSynchronizer() override;
38 33
39 WindowMus* capture_window() { return capture_window_; } 34 WindowMus* capture_window() { return capture_window_; }
40 35
41 // Called when the server side wants to change capture to |window|. 36 // Called when the server side wants to change capture to |window|.
42 void SetCaptureFromServer(WindowMus* window); 37 void SetCaptureFromServer(WindowMus* window);
43 38
44 private:
45 // Internal implementation for capture changes. Adds/removes observer as 39 // Internal implementation for capture changes. Adds/removes observer as
46 // necessary and sets |capture_window_| to |window|. 40 // necessary and sets |capture_window_| to |window|.
47 void SetCaptureWindow(WindowMus* window); 41 void SetCaptureWindow(WindowMus* window);
48 42
43 private:
49 // WindowObserver: 44 // WindowObserver:
50 void OnWindowDestroying(Window* window) override; 45 void OnWindowDestroying(Window* window) override;
51 46
52 // client::CaptureClientObserver: 47 // client::CaptureClientObserver:
53 void OnCaptureChanged(Window* lost_capture, Window* gained_capture) override; 48 void OnCaptureChanged(Window* lost_capture, Window* gained_capture) override;
54 49
55 CaptureSynchronizerDelegate* delegate_; 50 CaptureSynchronizerDelegate* delegate_;
56 ui::mojom::WindowTree* window_tree_; 51 ui::mojom::WindowTree* window_tree_;
57 client::CaptureClient* capture_client_;
58 52
59 // Window that currently has capture. 53 // Window that currently has capture.
60 WindowMus* capture_window_ = nullptr; 54 WindowMus* capture_window_ = nullptr;
61 55
62 // Used when setting capture from the server to avoid setting capture back 56 // Used when setting capture from the server to avoid setting capture back
63 // on the server. If |setting_capture_| is true SetCaptureFromServer() was 57 // on the server. If |setting_capture_| is true SetCaptureFromServer() was
64 // called and |window_setting_capture_to_| is the window capture is being 58 // called and |window_setting_capture_to_| is the window capture is being
65 // set on. 59 // set on.
66 bool setting_capture_ = false; 60 bool setting_capture_ = false;
67 WindowMus* window_setting_capture_to_ = nullptr; 61 WindowMus* window_setting_capture_to_ = nullptr;
68 62
69 DISALLOW_COPY_AND_ASSIGN(CaptureSynchronizer); 63 DISALLOW_COPY_AND_ASSIGN(CaptureSynchronizer);
70 }; 64 };
71 65
72 } // namespace aura 66 } // namespace aura
73 67
74 #endif // UI_AURA_MUS_CAPTURE_SYNCHRONIZER_H_ 68 #endif // UI_AURA_MUS_CAPTURE_SYNCHRONIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698