| 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/extensions/native_app_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.h" |
| 6 | 6 |
| 7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/cocoa/browser_window_utils.h" | 10 #include "chrome/browser/ui/cocoa/browser_window_utils.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 @end | 183 @end |
| 184 | 184 |
| 185 @interface NSView (WebContentsView) | 185 @interface NSView (WebContentsView) |
| 186 - (void)setMouseDownCanMoveWindow:(BOOL)can_move; | 186 - (void)setMouseDownCanMoveWindow:(BOOL)can_move; |
| 187 @end | 187 @end |
| 188 | 188 |
| 189 NativeAppWindowCocoa::NativeAppWindowCocoa( | 189 NativeAppWindowCocoa::NativeAppWindowCocoa( |
| 190 ShellWindow* shell_window, | 190 ShellWindow* shell_window, |
| 191 const ShellWindow::CreateParams& params) | 191 const ShellWindow::CreateParams& params) |
| 192 : shell_window_(shell_window), | 192 : shell_window_(shell_window), |
| 193 has_frame_(params.frame == ShellWindow::CreateParams::FRAME_CHROME), | 193 has_frame_(params.frame == ShellWindow::FRAME_CHROME), |
| 194 attention_request_id_(0), | 194 attention_request_id_(0), |
| 195 use_system_drag_(true) { | 195 use_system_drag_(true) { |
| 196 // Flip coordinates based on the primary screen. | 196 // Flip coordinates based on the primary screen. |
| 197 NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame]; | 197 NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame]; |
| 198 NSRect cocoa_bounds = NSMakeRect(params.bounds.x(), | 198 NSRect cocoa_bounds = NSMakeRect(params.bounds.x(), |
| 199 NSHeight(main_screen_rect) - params.bounds.y() - params.bounds.height(), | 199 NSHeight(main_screen_rect) - params.bounds.y() - params.bounds.height(), |
| 200 params.bounds.width(), params.bounds.height()); | 200 params.bounds.width(), params.bounds.height()); |
| 201 | 201 |
| 202 // If coordinates are < 0, center window on primary screen | 202 // If coordinates are < 0, center window on primary screen |
| 203 if (params.bounds.x() == INT_MIN) { | 203 if (params.bounds.x() == INT_MIN) { |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); | 729 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); |
| 730 return static_cast<ShellNSWindow*>(window); | 730 return static_cast<ShellNSWindow*>(window); |
| 731 } | 731 } |
| 732 | 732 |
| 733 // static | 733 // static |
| 734 NativeAppWindow* NativeAppWindow::Create( | 734 NativeAppWindow* NativeAppWindow::Create( |
| 735 ShellWindow* shell_window, | 735 ShellWindow* shell_window, |
| 736 const ShellWindow::CreateParams& params) { | 736 const ShellWindow::CreateParams& params) { |
| 737 return new NativeAppWindowCocoa(shell_window, params); | 737 return new NativeAppWindowCocoa(shell_window, params); |
| 738 } | 738 } |
| OLD | NEW |