Home | History | Annotate | Download | only in win
      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 UI_VIEWS_WIN_FULLSCREEN_HANDLER_H_
      6 #define UI_VIEWS_WIN_FULLSCREEN_HANDLER_H_
      7 
      8 #include <windows.h>
      9 
     10 #include <map>
     11 
     12 #include "base/basictypes.h"
     13 
     14 namespace gfx {
     15 class Rect;
     16 }
     17 
     18 namespace views {
     19 
     20 class FullscreenHandler {
     21  public:
     22   FullscreenHandler();
     23   ~FullscreenHandler();
     24 
     25   void set_hwnd(HWND hwnd) { hwnd_ = hwnd; }
     26 
     27   void SetFullscreen(bool fullscreen);
     28   void SetMetroSnap(bool metro_snap);
     29 
     30   gfx::Rect GetRestoreBounds() const;
     31 
     32   bool fullscreen() const { return fullscreen_; }
     33   bool metro_snap() const { return metro_snap_; }
     34 
     35  private:
     36   // Information saved before going into fullscreen mode, used to restore the
     37   // window afterwards.
     38   struct SavedWindowInfo {
     39     bool maximized;
     40     LONG style;
     41     LONG ex_style;
     42     RECT window_rect;
     43   };
     44 
     45   void SetFullscreenImpl(bool fullscreen, bool for_metro);
     46 
     47   HWND hwnd_;
     48   bool fullscreen_;
     49   bool metro_snap_;
     50 
     51   // Saved window information from before entering fullscreen mode.
     52   // TODO(beng): move to private once GetRestoredBounds() moves onto Widget.
     53   SavedWindowInfo saved_window_info_;
     54 
     55   DISALLOW_COPY_AND_ASSIGN(FullscreenHandler);
     56 };
     57 
     58 }  // namespace views
     59 
     60 #endif  // UI_VIEWS_WIN_FULLSCREEN_HANDLER_H_