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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm

Issue 900613003: Mac: Make it easier for views to correctly draw with a theme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gyp
Patch Set: Created 5 years, 10 months 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
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/bookmarks/bookmark_button.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 // CoreAnimation is enabled. 409 // CoreAnimation is enabled.
410 return YES; 410 return YES;
411 } 411 }
412 412
413 - (void)drawRect:(NSRect)rect { 413 - (void)drawRect:(NSRect)rect {
414 NSView* bookmarkBarToolbarView = [[self superview] superview]; 414 NSView* bookmarkBarToolbarView = [[self superview] superview];
415 [self cr_drawUsingAncestor:bookmarkBarToolbarView inRect:(NSRect)rect]; 415 [self cr_drawUsingAncestor:bookmarkBarToolbarView inRect:(NSRect)rect];
416 [super drawRect:rect]; 416 [super drawRect:rect];
417 } 417 }
418 418
419 // ThemedWindowDrawing implementation.
420
421 - (void)windowDidChangeTheme {
422 [self setNeedsDisplay:YES];
423 }
424
425 - (void)windowDidChangeActive {
426 [self setNeedsDisplay:YES];
427 }
428
419 @end 429 @end
420 430
421 @implementation BookmarkButton(Private) 431 @implementation BookmarkButton(Private)
422 432
423 433
424 - (void)installCustomTrackingArea { 434 - (void)installCustomTrackingArea {
425 const NSTrackingAreaOptions options = 435 const NSTrackingAreaOptions options =
426 NSTrackingActiveAlways | 436 NSTrackingActiveAlways |
427 NSTrackingMouseEnteredAndExited | 437 NSTrackingMouseEnteredAndExited |
428 NSTrackingEnabledDuringMouseDrag; 438 NSTrackingEnabledDuringMouseDrag;
(...skipping 27 matching lines...) Expand all
456 [[cell clipPathForFrame:bounds inView:self] setClip]; 466 [[cell clipPathForFrame:bounds inView:self] setClip];
457 [cell drawWithFrame:bounds inView:self]; 467 [cell drawWithFrame:bounds inView:self];
458 468
459 CGContextEndTransparencyLayer(cgContext); 469 CGContextEndTransparencyLayer(cgContext);
460 [image unlockFocus]; 470 [image unlockFocus];
461 471
462 return image.autorelease(); 472 return image.autorelease();
463 } 473 }
464 474
465 @end // @implementation BookmarkButton(Private) 475 @end // @implementation BookmarkButton(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698