panel_browser_view.h revision 513209b27ff55e2841eac0e4120199c23acce758
1// Copyright (c) 2010 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_CHROMEOS_FRAME_PANEL_BROWSER_VIEW_H_
6#define CHROME_BROWSER_CHROMEOS_FRAME_PANEL_BROWSER_VIEW_H_
7#pragma once
8
9#include "app/x11_util.h"
10#include "base/scoped_ptr.h"
11#include "chrome/browser/chromeos/frame/panel_controller.h"
12#include "chrome/browser/views/frame/browser_view.h"
13
14class Browser;
15
16namespace chromeos {
17
18class PanelController;
19
20// A browser view that implements Panel specific behavior.
21// NOTE: This inherits from ::BrowserView in chrome/browser/views/frame/,
22// not chromeos::BrowserView in chrome/browser/chromeos/frame/.
23class PanelBrowserView : public ::BrowserView,
24                         public PanelController::Delegate {
25 public:
26  explicit PanelBrowserView(Browser* browser);
27
28  // BrowserView overrides.
29  virtual void Show();
30  virtual void SetBounds(const gfx::Rect& bounds);
31  virtual void Close();
32  virtual void UpdateTitleBar();
33  virtual void ActivationChanged(bool activated);
34  virtual void SetCreatorView(PanelBrowserView* creator);
35  virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const;
36
37  // PanelController::Delegate overrides
38  virtual string16 GetPanelTitle();
39  virtual SkBitmap GetPanelIcon();
40  virtual void ClosePanel();
41  virtual void OnPanelStateChanged(PanelController::State state) {}
42
43 private:
44  // Enforces the min, max, and default bounds.
45  void LimitBounds(gfx::Rect* bounds) const;
46
47  // Controls interactions with the window manager for popup panels.
48  scoped_ptr<chromeos::PanelController> panel_controller_;
49
50  // X id for the content window of the panel that created this
51  // panel.  This tells ChromeOS that it should be created next to the
52  // content window of this panel.
53  XID creator_xid_;
54  DISALLOW_COPY_AND_ASSIGN(PanelBrowserView);
55};
56
57}  // namespace chromeos
58
59#endif  // CHROME_BROWSER_CHROMEOS_FRAME_PANEL_BROWSER_VIEW_H_
60