| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/toolbar_actions_bar_bubble_mac.h" | 5 #import "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 11 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" | 11 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" |
| 12 #include "skia/ext/skia_utils_mac.h" | 12 #include "skia/ext/skia_utils_mac.h" |
| 13 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" | 13 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 15 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" | 15 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
| 16 #import "ui/base/cocoa/hover_button.h" | 16 #import "ui/base/cocoa/hover_button.h" |
| 17 #import "ui/base/cocoa/window_size_constants.h" | 17 #import "ui/base/cocoa/window_size_constants.h" |
| 18 #include "ui/native_theme/native_theme.h" | 18 #include "ui/native_theme/native_theme.h" |
| 19 #include "ui/native_theme/native_theme_mac.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 BOOL g_animations_enabled = false; | 22 BOOL g_animations_enabled = false; |
| 22 CGFloat kMinWidth = 320.0; | 23 CGFloat kMinWidth = 320.0; |
| 23 } | 24 } |
| 24 | 25 |
| 25 @interface ToolbarActionsBarBubbleMac () | 26 @interface ToolbarActionsBarBubbleMac () |
| 26 | 27 |
| 27 // Handles the notification that the window will close. | 28 // Handles the notification that the window will close. |
| 28 - (void)windowWillClose:(NSNotification*)notification; | 29 - (void)windowWillClose:(NSNotification*)notification; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 initWithContentRect:ui::kWindowSizeDeterminedLater | 68 initWithContentRect:ui::kWindowSizeDeterminedLater |
| 68 styleMask:NSBorderlessWindowMask | 69 styleMask:NSBorderlessWindowMask |
| 69 backing:NSBackingStoreBuffered | 70 backing:NSBackingStoreBuffered |
| 70 defer:NO]); | 71 defer:NO]); |
| 71 if ((self = [super initWithWindow:window | 72 if ((self = [super initWithWindow:window |
| 72 parentWindow:parentWindow | 73 parentWindow:parentWindow |
| 73 anchoredAt:anchorPoint])) { | 74 anchoredAt:anchorPoint])) { |
| 74 acknowledged_ = NO; | 75 acknowledged_ = NO; |
| 75 delegate_ = delegate.Pass(); | 76 delegate_ = delegate.Pass(); |
| 76 | 77 |
| 77 ui::NativeTheme* nativeTheme = ui::NativeTheme::instance(); | 78 ui::NativeTheme* nativeTheme = ui::NativeThemeMac::instance(); |
| 78 [[self bubble] setAlignment:info_bubble::kAlignArrowToAnchor]; | 79 [[self bubble] setAlignment:info_bubble::kAlignArrowToAnchor]; |
| 79 [[self bubble] setArrowLocation:info_bubble::kTopRight]; | 80 [[self bubble] setArrowLocation:info_bubble::kTopRight]; |
| 80 [[self bubble] setBackgroundColor: | 81 [[self bubble] setBackgroundColor: |
| 81 gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor( | 82 gfx::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor( |
| 82 ui::NativeTheme::kColorId_DialogBackground))]; | 83 ui::NativeTheme::kColorId_DialogBackground))]; |
| 83 | 84 |
| 84 if (!g_animations_enabled) | 85 if (!g_animations_enabled) |
| 85 [window setAllowedAnimations:info_bubble::kAnimateNone]; | 86 [window setAllowedAnimations:info_bubble::kAnimateNone]; |
| 86 | 87 |
| 87 [self layout]; | 88 [self layout]; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } else { | 332 } else { |
| 332 DCHECK_EQ(sender, actionButton_); | 333 DCHECK_EQ(sender, actionButton_); |
| 333 action = ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE; | 334 action = ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE; |
| 334 } | 335 } |
| 335 acknowledged_ = YES; | 336 acknowledged_ = YES; |
| 336 delegate_->OnBubbleClosed(action); | 337 delegate_->OnBubbleClosed(action); |
| 337 [self close]; | 338 [self close]; |
| 338 } | 339 } |
| 339 | 340 |
| 340 @end | 341 @end |
| OLD | NEW |