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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/button_decoration.mm

Issue 12042002: Alternate NTP: Add search token to omnibox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 7 years, 10 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 | Annotate | Revision Log
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 #include <cmath> 5 #include <cmath>
6 6
7 #import "chrome/browser/ui/cocoa/location_bar/button_decoration.h" 7 #import "chrome/browser/ui/cocoa/location_bar/button_decoration.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 17 matching lines...) Expand all
28 ButtonState old_state = GetButtonState(); 28 ButtonState old_state = GetButtonState();
29 SetButtonState(ButtonDecoration::kButtonStatePressed); 29 SetButtonState(ButtonDecoration::kButtonStatePressed);
30 [control_view setNeedsDisplay:YES]; 30 [control_view setNeedsDisplay:YES];
31 31
32 bool handled = OnMousePressed(frame); 32 bool handled = OnMousePressed(frame);
33 33
34 SetButtonState(old_state); 34 SetButtonState(old_state);
35 return handled; 35 return handled;
36 } 36 }
37 37
38 CGFloat ButtonDecoration::GetWidthForSpace(CGFloat width) { 38 CGFloat ButtonDecoration::GetWidthForSpace(CGFloat width, CGFloat text_width) {
39 NSImage* image = GetImage(); 39 NSImage* image = GetImage();
40 if (image) { 40 if (image) {
41 const CGFloat image_width = [image size].width; 41 const CGFloat image_width = [image size].width;
42 if (image_width <= width) 42 if (image_width <= width)
43 return image_width; 43 return image_width;
44 } 44 }
45 return kOmittedWidth; 45 return kOmittedWidth;
46 } 46 }
47 47
48 void ButtonDecoration::DrawInFrame(NSRect frame, NSView* control_view) { 48 void ButtonDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 DCHECK(hover_image_.get()); 89 DCHECK(hover_image_.get());
90 return hover_image_.get(); 90 return hover_image_.get();
91 case kButtonStatePressed: 91 case kButtonStatePressed:
92 DCHECK(pressed_image_.get()); 92 DCHECK(pressed_image_.get());
93 return pressed_image_.get(); 93 return pressed_image_.get();
94 default: 94 default:
95 NOTREACHED(); 95 NOTREACHED();
96 return nil; 96 return nil;
97 } 97 }
98 } 98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698