chrome_views_delegate_aura.cc revision f8ee788a64d60abd8f2d742a5fdedde054ecd910
1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/ui/views/chrome_views_delegate.h"
6
7#include "chrome/browser/ui/ash/ash_util.h"
8
9views::Widget::InitParams::WindowOpacity
10ChromeViewsDelegate::GetOpacityForInitParams(
11    const views::Widget::InitParams& params) {
12  gfx::NativeView native_view = params.parent ? params.parent : params.context;
13  if (native_view && chrome::IsNativeViewInAsh(native_view))
14    return views::Widget::InitParams::TRANSLUCENT_WINDOW;
15
16  // We want translucent windows when either we are in ASH or we are
17  // a top level window which is not of type TYPE_WINDOW.
18  if (!params.child && params.type != views::Widget::InitParams::TYPE_WINDOW)
19    return views::Widget::InitParams::TRANSLUCENT_WINDOW;
20
21  return views::Widget::InitParams::OPAQUE_WINDOW;
22}
23