| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" | 10 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" |
| 11 #include "chrome/browser/ui/views/chrome_views_delegate.h" | 11 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
| 12 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 12 #include "chrome/browser/ui/views/ime_driver/ime_driver_mus.h" | 13 #include "chrome/browser/ui/views/ime_driver/ime_driver_mus.h" |
| 13 #include "components/constrained_window/constrained_window_views.h" | 14 #include "components/constrained_window/constrained_window_views.h" |
| 14 | 15 |
| 15 #if defined(USE_AURA) | 16 #if defined(USE_AURA) |
| 16 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/common/service_manager_connection.h" | 19 #include "content/public/common/service_manager_connection.h" |
| 19 #include "services/service_manager/public/cpp/connector.h" | 20 #include "services/service_manager/public/cpp/connector.h" |
| 20 #include "services/service_manager/runner/common/client_util.h" | 21 #include "services/service_manager/runner/common/client_util.h" |
| 21 #include "services/ui/public/cpp/gpu/gpu.h" // nogncheck | 22 #include "services/ui/public/cpp/gpu/gpu.h" // nogncheck |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 64 } |
| 64 | 65 |
| 65 ChromeBrowserMainExtraPartsViews::~ChromeBrowserMainExtraPartsViews() { | 66 ChromeBrowserMainExtraPartsViews::~ChromeBrowserMainExtraPartsViews() { |
| 66 constrained_window::SetConstrainedWindowViewsClient(nullptr); | 67 constrained_window::SetConstrainedWindowViewsClient(nullptr); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void ChromeBrowserMainExtraPartsViews::ToolkitInitialized() { | 70 void ChromeBrowserMainExtraPartsViews::ToolkitInitialized() { |
| 70 // The delegate needs to be set before any UI is created so that windows | 71 // The delegate needs to be set before any UI is created so that windows |
| 71 // display the correct icon. | 72 // display the correct icon. |
| 72 if (!views::ViewsDelegate::GetInstance()) | 73 if (!views::ViewsDelegate::GetInstance()) |
| 73 views_delegate_.reset(new ChromeViewsDelegate); | 74 views_delegate_ = base::MakeUnique<ChromeViewsDelegate>(); |
| 75 |
| 76 if (!views::LayoutProvider::Get()) |
| 77 layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider(); |
| 74 | 78 |
| 75 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); | 79 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); |
| 76 | 80 |
| 77 #if defined(USE_AURA) | 81 #if defined(USE_AURA) |
| 78 if (ShouldCreateWMState()) | 82 if (ShouldCreateWMState()) |
| 79 wm_state_.reset(new wm::WMState); | 83 wm_state_.reset(new wm::WMState); |
| 80 #endif | 84 #endif |
| 81 } | 85 } |
| 82 | 86 |
| 83 void ChromeBrowserMainExtraPartsViews::PreCreateThreads() { | 87 void ChromeBrowserMainExtraPartsViews::PreCreateThreads() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 152 |
| 149 // WMState is owned as a member, so don't have MusClient create it. | 153 // WMState is owned as a member, so don't have MusClient create it. |
| 150 const bool create_wm_state = false; | 154 const bool create_wm_state = false; |
| 151 mus_client_ = base::MakeUnique<views::MusClient>( | 155 mus_client_ = base::MakeUnique<views::MusClient>( |
| 152 connection->GetConnector(), service_manager::Identity(), | 156 connection->GetConnector(), service_manager::Identity(), |
| 153 content::BrowserThread::GetTaskRunnerForThread( | 157 content::BrowserThread::GetTaskRunnerForThread( |
| 154 content::BrowserThread::IO), | 158 content::BrowserThread::IO), |
| 155 create_wm_state); | 159 create_wm_state); |
| 156 #endif // defined(USE_AURA) | 160 #endif // defined(USE_AURA) |
| 157 } | 161 } |
| OLD | NEW |