| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 return service && !service->entries().empty(); | 711 return service && !service->entries().empty(); |
| 712 } | 712 } |
| 713 | 713 |
| 714 // Returns true if there is not a modal window (either window- or application- | 714 // Returns true if there is not a modal window (either window- or application- |
| 715 // modal) blocking the active browser. Note that tab modal dialogs (HTTP auth | 715 // modal) blocking the active browser. Note that tab modal dialogs (HTTP auth |
| 716 // sheets) will not count as blocking the browser. But things like open/save | 716 // sheets) will not count as blocking the browser. But things like open/save |
| 717 // dialogs that are window modal will block the browser. | 717 // dialogs that are window modal will block the browser. |
| 718 - (BOOL)keyWindowIsNotModal { | 718 - (BOOL)keyWindowIsNotModal { |
| 719 Browser* browser = browser::GetLastActiveBrowser(); | 719 Browser* browser = browser::GetLastActiveBrowser(); |
| 720 return [NSApp modalWindow] == nil && (!browser || | 720 return [NSApp modalWindow] == nil && (!browser || |
| 721 ![[browser->window()->GetNativeHandle() attachedSheet] | 721 ![[browser->window()->GetNativeWindow() attachedSheet] |
| 722 isKindOfClass:[NSWindow class]]); | 722 isKindOfClass:[NSWindow class]]); |
| 723 } | 723 } |
| 724 | 724 |
| 725 // Called to validate menu items when there are no key windows. All the | 725 // Called to validate menu items when there are no key windows. All the |
| 726 // items we care about have been set with the |commandDispatch:| action and | 726 // items we care about have been set with the |commandDispatch:| action and |
| 727 // a target of FirstResponder in IB. If it's not one of those, let it | 727 // a target of FirstResponder in IB. If it's not one of those, let it |
| 728 // continue up the responder chain to be handled elsewhere. We pull out the | 728 // continue up the responder chain to be handled elsewhere. We pull out the |
| 729 // tag as the cross-platform constant to differentiate and dispatch the | 729 // tag as the cross-platform constant to differentiate and dispatch the |
| 730 // various commands. | 730 // various commands. |
| 731 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { | 731 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 | 1318 |
| 1319 } // namespace browser | 1319 } // namespace browser |
| 1320 | 1320 |
| 1321 namespace app_controller_mac { | 1321 namespace app_controller_mac { |
| 1322 | 1322 |
| 1323 bool IsOpeningNewWindow() { | 1323 bool IsOpeningNewWindow() { |
| 1324 return g_is_opening_new_window; | 1324 return g_is_opening_new_window; |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 } // namespace app_controller_mac | 1327 } // namespace app_controller_mac |
| OLD | NEW |