| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_browser_window_cocoa.h" | 5 #include "chrome/browser/ui/panels/panel_browser_window_cocoa.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" | 9 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
| 10 #include "chrome/browser/ui/panels/panel.h" | 10 #include "chrome/browser/ui/panels/panel.h" |
| 11 #include "chrome/browser/ui/panels/panel_manager.h" |
| 11 #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h" | 12 #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h" |
| 12 #include "content/common/native_web_keyboard_event.h" | 13 #include "content/common/native_web_keyboard_event.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // Use this instead of 0 for minimum size of a window when doing opening and | 17 // Use this instead of 0 for minimum size of a window when doing opening and |
| 17 // closing animations, since OSX window manager does not like 0-sized windows | 18 // closing animations, since OSX window manager does not like 0-sized windows |
| 18 // (according to avi@). | 19 // (according to avi@). |
| 19 const int kMinimumWindowSize = 1; | 20 const int kMinimumWindowSize = 1; |
| 20 | 21 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 int mouse_y) const { | 97 int mouse_y) const { |
| 97 NOTIMPLEMENTED(); | 98 NOTIMPLEMENTED(); |
| 98 return false; | 99 return false; |
| 99 } | 100 } |
| 100 | 101 |
| 101 void PanelBrowserWindowCocoa::ClosePanel() { | 102 void PanelBrowserWindowCocoa::ClosePanel() { |
| 102 if (isClosed()) | 103 if (isClosed()) |
| 103 return; | 104 return; |
| 104 | 105 |
| 105 NSWindow* window = [controller_ window]; | 106 NSWindow* window = [controller_ window]; |
| 106 NSRect frame = [window frame]; | 107 [window performClose:controller_]; |
| 107 frame.size.height = kMinimumWindowSize; | |
| 108 // TODO(dimich): make this async. Currently, multiple panels will serially | |
| 109 // (and annoyingly) close when user exits Chrome. | |
| 110 [window setFrame:frame display:YES animate:YES]; | |
| 111 browser_->OnWindowClosing(); | |
| 112 DestroyPanelBrowser(); // not immediately, though. | |
| 113 } | 108 } |
| 114 | 109 |
| 115 void PanelBrowserWindowCocoa::ActivatePanel() { | 110 void PanelBrowserWindowCocoa::ActivatePanel() { |
| 116 NOTIMPLEMENTED(); | 111 NOTIMPLEMENTED(); |
| 117 } | 112 } |
| 118 | 113 |
| 119 void PanelBrowserWindowCocoa::DeactivatePanel() { | 114 void PanelBrowserWindowCocoa::DeactivatePanel() { |
| 120 NOTIMPLEMENTED(); | 115 NOTIMPLEMENTED(); |
| 121 } | 116 } |
| 122 | 117 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 const NativeWebKeyboardEvent& event) { | 164 const NativeWebKeyboardEvent& event) { |
| 170 NOTIMPLEMENTED(); | 165 NOTIMPLEMENTED(); |
| 171 } | 166 } |
| 172 | 167 |
| 173 Browser* PanelBrowserWindowCocoa::GetPanelBrowser() const { | 168 Browser* PanelBrowserWindowCocoa::GetPanelBrowser() const { |
| 174 return browser(); | 169 return browser(); |
| 175 } | 170 } |
| 176 | 171 |
| 177 void PanelBrowserWindowCocoa::DestroyPanelBrowser() { | 172 void PanelBrowserWindowCocoa::DestroyPanelBrowser() { |
| 178 [controller_ close]; | 173 [controller_ close]; |
| 174 } |
| 175 |
| 176 void PanelBrowserWindowCocoa::didCloseNativeWindow() { |
| 177 DCHECK(!isClosed()); |
| 178 panel_->manager()->Remove(panel_.get()); |
| 179 controller_ = NULL; | 179 controller_ = NULL; |
| 180 } | 180 } |
| 181 | |
| 182 // NativePanelTesting implementation. | 181 // NativePanelTesting implementation. |
| 183 | 182 |
| 184 // static | 183 // static |
| 185 NativePanelTesting* NativePanelTesting::Create(NativePanel* native_panel) { | 184 NativePanelTesting* NativePanelTesting::Create(NativePanel* native_panel) { |
| 186 NOTIMPLEMENTED(); | 185 NOTIMPLEMENTED(); |
| 187 return NULL; | 186 return NULL; |
| 188 } | 187 } |
| OLD | NEW |