Chromium Code Reviews| 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 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 5 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <objc/runtime.h> | 8 #include <objc/runtime.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/mac/sdk_forward_declarations.h" | 12 #include "base/mac/sdk_forward_declarations.h" |
| 13 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 13 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 14 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 14 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 15 #include "chrome/browser/themes/theme_properties.h" | 15 #include "chrome/browser/themes/theme_properties.h" |
| 16 #include "chrome/browser/themes/theme_service.h" | 16 #include "chrome/browser/themes/theme_service.h" |
| 17 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 17 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 18 #import "chrome/browser/ui/cocoa/browser_window_layout.h" | 18 #import "chrome/browser/ui/cocoa/browser_window_layout.h" |
| 19 #import "chrome/browser/ui/cocoa/browser_window_touch_bar.h" | |
| 19 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 20 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 20 #include "chrome/browser/ui/cocoa/l10n_util.h" | 21 #include "chrome/browser/ui/cocoa/l10n_util.h" |
| 21 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 22 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 22 #import "chrome/browser/ui/cocoa/themed_window.h" | 23 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 23 #include "chrome/grit/theme_resources.h" | 24 #include "chrome/grit/theme_resources.h" |
| 24 #include "ui/base/cocoa/cocoa_base_utils.h" | 25 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 25 #include "ui/base/cocoa/nsgraphics_context_additions.h" | 26 #include "ui/base/cocoa/nsgraphics_context_additions.h" |
| 26 #import "ui/base/cocoa/nsview_additions.h" | 27 #import "ui/base/cocoa/nsview_additions.h" |
| 27 #include "ui/base/material_design/material_design_controller.h" | 28 #import "ui/base/cocoa/touch_bar_forward_declarations.h" |
| 28 | 29 |
| 29 // Implementer's note: Moving the window controls is tricky. When altering the | 30 // Implementer's note: Moving the window controls is tricky. When altering the |
| 30 // code, ensure that: | 31 // code, ensure that: |
| 31 // - accessibility hit testing works | 32 // - accessibility hit testing works |
| 32 // - the accessibility hierarchy is correct | 33 // - the accessibility hierarchy is correct |
| 33 // - close/min in the background don't bring the window forward | 34 // - close/min in the background don't bring the window forward |
| 34 // - rollover effects work correctly | 35 // - rollover effects work correctly |
| 35 | 36 |
| 36 // The NSLayoutConstraint class hierarchy only exists in the 10.11 SDK. When | 37 // The NSLayoutConstraint class hierarchy only exists in the 10.11 SDK. When |
| 37 // targeting something lower, constraintEqualToAnchor:constant: needs to be | 38 // targeting something lower, constraintEqualToAnchor:constant: needs to be |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 493 [overlayImage drawAtPoint:NSMakePoint(position.x, | 494 [overlayImage drawAtPoint:NSMakePoint(position.x, |
| 494 position.y - overlaySize.height) | 495 position.y - overlaySize.height) |
| 495 fromRect:imageFrame | 496 fromRect:imageFrame |
| 496 operation:NSCompositeSourceOver | 497 operation:NSCompositeSourceOver |
| 497 fraction:1.0]; | 498 fraction:1.0]; |
| 498 } | 499 } |
| 499 | 500 |
| 500 return themed; | 501 return themed; |
| 501 } | 502 } |
| 502 | 503 |
| 504 - (NSTouchBar*)makeTouchBar { | |
| 505 BrowserWindowController* bwc = | |
| 506 static_cast<BrowserWindowController*>([self windowController]); | |
|
Robert Sesek
2017/02/14 17:32:51
Use ObjCCastStrict instead.
spqchan
2017/02/16 15:25:52
Done.
| |
| 507 return [[bwc browserWindowTouchBar] makeTouchBar]; | |
| 508 } | |
| 509 | |
| 503 - (NSColor*)titleColor { | 510 - (NSColor*)titleColor { |
| 504 const ui::ThemeProvider* themeProvider = [self themeProvider]; | 511 const ui::ThemeProvider* themeProvider = [self themeProvider]; |
| 505 if (!themeProvider) | 512 if (!themeProvider) |
| 506 return [NSColor windowFrameTextColor]; | 513 return [NSColor windowFrameTextColor]; |
| 507 | 514 |
| 508 ThemedWindowStyle windowStyle = [self themedWindowStyle]; | 515 ThemedWindowStyle windowStyle = [self themedWindowStyle]; |
| 509 BOOL incognito = windowStyle & THEMED_INCOGNITO; | 516 BOOL incognito = windowStyle & THEMED_INCOGNITO; |
| 510 | 517 |
| 511 if (incognito) | 518 if (incognito) |
| 512 return [NSColor whiteColor]; | 519 return [NSColor whiteColor]; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 525 [self childWindowsDidChange]; | 532 [self childWindowsDidChange]; |
| 526 } | 533 } |
| 527 | 534 |
| 528 - (void)childWindowsDidChange { | 535 - (void)childWindowsDidChange { |
| 529 id delegate = [self delegate]; | 536 id delegate = [self delegate]; |
| 530 if ([delegate respondsToSelector:@selector(childWindowsDidChange)]) | 537 if ([delegate respondsToSelector:@selector(childWindowsDidChange)]) |
| 531 [delegate childWindowsDidChange]; | 538 [delegate childWindowsDidChange]; |
| 532 } | 539 } |
| 533 | 540 |
| 534 @end | 541 @end |
| OLD | NEW |