| 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 "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" | 5 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" | 7 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" |
| 8 #include "chrome/browser/ui/views/chrome_views_delegate.h" | 8 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
| 9 #include "components/constrained_window/constrained_window_views.h" | 9 #include "components/constrained_window/constrained_window_views.h" |
| 10 | 10 |
| 11 #if defined(USE_AURA) | 11 #if defined(USE_AURA) |
| 12 #include "ui/gfx/screen.h" |
| 13 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
| 12 #include "ui/wm/core/wm_state.h" | 14 #include "ui/wm/core/wm_state.h" |
| 13 #endif | 15 #endif |
| 14 | 16 |
| 15 ChromeBrowserMainExtraPartsViews::ChromeBrowserMainExtraPartsViews() { | 17 ChromeBrowserMainExtraPartsViews::ChromeBrowserMainExtraPartsViews() { |
| 16 } | 18 } |
| 17 | 19 |
| 18 ChromeBrowserMainExtraPartsViews::~ChromeBrowserMainExtraPartsViews() { | 20 ChromeBrowserMainExtraPartsViews::~ChromeBrowserMainExtraPartsViews() { |
| 19 constrained_window::SetConstrainedWindowViewsClient(nullptr); | 21 constrained_window::SetConstrainedWindowViewsClient(nullptr); |
| 20 } | 22 } |
| 21 | 23 |
| 22 void ChromeBrowserMainExtraPartsViews::ToolkitInitialized() { | 24 void ChromeBrowserMainExtraPartsViews::ToolkitInitialized() { |
| 23 // The delegate needs to be set before any UI is created so that windows | 25 // The delegate needs to be set before any UI is created so that windows |
| 24 // display the correct icon. | 26 // display the correct icon. |
| 25 if (!views::ViewsDelegate::GetInstance()) | 27 if (!views::ViewsDelegate::GetInstance()) |
| 26 views_delegate_.reset(new ChromeViewsDelegate); | 28 views_delegate_.reset(new ChromeViewsDelegate); |
| 27 | 29 |
| 28 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); | 30 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); |
| 29 | 31 |
| 30 #if defined(USE_AURA) | 32 #if defined(USE_AURA) |
| 31 wm_state_.reset(new wm::WMState); | 33 wm_state_.reset(new wm::WMState); |
| 32 #endif | 34 #endif |
| 33 } | 35 } |
| 36 |
| 37 void ChromeBrowserMainExtraPartsViews::PreCreateThreads() { |
| 38 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
| 39 gfx::Screen::SetScreenInstance(views::CreateDesktopScreen()); |
| 40 #endif |
| 41 } |
| OLD | NEW |