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

Unified Diff: services/ui/display/platform_screen_ozone.cc

Issue 2310133002: Add mojom::DisplayController. (Closed)
Patch Set: Add missing dep. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/display/platform_screen_ozone.h ('k') | services/ui/display/platform_screen_ozone_unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/display/platform_screen_ozone.cc
diff --git a/services/ui/display/platform_screen_ozone.cc b/services/ui/display/platform_screen_ozone.cc
index 7b4b22e24d53d0bc7cbe5a470dbf2840b1d0cb21..9bf16ebf652acc1fd742f056953328ff1a5b8d30 100644
--- a/services/ui/display/platform_screen_ozone.cc
+++ b/services/ui/display/platform_screen_ozone.cc
@@ -64,6 +64,25 @@ int64_t PlatformScreenOzone::GetPrimaryDisplayId() const {
return primary_display_id_;
}
+void PlatformScreenOzone::ToggleVirtualDisplay(
+ const ToggleVirtualDisplayCallback& callback) {
+ if (base::SysInfo::IsRunningOnChromeOS()) {
+ callback.Run(false);
+ return;
+ }
+
+ if (cached_displays_.size() == 1) {
+ display_configurator_.AddVirtualDisplay(cached_displays_[0].bounds.size());
+ callback.Run(true);
+ } else if (cached_displays_.size() > 1) {
+ callback.Run(
+ display_configurator_.RemoveVirtualDisplay(cached_displays_.back().id));
+ } else {
+ NOTREACHED();
+ callback.Run(false);
+ }
+}
+
void PlatformScreenOzone::ProcessRemovedDisplays(
const ui::DisplayConfigurator::DisplayStateList& snapshots) {
std::vector<int64_t> current_ids;
@@ -155,7 +174,7 @@ void PlatformScreenOzone::AddNewDisplays(
primary_display_id_ = id;
cached_displays_.push_back(DisplayInfo(id, bounds));
- delegate_->OnDisplayAdded(this, id, bounds);
+ delegate_->OnDisplayAdded(id, bounds);
}
}
« no previous file with comments | « services/ui/display/platform_screen_ozone.h ('k') | services/ui/display/platform_screen_ozone_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698