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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 params->opacity = GetOpacityForInitParams(*params); | 326 params->opacity = GetOpacityForInitParams(*params); |
327 | 327 |
328 // If we already have a native_widget, we don't have to try to come | 328 // If we already have a native_widget, we don't have to try to come |
329 // up with one. | 329 // up with one. |
330 if (params->native_widget) | 330 if (params->native_widget) |
331 return; | 331 return; |
332 | 332 |
333 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 333 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
334 bool use_non_toplevel_window = | 334 bool use_non_toplevel_window = |
335 params->parent && | 335 params->parent && |
336 params->type != views::Widget::InitParams::TYPE_MENU && | 336 !params->force_software_compositing && |
337 params->type != views::Widget::InitParams::TYPE_TOOLTIP; | 337 params->type != views::Widget::InitParams::TYPE_TOOLTIP; |
338 | 338 |
339 #if defined(OS_WIN) | 339 #if defined(OS_WIN) |
340 // On desktop Linux Chrome must run in an environment that supports a variety | 340 // On desktop Linux Chrome must run in an environment that supports a variety |
341 // of window managers, some of which do not play nicely with parts of our UI | 341 // of window managers, some of which do not play nicely with parts of our UI |
342 // that have specific expectations about window sizing and placement. For this | 342 // that have specific expectations about window sizing and placement. For this |
343 // reason windows opened as top level (!params.child) are always constrained | 343 // reason windows opened as top level (!params.child) are always constrained |
344 // by the browser frame, so we can position them correctly. This has some | 344 // by the browser frame, so we can position them correctly. This has some |
345 // negative side effects, like dialogs being clipped by the browser frame, but | 345 // negative side effects, like dialogs being clipped by the browser frame, but |
346 // the side effects are not as bad as the poor window manager interactions. On | 346 // the side effects are not as bad as the poor window manager interactions. On |
347 // Windows however these WM interactions are not an issue, so we open windows | 347 // Windows however these WM interactions are not an issue, so we open windows |
348 // requested as top_level as actual top level windows on the desktop. | 348 // requested as top_level as actual top level windows on the desktop. |
349 use_non_toplevel_window = use_non_toplevel_window && | 349 use_non_toplevel_window = use_non_toplevel_window && |
350 (params->child || | 350 (params->child || |
351 chrome::GetHostDesktopTypeForNativeView(params->parent) != | 351 chrome::GetHostDesktopTypeForNativeView(params->parent) != |
352 chrome::HOST_DESKTOP_TYPE_NATIVE); | 352 chrome::HOST_DESKTOP_TYPE_NATIVE); |
353 | 353 |
354 if (!ui::win::IsAeroGlassEnabled()) { | 354 if (!ui::win::IsAeroGlassEnabled()) { |
355 // If we don't have composition (either because Glass is not enabled or | 355 // If we don't have composition (either because Glass is not enabled or |
356 // because it was disabled at the command line), anything that requires | 356 // because it was disabled at the command line), anything that requires |
357 // transparency will be broken with a toplevel window, so force the use of | 357 // transparency will be broken with a toplevel window, so force the use of |
358 // a non toplevel window. | 358 // a non toplevel window. |
359 if (params->opacity == views::Widget::InitParams::TRANSLUCENT_WINDOW && | 359 if (params->opacity == views::Widget::InitParams::TRANSLUCENT_WINDOW && |
360 params->type != views::Widget::InitParams::TYPE_MENU) | 360 !params->force_software_compositing) |
361 use_non_toplevel_window = true; | 361 use_non_toplevel_window = true; |
362 } else { | 362 } else { |
363 // If we're on Vista+ with composition enabled, then we can use toplevel | 363 // If we're on Vista+ with composition enabled, then we can use toplevel |
364 // windows for most things (they get blended via WS_EX_COMPOSITED, which | 364 // windows for most things (they get blended via WS_EX_COMPOSITED, which |
365 // allows for animation effects, but also exceeding the bounds of the parent | 365 // allows for animation effects, but also exceeding the bounds of the parent |
366 // window). | 366 // window). |
367 if (chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_ASH && | 367 if (chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_ASH && |
368 params->parent && | 368 params->parent && |
369 params->type != views::Widget::InitParams::TYPE_CONTROL && | 369 params->type != views::Widget::InitParams::TYPE_CONTROL && |
370 params->type != views::Widget::InitParams::TYPE_WINDOW) { | 370 params->type != views::Widget::InitParams::TYPE_WINDOW) { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 return content::BrowserThread::GetBlockingPool(); | 505 return content::BrowserThread::GetBlockingPool(); |
506 } | 506 } |
507 | 507 |
508 #if !defined(USE_ASH) | 508 #if !defined(USE_ASH) |
509 views::Widget::InitParams::WindowOpacity | 509 views::Widget::InitParams::WindowOpacity |
510 ChromeViewsDelegate::GetOpacityForInitParams( | 510 ChromeViewsDelegate::GetOpacityForInitParams( |
511 const views::Widget::InitParams& params) { | 511 const views::Widget::InitParams& params) { |
512 return views::Widget::InitParams::OPAQUE_WINDOW; | 512 return views::Widget::InitParams::OPAQUE_WINDOW; |
513 } | 513 } |
514 #endif | 514 #endif |
OLD | NEW |