OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 "base/memory/scoped_ptr.h" | |
10 #include "chrome/browser/chromeos/frame/panel_controller.h" | |
11 #include "chrome/browser/ui/views/frame/browser_view.h" | |
12 #include "ui/base/x/x11_util.h" | |
13 | |
14 class Browser; | |
15 | |
16 namespace chromeos { | |
17 | |
18 class PanelController; | |
19 | |
20 // A browser view that implements Panel specific behavior. | |
21 // NOTE: This inherits from ::BrowserView in chrome/browser/ui/views/frame/, | |
22 // not chromeos::BrowserView in chrome/browser/chromeos/frame/. | |
23 class PanelBrowserView : public ::BrowserView, | |
24 public PanelController::Delegate { | |
25 public: | |
26 explicit PanelBrowserView(Browser* browser); | |
27 virtual ~PanelBrowserView(); | |
28 | |
29 // BrowserView overrides. | |
30 virtual void Show() OVERRIDE; | |
31 virtual void ShowInactive() OVERRIDE; | |
32 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | |
33 virtual void Close() OVERRIDE; | |
34 virtual void FlashFrame(bool flash) OVERRIDE; | |
35 virtual void UpdateTitleBar() OVERRIDE; | |
36 virtual bool IsPanel() const OVERRIDE; | |
37 virtual WindowOpenDisposition GetDispositionForPopupBounds( | |
38 const gfx::Rect& bounds) OVERRIDE; | |
39 virtual bool GetSavedWindowPlacement( | |
40 gfx::Rect* bounds, | |
41 ui::WindowShowState* show_state) const OVERRIDE; | |
42 | |
43 // views::Widget::Observer overrides. | |
44 virtual void OnWidgetActivationChanged(views::Widget* widget, | |
45 bool active) OVERRIDE; | |
46 | |
47 // BrowserView : TabStripModelObserver overrides. | |
48 virtual void TabChangedAt(TabContentsWrapper* contents, | |
49 int index, | |
50 TabChangeType change_type) OVERRIDE; | |
51 | |
52 // PanelController::Delegate overrides. | |
53 virtual string16 GetPanelTitle() OVERRIDE; | |
54 virtual SkBitmap GetPanelIcon() OVERRIDE; | |
55 virtual bool CanClosePanel() OVERRIDE; | |
56 virtual void ClosePanel() OVERRIDE; | |
57 virtual void ActivatePanel() OVERRIDE; | |
58 | |
59 // Specific to PanelBrowserView. | |
60 void SetCreatorView(PanelBrowserView* creator); | |
61 | |
62 private: | |
63 // Enforces the min, max, and default bounds. | |
64 void LimitBounds(gfx::Rect* bounds) const; | |
65 | |
66 void InitPanelController(bool is_active); | |
67 | |
68 // Controls interactions with the window manager for popup panels. | |
69 scoped_ptr<chromeos::PanelController> panel_controller_; | |
70 | |
71 // X id for the content window of the panel that created this | |
72 // panel. This tells ChromeOS that it should be created next to the | |
73 // content window of this panel. | |
74 XID creator_xid_; | |
75 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); | |
76 }; | |
77 | |
78 } // namespace chromeos | |
79 | |
80 #endif // CHROME_BROWSER_CHROMEOS_FRAME_PANEL_BROWSER_VIEW_H_ | |
OLD | NEW |