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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 // this occurring, throttle activation requests. To balance a possible Hide(), | 490 // this occurring, throttle activation requests. To balance a possible Hide(), |
491 // always show the window, but don't make it key. | 491 // always show the window, but don't make it key. |
492 base::Time now = base::Time::Now(); | 492 base::Time now = base::Time::Now(); |
493 if (now - last_activate_ < | 493 if (now - last_activate_ < |
494 base::TimeDelta::FromSeconds(kActivateThrottlePeriodSeconds)) { | 494 base::TimeDelta::FromSeconds(kActivateThrottlePeriodSeconds)) { |
495 [window() orderFront:window_controller_]; | 495 [window() orderFront:window_controller_]; |
496 return; | 496 return; |
497 } | 497 } |
498 | 498 |
499 last_activate_ = now; | 499 last_activate_ = now; |
500 [BrowserWindowUtils activateWindowForController:window_controller_]; | 500 |
| 501 [window() makeKeyAndOrderFront:nil]; |
| 502 [NSApp activateIgnoringOtherApps:YES]; |
501 } | 503 } |
502 | 504 |
503 void NativeAppWindowCocoa::ShowInactive() { | 505 void NativeAppWindowCocoa::ShowInactive() { |
504 [window() orderFront:window_controller_]; | 506 [window() orderFront:window_controller_]; |
505 } | 507 } |
506 | 508 |
507 void NativeAppWindowCocoa::Hide() { | 509 void NativeAppWindowCocoa::Hide() { |
508 HideWithoutMarkingHidden(); | 510 HideWithoutMarkingHidden(); |
509 } | 511 } |
510 | 512 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 } | 892 } |
891 | 893 |
892 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 894 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
893 if (IsRestored(*this)) | 895 if (IsRestored(*this)) |
894 restored_bounds_ = [window() frame]; | 896 restored_bounds_ = [window() frame]; |
895 } | 897 } |
896 | 898 |
897 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { | 899 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { |
898 [window() orderOut:window_controller_]; | 900 [window() orderOut:window_controller_]; |
899 } | 901 } |
OLD | NEW |