Infobar material design refresh: layout
[chromium-blink-merge.git] / chrome / browser / ui / views / apps / chrome_native_app_window_views_mac.h
blob18b057b3c975f37f14b67645b86dddce2c4d9fd3
1 // Copyright 2015 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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_MAC_H_
6 #define CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_MAC_H_
8 #import <Foundation/Foundation.h>
10 #import "base/mac/scoped_nsobject.h"
11 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h"
13 @class StartResizeNotificationObserver;
15 // Mac-specific parts of ChromeNativeAppWindowViews.
16 class ChromeNativeAppWindowViewsMac : public ChromeNativeAppWindowViews {
17 public:
18 ChromeNativeAppWindowViewsMac();
19 ~ChromeNativeAppWindowViewsMac() override;
21 // Called by |nswindow_observer_| when the window is about to resize.
22 void OnWindowWillStartLiveResize();
24 protected:
25 // ChromeNativeAppWindowViews implementation.
26 void OnBeforeWidgetInit(
27 const extensions::AppWindow::CreateParams& create_params,
28 views::Widget::InitParams* init_params,
29 views::Widget* widget) override;
30 views::NonClientFrameView* CreateStandardDesktopAppFrame() override;
31 views::NonClientFrameView* CreateNonStandardAppFrame() override;
33 // ui::BaseWindow implementation.
34 bool IsMaximized() const override;
35 gfx::Rect GetRestoredBounds() const override;
36 void Show() override;
37 void ShowInactive() override;
38 void Activate() override;
39 void Maximize() override;
40 void Restore() override;
41 void FlashFrame(bool flash) override;
43 // WidgetObserver implementation.
44 void OnWidgetCreated(views::Widget* widget) override;
46 // NativeAppWindow implementation.
47 void UpdateDraggableRegions(
48 const std::vector<extensions::DraggableRegion>& regions) override;
49 // These are used to simulate Mac-style hide/show. Since windows can be hidden
50 // and shown using the app.window API, this sets is_hidden_with_app_ to
51 // differentiate the reason a window was hidden.
52 void ShowWithApp() override;
53 void HideWithApp() override;
55 private:
56 // Unset is_hidden_with_app_ and tell the shim to unhide.
57 void UnhideWithoutActivation();
59 // Used to notify us about certain NSWindow events.
60 base::scoped_nsobject<StartResizeNotificationObserver> nswindow_observer_;
62 // The bounds of the window just before it was last maximized.
63 NSRect bounds_before_maximize_;
65 // Whether this window last became hidden due to a request to hide the entire
66 // app, e.g. via the dock menu or Cmd+H. This is set by Hide/ShowWithApp.
67 bool is_hidden_with_app_;
69 DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViewsMac);
72 #endif // CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_MAC_H_