| OLD | NEW |
| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 if (backgroundColor_) { | 426 if (backgroundColor_) { |
| 427 [backgroundColor_ set]; | 427 [backgroundColor_ set]; |
| 428 NSRectFill(rect); | 428 NSRectFill(rect); |
| 429 } else { | 429 } else { |
| 430 [self cr_drawUsingAncestor:bookmarkBarToolbarView inRect:(NSRect)rect]; | 430 [self cr_drawUsingAncestor:bookmarkBarToolbarView inRect:(NSRect)rect]; |
| 431 } | 431 } |
| 432 [super drawRect:rect]; | 432 [super drawRect:rect]; |
| 433 } | 433 } |
| 434 | 434 |
| 435 - (void)updateIconToMatchTheme { | 435 - (void)updateIconToMatchTheme { |
| 436 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
| 437 return; | |
| 438 } | |
| 439 | |
| 440 // During testing, the window might not be a browser window, and the | 436 // During testing, the window might not be a browser window, and the |
| 441 // superview might not be a BookmarkBarView. | 437 // superview might not be a BookmarkBarView. |
| 442 if (![[self window] respondsToSelector:@selector(hasDarkTheme)] || | 438 if (![[self window] respondsToSelector:@selector(hasDarkTheme)] || |
| 443 ![[self superview] isKindOfClass:[BookmarkBarView class]]) { | 439 ![[self superview] isKindOfClass:[BookmarkBarView class]]) { |
| 444 return; | 440 return; |
| 445 } | 441 } |
| 446 | 442 |
| 447 BookmarkBarView* bookmarkBarView = | 443 BookmarkBarView* bookmarkBarView = |
| 448 base::mac::ObjCCastStrict<BookmarkBarView>([self superview]); | 444 base::mac::ObjCCastStrict<BookmarkBarView>([self superview]); |
| 449 BookmarkBarController* bookmarkBarController = [bookmarkBarView controller]; | 445 BookmarkBarController* bookmarkBarController = [bookmarkBarView controller]; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 [[cell clipPathForFrame:bounds inView:self] setClip]; | 518 [[cell clipPathForFrame:bounds inView:self] setClip]; |
| 523 [cell drawWithFrame:bounds inView:self]; | 519 [cell drawWithFrame:bounds inView:self]; |
| 524 | 520 |
| 525 CGContextEndTransparencyLayer(cgContext); | 521 CGContextEndTransparencyLayer(cgContext); |
| 526 [image unlockFocus]; | 522 [image unlockFocus]; |
| 527 | 523 |
| 528 return image.autorelease(); | 524 return image.autorelease(); |
| 529 } | 525 } |
| 530 | 526 |
| 531 @end | 527 @end |
| OLD | NEW |