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

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

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 6 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/location_bar/location_bar_decoration.h" 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" 9 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
10 10
11 const CGFloat LocationBarDecoration::kOmittedWidth = 0.0; 11 const CGFloat LocationBarDecoration::kOmittedWidth = 0.0;
12 12
13 bool LocationBarDecoration::IsVisible() const { 13 bool LocationBarDecoration::IsVisible() const {
14 return visible_; 14 return visible_;
15 } 15 }
16 16
17 void LocationBarDecoration::SetVisible(bool visible) { 17 void LocationBarDecoration::SetVisible(bool visible) {
18 visible_ = visible; 18 visible_ = visible;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 NSFont* LocationBarDecoration::GetFont() const { 70 NSFont* LocationBarDecoration::GetFont() const {
71 return OmniboxViewMac::GetFieldFont(); 71 return OmniboxViewMac::GetFieldFont();
72 } 72 }
73 73
74 // static 74 // static
75 void LocationBarDecoration::DrawLabel(NSString* label, 75 void LocationBarDecoration::DrawLabel(NSString* label,
76 NSDictionary* attributes, 76 NSDictionary* attributes,
77 const NSRect& frame) { 77 const NSRect& frame) {
78 scoped_nsobject<NSAttributedString> str( 78 base::scoped_nsobject<NSAttributedString> str(
79 [[NSAttributedString alloc] initWithString:label attributes:attributes]); 79 [[NSAttributedString alloc] initWithString:label attributes:attributes]);
80 DrawAttributedString(str, frame); 80 DrawAttributedString(str, frame);
81 } 81 }
82 82
83 // static 83 // static
84 void LocationBarDecoration::DrawAttributedString(NSAttributedString* str, 84 void LocationBarDecoration::DrawAttributedString(NSAttributedString* str,
85 const NSRect& frame) { 85 const NSRect& frame) {
86 NSRect text_rect = frame; 86 NSRect text_rect = frame;
87 text_rect.size.height = [str size].height; 87 text_rect.size.height = [str size].height;
88 text_rect.origin.y = roundf(NSMidY(frame) - NSHeight(text_rect) / 2.0) - 1; 88 text_rect.origin.y = roundf(NSMidY(frame) - NSHeight(text_rect) / 2.0) - 1;
89 [str drawInRect:text_rect]; 89 [str drawInRect:text_rect];
90 } 90 }
91 91
92 // static 92 // static
93 NSSize LocationBarDecoration::GetLabelSize(NSString* label, 93 NSSize LocationBarDecoration::GetLabelSize(NSString* label,
94 NSDictionary* attributes) { 94 NSDictionary* attributes) {
95 return [label sizeWithAttributes:attributes]; 95 return [label sizeWithAttributes:attributes];
96 } 96 }
97 97
98 ButtonDecoration* LocationBarDecoration::AsButtonDecoration() { 98 ButtonDecoration* LocationBarDecoration::AsButtonDecoration() {
99 return NULL; 99 return NULL;
100 } 100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698