summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/frame/panel_browser_view.h
blob: fdd9c958920c9544c22f00df43406951aeb80af9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_FRAME_PANEL_BROWSER_VIEW_H_
#define CHROME_BROWSER_CHROMEOS_FRAME_PANEL_BROWSER_VIEW_H_
#pragma once

#include "app/x11_util.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/chromeos/frame/panel_controller.h"
#include "chrome/browser/views/frame/browser_view.h"

class Browser;

namespace chromeos {

class PanelController;

// A browser view that implements Panel specific behavior.
// NOTE: This inherits from ::BrowserView in chrome/browser/views/frame/,
// not chromeos::BrowserView in chrome/browser/chromeos/frame/.
class PanelBrowserView : public ::BrowserView,
                         public PanelController::Delegate {
 public:
  explicit PanelBrowserView(Browser* browser);

  // BrowserView overrides.
  virtual void Init();
  virtual void Show();
  virtual void SetBounds(const gfx::Rect& bounds);
  virtual void Close();
  virtual void UpdateTitleBar();
  virtual void ActivationChanged(bool activated);
  virtual void SetCreatorView(PanelBrowserView* creator);
  virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const;

  // PanelController::Delegate overrides
  virtual string16 GetPanelTitle();
  virtual SkBitmap GetPanelIcon();
  virtual void ClosePanel();
  virtual void OnPanelStateChanged(PanelController::State state) {}

 private:
  // Enforces the min, max, and default bounds.
  void LimitBounds(gfx::Rect* bounds) const;

  // Controls interactions with the window manager for popup panels.
  scoped_ptr<chromeos::PanelController> panel_controller_;

  // X id for the content window of the panel that created this
  // panel.  This tells ChromeOS that it should be created next to the
  // content window of this panel.
  XID creator_xid_;
  DISALLOW_COPY_AND_ASSIGN(PanelBrowserView);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_FRAME_PANEL_BROWSER_VIEW_H_