OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/profiles/profile_signin_confirmation_view_contr
oller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_contr
oller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h" | 21 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h" |
22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
23 #include "chrome/grit/chromium_strings.h" | 23 #include "chrome/grit/chromium_strings.h" |
24 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
25 #include "google_apis/gaia/gaia_auth_util.h" | 25 #include "google_apis/gaia/gaia_auth_util.h" |
26 #include "skia/ext/skia_utils_mac.h" | 26 #include "skia/ext/skia_utils_mac.h" |
27 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" | 27 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" |
28 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" | 28 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
29 #import "ui/base/cocoa/controls/hyperlink_text_view.h" | 29 #import "ui/base/cocoa/controls/hyperlink_text_view.h" |
30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/native_theme/native_theme_mac.h" |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 const CGFloat kWindowMinWidth = 500; | 35 const CGFloat kWindowMinWidth = 500; |
35 const CGFloat kButtonGap = 6; | 36 const CGFloat kButtonGap = 6; |
36 const CGFloat kDialogAlertBarBorderWidth = 1; | 37 const CGFloat kDialogAlertBarBorderWidth = 1; |
37 | 38 |
38 // Determine the frame required to fit the content of a string. Uses the | 39 // Determine the frame required to fit the content of a string. Uses the |
39 // provided height and width as preferred dimensions, where a value of | 40 // provided height and width as preferred dimensions, where a value of |
40 // 0.0 indicates no preference. | 41 // 0.0 indicates no preference. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // Dialog minimum width must include the padding. | 238 // Dialog minimum width must include the padding. |
238 const CGFloat minWidth = | 239 const CGFloat minWidth = |
239 kWindowMinWidth - 2 * chrome_style::kHorizontalPadding; | 240 kWindowMinWidth - 2 * chrome_style::kHorizontalPadding; |
240 const CGFloat width = std::max(minWidth, | 241 const CGFloat width = std::max(minWidth, |
241 std::max(buttonsWidth, titleWidth)); | 242 std::max(buttonsWidth, titleWidth)); |
242 const CGFloat dialogWidth = width + 2 * chrome_style::kHorizontalPadding; | 243 const CGFloat dialogWidth = width + 2 * chrome_style::kHorizontalPadding; |
243 | 244 |
244 // Now setup the prompt and explanation text using the computed width. | 245 // Now setup the prompt and explanation text using the computed width. |
245 | 246 |
246 // Prompt box. | 247 // Prompt box. |
247 [promptBox_ setBorderColor:gfx::SkColorToCalibratedNSColor( | 248 [promptBox_ |
248 ui::GetSigninConfirmationPromptBarColor( | 249 setBorderColor:gfx::SkColorToCalibratedNSColor( |
249 ui::kSigninConfirmationPromptBarBorderAlpha))]; | 250 ui::GetSigninConfirmationPromptBarColor( |
| 251 ui::NativeThemeMac::instance(), |
| 252 ui::kSigninConfirmationPromptBarBorderAlpha))]; |
250 [promptBox_ setBorderWidth:kDialogAlertBarBorderWidth]; | 253 [promptBox_ setBorderWidth:kDialogAlertBarBorderWidth]; |
251 [promptBox_ setFillColor:gfx::SkColorToCalibratedNSColor( | 254 [promptBox_ |
252 ui::GetSigninConfirmationPromptBarColor( | 255 setFillColor:gfx::SkColorToCalibratedNSColor( |
253 ui::kSigninConfirmationPromptBarBackgroundAlpha))]; | 256 ui::GetSigninConfirmationPromptBarColor( |
| 257 ui::NativeThemeMac::instance(), |
| 258 ui::kSigninConfirmationPromptBarBackgroundAlpha))]; |
254 [promptBox_ setBoxType:NSBoxCustom]; | 259 [promptBox_ setBoxType:NSBoxCustom]; |
255 [promptBox_ setTitlePosition:NSNoTitle]; | 260 [promptBox_ setTitlePosition:NSNoTitle]; |
256 [[self view] addSubview:promptBox_]; | 261 [[self view] addSubview:promptBox_]; |
257 | 262 |
258 // Prompt text. | 263 // Prompt text. |
259 size_t offset; | 264 size_t offset; |
260 const base::string16 domain = | 265 const base::string16 domain = |
261 base::ASCIIToUTF16(gaia::ExtractDomainName(username_)); | 266 base::ASCIIToUTF16(gaia::ExtractDomainName(username_)); |
262 const base::string16 username = base::ASCIIToUTF16(username_); | 267 const base::string16 username = base::ASCIIToUTF16(username_); |
263 const base::string16 prompt_text = | 268 const base::string16 prompt_text = |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 | 448 |
444 - (NSButton*)createProfileButton { | 449 - (NSButton*)createProfileButton { |
445 return createProfileButton_.get(); | 450 return createProfileButton_.get(); |
446 } | 451 } |
447 | 452 |
448 - (NSTextView*)explanationField { | 453 - (NSTextView*)explanationField { |
449 return explanationField_.get(); | 454 return explanationField_.get(); |
450 } | 455 } |
451 | 456 |
452 @end | 457 @end |
OLD | NEW |