| 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/cocoa/panels/panel_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/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 #import "chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.h" | 9 #import "chrome/browser/ui/cocoa/panels/panel_titlebar_view_cocoa.h" |
| 10 #import "chrome/browser/ui/cocoa/panels/panel_utils_cocoa.h" | 10 #import "chrome/browser/ui/cocoa/panels/panel_utils_cocoa.h" |
| 11 #import "chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.h" | 11 #import "chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.h" |
| 12 #include "chrome/browser/ui/panels/panel.h" | 12 #include "chrome/browser/ui/panels/panel.h" |
| 13 #include "chrome/browser/ui/panels/stacked_panel_collection.h" | 13 #include "chrome/browser/ui/panels/stacked_panel_collection.h" |
| 14 #include "content/public/browser/native_web_keyboard_event.h" | 14 #include "content/public/browser/native_web_keyboard_event.h" |
| 15 | 15 |
| 16 using content::NativeWebKeyboardEvent; | 16 using content::NativeWebKeyboardEvent; |
| 17 using content::WebContents; | 17 using content::WebContents; |
| 18 | 18 |
| 19 namespace { | |
| 20 | |
| 21 // Use this instead of 0 for minimum size of a window when doing opening and | |
| 22 // closing animations, since OSX window manager does not like 0-sized windows | |
| 23 // (according to avi@). | |
| 24 const int kMinimumWindowSize = 1; | |
| 25 | |
| 26 } // namespace | |
| 27 | |
| 28 // This creates a shim window class, which in turn creates a Cocoa window | 19 // This creates a shim window class, which in turn creates a Cocoa window |
| 29 // controller which in turn creates actual NSWindow by loading a nib. | 20 // controller which in turn creates actual NSWindow by loading a nib. |
| 30 // Overall chain of ownership is: | 21 // Overall chain of ownership is: |
| 31 // PanelWindowControllerCocoa -> PanelCocoa -> Panel. | 22 // PanelWindowControllerCocoa -> PanelCocoa -> Panel. |
| 32 // static | 23 // static |
| 33 NativePanel* Panel::CreateNativePanel(Panel* panel, | 24 NativePanel* Panel::CreateNativePanel(Panel* panel, |
| 34 const gfx::Rect& bounds, | 25 const gfx::Rect& bounds, |
| 35 bool always_on_top) { | 26 bool always_on_top) { |
| 36 return new PanelCocoa(panel, bounds, always_on_top); | 27 return new PanelCocoa(panel, bounds, always_on_top); |
| 37 } | 28 } |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 panel::CornerStyle CocoaNativePanelTesting::GetWindowCornerStyle() const { | 452 panel::CornerStyle CocoaNativePanelTesting::GetWindowCornerStyle() const { |
| 462 return native_panel_window_->corner_style_; | 453 return native_panel_window_->corner_style_; |
| 463 } | 454 } |
| 464 | 455 |
| 465 bool CocoaNativePanelTesting::EnsureApplicationRunOnForeground() { | 456 bool CocoaNativePanelTesting::EnsureApplicationRunOnForeground() { |
| 466 if ([NSApp isActive]) | 457 if ([NSApp isActive]) |
| 467 return true; | 458 return true; |
| 468 [NSApp activateIgnoringOtherApps:YES]; | 459 [NSApp activateIgnoringOtherApps:YES]; |
| 469 return [NSApp isActive]; | 460 return [NSApp isActive]; |
| 470 } | 461 } |
| OLD | NEW |