• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_BUBBLE_FRAME_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_FRAME_BUBBLE_FRAME_VIEW_H_
7 #pragma once
8 
9 #include "chrome/browser/chromeos/frame/bubble_window.h"
10 #include "views/controls/button/button.h"
11 #include "views/window/non_client_view.h"
12 
13 namespace gfx {
14 class Insets;
15 class Path;
16 class Point;
17 class Rect;
18 class Size;
19 }
20 
21 namespace views {
22 class ImageButton;
23 class Label;
24 class Window;
25 }
26 
27 namespace chromeos {
28 
29 // BubbleFrameView implements a BubbleBorder based window frame.
30 class BubbleFrameView : public views::NonClientFrameView,
31                         public views::ButtonListener {
32  public:
33   BubbleFrameView(views::Window* frame, BubbleWindow::Style style);
34   virtual ~BubbleFrameView();
35 
36   // Overridden from views::NonClientFrameView:
37   virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
38   virtual gfx::Rect GetWindowBoundsForClientBounds(
39       const gfx::Rect& client_bounds) const OVERRIDE;
40   virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
41   virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask)
42       OVERRIDE;
43   virtual void EnableClose(bool enable) OVERRIDE;
44   virtual void ResetWindowControls() OVERRIDE;
45   virtual void UpdateWindowIcon() OVERRIDE;
46 
47   // View overrides:
48   virtual gfx::Insets GetInsets() const OVERRIDE;
49   virtual gfx::Size GetPreferredSize() OVERRIDE;
50   virtual void Layout() OVERRIDE;
51   virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
52 
53   // Overridden from views::ButtonListener:
54   virtual void ButtonPressed(views::Button* sender, const views::Event& event)
55       OVERRIDE;
56 
57   void StartThrobber();
58   void StopThrobber();
59 
60  private:
61   // The window that owns this view.
62   views::Window* frame_;
63 
64   // Allows to tweak appearance of the view.
65   BubbleWindow::Style style_;
66 
67   // Title label
68   views::Label* title_;
69 
70   // The bounds of the client view, in this view's coordinates.
71   gfx::Rect client_view_bounds_;
72 
73   // Close button for STYLE_XBAR case.
74   views::ImageButton* close_button_;
75 
76   // Throbber is optional. Employed by STYLE_THROBBER.
77   views::Throbber* throbber_;
78 
79   DISALLOW_COPY_AND_ASSIGN(BubbleFrameView);
80 };
81 
82 }  // namespace chromeos
83 
84 #endif  // CHROME_BROWSER_CHROMEOS_FRAME_BUBBLE_FRAME_VIEW_H_
85 
86