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/shell_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/extensions/shell_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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
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 ShellWindowCocoa::ShellWindowCocoa(ShellWindow* shell_window, | 189 ShellWindowCocoa::ShellWindowCocoa(ShellWindow* shell_window, |
190 const ShellWindow::CreateParams& params) | 190 const ShellWindow::CreateParams& params) |
191 : shell_window_(shell_window), | 191 : shell_window_(shell_window), |
192 has_frame_(params.frame == ShellWindow::CreateParams::FRAME_CHROME), | 192 has_frame_(params.frame == ShellWindow::FRAME_CHROME), |
193 attention_request_id_(0), | 193 attention_request_id_(0), |
194 use_system_drag_(true) { | 194 use_system_drag_(true) { |
195 // Flip coordinates based on the primary screen. | 195 // Flip coordinates based on the primary screen. |
196 NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame]; | 196 NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame]; |
197 NSRect cocoa_bounds = NSMakeRect(params.bounds.x(), | 197 NSRect cocoa_bounds = NSMakeRect(params.bounds.x(), |
198 NSHeight(main_screen_rect) - params.bounds.y() - params.bounds.height(), | 198 NSHeight(main_screen_rect) - params.bounds.y() - params.bounds.height(), |
199 params.bounds.width(), params.bounds.height()); | 199 params.bounds.width(), params.bounds.height()); |
200 | 200 |
201 // If coordinates are < 0, center window on primary screen | 201 // If coordinates are < 0, center window on primary screen |
202 if (params.bounds.x() == INT_MIN) { | 202 if (params.bounds.x() == INT_MIN) { |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 NSWindow* window = [window_controller_ window]; | 727 NSWindow* window = [window_controller_ window]; |
728 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); | 728 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); |
729 return static_cast<ShellNSWindow*>(window); | 729 return static_cast<ShellNSWindow*>(window); |
730 } | 730 } |
731 | 731 |
732 // static | 732 // static |
733 NativeShellWindow* NativeShellWindow::Create( | 733 NativeShellWindow* NativeShellWindow::Create( |
734 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { | 734 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { |
735 return new ShellWindowCocoa(shell_window, params); | 735 return new ShellWindowCocoa(shell_window, params); |
736 } | 736 } |
OLD | NEW |