| 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 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 10 #include "chrome/browser/ui/panels/panel.h" | 11 #include "chrome/browser/ui/panels/panel.h" |
| 11 #include "chrome/browser/ui/panels/panel_manager.h" | 12 #include "chrome/browser/ui/panels/panel_manager.h" |
| 12 #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h" | 13 #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h" |
| 13 #include "content/common/native_web_keyboard_event.h" | 14 #include "content/common/native_web_keyboard_event.h" |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 // Use this instead of 0 for minimum size of a window when doing opening and | 18 // Use this instead of 0 for minimum size of a window when doing opening and |
| 18 // closing animations, since OSX window manager does not like 0-sized windows | 19 // closing animations, since OSX window manager does not like 0-sized windows |
| 19 // (according to avi@). | 20 // (according to avi@). |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 NOTIMPLEMENTED(); | 150 NOTIMPLEMENTED(); |
| 150 } | 151 } |
| 151 | 152 |
| 152 bool PanelBrowserWindowCocoa::IsDrawingAttention() const { | 153 bool PanelBrowserWindowCocoa::IsDrawingAttention() const { |
| 153 NOTIMPLEMENTED(); | 154 NOTIMPLEMENTED(); |
| 154 return false; | 155 return false; |
| 155 } | 156 } |
| 156 | 157 |
| 157 bool PanelBrowserWindowCocoa::PreHandlePanelKeyboardEvent( | 158 bool PanelBrowserWindowCocoa::PreHandlePanelKeyboardEvent( |
| 158 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { | 159 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { |
| 159 NOTIMPLEMENTED(); | 160 if (![BrowserWindowUtils shouldHandleKeyboardEvent:event]) |
| 161 return false; |
| 162 |
| 163 int id = [BrowserWindowUtils getCommandId:event]; |
| 164 if (id == -1) |
| 165 return false; |
| 166 |
| 167 if (browser()->IsReservedCommandOrKey(id, event)) { |
| 168 return [BrowserWindowUtils handleKeyboardEvent:event.os_event |
| 169 inWindow:GetNativePanelHandle()]; |
| 170 } |
| 171 |
| 172 DCHECK(is_keyboard_shortcut); |
| 173 *is_keyboard_shortcut = true; |
| 160 return false; | 174 return false; |
| 161 } | 175 } |
| 162 | 176 |
| 163 void PanelBrowserWindowCocoa::HandlePanelKeyboardEvent( | 177 void PanelBrowserWindowCocoa::HandlePanelKeyboardEvent( |
| 164 const NativeWebKeyboardEvent& event) { | 178 const NativeWebKeyboardEvent& event) { |
| 165 NOTIMPLEMENTED(); | 179 if ([BrowserWindowUtils shouldHandleKeyboardEvent:event]) { |
| 180 [BrowserWindowUtils handleKeyboardEvent:event.os_event |
| 181 inWindow:GetNativePanelHandle()]; |
| 182 } |
| 166 } | 183 } |
| 167 | 184 |
| 168 Browser* PanelBrowserWindowCocoa::GetPanelBrowser() const { | 185 Browser* PanelBrowserWindowCocoa::GetPanelBrowser() const { |
| 169 return browser(); | 186 return browser(); |
| 170 } | 187 } |
| 171 | 188 |
| 172 void PanelBrowserWindowCocoa::DestroyPanelBrowser() { | 189 void PanelBrowserWindowCocoa::DestroyPanelBrowser() { |
| 173 [controller_ close]; | 190 [controller_ close]; |
| 174 } | 191 } |
| 175 | 192 |
| 176 void PanelBrowserWindowCocoa::didCloseNativeWindow() { | 193 void PanelBrowserWindowCocoa::didCloseNativeWindow() { |
| 177 DCHECK(!isClosed()); | 194 DCHECK(!isClosed()); |
| 178 panel_->manager()->Remove(panel_.get()); | 195 panel_->manager()->Remove(panel_.get()); |
| 179 controller_ = NULL; | 196 controller_ = NULL; |
| 180 } | 197 } |
| 181 // NativePanelTesting implementation. | 198 // NativePanelTesting implementation. |
| 182 | 199 |
| 183 // static | 200 // static |
| 184 NativePanelTesting* NativePanelTesting::Create(NativePanel* native_panel) { | 201 NativePanelTesting* NativePanelTesting::Create(NativePanel* native_panel) { |
| 185 NOTIMPLEMENTED(); | 202 NOTIMPLEMENTED(); |
| 186 return NULL; | 203 return NULL; |
| 187 } | 204 } |
| OLD | NEW |