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/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 autofillDialog_->PerformClose(); | 446 autofillDialog_->PerformClose(); |
447 } | 447 } |
448 | 448 |
449 - (void)updateNotificationArea { | 449 - (void)updateNotificationArea { |
450 [mainContainer_ updateNotificationArea]; | 450 [mainContainer_ updateNotificationArea]; |
451 } | 451 } |
452 | 452 |
453 - (void)updateAccountChooser { | 453 - (void)updateAccountChooser { |
454 [accountChooser_ update]; | 454 [accountChooser_ update]; |
455 [mainContainer_ updateLegalDocuments]; | 455 [mainContainer_ updateLegalDocuments]; |
456 // TODO(estade): replace this with a better loading image/animation. | 456 |
457 // See http://crbug.com/230932 | |
458 NSString* newLoadingMessage = @""; | 457 NSString* newLoadingMessage = @""; |
459 if (autofillDialog_->delegate()->ShouldShowSpinner()) | 458 if (autofillDialog_->delegate()->ShouldShowSpinner()) |
460 newLoadingMessage = l10n_util::GetNSStringWithFixup(IDS_TAB_LOADING_TITLE); | 459 newLoadingMessage = l10n_util::GetNSStringWithFixup(IDS_TAB_LOADING_TITLE); |
461 if (![newLoadingMessage isEqualToString: | 460 if (![newLoadingMessage isEqualToString: |
462 [loadingShieldTextField_ stringValue]]) { | 461 [loadingShieldTextField_ stringValue]]) { |
| 462 NSView* loadingShieldView = [loadingShieldTextField_ superview]; |
463 [loadingShieldTextField_ setStringValue:newLoadingMessage]; | 463 [loadingShieldTextField_ setStringValue:newLoadingMessage]; |
464 [loadingShieldTextField_ sizeToFit]; | 464 [loadingShieldTextField_ sizeToFit]; |
465 [[loadingShieldTextField_ superview] setHidden: | 465 [loadingShieldView setHidden:[newLoadingMessage length] == 0]; |
466 [newLoadingMessage length] == 0]; | 466 |
| 467 // For the duration of the loading shield, it becomes first responder. |
| 468 // This prevents the currently focused text field "shining through". |
| 469 if (![loadingShieldView isHidden]) { |
| 470 [loadingShieldView setNextResponder: |
| 471 [[loadingShieldView window] firstResponder]]; |
| 472 [[loadingShieldView window] makeFirstResponder:loadingShieldView]; |
| 473 } else { |
| 474 [[loadingShieldView window] makeFirstResponder: |
| 475 [loadingShieldView nextResponder]]; |
| 476 } |
467 [self requestRelayout]; | 477 [self requestRelayout]; |
468 } | 478 } |
469 } | 479 } |
470 | 480 |
471 - (void)updateButtonStrip { | 481 - (void)updateButtonStrip { |
472 [overlayController_ updateState]; | 482 [overlayController_ updateState]; |
473 } | 483 } |
474 | 484 |
475 - (void)updateSection:(autofill::DialogSection)section { | 485 - (void)updateSection:(autofill::DialogSection)section { |
476 [[mainContainer_ sectionForId:section] update]; | 486 [[mainContainer_ sectionForId:section] update]; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 } | 539 } |
530 | 540 |
531 - (void)activateFieldForInput:(const autofill::DetailInput&)input { | 541 - (void)activateFieldForInput:(const autofill::DetailInput&)input { |
532 for (size_t i = autofill::SECTION_MIN; i <= autofill::SECTION_MAX; ++i) { | 542 for (size_t i = autofill::SECTION_MIN; i <= autofill::SECTION_MAX; ++i) { |
533 autofill::DialogSection section = static_cast<autofill::DialogSection>(i); | 543 autofill::DialogSection section = static_cast<autofill::DialogSection>(i); |
534 [[mainContainer_ sectionForId:section] activateFieldForInput:input]; | 544 [[mainContainer_ sectionForId:section] activateFieldForInput:input]; |
535 } | 545 } |
536 } | 546 } |
537 | 547 |
538 @end | 548 @end |
OLD | NEW |