OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
13 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" | 13 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" |
14 #include "chrome/browser/ui/chrome_style.h" | 14 #include "chrome/browser/ui/chrome_style.h" |
15 #import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h" | |
16 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" | 15 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" |
17 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h" | 16 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h" |
17 #import "chrome/browser/ui/cocoa/autofill/autofill_header.h" | |
18 #import "chrome/browser/ui/cocoa/autofill/autofill_input_field.h" | 18 #import "chrome/browser/ui/cocoa/autofill/autofill_input_field.h" |
19 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" | 19 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" |
20 #import "chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.h" | 20 #import "chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.h" |
21 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" | 21 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" |
22 #import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h" | 22 #import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h" |
23 #import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h" | 23 #import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h" |
24 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" | 24 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" |
25 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h" | 25 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h" |
26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
27 #include "content/public/browser/web_contents_view.h" | 27 #include "content/public/browser/web_contents_view.h" |
28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
29 #import "ui/base/cocoa/flipped_view.h" | 29 #import "ui/base/cocoa/flipped_view.h" |
30 #include "ui/base/cocoa/window_size_constants.h" | 30 #include "ui/base/cocoa/window_size_constants.h" |
31 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
32 #include "ui/gfx/platform_font.h" | 32 #include "ui/gfx/platform_font.h" |
33 | 33 |
34 const CGFloat kAccountChooserHeight = 20.0; | |
35 const CGFloat kMinimumContentsHeight = 101; | 34 const CGFloat kMinimumContentsHeight = 101; |
36 | 35 |
37 // Height of all decorations & paddings on main dialog together. | 36 // Height of all decorations & paddings on main dialog together. |
38 const CGFloat kDecorationHeight = kAccountChooserHeight + | 37 const CGFloat kDecorationHeight = autofill::kAccountChooserHeight + |
groby-ooo-7-16
2013/11/20 23:51:44
If this is part of the header, why do we need this
Ilya Sherman
2013/11/22 05:01:13
Done.
| |
39 autofill::kDetailVerticalPadding + | 38 autofill::kDetailVerticalPadding + |
40 chrome_style::kClientBottomPadding + | 39 chrome_style::kClientBottomPadding + |
41 chrome_style::kTitleTopPadding; | 40 chrome_style::kTitleTopPadding; |
42 | 41 |
43 namespace autofill { | 42 namespace autofill { |
44 | 43 |
45 // static | 44 // static |
46 AutofillDialogView* AutofillDialogView::Create( | 45 AutofillDialogView* AutofillDialogView::Create( |
47 AutofillDialogViewDelegate* delegate) { | 46 AutofillDialogViewDelegate* delegate) { |
48 return new AutofillDialogCocoa(delegate); | 47 return new AutofillDialogCocoa(delegate); |
49 } | 48 } |
50 | 49 |
51 AutofillDialogCocoa::AutofillDialogCocoa(AutofillDialogViewDelegate* delegate) | 50 AutofillDialogCocoa::AutofillDialogCocoa(AutofillDialogViewDelegate* delegate) |
52 : close_weak_ptr_factory_(this), | 51 : close_weak_ptr_factory_(this), |
53 delegate_(delegate) { | 52 delegate_(delegate) { |
54 } | 53 } |
55 | 54 |
56 AutofillDialogCocoa::~AutofillDialogCocoa() { | 55 AutofillDialogCocoa::~AutofillDialogCocoa() { |
57 // Cancel potential relayout requests, since the AutofillDialogController | 56 // Cancel potential relayout requests, since the AutofillDialogController |
58 // is about to go away, but relayout requests assume it will still exist. | 57 // is about to go away, but relayout requests assume it will still exist. |
59 [sheet_delegate_ cancelRelayout]; | 58 [sheet_delegate_ cancelRelayout]; |
60 } | 59 } |
61 | 60 |
62 void AutofillDialogCocoa::Show() { | 61 void AutofillDialogCocoa::Show() { |
63 // This should only be called once. | 62 // This should only be called once. |
64 DCHECK(!sheet_delegate_.get()); | 63 DCHECK(!sheet_delegate_.get()); |
65 sheet_delegate_.reset([[AutofillDialogWindowController alloc] | 64 sheet_delegate_.reset([[AutofillDialogWindowController alloc] |
66 initWithWebContents:delegate_->GetWebContents() | 65 initWithWebContents:delegate_->GetWebContents() |
67 autofillDialog:this]); | 66 dialog:this]); |
68 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( | 67 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( |
69 [[CustomConstrainedWindowSheet alloc] | 68 [[CustomConstrainedWindowSheet alloc] |
70 initWithCustomWindow:[sheet_delegate_ window]]); | 69 initWithCustomWindow:[sheet_delegate_ window]]); |
71 constrained_window_.reset( | 70 constrained_window_.reset( |
72 new ConstrainedWindowMac(this, delegate_->GetWebContents(), sheet)); | 71 new ConstrainedWindowMac(this, delegate_->GetWebContents(), sheet)); |
73 [sheet_delegate_ show]; | 72 [sheet_delegate_ show]; |
74 } | 73 } |
75 | 74 |
76 void AutofillDialogCocoa::Hide() { | 75 void AutofillDialogCocoa::Hide() { |
77 [sheet_delegate_ hide]; | 76 [sheet_delegate_ hide]; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 } | 301 } |
303 return fieldEditor_.get(); | 302 return fieldEditor_.get(); |
304 } | 303 } |
305 | 304 |
306 @end | 305 @end |
307 | 306 |
308 | 307 |
309 @implementation AutofillDialogWindowController | 308 @implementation AutofillDialogWindowController |
310 | 309 |
311 - (id)initWithWebContents:(content::WebContents*)webContents | 310 - (id)initWithWebContents:(content::WebContents*)webContents |
312 autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog { | 311 dialog:(autofill::AutofillDialogCocoa*)dialog { |
313 DCHECK(webContents); | 312 DCHECK(webContents); |
314 | 313 |
315 base::scoped_nsobject<ConstrainedWindowCustomWindow> window( | 314 base::scoped_nsobject<ConstrainedWindowCustomWindow> window( |
316 [[ConstrainedWindowCustomWindow alloc] | 315 [[ConstrainedWindowCustomWindow alloc] |
317 initWithContentRect:ui::kWindowSizeDeterminedLater]); | 316 initWithContentRect:ui::kWindowSizeDeterminedLater]); |
318 | 317 |
319 if ((self = [super initWithWindow:window])) { | 318 if ((self = [super initWithWindow:window])) { |
320 [window setDelegate:self]; | 319 [window setDelegate:self]; |
321 webContents_ = webContents; | 320 webContents_ = webContents; |
322 autofillDialog_ = autofillDialog; | 321 dialog_ = dialog; |
322 | |
323 header_.reset([[AutofillHeader alloc] initWithDelegate:dialog->delegate()]); | |
323 | 324 |
324 mainContainer_.reset([[AutofillMainContainer alloc] | 325 mainContainer_.reset([[AutofillMainContainer alloc] |
325 initWithDelegate:autofillDialog->delegate()]); | 326 initWithDelegate:dialog->delegate()]); |
326 [mainContainer_ setTarget:self]; | 327 [mainContainer_ setTarget:self]; |
327 | 328 |
328 signInContainer_.reset( | 329 signInContainer_.reset( |
329 [[AutofillSignInContainer alloc] initWithDialog:autofillDialog]); | 330 [[AutofillSignInContainer alloc] initWithDialog:dialog]); |
330 [[signInContainer_ view] setHidden:YES]; | 331 [[signInContainer_ view] setHidden:YES]; |
331 | 332 |
332 // Set dialog title. | |
333 titleTextField_.reset([[NSTextField alloc] initWithFrame:NSZeroRect]); | |
334 [titleTextField_ setEditable:NO]; | |
335 [titleTextField_ setBordered:NO]; | |
336 [titleTextField_ setDrawsBackground:NO]; | |
337 [titleTextField_ setFont:[NSFont systemFontOfSize:15.0]]; | |
338 [titleTextField_ setStringValue: | |
339 base::SysUTF16ToNSString(autofillDialog->delegate()->DialogTitle())]; | |
340 [titleTextField_ sizeToFit]; | |
341 | |
342 accountChooser_.reset([[AutofillAccountChooser alloc] | |
343 initWithFrame:NSZeroRect | |
344 delegate:autofillDialog->delegate()]); | |
345 | |
346 loadingShieldTextField_.reset( | 333 loadingShieldTextField_.reset( |
347 [[NSTextField alloc] initWithFrame:NSZeroRect]); | 334 [[NSTextField alloc] initWithFrame:NSZeroRect]); |
348 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 335 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
349 NSFont* loadingFont = rb.GetFont( | 336 NSFont* loadingFont = rb.GetFont( |
350 ui::ResourceBundle::BaseFont).DeriveFont(15).GetNativeFont(); | 337 ui::ResourceBundle::BaseFont).DeriveFont(15).GetNativeFont(); |
351 [loadingShieldTextField_ setFont:loadingFont]; | 338 [loadingShieldTextField_ setFont:loadingFont]; |
352 [loadingShieldTextField_ setEditable:NO]; | 339 [loadingShieldTextField_ setEditable:NO]; |
353 [loadingShieldTextField_ setBordered:NO]; | 340 [loadingShieldTextField_ setBordered:NO]; |
354 [loadingShieldTextField_ setDrawsBackground:NO]; | 341 [loadingShieldTextField_ setDrawsBackground:NO]; |
355 | 342 |
356 base::scoped_nsobject<AutofillOpaqueView> loadingShieldView( | 343 base::scoped_nsobject<AutofillOpaqueView> loadingShieldView( |
357 [[AutofillOpaqueView alloc] initWithFrame:NSZeroRect]); | 344 [[AutofillOpaqueView alloc] initWithFrame:NSZeroRect]); |
358 [loadingShieldView setHidden:YES]; | 345 [loadingShieldView setHidden:YES]; |
359 [loadingShieldView addSubview:loadingShieldTextField_]; | 346 [loadingShieldView addSubview:loadingShieldTextField_]; |
360 | 347 |
361 overlayController_.reset( | 348 overlayController_.reset( |
362 [[AutofillOverlayController alloc] initWithDelegate: | 349 [[AutofillOverlayController alloc] initWithDelegate: |
363 autofillDialog->delegate()]); | 350 dialog->delegate()]); |
364 [[overlayController_ view] setHidden:YES]; | 351 [[overlayController_ view] setHidden:YES]; |
365 | 352 |
366 // This needs a flipped content view because otherwise the size | 353 // This needs a flipped content view because otherwise the size |
367 // animation looks odd. However, replacing the contentView for constrained | 354 // animation looks odd. However, replacing the contentView for constrained |
368 // windows does not work - it does custom rendering. | 355 // windows does not work - it does custom rendering. |
369 base::scoped_nsobject<NSView> flippedContentView( | 356 base::scoped_nsobject<NSView> flippedContentView( |
370 [[FlippedView alloc] initWithFrame: | 357 [[FlippedView alloc] initWithFrame: |
371 [[[self window] contentView] frame]]); | 358 [[[self window] contentView] frame]]); |
372 [flippedContentView setSubviews: | 359 [flippedContentView setSubviews: |
373 @[accountChooser_, | 360 @[header_, |
374 titleTextField_, | |
375 [mainContainer_ view], | 361 [mainContainer_ view], |
376 [signInContainer_ view], | 362 [signInContainer_ view], |
377 loadingShieldView, | 363 loadingShieldView, |
378 [overlayController_ view]]]; | 364 [overlayController_ view]]]; |
379 [flippedContentView setAutoresizingMask: | 365 [flippedContentView setAutoresizingMask: |
380 (NSViewWidthSizable | NSViewHeightSizable)]; | 366 (NSViewWidthSizable | NSViewHeightSizable)]; |
381 [[[self window] contentView] addSubview:flippedContentView]; | 367 [[[self window] contentView] addSubview:flippedContentView]; |
382 [mainContainer_ setAnchorView:[[accountChooser_ subviews] objectAtIndex:1]]; | 368 [mainContainer_ setAnchorView:[header_ anchorView]]; |
383 } | 369 } |
384 return self; | 370 return self; |
385 } | 371 } |
386 | 372 |
387 - (void)dealloc { | 373 - (void)dealloc { |
388 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 374 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
389 [super dealloc]; | 375 [super dealloc]; |
390 } | 376 } |
391 | 377 |
392 - (CGFloat)maxHeight { | 378 - (CGFloat)maxHeight { |
(...skipping 28 matching lines...) Expand all Loading... | |
421 object:nil]; | 407 object:nil]; |
422 } | 408 } |
423 | 409 |
424 - (void)requestRelayout { | 410 - (void)requestRelayout { |
425 [self cancelRelayout]; | 411 [self cancelRelayout]; |
426 [self performSelector:@selector(performLayout) withObject:nil afterDelay:0.0]; | 412 [self performSelector:@selector(performLayout) withObject:nil afterDelay:0.0]; |
427 } | 413 } |
428 | 414 |
429 - (NSSize)preferredSize { | 415 - (NSSize)preferredSize { |
430 NSSize size; | 416 NSSize size; |
431 | 417 |
groby-ooo-7-16
2013/11/20 23:51:44
Header size probably needs to be taken into accoun
Ilya Sherman
2013/11/22 05:01:13
Done.
| |
432 // Overall size is determined by either main container or sign in view. | 418 // Overall size is determined by either main container or sign in view. |
433 if ([[signInContainer_ view] isHidden]) | 419 if ([[signInContainer_ view] isHidden]) |
434 size = [mainContainer_ preferredSize]; | 420 size = [mainContainer_ preferredSize]; |
435 else | 421 else |
436 size = [signInContainer_ preferredSize]; | 422 size = [signInContainer_ preferredSize]; |
437 | 423 |
438 // Always make room for the header. | 424 // Always make room for the header. |
439 size.height += kDecorationHeight; | 425 size.height += kDecorationHeight; |
440 | 426 |
441 if (![[overlayController_ view] isHidden]) { | 427 if (![[overlayController_ view] isHidden]) { |
442 CGFloat height = [overlayController_ heightForWidth:size.width]; | 428 CGFloat height = [overlayController_ heightForWidth:size.width]; |
443 if (height != 0.0) | 429 if (height != 0.0) |
444 size.height = height; | 430 size.height = height; |
445 } | 431 } |
446 | 432 |
447 // Show as much of the main view as is possible without going past the | 433 // Show as much of the main view as is possible without going past the |
448 // bottom of the browser window. | 434 // bottom of the browser window. |
449 size.height = std::min(size.height, [self maxHeight]); | 435 size.height = std::min(size.height, [self maxHeight]); |
450 | 436 |
451 return size; | 437 return size; |
452 } | 438 } |
453 | 439 |
454 - (void)performLayout { | 440 - (void)performLayout { |
455 NSRect contentRect = NSZeroRect; | 441 NSRect contentRect = NSZeroRect; |
456 contentRect.size = [self preferredSize]; | 442 contentRect.size = [self preferredSize]; |
457 NSRect clientRect = contentRect; | 443 NSRect clientRect = contentRect; |
458 clientRect.origin.y = chrome_style::kTitleTopPadding; | 444 clientRect.size.height -= chrome_style::kClientBottomPadding; |
459 clientRect.size.height -= chrome_style::kTitleTopPadding + | |
460 chrome_style::kClientBottomPadding; | |
461 | 445 |
462 [titleTextField_ setStringValue: | 446 CGFloat headerHeight = [header_ heightForWidth:NSWidth(clientRect)]; |
463 base::SysUTF16ToNSString(autofillDialog_->delegate()->DialogTitle())]; | 447 NSRect headerRect, mainRect; |
464 [titleTextField_ sizeToFit]; | 448 NSDivideRect(clientRect, &headerRect, &mainRect, headerHeight, NSMinYEdge); |
465 | 449 |
466 NSRect headerRect, mainRect, titleRect, dummyRect; | 450 [header_ setFrame:headerRect]; |
467 NSDivideRect(clientRect, &headerRect, &mainRect, | 451 [header_ performLayout]; |
468 kAccountChooserHeight, NSMinYEdge); | |
469 NSDivideRect(mainRect, &dummyRect, &mainRect, | |
470 autofill::kDetailVerticalPadding, NSMinYEdge); | |
471 headerRect = NSInsetRect(headerRect, chrome_style::kHorizontalPadding, 0); | |
472 NSDivideRect(headerRect, &titleRect, &headerRect, | |
473 NSWidth([titleTextField_ frame]), NSMinXEdge); | |
474 | 452 |
475 // Align baseline of title with bottom of accountChooser. | |
476 base::scoped_nsobject<NSLayoutManager> layout_manager( | |
477 [[NSLayoutManager alloc] init]); | |
478 NSFont* titleFont = [titleTextField_ font]; | |
479 titleRect.origin.y += NSHeight(titleRect) - | |
480 [layout_manager defaultBaselineOffsetForFont:titleFont]; | |
481 [titleTextField_ setFrame:titleRect]; | |
482 | |
483 [accountChooser_ setFrame:headerRect]; | |
484 [accountChooser_ performLayout]; | |
485 if ([[signInContainer_ view] isHidden]) { | 453 if ([[signInContainer_ view] isHidden]) { |
486 [[mainContainer_ view] setFrame:mainRect]; | 454 [[mainContainer_ view] setFrame:mainRect]; |
487 [mainContainer_ performLayout]; | 455 [mainContainer_ performLayout]; |
488 } else { | 456 } else { |
489 [[signInContainer_ view] setFrame:mainRect]; | 457 [[signInContainer_ view] setFrame:mainRect]; |
490 } | 458 } |
491 | 459 |
492 // Loading shield has text centered in the content rect. | 460 // Loading shield has text centered in the content rect. |
493 NSRect textFrame = [loadingShieldTextField_ frame]; | 461 NSRect textFrame = [loadingShieldTextField_ frame]; |
494 textFrame.origin.x = | 462 textFrame.origin.x = |
495 std::ceil((NSWidth(contentRect) - NSWidth(textFrame)) / 2.0); | 463 std::ceil((NSWidth(contentRect) - NSWidth(textFrame)) / 2.0); |
496 textFrame.origin.y = | 464 textFrame.origin.y = |
497 std::ceil((NSHeight(contentRect) - NSHeight(textFrame)) / 2.0); | 465 std::ceil((NSHeight(contentRect) - NSHeight(textFrame)) / 2.0); |
498 [loadingShieldTextField_ setFrame:textFrame]; | 466 [loadingShieldTextField_ setFrame:textFrame]; |
499 [[loadingShieldTextField_ superview] setFrame:contentRect]; | 467 [[loadingShieldTextField_ superview] setFrame:contentRect]; |
500 | 468 |
501 [[overlayController_ view] setFrame:contentRect]; | 469 [[overlayController_ view] setFrame:contentRect]; |
502 [overlayController_ performLayout]; | 470 [overlayController_ performLayout]; |
503 | 471 |
504 NSRect frameRect = [[self window] frameRectForContentRect:contentRect]; | 472 NSRect frameRect = [[self window] frameRectForContentRect:contentRect]; |
505 [[self window] setFrame:frameRect display:YES]; | 473 [[self window] setFrame:frameRect display:YES]; |
506 [[self window] recalculateKeyViewLoop]; | 474 [[self window] recalculateKeyViewLoop]; |
507 } | 475 } |
508 | 476 |
509 - (IBAction)accept:(id)sender { | 477 - (IBAction)accept:(id)sender { |
510 if ([mainContainer_ validate]) | 478 if ([mainContainer_ validate]) |
511 autofillDialog_->delegate()->OnAccept(); | 479 dialog_->delegate()->OnAccept(); |
512 else | 480 else |
513 [mainContainer_ makeFirstInvalidInputFirstResponder]; | 481 [mainContainer_ makeFirstInvalidInputFirstResponder]; |
514 } | 482 } |
515 | 483 |
516 - (IBAction)cancel:(id)sender { | 484 - (IBAction)cancel:(id)sender { |
517 autofillDialog_->delegate()->OnCancel(); | 485 dialog_->delegate()->OnCancel(); |
518 autofillDialog_->PerformClose(); | 486 dialog_->PerformClose(); |
519 } | 487 } |
520 | 488 |
521 - (void)show { | 489 - (void)show { |
522 // Resizing the browser causes the ConstrainedWindow to move. | 490 // Resizing the browser causes the ConstrainedWindow to move. |
523 // Observe that to allow resizes based on browser size. | 491 // Observe that to allow resizes based on browser size. |
524 // NOTE: This MUST come last after all initial setup is done, because there | 492 // NOTE: This MUST come last after all initial setup is done, because there |
525 // is an immediate notification post registration. | 493 // is an immediate notification post registration. |
526 DCHECK([self window]); | 494 DCHECK([self window]); |
527 [[NSNotificationCenter defaultCenter] | 495 [[NSNotificationCenter defaultCenter] |
528 addObserver:self | 496 addObserver:self |
529 selector:@selector(onContentViewFrameDidChange:) | 497 selector:@selector(onContentViewFrameDidChange:) |
530 name:NSWindowDidMoveNotification | 498 name:NSWindowDidMoveNotification |
531 object:[self window]]; | 499 object:[self window]]; |
532 | 500 |
533 [self updateAccountChooser]; | 501 [self updateAccountChooser]; |
534 [self updateNotificationArea]; | 502 [self updateNotificationArea]; |
535 [self requestRelayout]; | 503 [self requestRelayout]; |
536 } | 504 } |
537 | 505 |
538 - (void)hide { | 506 - (void)hide { |
539 autofillDialog_->delegate()->OnCancel(); | 507 dialog_->delegate()->OnCancel(); |
540 autofillDialog_->PerformClose(); | 508 dialog_->PerformClose(); |
541 } | 509 } |
542 | 510 |
543 - (void)updateNotificationArea { | 511 - (void)updateNotificationArea { |
544 [mainContainer_ updateNotificationArea]; | 512 [mainContainer_ updateNotificationArea]; |
545 } | 513 } |
546 | 514 |
547 - (void)updateAccountChooser { | 515 - (void)updateAccountChooser { |
548 [accountChooser_ update]; | 516 [header_ update]; |
549 [mainContainer_ updateLegalDocuments]; | 517 [mainContainer_ updateLegalDocuments]; |
550 | 518 |
551 NSString* newLoadingMessage = @""; | 519 NSString* newLoadingMessage = @""; |
552 if (autofillDialog_->delegate()->ShouldShowSpinner()) | 520 if (dialog_->delegate()->ShouldShowSpinner()) |
553 newLoadingMessage = l10n_util::GetNSStringWithFixup(IDS_TAB_LOADING_TITLE); | 521 newLoadingMessage = l10n_util::GetNSStringWithFixup(IDS_TAB_LOADING_TITLE); |
554 if (![newLoadingMessage isEqualToString: | 522 if (![newLoadingMessage isEqualToString: |
555 [loadingShieldTextField_ stringValue]]) { | 523 [loadingShieldTextField_ stringValue]]) { |
556 NSView* loadingShieldView = [loadingShieldTextField_ superview]; | 524 NSView* loadingShieldView = [loadingShieldTextField_ superview]; |
557 [loadingShieldTextField_ setStringValue:newLoadingMessage]; | 525 [loadingShieldTextField_ setStringValue:newLoadingMessage]; |
558 [loadingShieldTextField_ sizeToFit]; | 526 [loadingShieldTextField_ sizeToFit]; |
559 | 527 |
560 BOOL showShield = ([newLoadingMessage length] != 0); | 528 BOOL showShield = ([newLoadingMessage length] != 0); |
561 | 529 |
562 // For the duration of the loading shield, hide the main contents. | 530 // For the duration of the loading shield, hide the main contents. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 | 628 |
661 - (content::WebContents*)getSignInWebContents { | 629 - (content::WebContents*)getSignInWebContents { |
662 return [signInContainer_ webContents]; | 630 return [signInContainer_ webContents]; |
663 } | 631 } |
664 | 632 |
665 - (BOOL)IsShowingOverlay { | 633 - (BOOL)IsShowingOverlay { |
666 return ![[overlayController_ view] isHidden]; | 634 return ![[overlayController_ view] isHidden]; |
667 } | 635 } |
668 | 636 |
669 @end | 637 @end |
OLD | NEW |