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 14 matching lines...) Expand all Loading... |
25 #include "ui/gfx/image/image_skia_util_mac.h" | 25 #include "ui/gfx/image/image_skia_util_mac.h" |
26 #include "ui/gfx/text_elider.h" | 26 #include "ui/gfx/text_elider.h" |
27 #include "ui/native_theme/native_theme.h" | 27 #include "ui/native_theme/native_theme.h" |
28 | 28 |
29 const CGFloat kMinimumWidth = 460; | 29 const CGFloat kMinimumWidth = 460; |
30 const CGFloat kMaximumWidth = 1000; | 30 const CGFloat kMaximumWidth = 1000; |
31 const CGFloat kHorizontalMargin = 10; | 31 const CGFloat kHorizontalMargin = 10; |
32 const CGFloat kPadding = 5; | 32 const CGFloat kPadding = 5; |
33 const CGFloat kPaddingLeft = 10; | 33 const CGFloat kPaddingLeft = 10; |
34 const CGFloat kWindowCornerRadius = 2; | 34 const CGFloat kWindowCornerRadius = 2; |
| 35 const CGFloat kWindowAlphaValue = 0.85; |
35 | 36 |
36 @interface ScreenCaptureNotificationController() | 37 @interface ScreenCaptureNotificationController() |
37 - (void)hide; | 38 - (void)hide; |
38 - (void)populateWithText:(const base::string16&)text; | 39 - (void)populateWithText:(const base::string16&)text; |
39 @end | 40 @end |
40 | 41 |
41 @interface ScreenCaptureNotificationView : NSView | 42 @interface ScreenCaptureNotificationView : NSView |
42 @end | 43 @end |
43 | 44 |
44 @interface WindowGripView : NSImageView | 45 @interface WindowGripView : NSImageView |
(...skipping 28 matching lines...) Expand all Loading... |
73 | 74 |
74 @implementation ScreenCaptureNotificationController | 75 @implementation ScreenCaptureNotificationController |
75 - (id)initWithCallback:(const base::Closure&)stop_callback | 76 - (id)initWithCallback:(const base::Closure&)stop_callback |
76 text:(const base::string16&)text { | 77 text:(const base::string16&)text { |
77 base::scoped_nsobject<NSWindow> window( | 78 base::scoped_nsobject<NSWindow> window( |
78 [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater | 79 [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater |
79 styleMask:NSBorderlessWindowMask | 80 styleMask:NSBorderlessWindowMask |
80 backing:NSBackingStoreBuffered | 81 backing:NSBackingStoreBuffered |
81 defer:NO]); | 82 defer:NO]); |
82 [window setReleasedWhenClosed:NO]; | 83 [window setReleasedWhenClosed:NO]; |
| 84 [window setAlphaValue:kWindowAlphaValue]; |
83 [window setBackgroundColor:[NSColor clearColor]]; | 85 [window setBackgroundColor:[NSColor clearColor]]; |
84 [window setOpaque:NO]; | 86 [window setOpaque:NO]; |
85 [window setHasShadow:YES]; | 87 [window setHasShadow:YES]; |
86 [window setLevel:NSStatusWindowLevel]; | 88 [window setLevel:NSStatusWindowLevel]; |
87 [window setMovableByWindowBackground:YES]; | 89 [window setMovableByWindowBackground:YES]; |
88 [window setDelegate:self]; | 90 [window setDelegate:self]; |
89 | 91 |
90 self = [super initWithWindow:window]; | 92 self = [super initWithWindow:window]; |
91 if (self) { | 93 if (self) { |
92 stop_callback_ = stop_callback; | 94 stop_callback_ = stop_callback; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 self = [super | 243 self = [super |
242 initWithFrame:NSMakeRect(0, 0, gripImage.Width(), gripImage.Height())]; | 244 initWithFrame:NSMakeRect(0, 0, gripImage.Width(), gripImage.Height())]; |
243 [self setImage:gripImage.ToNSImage()]; | 245 [self setImage:gripImage.ToNSImage()]; |
244 return self; | 246 return self; |
245 } | 247 } |
246 | 248 |
247 - (BOOL)mouseDownCanMoveWindow { | 249 - (BOOL)mouseDownCanMoveWindow { |
248 return YES; | 250 return YES; |
249 } | 251 } |
250 @end | 252 @end |
OLD | NEW |