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.
5 #include "chrome/browser/ui/views/frame/top_container_view.h"
7 #include "chrome/browser/ui/views/frame/browser_frame.h"
8 #include "chrome/browser/ui/views/frame/browser_view.h"
9 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
10 #include "ui/compositor/paint_context.h"
12 TopContainerView::TopContainerView(BrowserView
* browser_view
)
13 : browser_view_(browser_view
) {
16 TopContainerView::~TopContainerView() {
19 const char* TopContainerView::GetClassName() const {
20 return "TopContainerView";
23 void TopContainerView::PaintChildren(const ui::PaintContext
& context
) {
24 if (browser_view_
->immersive_mode_controller()->IsRevealed()) {
25 // Top-views depend on parts of the frame (themes, window title,
26 // window controls) being painted underneath them. Clip rect has already
27 // been set to the bounds of this view, so just paint the frame.
28 views::View
* frame
= browser_view_
->frame()->GetFrameView();
29 // Use a clone without invalidation info, as we're painting something
30 // outside of the normal parent-child relationship, so invalidations are
31 // no longer in the correct space to compare.
32 frame
->Paint(ui::PaintContext(
33 context
, ui::PaintContext::CLONE_WITHOUT_INVALIDATION
));
35 View::PaintChildren(context
);