OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop/message_loop.h" | |
7 #include "base/strings/sys_string_conversions.h" | 6 #include "base/strings/sys_string_conversions.h" |
| 7 #include "base/threading/thread_task_runner_handle.h" |
8 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 8 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
9 #include "chrome/browser/ui/chrome_style.h" | 9 #include "chrome/browser/ui/chrome_style.h" |
10 #import "chrome/browser/ui/cocoa/autofill/autofill_pop_up_button.h" | 10 #import "chrome/browser/ui/cocoa/autofill/autofill_pop_up_button.h" |
11 #import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h" | 11 #import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h" |
12 #import "chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.h" | 12 #import "chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.h" |
13 #include "chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.h" | 13 #include "chrome/browser/ui/cocoa/autofill/card_unmask_prompt_view_bridge.h" |
14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" | 14 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" |
15 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_u
tils.h" | 15 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_u
tils.h" |
16 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 16 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
17 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi
ndow.h" | 17 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi
ndow.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 void CardUnmaskPromptViewBridge::GotVerificationResult( | 100 void CardUnmaskPromptViewBridge::GotVerificationResult( |
101 const base::string16& error_message, | 101 const base::string16& error_message, |
102 bool allow_retry) { | 102 bool allow_retry) { |
103 if (error_message.empty()) { | 103 if (error_message.empty()) { |
104 [view_controller_ setProgressOverlayText: | 104 [view_controller_ setProgressOverlayText: |
105 l10n_util::GetStringUTF16( | 105 l10n_util::GetStringUTF16( |
106 IDS_AUTOFILL_CARD_UNMASK_VERIFICATION_SUCCESS) | 106 IDS_AUTOFILL_CARD_UNMASK_VERIFICATION_SUCCESS) |
107 showSpinner:NO]; | 107 showSpinner:NO]; |
108 | 108 |
109 base::MessageLoop::current()->PostDelayedTask( | 109 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
110 FROM_HERE, base::Bind(&CardUnmaskPromptViewBridge::PerformClose, | 110 FROM_HERE, base::Bind(&CardUnmaskPromptViewBridge::PerformClose, |
111 weak_ptr_factory_.GetWeakPtr()), | 111 weak_ptr_factory_.GetWeakPtr()), |
112 base::TimeDelta::FromSeconds(1)); | 112 base::TimeDelta::FromSeconds(1)); |
113 } else { | 113 } else { |
114 [view_controller_ setProgressOverlayText:base::string16() showSpinner:NO]; | 114 [view_controller_ setProgressOverlayText:base::string16() showSpinner:NO]; |
115 | 115 |
116 if (allow_retry) { | 116 if (allow_retry) { |
117 // TODO(bondd): Views version never hides |errorLabel_|. When Views | 117 // TODO(bondd): Views version never hides |errorLabel_|. When Views |
118 // decides when to hide it then do the same thing here. | 118 // decides when to hide it then do the same thing here. |
119 [view_controller_ setRetriableErrorMessage:error_message]; | 119 [view_controller_ setRetriableErrorMessage:error_message]; |
120 } else { | 120 } else { |
121 [view_controller_ setPermanentErrorMessage:error_message]; | 121 [view_controller_ setPermanentErrorMessage:error_message]; |
122 } | 122 } |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 void CardUnmaskPromptViewBridge::OnConstrainedWindowClosed( | 126 void CardUnmaskPromptViewBridge::OnConstrainedWindowClosed( |
127 ConstrainedWindowMac* window) { | 127 ConstrainedWindowMac* window) { |
128 if (controller_) | 128 if (controller_) |
129 controller_->OnUnmaskDialogClosed(); | 129 controller_->OnUnmaskDialogClosed(); |
130 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 130 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
131 } | 131 } |
132 | 132 |
133 CardUnmaskPromptController* CardUnmaskPromptViewBridge::GetController() { | 133 CardUnmaskPromptController* CardUnmaskPromptViewBridge::GetController() { |
134 return controller_; | 134 return controller_; |
135 } | 135 } |
136 | 136 |
137 content::WebContents* CardUnmaskPromptViewBridge::GetWebContents() { | 137 content::WebContents* CardUnmaskPromptViewBridge::GetWebContents() { |
138 return web_contents_; | 138 return web_contents_; |
139 } | 139 } |
140 | 140 |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 [verifyButton_ setAction:@selector(onVerify:)]; | 729 [verifyButton_ setAction:@selector(onVerify:)]; |
730 [verifyButton_ sizeToFit]; | 730 [verifyButton_ sizeToFit]; |
731 [self updateVerifyButtonEnabled]; | 731 [self updateVerifyButtonEnabled]; |
732 [mainView addSubview:verifyButton_]; | 732 [mainView addSubview:verifyButton_]; |
733 | 733 |
734 [self setView:mainView]; | 734 [self setView:mainView]; |
735 [self performLayoutAndDisplay:NO]; | 735 [self performLayoutAndDisplay:NO]; |
736 } | 736 } |
737 | 737 |
738 @end | 738 @end |
OLD | NEW |