| OLD | NEW |
| 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 #import "chrome/browser/ui/cocoa/intents/web_intent_progress_view_controller.h" | 5 #import "chrome/browser/ui/cocoa/intents/web_intent_progress_view_controller.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
| 8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_u
tils.h" | 8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_u
tils.h" |
| 9 #import "chrome/browser/ui/cocoa/flipped_view.h" | 9 #import "chrome/browser/ui/cocoa/flipped_view.h" |
| 10 #import "chrome/browser/ui/cocoa/spinner_progress_indicator.h" | 10 #import "chrome/browser/ui/cocoa/spinner_progress_indicator.h" |
| 11 #import "chrome/browser/ui/constrained_window.h" | 11 #import "chrome/browser/ui/constrained_window.h" |
| 12 #import "chrome/browser/ui/constrained_window_constants.h" |
| 12 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
| 13 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 14 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 // Vertical space between the progress indicator and the message text field. | 19 // Vertical space between the progress indicator and the message text field. |
| 19 const CGFloat kProgressMessageFieldSpacing = 15.0; | 20 const CGFloat kProgressMessageFieldSpacing = 15.0; |
| 20 | 21 |
| 21 // Joins the two strings with a space between them. | 22 // Joins the two strings with a space between them. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 [progressIndicator_ setFrame:progressFrame]; | 109 [progressIndicator_ setFrame:progressFrame]; |
| 109 | 110 |
| 110 textFrame.origin.x = NSMinX(innerFrame); | 111 textFrame.origin.x = NSMinX(innerFrame); |
| 111 textFrame.origin.y = NSMaxY(progressFrame) + kProgressMessageFieldSpacing; | 112 textFrame.origin.y = NSMaxY(progressFrame) + kProgressMessageFieldSpacing; |
| 112 [messageTextField_ setFrame:textFrame]; | 113 [messageTextField_ setFrame:textFrame]; |
| 113 } | 114 } |
| 114 | 115 |
| 115 - (void)updateTextFieldAndResizeToWidth:(CGFloat)width { | 116 - (void)updateTextFieldAndResizeToWidth:(CGFloat)width { |
| 116 NSAttributedString* title = constrained_window::GetAttributedLabelString( | 117 NSAttributedString* title = constrained_window::GetAttributedLabelString( |
| 117 title_, | 118 title_, |
| 118 ConstrainedWindow::kBoldTextFontStyle, | 119 ConstrainedWindowConstants::kBoldTextFontStyle, |
| 119 NSCenterTextAlignment, | 120 NSCenterTextAlignment, |
| 120 NSLineBreakByWordWrapping); | 121 NSLineBreakByWordWrapping); |
| 121 NSAttributedString* message = constrained_window::GetAttributedLabelString( | 122 NSAttributedString* message = constrained_window::GetAttributedLabelString( |
| 122 message_, | 123 message_, |
| 123 ConstrainedWindow::kTextFontStyle, | 124 ConstrainedWindowConstants::kTextFontStyle, |
| 124 NSCenterTextAlignment, | 125 NSCenterTextAlignment, |
| 125 NSLineBreakByWordWrapping); | 126 NSLineBreakByWordWrapping); |
| 126 [messageTextField_ setAttributedStringValue:JoinString(title, message)]; | 127 [messageTextField_ setAttributedStringValue:JoinString(title, message)]; |
| 127 | 128 |
| 128 NSRect frame = NSZeroRect; | 129 NSRect frame = NSZeroRect; |
| 129 frame.size.width = width; | 130 frame.size.width = width; |
| 130 [messageTextField_ setFrame:frame]; | 131 [messageTextField_ setFrame:frame]; |
| 131 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField: | 132 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField: |
| 132 messageTextField_]; | 133 messageTextField_]; |
| 133 } | 134 } |
| 134 | 135 |
| 135 @end | 136 @end |
| OLD | NEW |