| 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_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/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 10 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 11 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" | 11 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
| 12 #include "chrome/browser/ui/cocoa/task_manager_mac.h" | 12 #include "chrome/browser/ui/cocoa/task_manager_mac.h" |
| 13 #include "chrome/browser/ui/panels/panel.h" | 13 #include "chrome/browser/ui/panels/panel.h" |
| 14 #include "chrome/browser/ui/panels/panel_manager.h" | 14 #include "chrome/browser/ui/panels/panel_manager.h" |
| 15 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" | 15 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" |
| 16 #import "chrome/browser/ui/panels/panel_utils_cocoa.h" | 16 #import "chrome/browser/ui/panels/panel_utils_cocoa.h" |
| 17 #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h" | 17 #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h" |
| 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
| 21 #include "content/public/browser/native_web_keyboard_event.h" | 21 #include "content/public/browser/native_web_keyboard_event.h" |
| 22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
| 23 | 23 |
| 24 using content::NativeWebKeyboardEvent; | 24 using content::NativeWebKeyboardEvent; |
| 25 using content::WebContents; | 25 using content::WebContents; |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 const gfx::Size& window_size) const { | 317 const gfx::Size& window_size) const { |
| 318 NSRect frame = NSMakeRect(0, 0, window_size.width(), window_size.height()); | 318 NSRect frame = NSMakeRect(0, 0, window_size.width(), window_size.height()); |
| 319 NSRect content = [controller_ contentRectForFrameRect:frame]; | 319 NSRect content = [controller_ contentRectForFrameRect:frame]; |
| 320 return gfx::Size(NSWidth(content), NSHeight(content)); | 320 return gfx::Size(NSWidth(content), NSHeight(content)); |
| 321 } | 321 } |
| 322 | 322 |
| 323 int PanelBrowserWindowCocoa::TitleOnlyHeight() const { | 323 int PanelBrowserWindowCocoa::TitleOnlyHeight() const { |
| 324 return [controller_ titlebarHeightInScreenCoordinates]; | 324 return [controller_ titlebarHeightInScreenCoordinates]; |
| 325 } | 325 } |
| 326 | 326 |
| 327 void PanelBrowserWindowCocoa::TabInsertedAt(TabContentsWrapper* contents, | 327 void PanelBrowserWindowCocoa::TabInsertedAt(TabContents* contents, |
| 328 int index, | 328 int index, |
| 329 bool foreground) { | 329 bool foreground) { |
| 330 [controller_ tabInserted:contents->web_contents()]; | 330 [controller_ tabInserted:contents->web_contents()]; |
| 331 } | 331 } |
| 332 | 332 |
| 333 void PanelBrowserWindowCocoa::TabDetachedAt(TabContentsWrapper* contents, | 333 void PanelBrowserWindowCocoa::TabDetachedAt(TabContents* contents, |
| 334 int index) { | 334 int index) { |
| 335 [controller_ tabDetached:contents->web_contents()]; | 335 [controller_ tabDetached:contents->web_contents()]; |
| 336 } | 336 } |
| 337 | 337 |
| 338 void PanelBrowserWindowCocoa::Observe( | 338 void PanelBrowserWindowCocoa::Observe( |
| 339 int type, | 339 int type, |
| 340 const content::NotificationSource& source, | 340 const content::NotificationSource& source, |
| 341 const content::NotificationDetails& details) { | 341 const content::NotificationDetails& details) { |
| 342 DCHECK_EQ(chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, type); | 342 DCHECK_EQ(chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE, type); |
| 343 [controller_ updateWindowLevel]; | 343 [controller_ updateWindowLevel]; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 return ![[titlebar() closeButton] isHidden]; | 445 return ![[titlebar() closeButton] isHidden]; |
| 446 case panel::MINIMIZE_BUTTON: | 446 case panel::MINIMIZE_BUTTON: |
| 447 return ![[titlebar() minimizeButton] isHidden]; | 447 return ![[titlebar() minimizeButton] isHidden]; |
| 448 case panel::RESTORE_BUTTON: | 448 case panel::RESTORE_BUTTON: |
| 449 return ![[titlebar() restoreButton] isHidden]; | 449 return ![[titlebar() restoreButton] isHidden]; |
| 450 default: | 450 default: |
| 451 NOTREACHED(); | 451 NOTREACHED(); |
| 452 } | 452 } |
| 453 return false; | 453 return false; |
| 454 } | 454 } |
| OLD | NEW |