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 <utility> |
| 8 |
7 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
8 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 11 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 12 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
11 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" | 13 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" |
12 #include "skia/ext/skia_utils_mac.h" | 14 #include "skia/ext/skia_utils_mac.h" |
13 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" | 15 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" |
14 #include "third_party/skia/include/core/SkColor.h" | 16 #include "third_party/skia/include/core/SkColor.h" |
15 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" | 17 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
16 #import "ui/base/cocoa/hover_button.h" | 18 #import "ui/base/cocoa/hover_button.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 base::scoped_nsobject<InfoBubbleWindow> window( | 68 base::scoped_nsobject<InfoBubbleWindow> window( |
67 [[InfoBubbleWindow alloc] | 69 [[InfoBubbleWindow alloc] |
68 initWithContentRect:ui::kWindowSizeDeterminedLater | 70 initWithContentRect:ui::kWindowSizeDeterminedLater |
69 styleMask:NSBorderlessWindowMask | 71 styleMask:NSBorderlessWindowMask |
70 backing:NSBackingStoreBuffered | 72 backing:NSBackingStoreBuffered |
71 defer:NO]); | 73 defer:NO]); |
72 if ((self = [super initWithWindow:window | 74 if ((self = [super initWithWindow:window |
73 parentWindow:parentWindow | 75 parentWindow:parentWindow |
74 anchoredAt:anchorPoint])) { | 76 anchoredAt:anchorPoint])) { |
75 acknowledged_ = NO; | 77 acknowledged_ = NO; |
76 delegate_ = delegate.Pass(); | 78 delegate_ = std::move(delegate); |
77 | 79 |
78 ui::NativeTheme* nativeTheme = ui::NativeThemeMac::instance(); | 80 ui::NativeTheme* nativeTheme = ui::NativeThemeMac::instance(); |
79 [[self bubble] setAlignment:info_bubble::kAlignArrowToAnchor]; | 81 [[self bubble] setAlignment:info_bubble::kAlignArrowToAnchor]; |
80 [[self bubble] setArrowLocation:info_bubble::kTopRight]; | 82 [[self bubble] setArrowLocation:info_bubble::kTopRight]; |
81 [[self bubble] setBackgroundColor: | 83 [[self bubble] setBackgroundColor: |
82 skia::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor( | 84 skia::SkColorToCalibratedNSColor(nativeTheme->GetSystemColor( |
83 ui::NativeTheme::kColorId_DialogBackground))]; | 85 ui::NativeTheme::kColorId_DialogBackground))]; |
84 | 86 |
85 if (!g_animations_enabled) | 87 if (!g_animations_enabled) |
86 [window setAllowedAnimations:info_bubble::kAnimateNone]; | 88 [window setAllowedAnimations:info_bubble::kAnimateNone]; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } else { | 334 } else { |
333 DCHECK_EQ(sender, actionButton_); | 335 DCHECK_EQ(sender, actionButton_); |
334 action = ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE; | 336 action = ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE; |
335 } | 337 } |
336 acknowledged_ = YES; | 338 acknowledged_ = YES; |
337 delegate_->OnBubbleClosed(action); | 339 delegate_->OnBubbleClosed(action); |
338 [self close]; | 340 [self close]; |
339 } | 341 } |
340 | 342 |
341 @end | 343 @end |
OLD | NEW |