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" |
11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
14 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
15 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
16 #include "skia/ext/skia_utils_mac.h" | 16 #include "skia/ext/skia_utils_mac.h" |
17 #import "ui/base/cocoa/controls/blue_label_button.h" | 17 #import "ui/base/cocoa/controls/blue_label_button.h" |
18 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" | 18 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
19 #include "ui/base/cocoa/window_size_constants.h" | 19 #include "ui/base/cocoa/window_size_constants.h" |
20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
21 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
22 #include "ui/gfx/font_list.h" | 22 #include "ui/gfx/font_list.h" |
23 #include "ui/gfx/image/image_skia.h" | 23 #include "ui/gfx/image/image_skia.h" |
24 #include "ui/gfx/image/image_skia_util_mac.h" | 24 #include "ui/gfx/image/image_skia_util_mac.h" |
25 #include "ui/gfx/text_elider.h" | 25 #include "ui/gfx/text_elider.h" |
26 #include "ui/native_theme/native_theme.h" | 26 #include "ui/native_theme/native_theme.h" |
| 27 #include "ui/native_theme/native_theme_mac.h" |
27 | 28 |
28 const CGFloat kMinimumWidth = 460; | 29 const CGFloat kMinimumWidth = 460; |
29 const CGFloat kMaximumWidth = 1000; | 30 const CGFloat kMaximumWidth = 1000; |
30 const CGFloat kHorizontalMargin = 10; | 31 const CGFloat kHorizontalMargin = 10; |
31 const CGFloat kPaddingVertical = 5; | 32 const CGFloat kPaddingVertical = 5; |
32 const CGFloat kPaddingHorizontal = 10; | 33 const CGFloat kPaddingHorizontal = 10; |
33 const CGFloat kWindowCornerRadius = 2; | 34 const CGFloat kWindowCornerRadius = 2; |
34 const CGFloat kWindowAlphaValue = 0.85; | 35 const CGFloat kWindowAlphaValue = 0.85; |
35 | 36 |
36 @interface ScreenCaptureNotificationController() | 37 @interface ScreenCaptureNotificationController() |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 230 |
230 - (void)windowWillClose:(NSNotification*)notification { | 231 - (void)windowWillClose:(NSNotification*)notification { |
231 [self stopSharing:nil]; | 232 [self stopSharing:nil]; |
232 } | 233 } |
233 | 234 |
234 @end | 235 @end |
235 | 236 |
236 @implementation ScreenCaptureNotificationView | 237 @implementation ScreenCaptureNotificationView |
237 | 238 |
238 - (void)drawRect:(NSRect)dirtyRect { | 239 - (void)drawRect:(NSRect)dirtyRect { |
239 [gfx::SkColorToSRGBNSColor(ui::NativeTheme::instance()->GetSystemColor( | 240 [gfx::SkColorToSRGBNSColor(ui::NativeThemeMac::instance()->GetSystemColor( |
240 ui::NativeTheme::kColorId_DialogBackground)) set]; | 241 ui::NativeTheme::kColorId_DialogBackground)) set]; |
241 [[NSBezierPath bezierPathWithRoundedRect:[self bounds] | 242 [[NSBezierPath bezierPathWithRoundedRect:[self bounds] |
242 xRadius:kWindowCornerRadius | 243 xRadius:kWindowCornerRadius |
243 yRadius:kWindowCornerRadius] fill]; | 244 yRadius:kWindowCornerRadius] fill]; |
244 } | 245 } |
245 | 246 |
246 @end | 247 @end |
247 | 248 |
248 @implementation WindowGripView | 249 @implementation WindowGripView |
249 - (WindowGripView*)init { | 250 - (WindowGripView*)init { |
250 gfx::Image gripImage = | 251 gfx::Image gripImage = |
251 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 252 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
252 IDR_SCREEN_CAPTURE_NOTIFICATION_GRIP, | 253 IDR_SCREEN_CAPTURE_NOTIFICATION_GRIP, |
253 ui::ResourceBundle::RTL_DISABLED); | 254 ui::ResourceBundle::RTL_DISABLED); |
254 self = [super | 255 self = [super |
255 initWithFrame:NSMakeRect(0, 0, gripImage.Width(), gripImage.Height())]; | 256 initWithFrame:NSMakeRect(0, 0, gripImage.Width(), gripImage.Height())]; |
256 [self setImage:gripImage.ToNSImage()]; | 257 [self setImage:gripImage.ToNSImage()]; |
257 return self; | 258 return self; |
258 } | 259 } |
259 | 260 |
260 - (BOOL)mouseDownCanMoveWindow { | 261 - (BOOL)mouseDownCanMoveWindow { |
261 return YES; | 262 return YES; |
262 } | 263 } |
263 @end | 264 @end |
OLD | NEW |