browser_frame_gtk.h revision dc0f95d653279beabeb9817299e2902918ba123e
1// Copyright (c) 2011 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_BROWSER_FRAME_GTK_H_ 6#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_GTK_H_ 7#pragma once 8 9#include "base/basictypes.h" 10#include "chrome/browser/ui/views/frame/browser_frame.h" 11#include "views/window/window_gtk.h" 12 13class BrowserNonClientFrameView; 14class BrowserRootView; 15 16class BrowserFrameGtk : public BrowserFrame, 17 public views::WindowGtk { 18 public: 19 // Normally you will create this class by calling BrowserFrame::Create. 20 // Init must be called before using this class, which Create will do for you. 21 BrowserFrameGtk(BrowserView* browser_view, Profile* profile); 22 virtual ~BrowserFrameGtk(); 23 24 // Creates a frame view and initializes the window. This 25 // initialization function must be called after construction, it is 26 // separate to avoid recursive calling of the frame from its 27 // constructor. 28 virtual void InitBrowserFrame(); 29 30 // Overridden from BrowserFrame: 31 virtual views::Window* GetWindow(); 32 virtual int GetMinimizeButtonOffset() const; 33 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const; 34 virtual int GetHorizontalTabStripVerticalOffset(bool restored) const; 35 virtual void UpdateThrobber(bool running); 36 virtual ui::ThemeProvider* GetThemeProviderForFrame() const; 37 virtual bool AlwaysUseNativeFrame() const; 38 virtual views::View* GetFrameView() const; 39 virtual void TabStripDisplayModeChanged(); 40 41 // Overridden from views::Widget: 42 virtual ui::ThemeProvider* GetThemeProvider() const; 43 virtual void IsActiveChanged(); 44 virtual void SetInitialFocus(); 45 46 protected: 47 void set_browser_frame_view(BrowserNonClientFrameView* browser_frame_view) { 48 browser_frame_view_ = browser_frame_view; 49 } 50 51 // Overridden from views::WidgetGtk: 52 virtual views::RootView* CreateRootView(); 53 virtual bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); 54 55 // Overriden from views::WindowGtk: 56 virtual gboolean OnWindowStateEvent(GtkWidget* widget, 57 GdkEventWindowState* event); 58 virtual gboolean OnConfigureEvent(GtkWidget* widget, 59 GdkEventConfigure* event); 60 61 protected: 62 BrowserView* browser_view() const { 63 return browser_view_; 64 } 65 66 private: 67 // The BrowserView is our ClientView. This is a pointer to it. 68 BrowserView* browser_view_; 69 70 // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. 71 BrowserNonClientFrameView* browser_frame_view_; 72 73 // An unowning reference to the root view associated with the window. We save 74 // a copy as a BrowserRootView to avoid evil casting later, when we need to 75 // call functions that only exist on BrowserRootView (versus RootView). 76 BrowserRootView* root_view_; 77 78 Profile* profile_; 79 80 DISALLOW_COPY_AND_ASSIGN(BrowserFrameGtk); 81}; 82 83#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_GTK_H_ 84