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

Side by Side Diff: chrome/browser/cocoa/status_bubble_mac.mm

Issue 3083022: Rework gfx::Font by moving platform-specific code into inner classes.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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) 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 <limits> 7 #include <limits>
8 8
9 #include "app/text_elider.h" 9 #include "app/text_elider.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 void StatusBubbleMac::SetURL(const GURL& url, const std::wstring& languages) { 121 void StatusBubbleMac::SetURL(const GURL& url, const std::wstring& languages) {
122 Create(); 122 Create();
123 123
124 NSRect frame = [window_ frame]; 124 NSRect frame = [window_ frame];
125 int text_width = static_cast<int>(frame.size.width - 125 int text_width = static_cast<int>(frame.size.width -
126 kBubbleViewTextPositionX - 126 kBubbleViewTextPositionX -
127 kTextPadding); 127 kTextPadding);
128 NSFont* font = [[window_ contentView] font]; 128 NSFont* font = [[window_ contentView] font];
129 gfx::Font font_chr = 129 gfx::Font font_chr(base::SysNSStringToWide([font fontName]),
130 gfx::Font::CreateFont(base::SysNSStringToWide([font fontName]), 130 [font pointSize]);
131 [font pointSize]);
132 131
133 std::wstring status = gfx::ElideUrl(url, font_chr, text_width, languages); 132 std::wstring status = gfx::ElideUrl(url, font_chr, text_width, languages);
134 133
135 SetText(status, true); 134 SetText(status, true);
136 } 135 }
137 136
138 void StatusBubbleMac::SetText(const std::wstring& text, bool is_url) { 137 void StatusBubbleMac::SetText(const std::wstring& text, bool is_url) {
139 // The status bubble allows the status and URL strings to be set 138 // The status bubble allows the status and URL strings to be set
140 // independently. Whichever was set non-empty most recently will be the 139 // independently. Whichever was set non-empty most recently will be the
141 // value displayed. When both are empty, the status bubble hides. 140 // value displayed. When both are empty, the status bubble hides.
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 DCHECK(parent_); 562 DCHECK(parent_);
564 563
565 NSSize size = NSMakeSize(0, kWindowHeight); 564 NSSize size = NSMakeSize(0, kWindowHeight);
566 size = [[parent_ contentView] convertSize:size toView:nil]; 565 size = [[parent_ contentView] convertSize:size toView:nil];
567 566
568 NSRect rect = [parent_ frame]; 567 NSRect rect = [parent_ frame];
569 rect.size.height = size.height; 568 rect.size.height = size.height;
570 rect.size.width = static_cast<int>(kWindowWidthPercent * rect.size.width); 569 rect.size.width = static_cast<int>(kWindowWidthPercent * rect.size.width);
571 return rect; 570 return rect;
572 } 571 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/location_bar/ev_bubble_decoration.mm ('k') | chrome/browser/gtk/bookmark_utils_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698