| 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/infobars/infobar_controller.h" | 5 #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 [[closeButton_ cell] setImageID:IDR_CLOSE_1 | 64 [[closeButton_ cell] setImageID:IDR_CLOSE_1 |
| 65 forButtonState:image_button_cell::kDefaultState]; | 65 forButtonState:image_button_cell::kDefaultState]; |
| 66 [[closeButton_ cell] setImageID:IDR_CLOSE_1_H | 66 [[closeButton_ cell] setImageID:IDR_CLOSE_1_H |
| 67 forButtonState:image_button_cell::kHoverState]; | 67 forButtonState:image_button_cell::kHoverState]; |
| 68 [[closeButton_ cell] setImageID:IDR_CLOSE_1_P | 68 [[closeButton_ cell] setImageID:IDR_CLOSE_1_P |
| 69 forButtonState:image_button_cell::kPressedState]; | 69 forButtonState:image_button_cell::kPressedState]; |
| 70 [[closeButton_ cell] setImageID:IDR_CLOSE_1 | 70 [[closeButton_ cell] setImageID:IDR_CLOSE_1 |
| 71 forButtonState:image_button_cell::kDisabledState]; | 71 forButtonState:image_button_cell::kDisabledState]; |
| 72 | 72 |
| 73 if (delegate_->GetIcon()) { | 73 if (!delegate_->GetIcon().IsEmpty()) { |
| 74 [image_ setImage:delegate_->GetIcon()->ToNSImage()]; | 74 [image_ setImage:delegate_->GetIcon().ToNSImage()]; |
| 75 } else { | 75 } else { |
| 76 // No icon, remove it from the view and grow the textfield to include the | 76 // No icon, remove it from the view and grow the textfield to include the |
| 77 // space. | 77 // space. |
| 78 NSRect imageFrame = [image_ frame]; | 78 NSRect imageFrame = [image_ frame]; |
| 79 NSRect labelFrame = [labelPlaceholder_ frame]; | 79 NSRect labelFrame = [labelPlaceholder_ frame]; |
| 80 labelFrame.size.width += NSMinX(imageFrame) - NSMinX(labelFrame); | 80 labelFrame.size.width += NSMinX(imageFrame) - NSMinX(labelFrame); |
| 81 labelFrame.origin.x = imageFrame.origin.x; | 81 labelFrame.origin.x = imageFrame.origin.x; |
| 82 [image_ removeFromSuperview]; | 82 [image_ removeFromSuperview]; |
| 83 image_ = nil; | 83 image_ = nil; |
| 84 [labelPlaceholder_ setFrame:labelFrame]; | 84 [labelPlaceholder_ setFrame:labelFrame]; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if (!windowController) { | 269 if (!windowController) { |
| 270 // This should only happen in unit tests. | 270 // This should only happen in unit tests. |
| 271 return NSZeroPoint; | 271 return NSZeroPoint; |
| 272 } | 272 } |
| 273 | 273 |
| 274 LocationBarViewMac* locationBar = [windowController locationBarBridge]; | 274 LocationBarViewMac* locationBar = [windowController locationBarBridge]; |
| 275 return locationBar->GetPageInfoBubblePoint(); | 275 return locationBar->GetPageInfoBubblePoint(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 @end | 278 @end |
| OLD | NEW |