| 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 #include "chrome/browser/ui/panels/panel_cocoa.h" | 5 #include "chrome/browser/ui/panels/panel_cocoa.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 8 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
| 9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
| 10 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" | 10 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 PanelCocoa::~PanelCocoa() { | 44 PanelCocoa::~PanelCocoa() { |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool PanelCocoa::isClosed() { | 47 bool PanelCocoa::isClosed() { |
| 48 return !controller_; | 48 return !controller_; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void PanelCocoa::ShowPanel() { | 51 void PanelCocoa::ShowPanel() { |
| 52 ShowPanelInactive(); | 52 ShowPanelInactive(); |
| 53 ActivatePanel(); | 53 ActivatePanel(); |
| 54 |
| 55 // |-makeKeyAndOrderFront:| won't send |-windowDidBecomeKey:| until we |
| 56 // return to the runloop. This causes extension tests that wait for the |
| 57 // active status change notification to fail, so we send an active status |
| 58 // notification here. |
| 59 panel_->OnActiveStateChanged(true); |
| 54 } | 60 } |
| 55 | 61 |
| 56 void PanelCocoa::ShowPanelInactive() { | 62 void PanelCocoa::ShowPanelInactive() { |
| 57 if (isClosed()) | 63 if (isClosed()) |
| 58 return; | 64 return; |
| 59 | 65 |
| 60 // This method may be called several times, meaning 'ensure it's shown'. | 66 // This method may be called several times, meaning 'ensure it's shown'. |
| 61 // Animations don't look good when repeated - hence this flag is needed. | 67 // Animations don't look good when repeated - hence this flag is needed. |
| 62 if (is_shown_) { | 68 if (is_shown_) { |
| 63 return; | 69 return; |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 return ![[titlebar() closeButton] isHidden]; | 385 return ![[titlebar() closeButton] isHidden]; |
| 380 case panel::MINIMIZE_BUTTON: | 386 case panel::MINIMIZE_BUTTON: |
| 381 return ![[titlebar() minimizeButton] isHidden]; | 387 return ![[titlebar() minimizeButton] isHidden]; |
| 382 case panel::RESTORE_BUTTON: | 388 case panel::RESTORE_BUTTON: |
| 383 return ![[titlebar() restoreButton] isHidden]; | 389 return ![[titlebar() restoreButton] isHidden]; |
| 384 default: | 390 default: |
| 385 NOTREACHED(); | 391 NOTREACHED(); |
| 386 } | 392 } |
| 387 return false; | 393 return false; |
| 388 } | 394 } |
| OLD | NEW |