Skip to content

Commit

Permalink
Introduce cros_display_config.mojom
Browse files Browse the repository at this point in the history
This includes the implementation in ash, but no clients
(dependent CL will follow).

Bug: 682402
Change-Id: I9fe82f915f2b2ddacc29c27f039a47bc8b8a043b
Reviewed-on: https://chromium-review.googlesource.com/1011563
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Reviewed-by: Malay Keshav <malaykeshav@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554187}
  • Loading branch information
stevenjb authored and Commit Bot committed Apr 26, 2018
1 parent ce380cb commit 2a9b438
Show file tree
Hide file tree
Showing 10 changed files with 2,000 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ component("ash") {
"disconnected_app_handler.h",
"display/ash_display_controller.cc",
"display/ash_display_controller.h",
"display/cros_display_config.cc",
"display/cros_display_config.h",
"display/cursor_window_controller.cc",
"display/cursor_window_controller.h",
"display/display_animator.cc",
Expand Down Expand Up @@ -1518,6 +1520,7 @@ test("ash_unittests") {
"detachable_base/detachable_base_handler_unittest.cc",
"detachable_base/detachable_base_notification_controller_unittest.cc",
"dip_unittest.cc",
"display/cros_display_config_unittest.cc",
"display/cursor_window_controller_unittest.cc",
"display/display_color_manager_unittest.cc",
"display/display_configuration_controller_unittest.cc",
Expand Down
893 changes: 893 additions & 0 deletions ash/display/cros_display_config.cc

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions ash/display/cros_display_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// 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 ASH_DISPLAY_CROS_DISPLAY_CONFIG_H_
#define ASH_DISPLAY_CROS_DISPLAY_CONFIG_H_

#include <map>
#include <memory>
#include <string>

#include "ash/ash_export.h"
#include "ash/public/interfaces/cros_display_config.mojom.h"
#include "base/macros.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/interface_ptr_set.h"

namespace ash {

class OverscanCalibrator;
class TouchCalibratorController;

// ASH_EXPORT for use in chrome unit_tests for DisplayInfoProviderChromeOS.
class ASH_EXPORT CrosDisplayConfig : public mojom::CrosDisplayConfigController {
public:
CrosDisplayConfig();
~CrosDisplayConfig() override;

void BindRequest(mojom::CrosDisplayConfigControllerRequest request);

// mojom::CrosDisplayConfigController:
void AddObserver(
mojom::CrosDisplayConfigObserverAssociatedPtrInfo observer) override;
void GetDisplayLayoutInfo(GetDisplayLayoutInfoCallback callback) override;
void SetDisplayLayoutInfo(mojom::DisplayLayoutInfoPtr info,
SetDisplayLayoutInfoCallback callback) override;
void GetDisplayUnitInfoList(bool single_unified,
GetDisplayUnitInfoListCallback callback) override;
void SetDisplayProperties(const std::string& id,
mojom::DisplayConfigPropertiesPtr properties,
SetDisplayPropertiesCallback callback) override;
void SetUnifiedDesktopEnabled(bool enabled) override;
void OverscanCalibration(const std::string& display_id,
mojom::DisplayConfigOperation op,
const base::Optional<gfx::Insets>& delta,
OverscanCalibrationCallback callback) override;
void TouchCalibration(const std::string& display_id,
mojom::DisplayConfigOperation op,
mojom::TouchCalibrationPtr calibration,
TouchCalibrationCallback callback) override;

TouchCalibratorController* touch_calibrator_for_test() {
return touch_calibrator_.get();
}

private:
class DisplayObserver;
void NotifyObserversDisplayConfigChanged();
OverscanCalibrator* GetOverscanCalibrator(const std::string& id);

std::unique_ptr<DisplayObserver> display_observer_;
mojo::BindingSet<mojom::CrosDisplayConfigController> bindings_;
mojo::AssociatedInterfacePtrSet<mojom::CrosDisplayConfigObserver> observers_;
std::map<std::string, std::unique_ptr<OverscanCalibrator>>
overscan_calibrators_;
std::unique_ptr<TouchCalibratorController> touch_calibrator_;

DISALLOW_COPY_AND_ASSIGN(CrosDisplayConfig);
};

} // namespace ash

#endif // ASH_DISPLAY_CROS_DISPLAY_CONFIG_H_
Loading

0 comments on commit 2a9b438

Please sign in to comment.