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