Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Side by Side Diff: chrome/browser/cocoa/browser_window_controller.mm

Issue 510001: [Mac] Implement WindowSizer::GetDefaultPopupOrigin()... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/window_sizer_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <Carbon/Carbon.h> 5 #include <Carbon/Carbon.h>
6 6
7 #include "app/l10n_util_mac.h" 7 #include "app/l10n_util_mac.h"
8 #include "base/mac_util.h" 8 #include "base/mac_util.h"
9 #include "base/scoped_nsdisable_screen_updates.h" 9 #include "base/scoped_nsdisable_screen_updates.h"
10 #import "base/scoped_nsobject.h" 10 #import "base/scoped_nsobject.h"
11 #include "base/sys_string_conversions.h" 11 #include "base/sys_string_conversions.h"
12 #include "chrome/app/chrome_dll_resource.h" // IDC_* 12 #include "chrome/app/chrome_dll_resource.h" // IDC_*
13 #include "chrome/browser/bookmarks/bookmark_editor.h" 13 #include "chrome/browser/bookmarks/bookmark_editor.h"
14 #include "chrome/browser/browser.h" 14 #include "chrome/browser/browser.h"
15 #include "chrome/browser/browser_list.h" 15 #include "chrome/browser/browser_list.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/browser_theme_provider.h" 17 #include "chrome/browser/browser_theme_provider.h"
18 #include "chrome/browser/dock_info.h" 18 #include "chrome/browser/dock_info.h"
19 #include "chrome/browser/encoding_menu_controller.h" 19 #include "chrome/browser/encoding_menu_controller.h"
20 #include "chrome/browser/location_bar.h" 20 #include "chrome/browser/location_bar.h"
21 #include "chrome/browser/profile.h" 21 #include "chrome/browser/profile.h"
22 #include "chrome/browser/window_sizer.h"
22 #include "chrome/browser/renderer_host/render_widget_host_view.h" 23 #include "chrome/browser/renderer_host/render_widget_host_view.h"
23 #include "chrome/browser/tab_contents/tab_contents.h" 24 #include "chrome/browser/tab_contents/tab_contents.h"
24 #include "chrome/browser/tab_contents/tab_contents_view.h" 25 #include "chrome/browser/tab_contents/tab_contents_view.h"
25 #include "chrome/browser/tabs/tab_strip_model.h" 26 #include "chrome/browser/tabs/tab_strip_model.h"
26 #import "chrome/browser/cocoa/background_gradient_view.h" 27 #import "chrome/browser/cocoa/background_gradient_view.h"
27 #import "chrome/browser/cocoa/bookmark_bar_controller.h" 28 #import "chrome/browser/cocoa/bookmark_bar_controller.h"
28 #import "chrome/browser/cocoa/bookmark_editor_controller.h" 29 #import "chrome/browser/cocoa/bookmark_editor_controller.h"
29 #import "chrome/browser/cocoa/browser_window_cocoa.h" 30 #import "chrome/browser/cocoa/browser_window_cocoa.h"
30 #import "chrome/browser/cocoa/browser_window_controller.h" 31 #import "chrome/browser/cocoa/browser_window_controller.h"
31 #import "chrome/browser/cocoa/chrome_browser_window.h" 32 #import "chrome/browser/cocoa/chrome_browser_window.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // the coordinates for us so we can use it to save some code. 246 // the coordinates for us so we can use it to save some code.
246 // Note that this may leave a significant portion of the window 247 // Note that this may leave a significant portion of the window
247 // offscreen, but there will always be enough window onscreen to 248 // offscreen, but there will always be enough window onscreen to
248 // drag the whole window back into view. 249 // drag the whole window back into view.
249 NSSize minSize = [[self window] minSize]; 250 NSSize minSize = [[self window] minSize];
250 gfx::Rect windowRect = browser_->GetSavedWindowBounds(); 251 gfx::Rect windowRect = browser_->GetSavedWindowBounds();
251 if (windowRect.width() < minSize.width) 252 if (windowRect.width() < minSize.width)
252 windowRect.set_width(minSize.width); 253 windowRect.set_width(minSize.width);
253 if (windowRect.height() < minSize.height) 254 if (windowRect.height() < minSize.height)
254 windowRect.set_height(minSize.height); 255 windowRect.set_height(minSize.height);
256
257 // When we are given x/y coordinates of 0 on a created popup window, assume
258 // none were given by the window.open() command.
259 if (browser_->type() & Browser::TYPE_POPUP &&
260 windowRect.x() == 0 && windowRect.y() == 0) {
261 gfx::Size size = windowRect.size();
262 windowRect.set_origin(WindowSizer::GetDefaultPopupOrigin(size));
263 }
264
255 windowShim_->SetBounds(windowRect); 265 windowShim_->SetBounds(windowRect);
256 266
257 // Puts the incognito badge on the window frame, if necessary. Do this 267 // Puts the incognito badge on the window frame, if necessary. Do this
258 // before creating the tab strip to avoid redundant tab layout. 268 // before creating the tab strip to avoid redundant tab layout.
259 [self installIncognitoBadge]; 269 [self installIncognitoBadge];
260 270
261 // Create a controller for the tab strip, giving it the model object for 271 // Create a controller for the tab strip, giving it the model object for
262 // this window's Browser and the tab strip view. The controller will handle 272 // this window's Browser and the tab strip view. The controller will handle
263 // registering for the appropriate tab notifications from the back-end and 273 // registering for the appropriate tab notifications from the back-end and
264 // managing the creation of new tabs. 274 // managing the creation of new tabs.
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 if (frameOverlayInactiveImage) { 1967 if (frameOverlayInactiveImage) {
1958 [theme setValue:frameOverlayInactiveImage 1968 [theme setValue:frameOverlayInactiveImage
1959 forAttribute:@"overlay" 1969 forAttribute:@"overlay"
1960 style:GTMThemeStyleWindow 1970 style:GTMThemeStyleWindow
1961 state:GTMThemeStateInactiveWindow]; 1971 state:GTMThemeStateInactiveWindow];
1962 } 1972 }
1963 1973
1964 return theme; 1974 return theme;
1965 } 1975 }
1966 @end 1976 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/window_sizer_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698