| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_bar_toolbar_view.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/search/search.h" | 7 #include "chrome/browser/search/search.h" |
| 8 #include "chrome/browser/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.h" |
| 9 #include "chrome/browser/themes/theme_service.h" | 9 #include "chrome/browser/themes/theme_service.h" |
| 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 13 #include "skia/ext/skia_utils_mac.h" | 13 #include "skia/ext/skia_utils_mac.h" |
| 14 #import "ui/base/cocoa/nsview_additions.h" | 14 #import "ui/base/cocoa/nsview_additions.h" |
| 15 #include "ui/base/theme_provider.h" | 15 #include "ui/base/theme_provider.h" |
| 16 #include "ui/gfx/canvas_skia_paint.h" | 16 #include "ui/gfx/canvas_skia_paint.h" |
| 17 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
| 18 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 18 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 19 | 19 |
| 20 @interface BookmarkBarToolbarView (Private) | 20 @interface BookmarkBarToolbarView (Private) |
| 21 - (void)drawAsDetachedBubble:(NSRect)dirtyRect; | 21 - (void)drawAsDetachedBubble:(NSRect)dirtyRect; |
| 22 @end | 22 @end |
| 23 | 23 |
| 24 @implementation BookmarkBarToolbarView | 24 @implementation BookmarkBarToolbarView |
| 25 | 25 |
| 26 - (BOOL)isOpaque { | 26 - (BOOL)isOpaque { |
| 27 return [controller_ isInState:BookmarkBar::DETACHED]; | 27 // -drawRect: calls -drawAsDetachedBubble: or -drawBackground:, both of which |
| 28 // fill the dirty rect with an opaque color. |
| 29 return YES; |
| 28 } | 30 } |
| 29 | 31 |
| 30 - (void)resetCursorRects { | 32 - (void)resetCursorRects { |
| 31 NSCursor *arrow = [NSCursor arrowCursor]; | 33 NSCursor *arrow = [NSCursor arrowCursor]; |
| 32 [self addCursorRect:[self visibleRect] cursor:arrow]; | 34 [self addCursorRect:[self visibleRect] cursor:arrow]; |
| 33 [arrow setOnMouseEntered:YES]; | 35 [arrow setOnMouseEntered:YES]; |
| 34 } | 36 } |
| 35 | 37 |
| 36 - (void)drawRect:(NSRect)dirtyRect { | 38 - (void)drawRect:(NSRect)dirtyRect { |
| 37 if ([controller_ isInState:BookmarkBar::DETACHED] || | 39 if ([controller_ isInState:BookmarkBar::DETACHED] || |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 strokeColor = [[self strokeColor] blendedColorWithFraction:morph | 83 strokeColor = [[self strokeColor] blendedColorWithFraction:morph |
| 82 ofColor:strokeColor]; | 84 ofColor:strokeColor]; |
| 83 strokeColor = [strokeColor colorWithAlphaComponent:0.5]; | 85 strokeColor = [strokeColor colorWithAlphaComponent:0.5]; |
| 84 [strokeColor set]; | 86 [strokeColor set]; |
| 85 NSRectFillUsingOperation(NSIntersectionRect(strokeRect, dirtyRect), | 87 NSRectFillUsingOperation(NSIntersectionRect(strokeRect, dirtyRect), |
| 86 NSCompositeSourceOver); | 88 NSCompositeSourceOver); |
| 87 } | 89 } |
| 88 } | 90 } |
| 89 | 91 |
| 90 @end // @implementation BookmarkBarToolbarView | 92 @end // @implementation BookmarkBarToolbarView |
| OLD | NEW |