| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_linux.h" | 5 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "chrome/browser/chrome_browser_main.h" | 8 #include "chrome/browser/chrome_browser_main.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 return ui::NativeTheme::GetInstanceForNativeUi(); | 59 return ui::NativeTheme::GetInstanceForNativeUi(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace | 62 } // namespace |
| 63 | 63 |
| 64 ChromeBrowserMainExtraPartsViewsLinux::ChromeBrowserMainExtraPartsViewsLinux() { | 64 ChromeBrowserMainExtraPartsViewsLinux::ChromeBrowserMainExtraPartsViewsLinux() { |
| 65 } | 65 } |
| 66 | 66 |
| 67 ChromeBrowserMainExtraPartsViewsLinux:: | 67 ChromeBrowserMainExtraPartsViewsLinux:: |
| 68 ~ChromeBrowserMainExtraPartsViewsLinux() { | 68 ~ChromeBrowserMainExtraPartsViewsLinux() { |
| 69 // X11DesktopHandler is destructed at this point, so we don't need to remove | 69 views::X11DesktopHandler::get()->RemoveObserver(this); |
| 70 // ourselves as an X11DesktopHandlerObserver | |
| 71 DCHECK(!aura::Env::GetInstanceDontCreate()); | |
| 72 } | 70 } |
| 73 | 71 |
| 74 void ChromeBrowserMainExtraPartsViewsLinux::PreEarlyInitialization() { | 72 void ChromeBrowserMainExtraPartsViewsLinux::PreEarlyInitialization() { |
| 75 // TODO(erg): Refactor this into a dlopen call when we add a GTK3 port. | 73 // TODO(erg): Refactor this into a dlopen call when we add a GTK3 port. |
| 76 views::LinuxUI* gtk2_ui = BuildGtk2UI(); | 74 views::LinuxUI* gtk2_ui = BuildGtk2UI(); |
| 77 gtk2_ui->SetNativeThemeOverride(base::Bind(&GetNativeThemeForWindow)); | 75 gtk2_ui->SetNativeThemeOverride(base::Bind(&GetNativeThemeForWindow)); |
| 78 views::LinuxUI::SetInstance(gtk2_ui); | 76 views::LinuxUI::SetInstance(gtk2_ui); |
| 79 } | 77 } |
| 80 | 78 |
| 81 void ChromeBrowserMainExtraPartsViewsLinux::ToolkitInitialized() { | 79 void ChromeBrowserMainExtraPartsViewsLinux::ToolkitInitialized() { |
| 82 ChromeBrowserMainExtraPartsViews::ToolkitInitialized(); | 80 ChromeBrowserMainExtraPartsViews::ToolkitInitialized(); |
| 83 views::LinuxUI::instance()->Initialize(); | 81 views::LinuxUI::instance()->Initialize(); |
| 84 } | 82 } |
| 85 | 83 |
| 86 void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() { | 84 void ChromeBrowserMainExtraPartsViewsLinux::PreCreateThreads() { |
| 87 // Update the device scale factor before initializing views | 85 // Update the device scale factor before initializing views |
| 88 // because its display::Screen instance depends on it. | 86 // because its display::Screen instance depends on it. |
| 89 views::LinuxUI::instance()->UpdateDeviceScaleFactor(); | 87 views::LinuxUI::instance()->UpdateDeviceScaleFactor(); |
| 90 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); | 88 ChromeBrowserMainExtraPartsViews::PreCreateThreads(); |
| 91 views::X11DesktopHandler::get()->AddObserver(this); | 89 views::X11DesktopHandler::get()->AddObserver(this); |
| 92 } | 90 } |
| 93 | 91 |
| 94 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged( | 92 void ChromeBrowserMainExtraPartsViewsLinux::OnWorkspaceChanged( |
| 95 const std::string& new_workspace) { | 93 const std::string& new_workspace) { |
| 96 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace); | 94 BrowserList::MoveBrowsersInWorkspaceToFront(new_workspace); |
| 97 } | 95 } |
| OLD | NEW |