OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.h" | 5 #import "chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.h" |
6 | 6 |
7 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" | 7 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" |
8 #include "chrome/browser/ui/views/apps/app_window_native_widget_mac.h" | 8 #include "chrome/browser/ui/views/apps/app_window_native_widget_mac.h" |
9 #include "chrome/browser/ui/views/apps/native_app_window_frame_view_mac.h" | |
10 | 9 |
11 ChromeNativeAppWindowViewsMac::ChromeNativeAppWindowViewsMac() | 10 ChromeNativeAppWindowViewsMac::ChromeNativeAppWindowViewsMac() |
12 : is_hidden_with_app_(false) { | 11 : is_hidden_with_app_(false) { |
13 } | 12 } |
14 | 13 |
15 ChromeNativeAppWindowViewsMac::~ChromeNativeAppWindowViewsMac() { | 14 ChromeNativeAppWindowViewsMac::~ChromeNativeAppWindowViewsMac() { |
16 } | 15 } |
17 | 16 |
18 void ChromeNativeAppWindowViewsMac::OnBeforeWidgetInit( | 17 void ChromeNativeAppWindowViewsMac::OnBeforeWidgetInit( |
19 const extensions::AppWindow::CreateParams& create_params, | 18 const extensions::AppWindow::CreateParams& create_params, |
20 views::Widget::InitParams* init_params, | 19 views::Widget::InitParams* init_params, |
21 views::Widget* widget) { | 20 views::Widget* widget) { |
22 DCHECK(!init_params->native_widget); | 21 DCHECK(!init_params->native_widget); |
23 init_params->native_widget = new AppWindowNativeWidgetMac(widget); | 22 init_params->native_widget = new AppWindowNativeWidgetMac(widget); |
24 ChromeNativeAppWindowViews::OnBeforeWidgetInit(create_params, init_params, | 23 ChromeNativeAppWindowViews::OnBeforeWidgetInit(create_params, init_params, |
25 widget); | 24 widget); |
26 } | 25 } |
27 | 26 |
28 views::NonClientFrameView* | |
29 ChromeNativeAppWindowViewsMac::CreateStandardDesktopAppFrame() { | |
30 return new NativeAppWindowFrameViewMac(widget()); | |
31 } | |
32 | |
33 void ChromeNativeAppWindowViewsMac::Show() { | 27 void ChromeNativeAppWindowViewsMac::Show() { |
34 if (is_hidden_with_app_) { | 28 if (is_hidden_with_app_) { |
35 // If there is a shim to gently request attention, return here. Otherwise | 29 // If there is a shim to gently request attention, return here. Otherwise |
36 // show the window as usual. | 30 // show the window as usual. |
37 if (apps::ExtensionAppShimHandler::ActivateAndRequestUserAttentionForWindow( | 31 if (apps::ExtensionAppShimHandler::ActivateAndRequestUserAttentionForWindow( |
38 app_window())) { | 32 app_window())) { |
39 return; | 33 return; |
40 } | 34 } |
41 } | 35 } |
42 | 36 |
(...skipping 10 matching lines...) Expand all Loading... |
53 void ChromeNativeAppWindowViewsMac::ShowWithApp() { | 47 void ChromeNativeAppWindowViewsMac::ShowWithApp() { |
54 is_hidden_with_app_ = false; | 48 is_hidden_with_app_ = false; |
55 if (!app_window()->is_hidden()) | 49 if (!app_window()->is_hidden()) |
56 ShowInactive(); | 50 ShowInactive(); |
57 } | 51 } |
58 | 52 |
59 void ChromeNativeAppWindowViewsMac::HideWithApp() { | 53 void ChromeNativeAppWindowViewsMac::HideWithApp() { |
60 is_hidden_with_app_ = true; | 54 is_hidden_with_app_ = true; |
61 ChromeNativeAppWindowViews::Hide(); | 55 ChromeNativeAppWindowViews::Hide(); |
62 } | 56 } |
OLD | NEW |