| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "extensions/browser/api/system_display/display_info_provider.h" | 5 #include "extensions/browser/api/system_display/display_info_provider.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/display/screen_orientation_controller_chromeos.h" | 11 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 18 #include "extensions/common/api/system_display.h" | 18 #include "extensions/common/api/system_display.h" |
| 19 #include "ui/display/display.h" | 19 #include "ui/display/display.h" |
| 20 #include "ui/display/display_switches.h" | 20 #include "ui/display/display_switches.h" |
| 21 #include "ui/display/manager/display_layout.h" | 21 #include "ui/display/manager/display_layout.h" |
| 22 #include "ui/display/manager/display_manager.h" | 22 #include "ui/display/manager/display_manager.h" |
| 23 #include "ui/display/test/display_manager_test_api.h" | 23 #include "ui/display/test/display_manager_test_api.h" |
| 24 #include "ui/display/types/display_constants.h" |
| 24 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 25 | 26 |
| 26 namespace extensions { | 27 namespace extensions { |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 using DisplayUnitInfoList = DisplayInfoProvider::DisplayUnitInfoList; | 30 using DisplayUnitInfoList = DisplayInfoProvider::DisplayUnitInfoList; |
| 30 using DisplayLayoutList = DisplayInfoProvider::DisplayLayoutList; | 31 using DisplayLayoutList = DisplayInfoProvider::DisplayLayoutList; |
| 31 | 32 |
| 32 class DisplayInfoProviderChromeosTest : public ash::test::AshTestBase { | 33 class DisplayInfoProviderChromeosTest : public ash::test::AshTestBase { |
| 33 public: | 34 public: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 48 bool* success, | 49 bool* success, |
| 49 std::string* error) { | 50 std::string* error) { |
| 50 // Reset error messsage. | 51 // Reset error messsage. |
| 51 (*error).clear(); | 52 (*error).clear(); |
| 52 *success = DisplayInfoProvider::Get()->SetInfo(display_id, info, error); | 53 *success = DisplayInfoProvider::Get()->SetInfo(display_id, info, error); |
| 53 } | 54 } |
| 54 | 55 |
| 55 bool DisplayExists(int64_t display_id) const { | 56 bool DisplayExists(int64_t display_id) const { |
| 56 const display::Display& display = | 57 const display::Display& display = |
| 57 GetDisplayManager()->GetDisplayForId(display_id); | 58 GetDisplayManager()->GetDisplayForId(display_id); |
| 58 return display.id() != display::Display::kInvalidDisplayID; | 59 return display.id() != display::kInvalidDisplayId; |
| 59 } | 60 } |
| 60 | 61 |
| 61 display::DisplayManager* GetDisplayManager() const { | 62 display::DisplayManager* GetDisplayManager() const { |
| 62 return ash::Shell::GetInstance()->display_manager(); | 63 return ash::Shell::GetInstance()->display_manager(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 std::string SystemInfoDisplayInsetsToString( | 66 std::string SystemInfoDisplayInsetsToString( |
| 66 const api::system_display::Insets& insets) const { | 67 const api::system_display::Insets& insets) const { |
| 67 // Order to match gfx::Insets::ToString(). | 68 // Order to match gfx::Insets::ToString(). |
| 68 return base::StringPrintf( | 69 return base::StringPrintf( |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 CallSetDisplayUnitInfo(base::Int64ToString(id), info, &success, &error); | 1191 CallSetDisplayUnitInfo(base::Int64ToString(id), info, &success, &error); |
| 1191 ASSERT_TRUE(success); | 1192 ASSERT_TRUE(success); |
| 1192 | 1193 |
| 1193 // Verify that other_mode now matches the active mode. | 1194 // Verify that other_mode now matches the active mode. |
| 1194 active_mode = GetDisplayManager()->GetActiveModeForDisplayId(id); | 1195 active_mode = GetDisplayManager()->GetActiveModeForDisplayId(id); |
| 1195 EXPECT_TRUE(active_mode->IsEquivalent(other_mode_ash)); | 1196 EXPECT_TRUE(active_mode->IsEquivalent(other_mode_ash)); |
| 1196 } | 1197 } |
| 1197 | 1198 |
| 1198 } // namespace | 1199 } // namespace |
| 1199 } // namespace extensions | 1200 } // namespace extensions |
| OLD | NEW |