Commit 5f5ef2b4 authored by dconnelly's avatar dconnelly Committed by Commit bot

Add a ComboboxModel and strings for the account chooser's "More" button.

BUG=448011

Review URL: https://codereview.chromium.org/908493002

Cr-Commit-Position: refs/heads/master@{#315332}
parent 3d4c1dab
...@@ -15517,6 +15517,21 @@ Do you accept? ...@@ -15517,6 +15517,21 @@ Do you accept?
<message name="IDS_FLAGS_ENABLE_TOUCH_HOVER_DESCRIPTION" desc="Description of the 'Enable support for hover capable touchscreens' flag."> <message name="IDS_FLAGS_ENABLE_TOUCH_HOVER_DESCRIPTION" desc="Description of the 'Enable support for hover capable touchscreens' flag.">
Enables hover feature by holding your finger just over the screen to experience a mouseover event. Enables hover feature by holding your finger just over the screen to experience a mouseover event.
</message> </message>
<!-- Credential management account chooser -->
<message name="IDS_CREDENTIAL_MANAGEMENT_ACCOUNT_CHOOSER_NO_THANKS" desc="Text of the button to dismiss the account chooser.">
No thanks
</message>
<message name="IDS_CREDENTIAL_MANAGEMENT_ACCOUNT_CHOOSER_MORE" desc="Text of the button to show more options on the account chooser.">
More
</message>
<message name="IDS_CREDENTIAL_MANAGEMENT_ACCOUNT_CHOOSER_PASSWORDS_LINK" desc="Text of the item on the account chooser to show existing passwords.">
Settings
</message>
<message name="IDS_CREDENTIAL_MANAGEMENT_ACCOUNT_CHOOSER_LEARN_MORE" desc="Text of the item on the account chooser to show the help center article about credential management.">
Learn more
</message>
</messages> </messages>
</release> </release>
</grit> </grit>
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/passwords/account_chooser_more_combobox_model.h"
#include "base/logging.h"
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
const int AccountChooserMoreComboboxModel::INDEX_MORE = 0;
const int AccountChooserMoreComboboxModel::INDEX_LEARN_MORE = 1;
const int AccountChooserMoreComboboxModel::INDEX_SETTINGS = 2;
AccountChooserMoreComboboxModel::AccountChooserMoreComboboxModel() = default;
AccountChooserMoreComboboxModel::~AccountChooserMoreComboboxModel() = default;
int AccountChooserMoreComboboxModel::GetItemCount() const {
return 3;
}
base::string16 AccountChooserMoreComboboxModel::GetItemAt(int index) {
switch (index) {
default:
NOTREACHED();
case INDEX_MORE:
return l10n_util::GetStringUTF16(
IDS_CREDENTIAL_MANAGEMENT_ACCOUNT_CHOOSER_MORE);
case INDEX_LEARN_MORE:
return l10n_util::GetStringUTF16(
IDS_CREDENTIAL_MANAGEMENT_ACCOUNT_CHOOSER_LEARN_MORE);
case INDEX_SETTINGS:
return l10n_util::GetStringUTF16(
IDS_CREDENTIAL_MANAGEMENT_ACCOUNT_CHOOSER_PASSWORDS_LINK);
}
}
bool AccountChooserMoreComboboxModel::IsItemSeparatorAt(int index) {
return false;
}
int AccountChooserMoreComboboxModel::GetDefaultIndex() const {
return 0;
}
bool AccountChooserMoreComboboxModel::IsItemEnabledAt(int index) const {
return true;
}
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_PASSWORDS_ACCOUNT_CHOOSER_MORE_COMBOBOX_MODEL_H_
#define CHROME_BROWSER_UI_PASSWORDS_ACCOUNT_CHOOSER_MORE_COMBOBOX_MODEL_H_
#include "ui/base/models/combobox_model.h"
// Model for the account chooser's "More" combobox.
class AccountChooserMoreComboboxModel : public ui::ComboboxModel {
public:
AccountChooserMoreComboboxModel();
~AccountChooserMoreComboboxModel() override;
// Index constants.
static const int INDEX_MORE;
static const int INDEX_LEARN_MORE;
static const int INDEX_SETTINGS;
// ui::ComboboxModel:
int GetItemCount() const override;
base::string16 GetItemAt(int index) override;
bool IsItemSeparatorAt(int index) override;
int GetDefaultIndex() const override;
bool IsItemEnabledAt(int index) const override;
private:
DISALLOW_COPY_AND_ASSIGN(AccountChooserMoreComboboxModel);
};
#endif // CHROME_BROWSER_UI_PASSWORDS_ACCOUNT_CHOOSER_MORE_COMBOBOX_MODEL_H_
...@@ -792,6 +792,8 @@ ...@@ -792,6 +792,8 @@
'browser/ui/metro_pin_tab_helper_win.h', 'browser/ui/metro_pin_tab_helper_win.h',
'browser/ui/passwords/account_avatar_fetcher.cc', 'browser/ui/passwords/account_avatar_fetcher.cc',
'browser/ui/passwords/account_avatar_fetcher.h', 'browser/ui/passwords/account_avatar_fetcher.h',
'browser/ui/passwords/account_chooser_more_combobox_model.h',
'browser/ui/passwords/account_chooser_more_combobox_model.cc',
'browser/ui/passwords/manage_passwords_bubble.cc', 'browser/ui/passwords/manage_passwords_bubble.cc',
'browser/ui/passwords/manage_passwords_bubble.h', 'browser/ui/passwords/manage_passwords_bubble.h',
'browser/ui/passwords/manage_passwords_bubble_model.cc', 'browser/ui/passwords/manage_passwords_bubble_model.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment