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

Side by Side Diff: chrome/browser/ui/cocoa/infobars/infobar_controller.mm

Issue 12742013: Inconsistent use of [x] close panel icon. Code changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_217094_3
Patch Set: Created 7 years, 9 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 unified diff | Download patch
OLDNEW
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"
11 #import "chrome/browser/ui/cocoa/animatable_view.h" 11 #import "chrome/browser/ui/cocoa/animatable_view.h"
12 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
13 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" 13 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h"
14 #import "chrome/browser/ui/cocoa/image_button_cell.h" 14 #import "chrome/browser/ui/cocoa/image_button_cell.h"
15 #include "chrome/browser/ui/cocoa/infobars/infobar.h" 15 #include "chrome/browser/ui/cocoa/infobars/infobar.h"
16 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" 16 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h"
17 #import "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" 17 #import "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h"
18 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 18 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
19 #include "grit/theme_resources.h"
19 #include "grit/ui_resources.h" 20 #include "grit/ui_resources.h"
20 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
21 22
22 namespace { 23 namespace {
23 // Durations set to match the default SlideAnimation duration. 24 // Durations set to match the default SlideAnimation duration.
24 const float kAnimateOpenDuration = 0.12; 25 const float kAnimateOpenDuration = 0.12;
25 const float kAnimateCloseDuration = 0.12; 26 const float kAnimateCloseDuration = 0.12;
26 } 27 }
27 28
28 @interface InfoBarController (PrivateMethods) 29 @interface InfoBarController (PrivateMethods)
(...skipping 24 matching lines...) Expand all
53 owner_ = owner; 54 owner_ = owner;
54 } 55 }
55 return self; 56 return self;
56 } 57 }
57 58
58 // All infobars have an icon, so we set up the icon in the base class 59 // All infobars have an icon, so we set up the icon in the base class
59 // awakeFromNib. 60 // awakeFromNib.
60 - (void)awakeFromNib { 61 - (void)awakeFromNib {
61 DCHECK(delegate_); 62 DCHECK(delegate_);
62 63
63 [[closeButton_ cell] setImageID:IDR_CLOSE_BAR 64 [[closeButton_ cell] setImageID:IDR_CLOSE_1
64 forButtonState:image_button_cell::kDefaultState]; 65 forButtonState:image_button_cell::kDefaultState];
65 [[closeButton_ cell] setImageID:IDR_CLOSE_BAR_H 66 [[closeButton_ cell] setImageID:IDR_CLOSE_1_H
66 forButtonState:image_button_cell::kHoverState]; 67 forButtonState:image_button_cell::kHoverState];
67 [[closeButton_ cell] setImageID:IDR_CLOSE_BAR_P 68 [[closeButton_ cell] setImageID:IDR_CLOSE_1_P
68 forButtonState:image_button_cell::kPressedState]; 69 forButtonState:image_button_cell::kPressedState];
69 [[closeButton_ cell] setImageID:IDR_CLOSE_BAR 70 [[closeButton_ cell] setImageID:IDR_CLOSE_1
70 forButtonState:image_button_cell::kDisabledState]; 71 forButtonState:image_button_cell::kDisabledState];
71 72
72 if (delegate_->GetIcon()) { 73 if (delegate_->GetIcon()) {
73 [image_ setImage:delegate_->GetIcon()->ToNSImage()]; 74 [image_ setImage:delegate_->GetIcon()->ToNSImage()];
74 } else { 75 } else {
75 // 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
76 // space. 77 // space.
77 NSRect imageFrame = [image_ frame]; 78 NSRect imageFrame = [image_ frame];
78 NSRect labelFrame = [labelPlaceholder_ frame]; 79 NSRect labelFrame = [labelPlaceholder_ frame];
79 labelFrame.size.width += NSMinX(imageFrame) - NSMinX(labelFrame); 80 labelFrame.size.width += NSMinX(imageFrame) - NSMinX(labelFrame);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 if (!windowController) { 269 if (!windowController) {
269 // This should only happen in unit tests. 270 // This should only happen in unit tests.
270 return NSZeroPoint; 271 return NSZeroPoint;
271 } 272 }
272 273
273 LocationBarViewMac* locationBar = [windowController locationBarBridge]; 274 LocationBarViewMac* locationBar = [windowController locationBarBridge];
274 return locationBar->GetPageInfoBubblePoint(); 275 return locationBar->GetPageInfoBubblePoint();
275 } 276 }
276 277
277 @end 278 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/hover_close_button.mm ('k') | chrome/browser/ui/gtk/confirm_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698