OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/cocoa/status_bubble_mac.h" | 5 #include "chrome/browser/cocoa/status_bubble_mac.h" |
6 | 6 |
7 #include "app/gfx/text_elider.h" | 7 #include "app/gfx/text_elider.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 void StatusBubbleMac::SetURL(const GURL& url, const std::wstring& languages) { | 78 void StatusBubbleMac::SetURL(const GURL& url, const std::wstring& languages) { |
79 Create(); | 79 Create(); |
80 | 80 |
81 NSRect frame = [window_ frame]; | 81 NSRect frame = [window_ frame]; |
82 int text_width = static_cast<int>(frame.size.width - | 82 int text_width = static_cast<int>(frame.size.width - |
83 kTextPositionX - | 83 kTextPositionX - |
84 kTextPadding); | 84 kTextPadding); |
85 NSFont* font = [[window_ contentView] font]; | 85 NSFont* font = [[window_ contentView] font]; |
86 ChromeFont font_chr = | 86 gfx::Font font_chr = |
87 ChromeFont::CreateFont(base::SysNSStringToWide([font fontName]), | 87 gfx::Font::CreateFont(base::SysNSStringToWide([font fontName]), |
88 [font pointSize]); | 88 [font pointSize]); |
89 | 89 |
90 std::wstring status = gfx::ElideUrl(url, font_chr, text_width, languages); | 90 std::wstring status = gfx::ElideUrl(url, font_chr, text_width, languages); |
91 NSString* status_ns = base::SysWideToNSString(status); | 91 NSString* status_ns = base::SysWideToNSString(status); |
92 | 92 |
93 SetStatus(status_ns, true); | 93 SetStatus(status_ns, true); |
94 } | 94 } |
95 | 95 |
96 void StatusBubbleMac::SetStatus(NSString* status, bool is_url) { | 96 void StatusBubbleMac::SetStatus(NSString* status, bool is_url) { |
97 NSString** main; | 97 NSString** main; |
98 NSString** backup; | 98 NSString** backup; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 316 |
317 NSDictionary* textDict = [NSDictionary dictionaryWithObjectsAndKeys: | 317 NSDictionary* textDict = [NSDictionary dictionaryWithObjectsAndKeys: |
318 textFont, NSFontAttributeName, | 318 textFont, NSFontAttributeName, |
319 textShadow, NSShadowAttributeName, | 319 textShadow, NSShadowAttributeName, |
320 nil]; | 320 nil]; |
321 [content_ drawAtPoint:NSMakePoint(kTextPositionX, kTextPositionY) | 321 [content_ drawAtPoint:NSMakePoint(kTextPositionX, kTextPositionY) |
322 withAttributes:textDict]; | 322 withAttributes:textDict]; |
323 } | 323 } |
324 | 324 |
325 @end | 325 @end |
OLD | NEW |