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

Side by Side Diff: chrome/browser/download/download_request_infobar_delegate.cc

Issue 6926001: Replace the virtual InfoBarDelegate::InfoBarClosed() function with a non-virtual one. This is a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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) 2011 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/download/download_request_infobar_delegate.h" 5 #include "chrome/browser/download/download_request_infobar_delegate.h"
6 6
7 #include "content/browser/tab_contents/tab_contents.h" 7 #include "content/browser/tab_contents/tab_contents.h"
8 #include "grit/generated_resources.h" 8 #include "grit/generated_resources.h"
9 #include "grit/theme_resources_standard.h" 9 #include "grit/theme_resources_standard.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
11 #include "ui/base/resource/resource_bundle.h" 11 #include "ui/base/resource/resource_bundle.h"
12 12
13 DownloadRequestInfoBarDelegate::DownloadRequestInfoBarDelegate( 13 DownloadRequestInfoBarDelegate::DownloadRequestInfoBarDelegate(
14 TabContents* tab, 14 TabContents* tab,
15 DownloadRequestLimiter::TabDownloadState* host) 15 DownloadRequestLimiter::TabDownloadState* host)
16 : ConfirmInfoBarDelegate(tab), 16 : ConfirmInfoBarDelegate(tab),
17 host_(host) { 17 host_(host) {
18 } 18 }
19 19
20 DownloadRequestInfoBarDelegate::~DownloadRequestInfoBarDelegate() { 20 DownloadRequestInfoBarDelegate::~DownloadRequestInfoBarDelegate() {
21 }
22
23 void DownloadRequestInfoBarDelegate::InfoBarClosed() {
24 if (host_) 21 if (host_)
25 host_->Cancel(); 22 host_->Cancel();
26 delete this;
27 } 23 }
28 24
29 gfx::Image* DownloadRequestInfoBarDelegate::GetIcon() const { 25 gfx::Image* DownloadRequestInfoBarDelegate::GetIcon() const {
30 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 26 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
31 IDR_INFOBAR_MULTIPLE_DOWNLOADS); 27 IDR_INFOBAR_MULTIPLE_DOWNLOADS);
32 } 28 }
33 29
34 string16 DownloadRequestInfoBarDelegate::GetMessageText() const { 30 string16 DownloadRequestInfoBarDelegate::GetMessageText() const {
35 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); 31 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING);
36 } 32 }
37 33
38 string16 DownloadRequestInfoBarDelegate::GetButtonLabel( 34 string16 DownloadRequestInfoBarDelegate::GetButtonLabel(
39 InfoBarButton button) const { 35 InfoBarButton button) const {
40 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? 36 return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
41 IDS_MULTI_DOWNLOAD_WARNING_ALLOW : IDS_MULTI_DOWNLOAD_WARNING_DENY); 37 IDS_MULTI_DOWNLOAD_WARNING_ALLOW : IDS_MULTI_DOWNLOAD_WARNING_DENY);
42 } 38 }
43 39
44 bool DownloadRequestInfoBarDelegate::Accept() { 40 bool DownloadRequestInfoBarDelegate::Accept() {
45 if (host_) { 41 if (host_) {
46 // Accept() call will nullify host_ if no further prompts are required. 42 // Accept() call will nullify host_ if no further prompts are required.
47 host_->Accept(); 43 host_->Accept();
48 } 44 }
49 45
50 return !host_; 46 return !host_;
51 } 47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698