| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
| 14 #include "ash/display/display_manager.h" | 15 #include "ash/display/display_manager.h" |
| 15 #include "base/bind.h" | 16 #include "base/bind.h" |
| 16 #include "base/bind_helpers.h" | 17 #include "base/bind_helpers.h" |
| 17 #include "base/callback.h" | 18 #include "base/callback.h" |
| 18 #include "base/callback_helpers.h" | 19 #include "base/callback_helpers.h" |
| 19 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| 20 #include "base/files/file_enumerator.h" | 21 #include "base/files/file_enumerator.h" |
| 21 #include "base/files/file_path.h" | 22 #include "base/files/file_path.h" |
| 22 #include "base/files/file_util.h" | 23 #include "base/files/file_util.h" |
| 23 #include "base/files/scoped_temp_dir.h" | 24 #include "base/files/scoped_temp_dir.h" |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 }; | 726 }; |
| 726 | 727 |
| 727 void TestScreenshotFile(bool enabled) { | 728 void TestScreenshotFile(bool enabled) { |
| 728 // AddObserver is an ash-specific method, so just replace the screenshot | 729 // AddObserver is an ash-specific method, so just replace the screenshot |
| 729 // grabber with one we've created here. | 730 // grabber with one we've created here. |
| 730 std::unique_ptr<ChromeScreenshotGrabber> chrome_screenshot_grabber( | 731 std::unique_ptr<ChromeScreenshotGrabber> chrome_screenshot_grabber( |
| 731 new ChromeScreenshotGrabber); | 732 new ChromeScreenshotGrabber); |
| 732 // ScreenshotGrabber doesn't own this observer, so the observer's lifetime | 733 // ScreenshotGrabber doesn't own this observer, so the observer's lifetime |
| 733 // is tied to the test instead. | 734 // is tied to the test instead. |
| 734 chrome_screenshot_grabber->screenshot_grabber()->AddObserver(&observer_); | 735 chrome_screenshot_grabber->screenshot_grabber()->AddObserver(&observer_); |
| 735 ash::Shell::GetInstance()->accelerator_controller()->SetScreenshotDelegate( | 736 ash::Shell::GetInstance() |
| 736 std::move(chrome_screenshot_grabber)); | 737 ->accelerator_controller_delegate() |
| 738 ->SetScreenshotDelegate(std::move(chrome_screenshot_grabber)); |
| 737 | 739 |
| 738 SetScreenshotPolicy(enabled); | 740 SetScreenshotPolicy(enabled); |
| 739 ash::Shell::GetInstance()->accelerator_controller()->PerformActionIfEnabled( | 741 ash::Shell::GetInstance()->accelerator_controller()->PerformActionIfEnabled( |
| 740 ash::TAKE_SCREENSHOT); | 742 ash::TAKE_SCREENSHOT); |
| 741 | 743 |
| 742 content::RunMessageLoop(); | 744 content::RunMessageLoop(); |
| 743 static_cast<ChromeScreenshotGrabber*>(ash::Shell::GetInstance() | 745 static_cast<ChromeScreenshotGrabber*>( |
| 744 ->accelerator_controller() | 746 ash::Shell::GetInstance() |
| 745 ->screenshot_delegate()) | 747 ->accelerator_controller_delegate() |
| 748 ->screenshot_delegate()) |
| 746 ->screenshot_grabber() | 749 ->screenshot_grabber() |
| 747 ->RemoveObserver(&observer_); | 750 ->RemoveObserver(&observer_); |
| 748 } | 751 } |
| 749 #endif | 752 #endif |
| 750 | 753 |
| 751 ExtensionService* extension_service() { | 754 ExtensionService* extension_service() { |
| 752 extensions::ExtensionSystem* system = | 755 extensions::ExtensionSystem* system = |
| 753 extensions::ExtensionSystem::Get(browser()->profile()); | 756 extensions::ExtensionSystem::Get(browser()->profile()); |
| 754 return system->extension_service(); | 757 return system->extension_service(); |
| 755 } | 758 } |
| (...skipping 3351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4107 | 4110 |
| 4108 SetEmptyPolicy(); | 4111 SetEmptyPolicy(); |
| 4109 // Policy not set. | 4112 // Policy not set. |
| 4110 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4113 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
| 4111 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4114 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
| 4112 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4115 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| 4113 } | 4116 } |
| 4114 #endif // defined(OS_CHROMEOS) | 4117 #endif // defined(OS_CHROMEOS) |
| 4115 | 4118 |
| 4116 } // namespace policy | 4119 } // namespace policy |
| OLD | NEW |