browser_frame_win.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_WIN_H_ 6#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_WIN_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_win.h" 12 13class AeroGlassNonClientView; 14class BrowserNonClientFrameView; 15class BrowserRootView; 16class BrowserView; 17class NonClientFrameView; 18class Profile; 19 20/////////////////////////////////////////////////////////////////////////////// 21// BrowserFrameWin 22// 23// BrowserFrame is a WindowWin subclass that provides the window frame for the 24// Chrome browser window. 25// 26class BrowserFrameWin : public BrowserFrame, public views::WindowWin { 27 public: 28 // Normally you will create this class by calling BrowserFrame::Create. 29 // Init must be called before using this class, which Create will do for you. 30 BrowserFrameWin(BrowserView* browser_view, Profile* profile); 31 virtual ~BrowserFrameWin(); 32 33 // This initialization function must be called after construction, it is 34 // separate to avoid recursive calling of the frame from its constructor. 35 void InitBrowserFrame(); 36 37 BrowserView* browser_view() const { return browser_view_; } 38 39 // BrowserFrame implementation. 40 virtual views::Window* GetWindow(); 41 virtual int GetMinimizeButtonOffset() const; 42 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const; 43 virtual int GetHorizontalTabStripVerticalOffset(bool restored) const; 44 virtual void UpdateThrobber(bool running); 45 virtual ui::ThemeProvider* GetThemeProviderForFrame() const; 46 virtual bool AlwaysUseNativeFrame() const; 47 virtual views::View* GetFrameView() const; 48 virtual void TabStripDisplayModeChanged(); 49 50 protected: 51 // Overridden from views::WindowWin: 52 virtual gfx::Insets GetClientAreaInsets() const; 53 virtual bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); 54 virtual void OnEndSession(BOOL ending, UINT logoff); 55 virtual void OnEnterSizeMove(); 56 virtual void OnExitSizeMove(); 57 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); 58 virtual LRESULT OnMouseActivate(HWND window, 59 UINT hittest_code, 60 UINT message); 61 virtual void OnMove(const CPoint& point); 62 virtual void OnMoving(UINT param, LPRECT new_bounds); 63 virtual LRESULT OnNCActivate(BOOL active); 64 virtual LRESULT OnNCHitTest(const CPoint& pt); 65 virtual void OnWindowPosChanged(WINDOWPOS* window_pos); 66 virtual ui::ThemeProvider* GetThemeProvider() const; 67 virtual void OnScreenReaderDetected(); 68 69 // Overridden from views::Window: 70 virtual int GetShowState() const; 71 virtual void Activate(); 72 virtual bool IsAppWindow() const { return true; } 73 virtual views::NonClientFrameView* CreateFrameViewForWindow(); 74 virtual void UpdateFrameAfterFrameChange(); 75 virtual views::RootView* CreateRootView(); 76 77 private: 78 // Updates the DWM with the frame bounds. 79 void UpdateDWMFrame(); 80 81 // The BrowserView is our ClientView. This is a pointer to it. 82 BrowserView* browser_view_; 83 84 // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. 85 BrowserNonClientFrameView* browser_frame_view_; 86 87 // An unowning reference to the root view associated with the window. We save 88 // a copy as a BrowserRootView to avoid evil casting later, when we need to 89 // call functions that only exist on BrowserRootView (versus RootView). 90 BrowserRootView* root_view_; 91 92 bool frame_initialized_; 93 94 Profile* profile_; 95 96 DISALLOW_COPY_AND_ASSIGN(BrowserFrameWin); 97}; 98 99#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_WIN_H_ 100