| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/mac/sdk_forward_declarations.h" | 11 #include "base/mac/sdk_forward_declarations.h" |
| 11 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 12 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 12 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 13 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 13 #include "chrome/browser/themes/theme_properties.h" | 14 #include "chrome/browser/themes/theme_properties.h" |
| 14 #include "chrome/browser/themes/theme_service.h" | 15 #include "chrome/browser/themes/theme_service.h" |
| 15 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 16 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 16 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 17 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 18 #include "chrome/browser/ui/cocoa/l10n_util.h" |
| 17 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 19 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 18 #import "chrome/browser/ui/cocoa/themed_window.h" | 20 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 19 #include "chrome/grit/theme_resources.h" | 21 #include "chrome/grit/theme_resources.h" |
| 20 #include "ui/base/cocoa/cocoa_base_utils.h" | 22 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 21 #include "ui/base/cocoa/nsgraphics_context_additions.h" | 23 #include "ui/base/cocoa/nsgraphics_context_additions.h" |
| 22 #import "ui/base/cocoa/nsview_additions.h" | 24 #import "ui/base/cocoa/nsview_additions.h" |
| 23 #include "ui/base/material_design/material_design_controller.h" | 25 #include "ui/base/material_design/material_design_controller.h" |
| 24 | 26 |
| 25 // Implementer's note: Moving the window controls is tricky. When altering the | 27 // Implementer's note: Moving the window controls is tricky. When altering the |
| 26 // code, ensure that: | 28 // code, ensure that: |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 buttonFrame.origin.x += windowButtonsInterButtonSpacing_; | 155 buttonFrame.origin.x += windowButtonsInterButtonSpacing_; |
| 154 // fallthrough | 156 // fallthrough |
| 155 case NSWindowMiniaturizeButton: | 157 case NSWindowMiniaturizeButton: |
| 156 buttonFrame.origin.x += NSWidth([closeButton_ frame]); | 158 buttonFrame.origin.x += NSWidth([closeButton_ frame]); |
| 157 buttonFrame.origin.x += windowButtonsInterButtonSpacing_; | 159 buttonFrame.origin.x += windowButtonsInterButtonSpacing_; |
| 158 // fallthrough | 160 // fallthrough |
| 159 default: | 161 default: |
| 160 break; | 162 break; |
| 161 } | 163 } |
| 162 | 164 |
| 165 if (cocoa_l10n_util::ExperimentalMacRTLIsEnabled() && base::i18n::IsRTL()) { |
| 166 buttonFrame.origin.x = |
| 167 NSWidth([self frame]) - buttonFrame.origin.x - NSWidth([button frame]); |
| 168 } |
| 169 |
| 163 BOOL didPost = [button postsBoundsChangedNotifications]; | 170 BOOL didPost = [button postsBoundsChangedNotifications]; |
| 164 [button setPostsFrameChangedNotifications:NO]; | 171 [button setPostsFrameChangedNotifications:NO]; |
| 165 [button setFrame:buttonFrame]; | 172 [button setFrame:buttonFrame]; |
| 166 [button setPostsFrameChangedNotifications:didPost]; | 173 [button setPostsFrameChangedNotifications:didPost]; |
| 167 } | 174 } |
| 168 | 175 |
| 169 // The tab strip view covers our window buttons. So we add hit testing here | 176 // The tab strip view covers our window buttons. So we add hit testing here |
| 170 // to find them properly and return them to the accessibility system. | 177 // to find them properly and return them to the accessibility system. |
| 171 - (id)accessibilityHitTest:(NSPoint)point { | 178 - (id)accessibilityHitTest:(NSPoint)point { |
| 172 NSPoint windowPoint = ui::ConvertPointFromScreenToWindow(self, point); | 179 NSPoint windowPoint = ui::ConvertPointFromScreenToWindow(self, point); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 [self childWindowsDidChange]; | 363 [self childWindowsDidChange]; |
| 357 } | 364 } |
| 358 | 365 |
| 359 - (void)childWindowsDidChange { | 366 - (void)childWindowsDidChange { |
| 360 id delegate = [self delegate]; | 367 id delegate = [self delegate]; |
| 361 if ([delegate respondsToSelector:@selector(childWindowsDidChange)]) | 368 if ([delegate respondsToSelector:@selector(childWindowsDidChange)]) |
| 362 [delegate childWindowsDidChange]; | 369 [delegate childWindowsDidChange]; |
| 363 } | 370 } |
| 364 | 371 |
| 365 @end | 372 @end |
| OLD | NEW |