| 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 "ash/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 return false; | 242 return false; |
| 243 | 243 |
| 244 const std::string position_str = GetStringFromPosition(layout.position); | 244 const std::string position_str = GetStringFromPosition(layout.position); |
| 245 dict_value->SetString("position", position_str); | 245 dict_value->SetString("position", position_str); |
| 246 dict_value->SetInteger("offset", layout.offset); | 246 dict_value->SetInteger("offset", layout.offset); |
| 247 return true; | 247 return true; |
| 248 } | 248 } |
| 249 | 249 |
| 250 std::string DisplayLayout::ToString() const { | 250 std::string DisplayLayout::ToString() const { |
| 251 const std::string position_str = GetStringFromPosition(position); | 251 const std::string position_str = GetStringFromPosition(position); |
| 252 return StringPrintf("%s, %d", position_str.c_str(), offset); | 252 return base::StringPrintf("%s, %d", position_str.c_str(), offset); |
| 253 } | 253 } |
| 254 | 254 |
| 255 // static | 255 // static |
| 256 void DisplayLayout::RegisterJSONConverter( | 256 void DisplayLayout::RegisterJSONConverter( |
| 257 base::JSONValueConverter<DisplayLayout>* converter) { | 257 base::JSONValueConverter<DisplayLayout>* converter) { |
| 258 converter->RegisterCustomField<Position>( | 258 converter->RegisterCustomField<Position>( |
| 259 "position", &DisplayLayout::position, &GetPositionFromString); | 259 "position", &DisplayLayout::position, &GetPositionFromString); |
| 260 converter->RegisterIntField("offset", &DisplayLayout::offset); | 260 converter->RegisterIntField("offset", &DisplayLayout::offset); |
| 261 } | 261 } |
| 262 | 262 |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 static int root_window_count = 0; | 761 static int root_window_count = 0; |
| 762 const internal::DisplayInfo& display_info = | 762 const internal::DisplayInfo& display_info = |
| 763 GetDisplayManager()->GetDisplayInfo(display); | 763 GetDisplayManager()->GetDisplayInfo(display); |
| 764 const gfx::Rect& bounds_in_pixel = display_info.bounds_in_pixel(); | 764 const gfx::Rect& bounds_in_pixel = display_info.bounds_in_pixel(); |
| 765 aura::RootWindow::CreateParams params(bounds_in_pixel); | 765 aura::RootWindow::CreateParams params(bounds_in_pixel); |
| 766 params.host = Shell::GetInstance()->root_window_host_factory()-> | 766 params.host = Shell::GetInstance()->root_window_host_factory()-> |
| 767 CreateRootWindowHost(bounds_in_pixel); | 767 CreateRootWindowHost(bounds_in_pixel); |
| 768 params.initial_insets = display_info.GetOverscanInsetsInPixel(); | 768 params.initial_insets = display_info.GetOverscanInsetsInPixel(); |
| 769 params.initial_root_window_scale = display_info.ui_scale(); | 769 params.initial_root_window_scale = display_info.ui_scale(); |
| 770 aura::RootWindow* root_window = new aura::RootWindow(params); | 770 aura::RootWindow* root_window = new aura::RootWindow(params); |
| 771 root_window->SetName(StringPrintf("RootWindow-%d", root_window_count++)); | 771 root_window->SetName( |
| 772 base::StringPrintf("RootWindow-%d", root_window_count++)); |
| 772 | 773 |
| 773 // No need to remove RootWindowObserver because | 774 // No need to remove RootWindowObserver because |
| 774 // the DisplayManager object outlives RootWindow objects. | 775 // the DisplayManager object outlives RootWindow objects. |
| 775 root_window->AddRootWindowObserver(GetDisplayManager()); | 776 root_window->AddRootWindowObserver(GetDisplayManager()); |
| 776 root_window->SetProperty(internal::kDisplayIdKey, display.id()); | 777 root_window->SetProperty(internal::kDisplayIdKey, display.id()); |
| 777 root_window->Init(); | 778 root_window->Init(); |
| 778 return root_window; | 779 return root_window; |
| 779 } | 780 } |
| 780 | 781 |
| 781 aura::RootWindow* DisplayController::AddRootWindowForDisplay( | 782 aura::RootWindow* DisplayController::AddRootWindowForDisplay( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 } | 860 } |
| 860 | 861 |
| 861 void DisplayController::OnFadeOutForSwapDisplayFinished() { | 862 void DisplayController::OnFadeOutForSwapDisplayFinished() { |
| 862 #if defined(OS_CHROMEOS) | 863 #if defined(OS_CHROMEOS) |
| 863 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); | 864 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); |
| 864 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); | 865 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); |
| 865 #endif | 866 #endif |
| 866 } | 867 } |
| 867 | 868 |
| 868 } // namespace ash | 869 } // namespace ash |
| OLD | NEW |