| Index: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
|
| diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
|
| index 89a651df2e9d0c7abf027460c90248b3ea5f029a..801cbf7fc01a9417d35ab763f840b3e7c8b783a5 100644
|
| --- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
|
| +++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
|
| @@ -32,13 +32,13 @@
|
| #include "ui/gfx/color_palette.h"
|
| #include "ui/gfx/image/image_skia.h"
|
| #include "ui/native_theme/native_theme.h"
|
| +#include "ui/views/bubble/bubble_frame_view.h"
|
| #include "ui/views/controls/button/blue_button.h"
|
| #include "ui/views/controls/button/md_text_button.h"
|
| #include "ui/views/controls/link.h"
|
| #include "ui/views/controls/link_listener.h"
|
| #include "ui/views/controls/separator.h"
|
| #include "ui/views/controls/styled_label.h"
|
| -#include "ui/views/controls/styled_label_listener.h"
|
| #include "ui/views/layout/fill_layout.h"
|
| #include "ui/views/layout/grid_layout.h"
|
| #include "ui/views/widget/widget.h"
|
| @@ -170,28 +170,6 @@ views::StyledLabel::RangeStyleInfo GetLinkStyle() {
|
| return result;
|
| }
|
|
|
| -// If a special title is required (i.e. one that contains links), creates a
|
| -// title view and a row for it in |layout|.
|
| -// TODO(estade): this should be removed and a replaced by a normal title (via
|
| -// GetWindowTitle).
|
| -void AddTitleRowWithLink(views::GridLayout* layout,
|
| - ManagePasswordsBubbleModel* model,
|
| - views::StyledLabelListener* listener) {
|
| - if (model->title_brand_link_range().is_empty())
|
| - return;
|
| -
|
| - views::StyledLabel* title_label =
|
| - new views::StyledLabel(model->title(), listener);
|
| - title_label->SetBaseFontList(views::style::GetFont(
|
| - views::style::CONTEXT_DIALOG_TITLE, views::style::STYLE_PRIMARY));
|
| - title_label->AddStyleRange(model->title_brand_link_range(), GetLinkStyle());
|
| - layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
|
| - layout->AddView(title_label);
|
| - layout->AddPaddingRow(0, ChromeLayoutProvider::Get()
|
| - ->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS)
|
| - .top());
|
| -}
|
| -
|
| } // namespace
|
|
|
| // ManagePasswordsBubbleView::AutoSigninView ----------------------------------
|
| @@ -290,10 +268,8 @@ void ManagePasswordsBubbleView::AutoSigninView::OnTimer() {
|
| // A view offering the user the ability to save credentials. Contains a
|
| // single ManagePasswordItemsView, along with a "Save Passwords" button
|
| // and a "Never" button.
|
| -class ManagePasswordsBubbleView::PendingView
|
| - : public views::View,
|
| - public views::ButtonListener,
|
| - public views::StyledLabelListener {
|
| +class ManagePasswordsBubbleView::PendingView : public views::View,
|
| + public views::ButtonListener {
|
| public:
|
| explicit PendingView(ManagePasswordsBubbleView* parent);
|
| ~PendingView() override;
|
| @@ -302,11 +278,6 @@ class ManagePasswordsBubbleView::PendingView
|
| // views::ButtonListener:
|
| void ButtonPressed(views::Button* sender, const ui::Event& event) override;
|
|
|
| - // views::StyledLabelListener:
|
| - void StyledLabelLinkClicked(views::StyledLabel* label,
|
| - const gfx::Range& range,
|
| - int event_flags) override;
|
| -
|
| ManagePasswordsBubbleView* parent_;
|
|
|
| views::Button* save_button_;
|
| @@ -334,9 +305,7 @@ ManagePasswordsBubbleView::PendingView::PendingView(
|
| this,
|
| l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON));
|
|
|
| - // Title row.
|
| BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
|
| - AddTitleRowWithLink(layout, parent_->model(), this);
|
|
|
| // Credential row.
|
| if (item) {
|
| @@ -378,14 +347,6 @@ void ManagePasswordsBubbleView::PendingView::ButtonPressed(
|
| parent_->CloseBubble();
|
| }
|
|
|
| -void ManagePasswordsBubbleView::PendingView::StyledLabelLinkClicked(
|
| - views::StyledLabel* label,
|
| - const gfx::Range& range,
|
| - int event_flags) {
|
| - DCHECK_EQ(range, parent_->model()->title_brand_link_range());
|
| - parent_->model()->OnBrandLinkClicked();
|
| -}
|
| -
|
| // ManagePasswordsBubbleView::ManageView --------------------------------------
|
|
|
| // A view offering the user a list of their currently saved credentials
|
| @@ -626,8 +587,7 @@ void ManagePasswordsBubbleView::SignInPromoView::ButtonPressed(
|
| // and a rejection button.
|
| class ManagePasswordsBubbleView::UpdatePendingView
|
| : public views::View,
|
| - public views::ButtonListener,
|
| - public views::StyledLabelListener {
|
| + public views::ButtonListener {
|
| public:
|
| explicit UpdatePendingView(ManagePasswordsBubbleView* parent);
|
| ~UpdatePendingView() override;
|
| @@ -636,11 +596,6 @@ class ManagePasswordsBubbleView::UpdatePendingView
|
| // views::ButtonListener:
|
| void ButtonPressed(views::Button* sender, const ui::Event& event) override;
|
|
|
| - // views::StyledLabelListener:
|
| - void StyledLabelLinkClicked(views::StyledLabel* label,
|
| - const gfx::Range& range,
|
| - int event_flags) override;
|
| -
|
| ManagePasswordsBubbleView* parent_;
|
|
|
| CredentialsSelectionView* selection_view_;
|
| @@ -674,9 +629,7 @@ ManagePasswordsBubbleView::UpdatePendingView::UpdatePendingView(
|
| update_button_ = views::MdTextButton::CreateSecondaryUiBlueButton(
|
| this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_UPDATE_BUTTON));
|
|
|
| - // Title row.
|
| BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
|
| - AddTitleRowWithLink(layout, parent_->model(), this);
|
|
|
| // Credential row.
|
| layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
|
| @@ -716,14 +669,6 @@ void ManagePasswordsBubbleView::UpdatePendingView::ButtonPressed(
|
| parent_->CloseBubble();
|
| }
|
|
|
| -void ManagePasswordsBubbleView::UpdatePendingView::StyledLabelLinkClicked(
|
| - views::StyledLabel* label,
|
| - const gfx::Range& range,
|
| - int event_flags) {
|
| - DCHECK_EQ(range, parent_->model()->title_brand_link_range());
|
| - parent_->model()->OnBrandLinkClicked();
|
| -}
|
| -
|
| // ManagePasswordsBubbleView --------------------------------------------------
|
|
|
| // static
|
| @@ -833,6 +778,22 @@ void ManagePasswordsBubbleView::CloseBubble() {
|
| LocationBarBubbleDelegateView::CloseBubble();
|
| }
|
|
|
| +views::View* ManagePasswordsBubbleView::CreateTitleView() {
|
| + title_view_ = new views::StyledLabel(base::string16(), this);
|
| + title_view_->SetBaseFontList(views::style::GetFont(
|
| + views::style::CONTEXT_DIALOG_TITLE, views::style::STYLE_PRIMARY));
|
| + return title_view_;
|
| +}
|
| +
|
| +void ManagePasswordsBubbleView::UpdateTitleView(views::View* view,
|
| + base::string16 title_text,
|
| + bool visible) {
|
| + DCHECK_EQ(view, title_view_);
|
| + title_view_->SetText(title_text);
|
| + if (!model_.title_brand_link_range().is_empty())
|
| + title_view_->AddStyleRange(model_.title_brand_link_range(), GetLinkStyle());
|
| +}
|
| +
|
| base::string16 ManagePasswordsBubbleView::GetWindowTitle() const {
|
| return model_.title();
|
| }
|
| @@ -848,13 +809,6 @@ gfx::ImageSkia ManagePasswordsBubbleView::GetWindowIcon() {
|
| return gfx::ImageSkia();
|
| }
|
|
|
| -bool ManagePasswordsBubbleView::ShouldShowWindowTitle() const {
|
| - // Since bubble titles don't support links, fall back to a custom title view
|
| - // if we need to show a link. Only use the normal title path if there's no
|
| - // link.
|
| - return model_.title_brand_link_range().is_empty();
|
| -}
|
| -
|
| bool ManagePasswordsBubbleView::ShouldShowWindowIcon() const {
|
| return model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE;
|
| }
|
| @@ -865,6 +819,14 @@ bool ManagePasswordsBubbleView::ShouldShowCloseButton() const {
|
| model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE;
|
| }
|
|
|
| +void ManagePasswordsBubbleView::StyledLabelLinkClicked(
|
| + views::StyledLabel* label,
|
| + const gfx::Range& range,
|
| + int event_flags) {
|
| + DCHECK_EQ(range, model_.title_brand_link_range());
|
| + model_.OnBrandLinkClicked();
|
| +}
|
| +
|
| void ManagePasswordsBubbleView::Refresh() {
|
| RemoveAllChildViews(true);
|
| initially_focused_view_ = NULL;
|
|
|