Chromium Code Reviews| Index: ui/display/android/screen_android.h |
| diff --git a/ui/display/test/test_screen.h b/ui/display/android/screen_android.h |
| similarity index 55% |
| copy from ui/display/test/test_screen.h |
| copy to ui/display/android/screen_android.h |
| index fb822f5d8dcd67e11426add22056ad13f72583b6..08c3f70164d347e70cc762bdaa397aad284cba83 100644 |
| --- a/ui/display/test/test_screen.h |
| +++ b/ui/display/android/screen_android.h |
| @@ -1,53 +1,61 @@ |
| -// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Copyright 2016 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 UI_DISPLAY_TEST_TEST_SCREEN_H_ |
| -#define UI_DISPLAY_TEST_TEST_SCREEN_H_ |
| +#ifndef UI_DISPLAY_ANDROID_SCREEN_ANDROID_H_ |
| +#define UI_DISPLAY_ANDROID_SCREEN_ANDROID_H_ |
| -#include <vector> |
| +#include <map> |
| +#include "base/logging.h" |
| #include "base/macros.h" |
| +#include "base/synchronization/lock.h" |
| #include "ui/display/display.h" |
| #include "ui/display/screen.h" |
| +#include "ui/gfx/native_widget_types.h" |
| namespace display { |
| -namespace test { |
| - |
| -// A dummy implementation of display::Screen that contains a single |
| -// display::Display only. The contained Display can be accessed and modified via |
| -// TestScreen::display(). |
| -// |
| -// NOTE: Adding and removing display::DisplayOberver's are no-ops and observers |
| -// will NOT be notified ever. |
| -class TestScreen : public Screen { |
| - public: |
| - TestScreen(); |
| - ~TestScreen() override; |
| - Display* display() { return &display_; } |
| +class DISPLAY_EXPORT ScreenAndroid : public Screen { |
| + public: |
| + ScreenAndroid(); |
| + ~ScreenAndroid() override; |
|
oshima
2016/10/24 20:01:10
nit: // Screen:
Please group overridden methods
|
| - // display::Screen: |
| gfx::Point GetCursorScreenPoint() override; |
| + |
| bool IsWindowUnderCursor(gfx::NativeWindow window) override; |
| + |
| gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| - int GetNumDisplays() const override; |
| - std::vector<Display> GetAllDisplays() const override; |
| + |
| + Display GetPrimaryDisplay() const override; |
| + |
| + // Used to control the display properties for a specific window. |
| + void SetDisplayForWindow(gfx::NativeView view, const Display& display); |
| + |
| + void ClearDisplayForWindow(gfx::NativeView view); |
| + |
| Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
| + |
| Display GetDisplayNearestPoint(const gfx::Point& point) const override; |
| + |
| + int GetNumDisplays() const override; |
| + |
| + std::vector<Display> GetAllDisplays() const override; |
| + |
| Display GetDisplayMatching(const gfx::Rect& match_rect) const override; |
| - Display GetPrimaryDisplay() const override; |
| + |
| void AddObserver(DisplayObserver* observer) override; |
| + |
| void RemoveObserver(DisplayObserver* observer) override; |
| private: |
| - // The only display. |
| - Display display_; |
| + std::map<gfx::NativeView, Display> display_map_; |
|
oshima
2016/10/24 20:01:10
optional: unordered_map
|
| + mutable base::Lock display_lock_; |
| - DISALLOW_COPY_AND_ASSIGN(TestScreen); |
| + DISALLOW_COPY_AND_ASSIGN(ScreenAndroid); |
| }; |
| -} // namespace test |
| } // namespace display |
| -#endif // UI_DISPLAY_TEST_TEST_SCREEN_H_ |
| +#endif // UI_DISPLAY_ANDROID_SCREEN_ANDROID_H_ |
| + |