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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_loading_shield_controller.mm

Issue 152343006: Clean-up: Replaces obsolete Font/FontList methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/autofill/autofill_loading_shield_controller.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_loading_shield_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" 10 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
11 #include "chrome/browser/ui/autofill/loading_animation.h" 11 #include "chrome/browser/ui/autofill/loading_animation.h"
12 #include "ui/base/resource/resource_bundle.h" 12 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/gfx/animation/animation_delegate.h" 13 #include "ui/gfx/animation/animation_delegate.h"
14 #include "ui/gfx/font_list.h"
14 15
15 namespace { 16 namespace {
16 17
17 // Horizontal spacing between the animated dots. 18 // Horizontal spacing between the animated dots.
18 // Using a negative spacing creates an ellipsis-like effect. 19 // Using a negative spacing creates an ellipsis-like effect.
19 // TODO(isherman): Consider using the recipe below instead: 20 // TODO(isherman): Consider using the recipe below instead:
20 // Create NSBezierPath 21 // Create NSBezierPath
21 // -[NSBezierPath appendBezierPathWithGlyph:inFont:] 22 // -[NSBezierPath appendBezierPathWithGlyph:inFont:]
22 // -[NSBezierPath bounds] 23 // -[NSBezierPath bounds]
23 const CGFloat kDotsHorizontalPadding = -6; 24 const CGFloat kDotsHorizontalPadding = -6;
(...skipping 23 matching lines...) Expand all
47 AutofillLoadingShieldController* const controller_; // weak, owns |this| 48 AutofillLoadingShieldController* const controller_; // weak, owns |this|
48 }; 49 };
49 50
50 51
51 @implementation AutofillLoadingShieldController 52 @implementation AutofillLoadingShieldController
52 53
53 - (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate { 54 - (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate {
54 if (self = [super initWithNibName:nil bundle:nil]) { 55 if (self = [super initWithNibName:nil bundle:nil]) {
55 delegate_ = delegate; 56 delegate_ = delegate;
56 57
57 gfx::Font font = ui::ResourceBundle::GetSharedInstance(). 58 const gfx::FontList& font_list =
58 GetFont(ui::ResourceBundle::BaseFont).DeriveFont(8); 59 ui::ResourceBundle::GetSharedInstance().GetFontList(
59 NSFont* native_font = font.GetNativeFont(); 60 ui::ResourceBundle::LargeFont);
61 NSFont* native_font = font_list.GetPrimaryFont().GetNativeFont();
60 animationDriver_.reset( 62 animationDriver_.reset(
61 new AutofillLoadingAnimationBridge(self, font.GetHeight())); 63 new AutofillLoadingAnimationBridge(self, font_list.GetHeight()));
62 64
63 base::scoped_nsobject<NSBox> view([[NSBox alloc] initWithFrame:NSZeroRect]); 65 base::scoped_nsobject<NSBox> view([[NSBox alloc] initWithFrame:NSZeroRect]);
64 [view setBoxType:NSBoxCustom]; 66 [view setBoxType:NSBoxCustom];
65 [view setBorderType:NSNoBorder]; 67 [view setBorderType:NSNoBorder];
66 [view setContentViewMargins:NSZeroSize]; 68 [view setContentViewMargins:NSZeroSize];
67 [view setTitlePosition:NSNoTitle]; 69 [view setTitlePosition:NSNoTitle];
68 70
69 message_.reset([[NSTextField alloc] initWithFrame:NSZeroRect]); 71 message_.reset([[NSTextField alloc] initWithFrame:NSZeroRect]);
70 [message_ setFont:native_font]; 72 [message_ setFont:native_font];
71 [message_ setEditable:NO]; 73 [message_ setEditable:NO];
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 (const autofill::LoadingAnimation&)animation { 160 (const autofill::LoadingAnimation&)animation {
159 for (NSView* dot in dots_.get()) { 161 for (NSView* dot in dots_.get()) {
160 NSPoint origin = [dot frame].origin; 162 NSPoint origin = [dot frame].origin;
161 origin.y = [message_ frame].origin.y - 163 origin.y = [message_ frame].origin.y -
162 animation.GetCurrentValueForDot([dot tag]); 164 animation.GetCurrentValueForDot([dot tag]);
163 [dot setFrameOrigin:origin]; 165 [dot setFrameOrigin:origin];
164 } 166 }
165 } 167 }
166 168
167 @end 169 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698