top_container_view.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_TOP_CONTAINER_VIEW_H_
6#define CHROME_BROWSER_UI_VIEWS_FRAME_TOP_CONTAINER_VIEW_H_
7
8#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "ui/views/focus/focus_manager.h"
11#include "ui/views/view.h"
12
13class BrowserView;
14
15// Container for the BrowserView's tab strip, toolbar, and sometimes bookmark
16// bar. In Chrome OS immersive fullscreen it stacks on top of other views in
17// order to slide in and out over the web contents. It informs the immersive
18// mode controller when its children lose focus to trigger a slide out.
19class TopContainerView : public views::View,
20                         public views::FocusChangeListener {
21 public:
22  explicit TopContainerView(BrowserView* browser_view);
23  virtual ~TopContainerView();
24
25  // views::View overrides:
26  virtual std::string GetClassName() const OVERRIDE;
27  virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE;
28
29  // views::FocusChangeListener overrides:
30  virtual void OnWillChangeFocus(View* focused_before,
31                                 View* focused_now) OVERRIDE;
32  virtual void OnDidChangeFocus(View* focused_before,
33                                View* focused_now) OVERRIDE;
34
35 private:
36  // The parent of this view. Not owned.
37  BrowserView* browser_view_;
38  // The focus manager of |browser_view_|, cached to allow listener cleanup
39  // during |browser_view_| destruction.
40  views::FocusManager* focus_manager_;
41
42  DISALLOW_COPY_AND_ASSIGN(TopContainerView);
43};
44
45#endif  // CHROME_BROWSER_UI_VIEWS_FRAME_TOP_CONTAINER_VIEW_H_
46