OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_danger_prompt.h" | 5 #include "chrome/browser/download/download_danger_prompt.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 8 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
9 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 9 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
10 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | 10 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" |
11 #include "content/public/browser/browser_thread.h" | |
12 #include "content/public/browser/download_danger_type.h" | 11 #include "content/public/browser/download_danger_type.h" |
13 #include "content/public/browser/download_item.h" | 12 #include "content/public/browser/download_item.h" |
14 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
15 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
16 | 15 |
17 namespace { | 16 namespace { |
18 | 17 |
19 // Implements DownloadDangerPrompt using a TabModalConfirmDialog. | 18 // Implements DownloadDangerPrompt using a TabModalConfirmDialog. |
20 class DownloadDangerPromptImpl | 19 class DownloadDangerPromptImpl |
21 : public DownloadDangerPrompt, | 20 : public DownloadDangerPrompt, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 131 |
133 void DownloadDangerPromptImpl::PrepareToClose() { | 132 void DownloadDangerPromptImpl::PrepareToClose() { |
134 accepted_.Reset(); | 133 accepted_.Reset(); |
135 canceled_.Reset(); | 134 canceled_.Reset(); |
136 if (download_ != NULL) { | 135 if (download_ != NULL) { |
137 download_->RemoveObserver(this); | 136 download_->RemoveObserver(this); |
138 download_ = NULL; | 137 download_ = NULL; |
139 } | 138 } |
140 } | 139 } |
141 | 140 |
142 } // namespace | 141 } // namespace |
143 | 142 |
144 // static | 143 // static |
145 DownloadDangerPrompt* DownloadDangerPrompt::Create( | 144 DownloadDangerPrompt* DownloadDangerPrompt::Create( |
146 content::DownloadItem* item, | 145 content::DownloadItem* item, |
147 content::WebContents* web_contents, | 146 content::WebContents* web_contents, |
148 const base::Closure& accepted, | 147 const base::Closure& accepted, |
149 const base::Closure& canceled) { | 148 const base::Closure& canceled) { |
150 DownloadDangerPromptImpl* prompt = | 149 DownloadDangerPromptImpl* prompt = |
151 new DownloadDangerPromptImpl(item, web_contents, accepted, canceled); | 150 new DownloadDangerPromptImpl(item, web_contents, accepted, canceled); |
152 // |prompt| will be deleted when the dialog is done. | 151 // |prompt| will be deleted when the dialog is done. |
153 TabModalConfirmDialog::Create(prompt, web_contents); | 152 TabModalConfirmDialog::Create(prompt, web_contents); |
154 return prompt; | 153 return prompt; |
155 } | 154 } |
OLD | NEW |