Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/download/download_item_controller.h" | 5 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/mac/mac_util.h" | |
| 8 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 14 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 14 #include "chrome/browser/download/download_item_model.h" | 15 #include "chrome/browser/download/download_item_model.h" |
| 15 #include "chrome/browser/download/download_shelf_context_menu.h" | 16 #include "chrome/browser/download/download_shelf_context_menu.h" |
| 16 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s ampling.h" | 17 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s ampling.h" |
| 17 #import "chrome/browser/themes/theme_properties.h" | 18 #import "chrome/browser/themes/theme_properties.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 [self updateExperienceSamplingEvent:ExperienceSamplingEvent::kIgnore]; | 123 [self updateExperienceSamplingEvent:ExperienceSamplingEvent::kIgnore]; |
| 123 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 124 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 124 [progressView_ setController:nil]; | 125 [progressView_ setController:nil]; |
| 125 [[self view] removeFromSuperview]; | 126 [[self view] removeFromSuperview]; |
| 126 [super dealloc]; | 127 [super dealloc]; |
| 127 } | 128 } |
| 128 | 129 |
| 129 - (void)awakeFromNib { | 130 - (void)awakeFromNib { |
| 130 [progressView_ setController:self]; | 131 [progressView_ setController:self]; |
| 131 | 132 |
| 133 // The new system font on Yosemite brings slightly different font metrics. | |
| 134 // The |dangerousDownloadLabel_| is 22 points high with two lines of text | |
| 135 // in the nib, but on Yosemite it needs 24 points to hold that same text. | |
| 136 // See http://crbug.com/454782 . | |
| 137 if (base::mac::IsOSYosemite()) { | |
|
Nico
2015/02/11 03:45:53
IsOSYosemiteOrLater() probably?
shrike
2015/02/11 16:45:35
Done.
| |
| 138 NSRect frame = [dangerousDownloadLabel_ frame]; | |
| 139 frame.origin.y -= 1.0; | |
| 140 frame.size.height += 2.0; | |
| 141 [dangerousDownloadLabel_ setFrame:frame]; | |
| 142 } | |
| 132 GTMUILocalizerAndLayoutTweaker* localizerAndLayoutTweaker = | 143 GTMUILocalizerAndLayoutTweaker* localizerAndLayoutTweaker = |
| 133 [[[GTMUILocalizerAndLayoutTweaker alloc] init] autorelease]; | 144 [[[GTMUILocalizerAndLayoutTweaker alloc] init] autorelease]; |
| 134 [localizerAndLayoutTweaker applyLocalizer:localizer_ tweakingUI:[self view]]; | 145 [localizerAndLayoutTweaker applyLocalizer:localizer_ tweakingUI:[self view]]; |
| 135 | 146 |
| 136 [self setStateFromDownload:bridge_->download_model()]; | 147 [self setStateFromDownload:bridge_->download_model()]; |
| 137 | 148 |
| 138 bridge_->LoadIcon(); | 149 bridge_->LoadIcon(); |
| 139 [self updateToolTip]; | 150 [self updateToolTip]; |
| 140 } | 151 } |
| 141 | 152 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 base::scoped_nsobject<DownloadShelfContextMenuController> menuController( | 384 base::scoped_nsobject<DownloadShelfContextMenuController> menuController( |
| 374 [[DownloadShelfContextMenuController alloc] | 385 [[DownloadShelfContextMenuController alloc] |
| 375 initWithItemController:self | 386 initWithItemController:self |
| 376 withDelegate:nil]); | 387 withDelegate:nil]); |
| 377 [NSMenu popUpContextMenu:[menuController menu] | 388 [NSMenu popUpContextMenu:[menuController menu] |
| 378 withEvent:[NSApp currentEvent] | 389 withEvent:[NSApp currentEvent] |
| 379 forView:[self view]]; | 390 forView:[self view]]; |
| 380 } | 391 } |
| 381 | 392 |
| 382 @end | 393 @end |
| OLD | NEW |