OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
6 | 6 |
7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 TabRestoreService* service = [self defaultProfile]->GetTabRestoreService(); | 573 TabRestoreService* service = [self defaultProfile]->GetTabRestoreService(); |
574 return service && !service->entries().empty(); | 574 return service && !service->entries().empty(); |
575 } | 575 } |
576 | 576 |
577 // Returns true if there is not a modal window (either window- or application- | 577 // Returns true if there is not a modal window (either window- or application- |
578 // modal) blocking the active browser. Note that tab modal dialogs (HTTP auth | 578 // modal) blocking the active browser. Note that tab modal dialogs (HTTP auth |
579 // sheets) will not count as blocking the browser. But things like open/save | 579 // sheets) will not count as blocking the browser. But things like open/save |
580 // dialogs that are window modal will block the browser. | 580 // dialogs that are window modal will block the browser. |
581 - (BOOL)keyWindowIsNotModal { | 581 - (BOOL)keyWindowIsNotModal { |
582 Browser* browser = BrowserList::GetLastActive(); | 582 Browser* browser = BrowserList::GetLastActive(); |
583 return [NSApp modalWindow] == nil && (browser && | 583 return [NSApp modalWindow] == nil && (!browser || |
584 ![[browser->window()->GetNativeHandle() attachedSheet] | 584 ![[browser->window()->GetNativeHandle() attachedSheet] |
585 isKindOfClass:[NSWindow class]]); | 585 isKindOfClass:[NSWindow class]]); |
586 } | 586 } |
587 | 587 |
588 // Called to validate menu items when there are no key windows. All the | 588 // Called to validate menu items when there are no key windows. All the |
589 // items we care about have been set with the |commandDispatch:| action and | 589 // items we care about have been set with the |commandDispatch:| action and |
590 // a target of FirstResponder in IB. If it's not one of those, let it | 590 // a target of FirstResponder in IB. If it's not one of those, let it |
591 // continue up the responder chain to be handled elsewhere. We pull out the | 591 // continue up the responder chain to be handled elsewhere. We pull out the |
592 // tag as the cross-platform constant to differentiate and dispatch the | 592 // tag as the cross-platform constant to differentiate and dispatch the |
593 // various commands. | 593 // various commands. |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 [appController showPreferencesWindow:nil page:page profile:profile]; | 1030 [appController showPreferencesWindow:nil page:page profile:profile]; |
1031 } | 1031 } |
1032 | 1032 |
1033 namespace app_controller_mac { | 1033 namespace app_controller_mac { |
1034 | 1034 |
1035 bool IsOpeningNewWindow() { | 1035 bool IsOpeningNewWindow() { |
1036 return g_is_opening_new_window; | 1036 return g_is_opening_new_window; |
1037 } | 1037 } |
1038 | 1038 |
1039 } // namespace app_controller_mac | 1039 } // namespace app_controller_mac |
OLD | NEW |