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 | 9 |
9 ChromeNativeAppWindowViewsMac::ChromeNativeAppWindowViewsMac() | 10 ChromeNativeAppWindowViewsMac::ChromeNativeAppWindowViewsMac() |
10 : is_hidden_with_app_(false) { | 11 : is_hidden_with_app_(false) { |
11 } | 12 } |
12 | 13 |
13 ChromeNativeAppWindowViewsMac::~ChromeNativeAppWindowViewsMac() { | 14 ChromeNativeAppWindowViewsMac::~ChromeNativeAppWindowViewsMac() { |
14 } | 15 } |
15 | 16 |
| 17 void ChromeNativeAppWindowViewsMac::OnBeforeWidgetInit( |
| 18 const extensions::AppWindow::CreateParams& create_params, |
| 19 views::Widget::InitParams* init_params, |
| 20 views::Widget* widget) { |
| 21 DCHECK(!init_params->native_widget); |
| 22 init_params->native_widget = new AppWindowNativeWidgetMac(widget); |
| 23 ChromeNativeAppWindowViews::OnBeforeWidgetInit(create_params, init_params, |
| 24 widget); |
| 25 } |
| 26 |
16 void ChromeNativeAppWindowViewsMac::Show() { | 27 void ChromeNativeAppWindowViewsMac::Show() { |
17 if (is_hidden_with_app_) { | 28 if (is_hidden_with_app_) { |
18 // 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 |
19 // show the window as usual. | 30 // show the window as usual. |
20 if (apps::ExtensionAppShimHandler::ActivateAndRequestUserAttentionForWindow( | 31 if (apps::ExtensionAppShimHandler::ActivateAndRequestUserAttentionForWindow( |
21 app_window())) { | 32 app_window())) { |
22 return; | 33 return; |
23 } | 34 } |
24 } | 35 } |
25 | 36 |
(...skipping 10 matching lines...) Expand all Loading... |
36 void ChromeNativeAppWindowViewsMac::ShowWithApp() { | 47 void ChromeNativeAppWindowViewsMac::ShowWithApp() { |
37 is_hidden_with_app_ = false; | 48 is_hidden_with_app_ = false; |
38 if (!app_window()->is_hidden()) | 49 if (!app_window()->is_hidden()) |
39 ShowInactive(); | 50 ShowInactive(); |
40 } | 51 } |
41 | 52 |
42 void ChromeNativeAppWindowViewsMac::HideWithApp() { | 53 void ChromeNativeAppWindowViewsMac::HideWithApp() { |
43 is_hidden_with_app_ = true; | 54 is_hidden_with_app_ = true; |
44 ChromeNativeAppWindowViews::Hide(); | 55 ChromeNativeAppWindowViews::Hide(); |
45 } | 56 } |
OLD | NEW |