OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/location_bar/location_bar_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #import "base/mac/mac_util.h" | 9 #import "base/mac/mac_util.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 + (NSImage*)imageForId:(gfx::VectorIconId)vectorIconId | 121 + (NSImage*)imageForId:(gfx::VectorIconId)vectorIconId |
122 color:(SkColor)vectorIconColor { | 122 color:(SkColor)vectorIconColor { |
123 if (vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTP && | 123 if (vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTP && |
124 vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID && | 124 vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID && |
125 vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID) { | 125 vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID) { |
126 return NSImageFromImageSkiaWithColorSpace( | 126 return NSImageFromImageSkiaWithColorSpace( |
127 gfx::CreateVectorIcon(vectorIconId, kDefaultIconSize, vectorIconColor), | 127 gfx::CreateVectorIcon(vectorIconId, kDefaultIconSize, vectorIconColor), |
128 base::mac::GetSRGBColorSpace()); | 128 base::mac::GetSRGBColorSpace()); |
129 } | 129 } |
130 | 130 |
131 base::scoped_nsobject<LocationBarImageRep> imageRep = | 131 base::scoped_nsobject<LocationBarImageRep> imageRep( |
132 [[LocationBarImageRep alloc] | 132 [[LocationBarImageRep alloc] |
133 initWithDrawSelector:@selector(drawLocationBarIcon:) | 133 initWithDrawSelector:@selector(drawLocationBarIcon:) |
134 delegate:[LocationBarImageRep class]]; | 134 delegate:[LocationBarImageRep class]]); |
135 [imageRep setIconId:vectorIconId]; | 135 [imageRep setIconId:vectorIconId]; |
136 [imageRep setFillColor:skia::SkColorToSRGBNSColor(vectorIconColor)]; | 136 [imageRep setFillColor:skia::SkColorToSRGBNSColor(vectorIconColor)]; |
137 | 137 |
138 // Create the image from the image rep. | 138 // Create the image from the image rep. |
139 const NSSize kImageSize = NSMakeSize(kDefaultIconSize, kDefaultIconSize); | 139 const NSSize kImageSize = NSMakeSize(kDefaultIconSize, kDefaultIconSize); |
140 NSImage* locationBarImage = | 140 NSImage* locationBarImage = |
141 [[[NSImage alloc] initWithSize:kImageSize] autorelease]; | 141 [[[NSImage alloc] initWithSize:kImageSize] autorelease]; |
142 [locationBarImage setCacheMode:NSImageCacheAlways]; | 142 [locationBarImage setCacheMode:NSImageCacheAlways]; |
143 [locationBarImage addRepresentation:imageRep]; | 143 [locationBarImage addRepresentation:imageRep]; |
144 | 144 |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 | 969 |
970 return zoom_decoration_->UpdateIfNecessary( | 970 return zoom_decoration_->UpdateIfNecessary( |
971 ui_zoom::ZoomController::FromWebContents(web_contents), | 971 ui_zoom::ZoomController::FromWebContents(web_contents), |
972 default_zoom_changed, IsLocationBarDark()); | 972 default_zoom_changed, IsLocationBarDark()); |
973 } | 973 } |
974 | 974 |
975 void LocationBarViewMac::OnDefaultZoomLevelChanged() { | 975 void LocationBarViewMac::OnDefaultZoomLevelChanged() { |
976 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) | 976 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) |
977 OnDecorationsChanged(); | 977 OnDecorationsChanged(); |
978 } | 978 } |
OLD | NEW |