Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: chrome/browser/ui/cocoa/download/download_shelf_view.mm

Issue 686993002: MacViews: Rename files to avoid duplicate basename conflicts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "chrome/browser/ui/cocoa/download/download_shelf_view.h"
6
7 #include "chrome/browser/themes/theme_properties.h"
8 #include "chrome/browser/themes/theme_service.h"
9 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
10 #import "chrome/browser/ui/cocoa/themed_window.h"
11 #import "chrome/browser/ui/cocoa/view_id_util.h"
12 #import "ui/base/cocoa/nsgraphics_context_additions.h"
13 #import "ui/base/cocoa/nsview_additions.h"
14 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
15
16 @implementation DownloadShelfView
17
18 // For programmatic instantiations in unit tests.
19 - (id)initWithFrame:(NSRect)frameRect {
20 if ((self = [super initWithFrame:frameRect])) {
21 [self setShowsDivider:NO];
22 }
23 return self;
24 }
25
26 // For nib instantiations in production.
27 - (id)initWithCoder:(NSCoder*)decoder {
28 if ((self = [super initWithCoder:decoder])) {
29 [self setShowsDivider:NO];
30 }
31 return self;
32 }
33
34 - (NSColor*)strokeColor {
35 BOOL isActive = [[self window] isMainWindow];
36 ui::ThemeProvider* themeProvider = [[self window] themeProvider];
37 return themeProvider ? themeProvider->GetNSColor(
38 isActive ? ThemeProperties::COLOR_TOOLBAR_STROKE :
39 ThemeProperties::COLOR_TOOLBAR_STROKE_INACTIVE) :
40 [NSColor blackColor];
41 }
42
43 - (void)drawRect:(NSRect)rect {
44 gfx::ScopedNSGraphicsContextSaveGState saveGState;
45
46 // We want our backgrounds for the shelf to be phased from the upper
47 // left hand corner of the view. Offset it by tab height so that the
48 // background matches the toolbar background.
49 NSPoint phase = NSMakePoint(
50 0, NSHeight([self bounds]) + [TabStripController defaultTabHeight]);
51 [[NSGraphicsContext currentContext]
52 cr_setPatternPhase:phase forView:[self cr_viewBeingDrawnTo]];
53 [self drawBackgroundWithOpaque:YES];
54
55 // Draw top stroke
56 [[self strokeColor] set];
57 NSRect borderRect, contentRect;
58 NSDivideRect([self bounds], &borderRect, &contentRect, [self cr_lineWidth],
59 NSMaxYEdge);
60 NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);
61
62 // Draw the top highlight
63 ThemeService* themeProvider =
64 static_cast<ThemeService*>([[self window] themeProvider]);
65 if (themeProvider) {
66 int resourceName = themeProvider->UsingDefaultTheme() ?
67 ThemeProperties::COLOR_TOOLBAR_BEZEL : ThemeProperties::COLOR_TOOLBAR;
68 NSColor* highlightColor = themeProvider->GetNSColor(resourceName);
69 if (highlightColor) {
70 [highlightColor set];
71 borderRect.origin.y -= [self cr_lineWidth];
72 NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);
73 }
74 }
75 }
76
77 // Mouse down events on the download shelf should not allow dragging the parent
78 // window around.
79 - (BOOL)mouseDownCanMoveWindow {
80 return NO;
81 }
82
83 - (ViewID)viewID {
84 return VIEW_ID_DOWNLOAD_SHELF;
85 }
86
87 - (BOOL)isOpaque {
88 return YES;
89 }
90
91 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_shelf_view.h ('k') | chrome/browser/ui/cocoa/download/download_shelf_view_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698