Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: chrome/browser/password_manager/password_manager_infobar_delegate.cc

Issue 1313363004: [Password Manager] Extract some methods of SavePasswordInfobarDelegate to separate class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/password_manager/password_manager_infobar_delegate.h"
6
7 #include "chrome/browser/infobars/infobar_service.h"
8 #include "chrome/grit/chromium_strings.h"
9 #include "chrome/grit/generated_resources.h"
10 #include "components/infobars/core/infobar.h"
11 #include "content/public/browser/web_contents.h"
12 #include "grit/theme_resources.h"
13 #include "ui/base/l10n/l10n_util.h"
14
15 PasswordManagerInfoBarDelegate::~PasswordManagerInfoBarDelegate() {}
16
17 PasswordManagerInfoBarDelegate::PasswordManagerInfoBarDelegate()
18 : ConfirmInfoBarDelegate(), message_link_range_(gfx::Range()) {}
19
20 infobars::InfoBarDelegate::Type PasswordManagerInfoBarDelegate::GetInfoBarType()
21 const {
22 return PAGE_ACTION_TYPE;
23 }
24
25 infobars::InfoBarDelegate::InfoBarAutomationType
26 PasswordManagerInfoBarDelegate::GetInfoBarAutomationType() const {
27 return PASSWORD_INFOBAR;
28 }
29
30 int PasswordManagerInfoBarDelegate::GetIconId() const {
31 return IDR_INFOBAR_SAVE_PASSWORD;
32 }
33
34 bool PasswordManagerInfoBarDelegate::ShouldExpire(
35 const NavigationDetails& details) const {
36 return !details.is_redirect && ConfirmInfoBarDelegate::ShouldExpire(details);
37 }
38
39 base::string16 PasswordManagerInfoBarDelegate::GetMessageText() const {
40 return message_;
41 }
42
43 bool PasswordManagerInfoBarDelegate::LinkClicked(
44 WindowOpenDisposition disposition) {
45 InfoBarService::WebContentsFromInfoBar(infobar())
46 ->OpenURL(content::OpenURLParams(
47 GURL(l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK_PAGE)),
48 content::Referrer(),
49 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
50 ui::PAGE_TRANSITION_LINK, false));
51 return true;
52 }
53
54 void PasswordManagerInfoBarDelegate::SetMessage(const base::string16& message) {
55 message_ = message;
56 }
57
58 void PasswordManagerInfoBarDelegate::SetMessageLinkRange(
59 const gfx::Range& message_link_range) {
60 message_link_range_ = message_link_range;
61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698