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/passwords/save_password_refusal_combobox_model.h" | 5 #include "chrome/browser/ui/passwords/save_password_refusal_combobox_model.h" |
6 | 6 |
7 #include "chrome/grit/generated_resources.h" | 7 #include "chrome/grit/generated_resources.h" |
8 #include "ui/base/l10n/l10n_util.h" | 8 #include "ui/base/l10n/l10n_util.h" |
9 | 9 |
10 SavePasswordRefusalComboboxModel::SavePasswordRefusalComboboxModel() { | 10 SavePasswordRefusalComboboxModel::SavePasswordRefusalComboboxModel( |
| 11 bool never_is_default) |
| 12 : never_is_default_(never_is_default) { |
11 #if !defined(OS_ANDROID) | 13 #if !defined(OS_ANDROID) |
12 items_.push_back( | 14 items_.push_back( |
13 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_BUTTON)); | 15 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_BUTTON)); |
14 items_.push_back( | 16 items_.push_back( |
15 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON)); | 17 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON)); |
| 18 if (never_is_default) |
| 19 swap(items_[0], items_[1]); |
16 #endif | 20 #endif |
17 } | 21 } |
18 | 22 |
19 SavePasswordRefusalComboboxModel::~SavePasswordRefusalComboboxModel() {} | 23 SavePasswordRefusalComboboxModel::~SavePasswordRefusalComboboxModel() {} |
20 | 24 |
21 int SavePasswordRefusalComboboxModel::GetItemCount() const { | 25 int SavePasswordRefusalComboboxModel::GetItemCount() const { |
22 return items_.size(); | 26 return items_.size(); |
23 } | 27 } |
24 | 28 |
25 base::string16 SavePasswordRefusalComboboxModel::GetItemAt(int index) { | 29 base::string16 SavePasswordRefusalComboboxModel::GetItemAt(int index) { |
26 return items_[index]; | 30 return items_[index]; |
27 } | 31 } |
28 | 32 |
29 bool SavePasswordRefusalComboboxModel::IsItemSeparatorAt(int index) { | 33 bool SavePasswordRefusalComboboxModel::IsItemSeparatorAt(int index) { |
30 return items_[index].empty(); | 34 return items_[index].empty(); |
31 } | 35 } |
32 | 36 |
33 int SavePasswordRefusalComboboxModel::GetDefaultIndex() const { | 37 int SavePasswordRefusalComboboxModel::GetDefaultIndex() const { |
34 return 0; | 38 return 0; |
35 } | 39 } |
OLD | NEW |