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

Side by Side Diff: chrome/browser/autofill/autofill_cc_infobar_delegate.cc

Issue 6249010: Cleanup: de-inline a bunch of classes, rename and move "PluginInstaller" to "... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/autofill/autofill_cc_infobar_delegate.h" 5 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/autofill/autofill_cc_infobar.h" 9 #include "chrome/browser/autofill/autofill_cc_infobar.h"
10 #include "chrome/browser/autofill/autofill_manager.h" 10 #include "chrome/browser/autofill/autofill_manager.h"
11 #include "chrome/browser/browser_list.h" 11 #include "chrome/browser/browser_list.h"
12 #include "chrome/browser/tab_contents/tab_contents.h"
13 #include "chrome/browser/tab_contents/tab_contents_delegate.h"
14 #include "grit/chromium_strings.h"
15 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
16 #include "grit/theme_resources.h" 13 #include "grit/theme_resources.h"
17 #include "third_party/skia/include/core/SkBitmap.h"
18 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
19 15
20 AutoFillCCInfoBarDelegate::AutoFillCCInfoBarDelegate(TabContents* tab_contents, 16 AutoFillCCInfoBarDelegate::AutoFillCCInfoBarDelegate(TabContents* tab_contents,
21 AutoFillManager* host) 17 AutoFillManager* host)
22 : ConfirmInfoBarDelegate(tab_contents), 18 : ConfirmInfoBarDelegate(tab_contents),
23 host_(host) { 19 host_(host) {
24 } 20 }
25 21
26 AutoFillCCInfoBarDelegate::~AutoFillCCInfoBarDelegate() { 22 AutoFillCCInfoBarDelegate::~AutoFillCCInfoBarDelegate() {
27 } 23 }
28 24
29 bool AutoFillCCInfoBarDelegate::ShouldExpire( 25 bool AutoFillCCInfoBarDelegate::ShouldExpire(
30 const NavigationController::LoadCommittedDetails& details) const { 26 const NavigationController::LoadCommittedDetails& details) const {
31 // The user has submitted a form, causing the page to navigate elsewhere. We 27 // The user has submitted a form, causing the page to navigate elsewhere. We
32 // don't want the infobar to be expired at this point, because the user won't 28 // don't want the infobar to be expired at this point, because the user won't
33 // get a chance to answer the question. 29 // get a chance to answer the question.
34 return false; 30 return false;
35 } 31 }
36 32
37 void AutoFillCCInfoBarDelegate::InfoBarClosed() { 33 void AutoFillCCInfoBarDelegate::InfoBarClosed() {
38 if (host_) { 34 if (host_) {
39 host_->OnInfoBarClosed(false); 35 host_->OnInfoBarClosed(false);
40 host_ = NULL; 36 host_ = NULL;
41 } 37 }
42 delete this; 38 delete this;
43 } 39 }
44 40
45 string16 AutoFillCCInfoBarDelegate::GetMessageText() const {
46 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_TEXT);
47 }
48
49 SkBitmap* AutoFillCCInfoBarDelegate::GetIcon() const { 41 SkBitmap* AutoFillCCInfoBarDelegate::GetIcon() const {
50 return ResourceBundle::GetSharedInstance().GetBitmapNamed( 42 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
51 IDR_INFOBAR_AUTOFILL); 43 IDR_INFOBAR_AUTOFILL);
52 } 44 }
53 45
46 InfoBarDelegate::Type AutoFillCCInfoBarDelegate::GetInfoBarType() const {
47 return PAGE_ACTION_TYPE;
48 }
49
50 string16 AutoFillCCInfoBarDelegate::GetMessageText() const {
51 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_TEXT);
52 }
53
54 int AutoFillCCInfoBarDelegate::GetButtons() const { 54 int AutoFillCCInfoBarDelegate::GetButtons() const {
55 return BUTTON_OK | BUTTON_CANCEL; 55 return BUTTON_OK | BUTTON_CANCEL;
56 } 56 }
57 57
58 string16 AutoFillCCInfoBarDelegate::GetButtonLabel( 58 string16 AutoFillCCInfoBarDelegate::GetButtonLabel(InfoBarButton button) const {
59 ConfirmInfoBarDelegate::InfoBarButton button) const { 59 return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
60 if (button == BUTTON_OK) 60 IDS_AUTOFILL_CC_INFOBAR_ACCEPT : IDS_AUTOFILL_CC_INFOBAR_DENY);
61 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_ACCEPT);
62 else if (button == BUTTON_CANCEL)
63 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_INFOBAR_DENY);
64 else
65 NOTREACHED();
66
67 return string16();
68 } 61 }
69 62
70 bool AutoFillCCInfoBarDelegate::Accept() { 63 bool AutoFillCCInfoBarDelegate::Accept() {
71 UMA_HISTOGRAM_COUNTS("AutoFill.CCInfoBarAccepted", 1); 64 UMA_HISTOGRAM_COUNTS("AutoFill.CCInfoBarAccepted", 1);
72 if (host_) { 65 if (host_) {
73 host_->OnInfoBarClosed(true); 66 host_->OnInfoBarClosed(true);
74 host_ = NULL; 67 host_ = NULL;
75 } 68 }
76 return true; 69 return true;
77 } 70 }
(...skipping 16 matching lines...) Expand all
94 DCHECK(browser); 87 DCHECK(browser);
95 browser->OpenAutoFillHelpTabAndActivate(); 88 browser->OpenAutoFillHelpTabAndActivate();
96 return false; 89 return false;
97 } 90 }
98 91
99 #if defined(OS_WIN) 92 #if defined(OS_WIN)
100 InfoBar* AutoFillCCInfoBarDelegate::CreateInfoBar() { 93 InfoBar* AutoFillCCInfoBarDelegate::CreateInfoBar() {
101 return CreateAutofillCcInfoBar(this); 94 return CreateAutofillCcInfoBar(this);
102 } 95 }
103 #endif // defined(OS_WIN) 96 #endif // defined(OS_WIN)
104
105 InfoBarDelegate::Type AutoFillCCInfoBarDelegate::GetInfoBarType() {
106 return PAGE_ACTION_TYPE;
107 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_cc_infobar_delegate.h ('k') | chrome/browser/automation/automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698