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