| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/screen_capture_notification_ui_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/screen_capture_notification_ui_cocoa.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 [gripView setFrameOrigin:NSMakePoint(kPaddingHorizontal, | 172 [gripView setFrameOrigin:NSMakePoint(kPaddingHorizontal, |
| 173 (totalHeight - gripHeight) / 2)]; | 173 (totalHeight - gripHeight) / 2)]; |
| 174 | 174 |
| 175 // Create text label. | 175 // Create text label. |
| 176 int maximumWidth = | 176 int maximumWidth = |
| 177 std::min(kMaximumWidth, NSWidth([[NSScreen mainScreen] visibleFrame])); | 177 std::min(kMaximumWidth, NSWidth([[NSScreen mainScreen] visibleFrame])); |
| 178 int maxLabelWidth = maximumWidth - kPaddingHorizontal * 2 - | 178 int maxLabelWidth = maximumWidth - kPaddingHorizontal * 2 - |
| 179 kHorizontalMargin * 2 - gripWidth - buttonsWidth; | 179 kHorizontalMargin * 2 - gripWidth - buttonsWidth; |
| 180 gfx::FontList font_list; | 180 gfx::FontList font_list; |
| 181 base::string16 elidedText = | 181 base::string16 elidedText = |
| 182 ElideText(text, font_list, maxLabelWidth, gfx::ELIDE_IN_MIDDLE); | 182 ElideText(text, font_list, maxLabelWidth, gfx::ELIDE_MIDDLE); |
| 183 NSString* statusText = base::SysUTF16ToNSString(elidedText); | 183 NSString* statusText = base::SysUTF16ToNSString(elidedText); |
| 184 base::scoped_nsobject<NSTextField> statusTextField( | 184 base::scoped_nsobject<NSTextField> statusTextField( |
| 185 [[NSTextField alloc] initWithFrame:ui::kWindowSizeDeterminedLater]); | 185 [[NSTextField alloc] initWithFrame:ui::kWindowSizeDeterminedLater]); |
| 186 [statusTextField setEditable:NO]; | 186 [statusTextField setEditable:NO]; |
| 187 [statusTextField setSelectable:NO]; | 187 [statusTextField setSelectable:NO]; |
| 188 [statusTextField setDrawsBackground:NO]; | 188 [statusTextField setDrawsBackground:NO]; |
| 189 [statusTextField setBezeled:NO]; | 189 [statusTextField setBezeled:NO]; |
| 190 [statusTextField setStringValue:statusText]; | 190 [statusTextField setStringValue:statusText]; |
| 191 [statusTextField setFont:font_list.GetPrimaryFont().GetNativeFont()]; | 191 [statusTextField setFont:font_list.GetPrimaryFont().GetNativeFont()]; |
| 192 [statusTextField sizeToFit]; | 192 [statusTextField sizeToFit]; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 self = [super | 255 self = [super |
| 256 initWithFrame:NSMakeRect(0, 0, gripImage.Width(), gripImage.Height())]; | 256 initWithFrame:NSMakeRect(0, 0, gripImage.Width(), gripImage.Height())]; |
| 257 [self setImage:gripImage.ToNSImage()]; | 257 [self setImage:gripImage.ToNSImage()]; |
| 258 return self; | 258 return self; |
| 259 } | 259 } |
| 260 | 260 |
| 261 - (BOOL)mouseDownCanMoveWindow { | 261 - (BOOL)mouseDownCanMoveWindow { |
| 262 return YES; | 262 return YES; |
| 263 } | 263 } |
| 264 @end | 264 @end |
| OLD | NEW |