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