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

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

Issue 259023: [Mac] Window titles for Expose. (Closed)
Patch Set: Fix unit_test expectations for Release. Created 11 years, 2 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
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 "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "base/scoped_nsdisable_screen_updates.h" 8 #include "base/scoped_nsdisable_screen_updates.h"
9 #import "base/scoped_nsobject.h" 9 #import "base/scoped_nsobject.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "chrome/app/chrome_dll_resource.h" // IDC_* 11 #include "chrome/app/chrome_dll_resource.h" // IDC_*
12 #include "chrome/browser/bookmarks/bookmark_editor.h" 12 #include "chrome/browser/bookmarks/bookmark_editor.h"
13 #include "chrome/browser/browser.h" 13 #include "chrome/browser/browser.h"
14 #include "chrome/browser/browser_list.h" 14 #include "chrome/browser/browser_list.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/encoding_menu_controller.h" 16 #include "chrome/browser/encoding_menu_controller.h"
17 #include "chrome/browser/location_bar.h" 17 #include "chrome/browser/location_bar.h"
18 #include "chrome/browser/profile.h" 18 #include "chrome/browser/profile.h"
19 #include "chrome/browser/renderer_host/render_widget_host_view.h" 19 #include "chrome/browser/renderer_host/render_widget_host_view.h"
20 #include "chrome/browser/tab_contents/tab_contents.h" 20 #include "chrome/browser/tab_contents/tab_contents.h"
21 #include "chrome/browser/tab_contents/tab_contents_view.h" 21 #include "chrome/browser/tab_contents/tab_contents_view.h"
22 #include "chrome/browser/tabs/tab_strip_model.h" 22 #include "chrome/browser/tabs/tab_strip_model.h"
23 #import "chrome/browser/cocoa/bookmark_bar_controller.h" 23 #import "chrome/browser/cocoa/bookmark_bar_controller.h"
24 #import "chrome/browser/cocoa/bookmark_editor_controller.h" 24 #import "chrome/browser/cocoa/bookmark_editor_controller.h"
25 #import "chrome/browser/cocoa/browser_window_cocoa.h" 25 #import "chrome/browser/cocoa/browser_window_cocoa.h"
26 #import "chrome/browser/cocoa/browser_window_controller.h" 26 #import "chrome/browser/cocoa/browser_window_controller.h"
27 #import "chrome/browser/cocoa/chrome_browser_window.h"
27 #import "chrome/browser/cocoa/download_shelf_controller.h" 28 #import "chrome/browser/cocoa/download_shelf_controller.h"
28 #import "chrome/browser/cocoa/extension_shelf_controller.h" 29 #import "chrome/browser/cocoa/extension_shelf_controller.h"
29 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" 30 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h"
30 #include "chrome/browser/cocoa/find_bar_bridge.h" 31 #include "chrome/browser/cocoa/find_bar_bridge.h"
31 #import "chrome/browser/cocoa/fullscreen_window.h" 32 #import "chrome/browser/cocoa/fullscreen_window.h"
32 #import "chrome/browser/cocoa/infobar_container_controller.h" 33 #import "chrome/browser/cocoa/infobar_container_controller.h"
33 #import "chrome/browser/cocoa/status_bubble_mac.h" 34 #import "chrome/browser/cocoa/status_bubble_mac.h"
34 #import "chrome/browser/cocoa/tab_strip_model_observer_bridge.h" 35 #import "chrome/browser/cocoa/tab_strip_model_observer_bridge.h"
35 #import "chrome/browser/cocoa/tab_strip_view.h" 36 #import "chrome/browser/cocoa/tab_strip_view.h"
36 #import "chrome/browser/cocoa/tab_strip_controller.h" 37 #import "chrome/browser/cocoa/tab_strip_controller.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 rwhv->SetActive(true); 354 rwhv->SetActive(true);
354 } 355 }
355 } 356 }
356 357
357 // Called when we are deactivated (when we lose focus). 358 // Called when we are deactivated (when we lose focus).
358 - (void)windowDidResignKey:(NSNotification*)notification { 359 - (void)windowDidResignKey:(NSNotification*)notification {
359 // If our app is still active and we're still the key window, ignore this 360 // If our app is still active and we're still the key window, ignore this
360 // message, since it just means that a menu extra (on the "system status bar") 361 // message, since it just means that a menu extra (on the "system status bar")
361 // was activated; we'll get another |-windowDidResignKey| if we ever really 362 // was activated; we'll get another |-windowDidResignKey| if we ever really
362 // lose key window status. 363 // lose key window status.
363 if ([NSApp isActive] && ([NSApp keyWindow] == window_)) 364 if ([NSApp isActive] &&
365 ([NSApp keyWindow] == static_cast<NSWindow*>(window_)))
364 return; 366 return;
365 367
366 // We need to deactivate the controls (in the "WebView"). To do this, get the 368 // We need to deactivate the controls (in the "WebView"). To do this, get the
367 // selected TabContents's RenderWidgetHostView and tell it to deactivate. 369 // selected TabContents's RenderWidgetHostView and tell it to deactivate.
368 if (TabContents* contents = browser_->GetSelectedTabContents()) { 370 if (TabContents* contents = browser_->GetSelectedTabContents()) {
369 if (RenderWidgetHostView* rwhv = contents->render_widget_host_view()) 371 if (RenderWidgetHostView* rwhv = contents->render_widget_host_view())
370 rwhv->SetActive(false); 372 rwhv->SetActive(false);
371 } 373 }
372 } 374 }
373 375
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 NSView* contentView = fullscreen_ ? [fullscreen_window_ contentView] 1234 NSView* contentView = fullscreen_ ? [fullscreen_window_ contentView]
1233 : [[self window] contentView]; 1235 : [[self window] contentView];
1234 NSRect contentFrame = [contentView frame]; 1236 NSRect contentFrame = [contentView frame];
1235 int maxY = NSMaxY(contentFrame); 1237 int maxY = NSMaxY(contentFrame);
1236 int minY = NSMinY(contentFrame); 1238 int minY = NSMinY(contentFrame);
1237 if (!fullscreen_ && [self isNormalWindow]) { 1239 if (!fullscreen_ && [self isNormalWindow]) {
1238 maxY = NSMinY([[self tabStripView] frame]); 1240 maxY = NSMinY([[self tabStripView] frame]);
1239 } 1241 }
1240 DCHECK_GE(maxY, minY); 1242 DCHECK_GE(maxY, minY);
1241 1243
1244 // Suppress title drawing for normal windows (popups use normal
1245 // window title bars).
1246 [window_ setShouldHideTitle:[self isNormalWindow]];
1247
1242 // Place the toolbar at the top of the reserved area, but only if we're not in 1248 // Place the toolbar at the top of the reserved area, but only if we're not in
1243 // fullscreen mode. 1249 // fullscreen mode.
1244 NSView* toolbarView = [toolbarController_ view]; 1250 NSView* toolbarView = [toolbarController_ view];
1245 NSRect toolbarFrame = [toolbarView frame]; 1251 NSRect toolbarFrame = [toolbarView frame];
1246 if (!fullscreen_) { 1252 if (!fullscreen_) {
1247 // The toolbar is present in the window, so we make room for it. 1253 // The toolbar is present in the window, so we make room for it.
1248 toolbarFrame.origin.x = 0; 1254 toolbarFrame.origin.x = 0;
1249 toolbarFrame.origin.y = maxY - NSHeight(toolbarFrame); 1255 toolbarFrame.origin.y = maxY - NSHeight(toolbarFrame);
1250 toolbarFrame.size.width = NSWidth(contentFrame); 1256 toolbarFrame.size.width = NSWidth(contentFrame);
1251 maxY -= NSHeight(toolbarFrame); 1257 maxY -= NSHeight(toolbarFrame);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 provider->GetNSColor(BrowserThemeProvider::COLOR_TOOLBAR); 1469 provider->GetNSColor(BrowserThemeProvider::COLOR_TOOLBAR);
1464 [theme setValue:toolbarBackgroundColor 1470 [theme setValue:toolbarBackgroundColor
1465 forAttribute:@"backgroundColor" 1471 forAttribute:@"backgroundColor"
1466 style:GTMThemeStyleToolBar 1472 style:GTMThemeStyleToolBar
1467 state:GTMThemeStateActiveWindow]; 1473 state:GTMThemeStateActiveWindow];
1468 1474
1469 return theme; 1475 return theme;
1470 } 1476 }
1471 @end 1477 @end
1472 1478
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/browser_window_controller.h ('k') | chrome/browser/cocoa/chrome_browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698