| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 void PanelCocoa::UpdatePanelTitleBar() { | 149 void PanelCocoa::UpdatePanelTitleBar() { |
| 150 if (!is_shown_) | 150 if (!is_shown_) |
| 151 return; | 151 return; |
| 152 [controller_ updateTitleBar]; | 152 [controller_ updateTitleBar]; |
| 153 } | 153 } |
| 154 | 154 |
| 155 void PanelCocoa::UpdatePanelLoadingAnimations(bool should_animate) { | 155 void PanelCocoa::UpdatePanelLoadingAnimations(bool should_animate) { |
| 156 [controller_ updateThrobber:should_animate]; | 156 [controller_ updateThrobber:should_animate]; |
| 157 } | 157 } |
| 158 | 158 |
| 159 FindBar* PanelCocoa::CreatePanelFindBar() { | |
| 160 NOTREACHED(); // legacy API from browser window. N/A for refactored panels. | |
| 161 return NULL; | |
| 162 } | |
| 163 | |
| 164 void PanelCocoa::NotifyPanelOnUserChangedTheme() { | 159 void PanelCocoa::NotifyPanelOnUserChangedTheme() { |
| 165 NOTIMPLEMENTED(); | 160 NOTIMPLEMENTED(); |
| 166 } | 161 } |
| 167 | 162 |
| 168 void PanelCocoa::PanelCut() { | 163 void PanelCocoa::PanelCut() { |
| 169 // Nothing to do since we do not have panel-specific system menu on Mac. | 164 // Nothing to do since we do not have panel-specific system menu on Mac. |
| 170 } | 165 } |
| 171 | 166 |
| 172 void PanelCocoa::PanelCopy() { | 167 void PanelCocoa::PanelCopy() { |
| 173 // Nothing to do since we do not have panel-specific system menu on Mac. | 168 // Nothing to do since we do not have panel-specific system menu on Mac. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 196 attention_request_id_ = 0; | 191 attention_request_id_ = 0; |
| 197 } | 192 } |
| 198 } | 193 } |
| 199 } | 194 } |
| 200 | 195 |
| 201 bool PanelCocoa::IsDrawingAttention() const { | 196 bool PanelCocoa::IsDrawingAttention() const { |
| 202 PanelTitlebarViewCocoa* titlebar = [controller_ titlebarView]; | 197 PanelTitlebarViewCocoa* titlebar = [controller_ titlebarView]; |
| 203 return [titlebar isDrawingAttention]; | 198 return [titlebar isDrawingAttention]; |
| 204 } | 199 } |
| 205 | 200 |
| 206 bool PanelCocoa::PreHandlePanelKeyboardEvent( | |
| 207 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { | |
| 208 // No need to prehandle as no keys are reserved. | |
| 209 return false; | |
| 210 } | |
| 211 | |
| 212 void PanelCocoa::HandlePanelKeyboardEvent( | 201 void PanelCocoa::HandlePanelKeyboardEvent( |
| 213 const NativeWebKeyboardEvent& event) { | 202 const NativeWebKeyboardEvent& event) { |
| 214 if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char) | 203 if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char) |
| 215 return; | 204 return; |
| 216 | 205 |
| 217 ChromeEventProcessingWindow* event_window = | 206 ChromeEventProcessingWindow* event_window = |
| 218 static_cast<ChromeEventProcessingWindow*>([controller_ window]); | 207 static_cast<ChromeEventProcessingWindow*>([controller_ window]); |
| 219 DCHECK([event_window isKindOfClass:[ChromeEventProcessingWindow class]]); | 208 DCHECK([event_window isKindOfClass:[ChromeEventProcessingWindow class]]); |
| 220 [event_window redispatchKeyEvent:event.os_event]; | 209 [event_window redispatchKeyEvent:event.os_event]; |
| 221 } | 210 } |
| 222 | 211 |
| 223 void PanelCocoa::FullScreenModeChanged( | 212 void PanelCocoa::FullScreenModeChanged( |
| 224 bool is_full_screen) { | 213 bool is_full_screen) { |
| 225 [controller_ fullScreenModeChanged:is_full_screen]; | 214 [controller_ fullScreenModeChanged:is_full_screen]; |
| 226 } | 215 } |
| 227 | 216 |
| 228 Browser* PanelCocoa::GetPanelBrowser() const { | |
| 229 NOTREACHED(); // legacy API from BrowserWindow. N/A for refactored panels. | |
| 230 return NULL; | |
| 231 } | |
| 232 | |
| 233 void PanelCocoa::EnsurePanelFullyVisible() { | |
| 234 [controller_ ensureFullyVisible]; | |
| 235 } | |
| 236 | |
| 237 void PanelCocoa::SetPanelAlwaysOnTop(bool on_top) { | 217 void PanelCocoa::SetPanelAlwaysOnTop(bool on_top) { |
| 238 [controller_ updateWindowLevel]; | 218 [controller_ updateWindowLevel]; |
| 239 } | 219 } |
| 240 | 220 |
| 241 void PanelCocoa::EnableResizeByMouse(bool enable) { | 221 void PanelCocoa::EnableResizeByMouse(bool enable) { |
| 242 [controller_ enableResizeByMouse:enable]; | 222 [controller_ enableResizeByMouse:enable]; |
| 243 } | 223 } |
| 244 | 224 |
| 245 void PanelCocoa::UpdatePanelMinimizeRestoreButtonVisibility() { | 225 void PanelCocoa::UpdatePanelMinimizeRestoreButtonVisibility() { |
| 246 [controller_ updateTitleBarMinimizeRestoreButtonVisibility]; | 226 [controller_ updateTitleBarMinimizeRestoreButtonVisibility]; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 return ![[titlebar() closeButton] isHidden]; | 365 return ![[titlebar() closeButton] isHidden]; |
| 386 case panel::MINIMIZE_BUTTON: | 366 case panel::MINIMIZE_BUTTON: |
| 387 return ![[titlebar() minimizeButton] isHidden]; | 367 return ![[titlebar() minimizeButton] isHidden]; |
| 388 case panel::RESTORE_BUTTON: | 368 case panel::RESTORE_BUTTON: |
| 389 return ![[titlebar() restoreButton] isHidden]; | 369 return ![[titlebar() restoreButton] isHidden]; |
| 390 default: | 370 default: |
| 391 NOTREACHED(); | 371 NOTREACHED(); |
| 392 } | 372 } |
| 393 return false; | 373 return false; |
| 394 } | 374 } |
| OLD | NEW |