| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_views_delegate.h" | 5 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/native_widget_factory.h" | 7 #include "chrome/browser/ui/views/native_widget_factory.h" |
| 8 #include "chrome/grit/chrome_unscaled_resources.h" | 8 #include "chrome/grit/chrome_unscaled_resources.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/views/linux_ui/linux_ui.h" | 10 #include "ui/views/linux_ui/linux_ui.h" |
| 11 | 11 |
| 12 views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget( | 12 views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget( |
| 13 views::Widget::InitParams* params, | 13 views::Widget::InitParams* params, |
| 14 views::internal::NativeWidgetDelegate* delegate) { | 14 views::internal::NativeWidgetDelegate* delegate) { |
| 15 NativeWidgetType native_widget_type = | 15 NativeWidgetType native_widget_type = |
| 16 (params->parent && params->type != views::Widget::InitParams::TYPE_MENU && | 16 (params->parent && params->type != views::Widget::InitParams::TYPE_MENU && |
| 17 params->type != views::Widget::InitParams::TYPE_MENU) | 17 params->type != views::Widget::InitParams::TYPE_TOOLTIP) |
| 18 ? NativeWidgetType::NATIVE_WIDGET_AURA | 18 ? NativeWidgetType::NATIVE_WIDGET_AURA |
| 19 : NativeWidgetType::DESKTOP_NATIVE_WIDGET_AURA; | 19 : NativeWidgetType::DESKTOP_NATIVE_WIDGET_AURA; |
| 20 return ::CreateNativeWidget(native_widget_type, params, delegate); | 20 return ::CreateNativeWidget(native_widget_type, params, delegate); |
| 21 } | 21 } |
| 22 | 22 |
| 23 gfx::ImageSkia* ChromeViewsDelegate::GetDefaultWindowIcon() const { | 23 gfx::ImageSkia* ChromeViewsDelegate::GetDefaultWindowIcon() const { |
| 24 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 24 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 25 return rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_64); | 25 return rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_64); |
| 26 } | 26 } |
| 27 | 27 |
| 28 bool ChromeViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) { | 28 bool ChromeViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) { |
| 29 // On Ubuntu Unity, the system always provides a title bar for maximized | 29 // On Ubuntu Unity, the system always provides a title bar for maximized |
| 30 // windows. | 30 // windows. |
| 31 views::LinuxUI* ui = views::LinuxUI::instance(); | 31 views::LinuxUI* ui = views::LinuxUI::instance(); |
| 32 return maximized && ui && ui->UnityIsRunning(); | 32 return maximized && ui && ui->UnityIsRunning(); |
| 33 } | 33 } |
| OLD | NEW |