OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" |
6 | 6 |
7 #include "apps/app_shim/extension_app_shim_handler_mac.h" | 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
563 NSRect frame = [window() frame]; | 563 NSRect frame = [window() frame]; |
564 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); | 564 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); |
565 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); | 565 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); |
566 return bounds; | 566 return bounds; |
567 } | 567 } |
568 | 568 |
569 void NativeAppWindowCocoa::Show() { | 569 void NativeAppWindowCocoa::Show() { |
570 if (is_hidden_with_app_) { | 570 if (is_hidden_with_app_) { |
571 // If there is a shim to gently request attention, return here. Otherwise | 571 // If there is a shim to gently request attention, return here. Otherwise |
572 // show the window as usual. | 572 // show the window as usual. |
573 if (apps::ExtensionAppShimHandler::RequestUserAttentionForWindow( | 573 if (apps::ExtensionAppShimHandler::ActivateAndRequestUserAttentionForWindow( |
574 app_window_)) { | 574 app_window_)) { |
575 return; | 575 return; |
576 } | 576 } |
577 } | 577 } |
578 | 578 |
579 [window_controller_ showWindow:nil]; | 579 [window_controller_ showWindow:nil]; |
580 Activate(); | 580 Activate(); |
581 } | 581 } |
582 | 582 |
583 void NativeAppWindowCocoa::ShowInactive() { | 583 void NativeAppWindowCocoa::ShowInactive() { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
722 [[ControlRegionView alloc] initWithFrame:NSZeroRect]); | 722 [[ControlRegionView alloc] initWithFrame:NSZeroRect]); |
723 [controlRegion setFrame:NSMakeRect(iter->x(), | 723 [controlRegion setFrame:NSMakeRect(iter->x(), |
724 webViewHeight - iter->bottom(), | 724 webViewHeight - iter->bottom(), |
725 iter->width(), | 725 iter->width(), |
726 iter->height())]; | 726 iter->height())]; |
727 [webView addSubview:controlRegion]; | 727 [webView addSubview:controlRegion]; |
728 } | 728 } |
729 } | 729 } |
730 | 730 |
731 void NativeAppWindowCocoa::FlashFrame(bool flash) { | 731 void NativeAppWindowCocoa::FlashFrame(bool flash) { |
732 if (flash) { | 732 apps::ExtensionAppShimHandler::RequestUserAttentionForWindow( |
733 attention_request_id_ = [NSApp requestUserAttention:NSInformationalRequest]; | 733 app_window_, |
734 } else { | 734 flash ? apps::APP_SHIM_ATTENTION_CRITICAL |
735 [NSApp cancelUserAttentionRequest:attention_request_id_]; | 735 : apps::APP_SHIM_ATTENTION_CANCEL); |
736 attention_request_id_ = 0; | |
737 } | |
738 } | 736 } |
tapted
2014/08/13 03:37:08
is NativeAppWindowCocoa::attention_request_id_ unu
jackhou1
2014/08/13 05:53:46
Removed.
I don't think we need to do anything in
| |
739 | 737 |
740 bool NativeAppWindowCocoa::IsAlwaysOnTop() const { | 738 bool NativeAppWindowCocoa::IsAlwaysOnTop() const { |
741 return [window() level] == AlwaysOnTopWindowLevel(); | 739 return [window() level] == AlwaysOnTopWindowLevel(); |
742 } | 740 } |
743 | 741 |
744 void NativeAppWindowCocoa::RenderViewCreated(content::RenderViewHost* rvh) { | 742 void NativeAppWindowCocoa::RenderViewCreated(content::RenderViewHost* rvh) { |
745 if (IsActive()) | 743 if (IsActive()) |
746 WebContents()->RestoreFocus(); | 744 WebContents()->RestoreFocus(); |
747 } | 745 } |
748 | 746 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
989 } | 987 } |
990 | 988 |
991 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 989 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
992 if (IsRestored(*this)) | 990 if (IsRestored(*this)) |
993 restored_bounds_ = [window() frame]; | 991 restored_bounds_ = [window() frame]; |
994 } | 992 } |
995 | 993 |
996 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { | 994 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { |
997 [window() orderOut:window_controller_]; | 995 [window() orderOut:window_controller_]; |
998 } | 996 } |
OLD | NEW |