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

Side by Side Diff: services/ui/display/platform_screen.h

Issue 2274353003: Add PlatformScreenDelegate and start implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes after once over. Created 4 years, 3 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 SERVICES_UI_DISPLAY_PLATFORM_SCREEN_H_ 5 #ifndef SERVICES_UI_DISPLAY_PLATFORM_SCREEN_H_
6 #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_H_ 6 #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/callback.h"
13
14 namespace gfx { 12 namespace gfx {
15 class Rect; 13 class Rect;
16 } 14 }
17 15
18 namespace display { 16 namespace display {
19 17
18 class PlatformScreen;
19
20 // The PlatformScreen delegate will be informed of changes to the physical
21 // and/or virtual displays that are connected.
22 class PlatformScreenDelegate {
sky 2016/08/25 19:18:43 It's common chrome practice (and mentioned in styl
kylechar 2016/08/25 20:26:01 Done.
23 public:
24 // Called when a display is added.
25 virtual void OnDisplayAdded(PlatformScreen* platform_screen,
26 int64_t id,
27 const gfx::Rect& bounds) = 0;
28 // Called when a display is removed.
29 virtual void OnDisplayRemoved(int64_t id) = 0;
30 // Called when a display is modified.
31 virtual void OnDisplayModified(int64_t id, const gfx::Rect& bounds) = 0;
32 };
33
20 // PlatformScreen provides the necessary functionality to configure all 34 // PlatformScreen provides the necessary functionality to configure all
21 // attached physical displays. 35 // attached physical displays.
22 class PlatformScreen { 36 class PlatformScreen {
23 public: 37 public:
24 using ConfiguredDisplayCallback =
25 base::Callback<void(int64_t, const gfx::Rect&)>;
26
27 virtual ~PlatformScreen() {} 38 virtual ~PlatformScreen() {}
28 39
29 // Creates a PlatformScreen instance. 40 // Creates a PlatformScreen instance.
30 static std::unique_ptr<PlatformScreen> Create(); 41 static std::unique_ptr<PlatformScreen> Create();
31 42
32 // Initializes platform specific screen resources. 43 // Initializes platform specific screen resources.
33 virtual void Init() = 0; 44 virtual void Init() = 0;
34 45
35 // ConfigurePhysicalDisplay() configures a single physical display and returns 46 // Triggers display configuration to start. On device this will trigger the
36 // its id and bounds for it via |callback|. 47 // initial configuration of connected displays. Off device this will create
37 virtual void ConfigurePhysicalDisplay( 48 // one or more fake displays and pretend to configure them. A non-null
38 const ConfiguredDisplayCallback& callback) = 0; 49 // |delegate| must be provided that will receive notifications when displays
50 // are added, removed or modified.
51 virtual void ConfigureDisplays(PlatformScreenDelegate* delegate) = 0;
sky 2016/08/25 19:18:43 Is there a reason we need both Init and Configure?
kylechar 2016/08/25 20:26:01 Yeah, that definitely works. I've merged Init() an
39 52
40 virtual int64_t GetPrimaryDisplayId() const = 0; 53 virtual int64_t GetPrimaryDisplayId() const = 0;
41 }; 54 };
42 55
43 } // namespace display 56 } // namespace display
44 57
45 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_H_ 58 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/display/platform_screen_impl.h » ('j') | services/ui/ws/window_server_delegate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698