Chromium Code Reviews| 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_views_delegate.h" | 5 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 if (params->context) | 443 if (params->context) |
| 444 params->context = params->context->GetRootWindow(); | 444 params->context = params->context->GetRootWindow(); |
| 445 DCHECK(params->parent || params->context || !params->child) | 445 DCHECK(params->parent || params->context || !params->child) |
| 446 << "Please provide a parent or context for this widget."; | 446 << "Please provide a parent or context for this widget."; |
| 447 if (!params->parent && !params->context) | 447 if (!params->parent && !params->context) |
| 448 params->context = ash::Shell::GetPrimaryRootWindow(); | 448 params->context = ash::Shell::GetPrimaryRootWindow(); |
| 449 #elif defined(USE_AURA) | 449 #elif defined(USE_AURA) |
| 450 // While the majority of the time, context wasn't plumbed through due to the | 450 // While the majority of the time, context wasn't plumbed through due to the |
| 451 // existence of a global WindowParentingClient, if this window is toplevel, | 451 // existence of a global WindowParentingClient, if this window is toplevel, |
| 452 // it's possible that there is no contextual state that we can use. | 452 // it's possible that there is no contextual state that we can use. |
| 453 if (params->parent == NULL && params->context == NULL && !params->child) { | 453 gfx::NativeWindow parent_or_context = |
| 454 params->native_widget = new views::DesktopNativeWidgetAura(delegate); | 454 params->parent ? params->parent : params->context; |
| 455 } else if (use_non_toplevel_window) { | 455 void* profile = |
| 456 views::NativeWidgetAura* native_widget = | 456 parent_or_context |
| 457 new views::NativeWidgetAura(delegate); | 457 ? parent_or_context->GetNativeWindowProperty(Profile::kProfileKey) |
| 458 if (params->parent) { | 458 : nullptr; |
| 459 Profile* parent_profile = reinterpret_cast<Profile*>( | 459 if (!params->parent && !params->context && !params->child && |
| 460 params->parent->GetNativeWindowProperty(Profile::kProfileKey)); | 460 !use_non_toplevel_window) { |
| 461 native_widget->SetNativeWindowProperty(Profile::kProfileKey, | 461 views::DesktopNativeWidgetAura* widget = |
| 462 parent_profile); | 462 new views::DesktopNativeWidgetAura(delegate); |
| 463 } | 463 params->native_widget = widget; |
| 464 params->native_widget = native_widget; | 464 if (profile) |
| 465 widget->SetNativeWindowProperty(Profile::kProfileKey, nullptr); | |
|
sky
2017/01/31 17:37:18
Don't you want profile here? Also, you should be a
Tom (Use chromium acct)
2017/01/31 18:10:29
Done. Yes it was broken with nullptr
| |
| 465 } else { | 466 } else { |
| 466 params->native_widget = new views::DesktopNativeWidgetAura(delegate); | 467 views::NativeWidgetAura* widget = new views::NativeWidgetAura(delegate); |
| 468 params->native_widget = widget; | |
| 469 if (profile) | |
| 470 widget->SetNativeWindowProperty(Profile::kProfileKey, nullptr); | |
| 467 } | 471 } |
| 468 #endif | 472 #endif |
| 469 } | 473 } |
| 470 | 474 |
| 471 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 475 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 472 bool ChromeViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) { | 476 bool ChromeViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) { |
| 473 // On Ubuntu Unity, the system always provides a title bar for maximized | 477 // On Ubuntu Unity, the system always provides a title bar for maximized |
| 474 // windows. | 478 // windows. |
| 475 views::LinuxUI* ui = views::LinuxUI::instance(); | 479 views::LinuxUI* ui = views::LinuxUI::instance(); |
| 476 return maximized && ui && ui->UnityIsRunning(); | 480 return maximized && ui && ui->UnityIsRunning(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 return ViewsDelegate::GetBubbleDialogMargins(); | 575 return ViewsDelegate::GetBubbleDialogMargins(); |
| 572 } | 576 } |
| 573 | 577 |
| 574 #if !defined(USE_ASH) | 578 #if !defined(USE_ASH) |
| 575 views::Widget::InitParams::WindowOpacity | 579 views::Widget::InitParams::WindowOpacity |
| 576 ChromeViewsDelegate::GetOpacityForInitParams( | 580 ChromeViewsDelegate::GetOpacityForInitParams( |
| 577 const views::Widget::InitParams& params) { | 581 const views::Widget::InitParams& params) { |
| 578 return views::Widget::InitParams::OPAQUE_WINDOW; | 582 return views::Widget::InitParams::OPAQUE_WINDOW; |
| 579 } | 583 } |
| 580 #endif | 584 #endif |
| OLD | NEW |