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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 457 |
458 gfx::Rect NativeAppWindowCocoa::GetBounds() const { | 458 gfx::Rect NativeAppWindowCocoa::GetBounds() const { |
459 // Flip coordinates based on the primary screen. | 459 // Flip coordinates based on the primary screen. |
460 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 460 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
461 NSRect frame = [window() frame]; | 461 NSRect frame = [window() frame]; |
462 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); | 462 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); |
463 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); | 463 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); |
464 return bounds; | 464 return bounds; |
465 } | 465 } |
466 | 466 |
467 void NativeAppWindowCocoa::Show() { | 467 void NativeAppWindowCocoa::Show(bool user_gesture) { |
468 if (is_hidden_with_app_) { | 468 if (is_hidden_with_app_) { |
469 // If there is a shim to gently request attention, return here. Otherwise | 469 // If there is a shim to gently request attention, return here. Otherwise |
470 // show the window as usual. | 470 // show the window as usual. |
471 if (apps::ExtensionAppShimHandler::ActivateAndRequestUserAttentionForWindow( | 471 if (apps::ExtensionAppShimHandler::ActivateAndRequestUserAttentionForWindow( |
472 app_window_)) { | 472 app_window_)) { |
473 return; | 473 return; |
474 } | 474 } |
475 } | 475 } |
476 | 476 |
477 [window_controller_ showWindow:nil]; | 477 [window_controller_ showWindow:nil]; |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 } | 866 } |
867 | 867 |
868 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 868 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
869 if (IsRestored(*this)) | 869 if (IsRestored(*this)) |
870 restored_bounds_ = [window() frame]; | 870 restored_bounds_ = [window() frame]; |
871 } | 871 } |
872 | 872 |
873 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { | 873 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { |
874 [window() orderOut:window_controller_]; | 874 [window() orderOut:window_controller_]; |
875 } | 875 } |
OLD | NEW |