15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// found in the LICENSE file.
45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/browser/ui/views/chrome_views_delegate.h"
65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/browser/ui/ash/ash_util.h"
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)views::Widget::InitParams::WindowOpacity
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)ChromeViewsDelegate::GetOpacityForInitParams(
115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    const views::Widget::InitParams& params) {
125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  gfx::NativeView native_view = params.parent ? params.parent : params.context;
135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  if (native_view && chrome::IsNativeViewInAsh(native_view))
145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    return views::Widget::InitParams::TRANSLUCENT_WINDOW;
15f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)
165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // We want translucent windows when either we are in ASH or we are
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // a top level window which is not of type TYPE_WINDOW.
18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  if (!params.child && params.type != views::Widget::InitParams::TYPE_WINDOW)
195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    return views::Widget::InitParams::TRANSLUCENT_WINDOW;
205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  return views::Widget::InitParams::OPAQUE_WINDOW;
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
23