| 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 #include "chrome/browser/ui/views/autofill/card_unmask_prompt_views.h" | 5 #include "chrome/browser/ui/views/autofill/card_unmask_prompt_views.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" | 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 constrained_window::UpdateWebContentsModalDialogPosition( | 134 constrained_window::UpdateWebContentsModalDialogPosition( |
| 135 GetWidget(), web_modal::WebContentsModalDialogManager::FromWebContents( | 135 GetWidget(), web_modal::WebContentsModalDialogManager::FromWebContents( |
| 136 controller_->GetWebContents()) | 136 controller_->GetWebContents()) |
| 137 ->delegate() | 137 ->delegate() |
| 138 ->GetWebContentsModalDialogHost()); | 138 ->GetWebContentsModalDialogHost()); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 void CardUnmaskPromptViews::SetInputsEnabled(bool enabled) { | 142 void CardUnmaskPromptViews::SetInputsEnabled(bool enabled) { |
| 143 cvc_input_->SetEnabled(enabled); | 143 cvc_input_->SetEnabled(enabled); |
| 144 storage_checkbox_->SetEnabled(enabled); | 144 if (storage_checkbox_) |
| 145 | 145 storage_checkbox_->SetEnabled(enabled); |
| 146 if (month_input_) | 146 if (month_input_) |
| 147 month_input_->SetEnabled(enabled); | 147 month_input_->SetEnabled(enabled); |
| 148 if (year_input_) | 148 if (year_input_) |
| 149 year_input_->SetEnabled(enabled); | 149 year_input_->SetEnabled(enabled); |
| 150 } | 150 } |
| 151 | 151 |
| 152 views::View* CardUnmaskPromptViews::GetContentsView() { | 152 views::View* CardUnmaskPromptViews::GetContentsView() { |
| 153 InitIfNecessary(); | 153 InitIfNecessary(); |
| 154 return this; | 154 return this; |
| 155 } | 155 } |
| 156 | 156 |
| 157 views::View* CardUnmaskPromptViews::CreateFootnoteView() { | 157 views::View* CardUnmaskPromptViews::CreateFootnoteView() { |
| 158 if (!controller_->CanStoreLocally()) |
| 159 return nullptr; |
| 160 |
| 158 // Local storage checkbox and (?) tooltip. | 161 // Local storage checkbox and (?) tooltip. |
| 159 views::View* storage_row = new views::View(); | 162 views::View* storage_row = new views::View(); |
| 160 views::BoxLayout* storage_row_layout = new views::BoxLayout( | 163 views::BoxLayout* storage_row_layout = new views::BoxLayout( |
| 161 views::BoxLayout::kHorizontal, kEdgePadding, kEdgePadding, 0); | 164 views::BoxLayout::kHorizontal, kEdgePadding, kEdgePadding, 0); |
| 162 storage_row->SetLayoutManager(storage_row_layout); | 165 storage_row->SetLayoutManager(storage_row_layout); |
| 163 storage_row->SetBorder( | 166 storage_row->SetBorder( |
| 164 views::Border::CreateSolidSidedBorder(1, 0, 0, 0, kSubtleBorderColor)); | 167 views::Border::CreateSolidSidedBorder(1, 0, 0, 0, kSubtleBorderColor)); |
| 165 storage_row->set_background( | 168 storage_row->set_background( |
| 166 views::Background::CreateSolidBackground(kShadingColor)); | 169 views::Background::CreateSolidBackground(kShadingColor)); |
| 167 | 170 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 return controller_->InputExpirationIsValid( | 397 return controller_->InputExpirationIsValid( |
| 395 month_input_->GetTextForRow(month_input_->selected_index()), | 398 month_input_->GetTextForRow(month_input_->selected_index()), |
| 396 year_input_->GetTextForRow(year_input_->selected_index())); | 399 year_input_->GetTextForRow(year_input_->selected_index())); |
| 397 } | 400 } |
| 398 | 401 |
| 399 void CardUnmaskPromptViews::ClosePrompt() { | 402 void CardUnmaskPromptViews::ClosePrompt() { |
| 400 GetWidget()->Close(); | 403 GetWidget()->Close(); |
| 401 } | 404 } |
| 402 | 405 |
| 403 } // namespace autofill | 406 } // namespace autofill |
| OLD | NEW |