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

Unified Diff: chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm

Issue 12315069: Mac: Update zoom bubble UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm b/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm
index bfb87d125bc067932367aa020086156f8e81cf8e..6b9d0800b6e0deb0eb5b7f5752ab87d481e0dd65 100644
--- a/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/location_bar/action_box_menu_bubble_controller.mm
@@ -19,10 +19,12 @@
#include "chrome/common/extensions/extension_constants.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "skia/ext/skia_utils_mac.h"
#import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia_util_mac.h"
+#include "ui/native_theme/native_theme.h"
@interface ActionBoxMenuBubbleController (Private)
- (id)highlightedItem;
@@ -33,6 +35,10 @@
- (void)highlightItem:(ActionBoxMenuItemController*)newItem;
@end
+@interface ActionBoxMenuItemView (Private)
+- (NSColor*)highlightedMenuItemBackgroundColor;
+@end
+
namespace {
// Some reasonable values for the menu geometry.
@@ -98,6 +104,7 @@ class ExtensionIconLoaderBridge : public extensions::IconImage::Observer {
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO]);
+ [window setAllowedAnimations:info_bubble::kAnimateNone];
if (self = [super initWithWindow:window
parentWindow:parent
anchoredAt:point]) {
@@ -106,9 +113,10 @@ class ExtensionIconLoaderBridge : public extensions::IconImage::Observer {
[[self bubble] setAlignment:info_bubble::kAlignRightEdgeToAnchorEdge];
[[self bubble] setArrowLocation:info_bubble::kNoArrow];
+ ui::NativeTheme* nativeTheme = ui::NativeTheme::instance();
[[self bubble] setBackgroundColor:
- [NSColor colorWithDeviceWhite:(251.0f/255.0f)
- alpha:1.0]];
+ gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
+ ui::NativeTheme::kColorId_DialogBackground))];
[self performLayout];
}
return self;
@@ -158,14 +166,17 @@ class ExtensionIconLoaderBridge : public extensions::IconImage::Observer {
CGFloat minX = NSMinX([contentView bounds]);
for (int i = model_->GetItemCount() - 1; i >= 0; --i) {
if (model_->GetTypeAt(i) == ui::MenuModel::TYPE_SEPARATOR) {
+ const CGFloat kSeparatorHeight = 1.0;
// Only supports one separator.
DCHECK(!separatorView);
- yOffset += kVerticalPadding;
+ yOffset += kVerticalPadding + kSeparatorHeight;
separatorView.reset([[NSBox alloc]
- initWithFrame:NSMakeRect(0, yOffset, width, 1)]);
- [separatorView setBorderType:NSNoBorder];
+ initWithFrame:NSMakeRect(0, yOffset, width, kSeparatorHeight)]);
[separatorView setBoxType:NSBoxCustom];
- [separatorView setFillColor:[NSColor grayColor]];
+ ui::NativeTheme* nativeTheme = ui::NativeTheme::instance();
+ [separatorView setBorderColor:
+ gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
+ ui::NativeTheme::kColorId_MenuSeparatorColor))];
[contentView addSubview:separatorView];
yOffset += kVerticalPadding;
} else {
@@ -396,7 +407,10 @@ class ExtensionIconLoaderBridge : public extensions::IconImage::Observer {
- (void)drawRect:(NSRect)dirtyRect {
NSColor* backgroundColor = nil;
if ([viewController_ isHighlighted]) {
- backgroundColor = [NSColor colorWithDeviceWhite:0.0 alpha:kSelectionAlpha];
+ ui::NativeTheme* nativeTheme = ui::NativeTheme::instance();
+ backgroundColor = gfx::SkColorToCalibratedNSColor(
+ nativeTheme->GetSystemColor(
+ ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor));
} else {
backgroundColor = [NSColor clearColor];
}
@@ -450,4 +464,10 @@ class ExtensionIconLoaderBridge : public extensions::IconImage::Observer {
[super accessibilityPerformAction:action];
}
+- (NSColor*)highlightedMenuItemBackgroundColor {
+ ui::NativeTheme* nativeTheme = ui::NativeTheme::instance();
+ return gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor(
+ ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor));
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698