Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / download / download_completion_blocker.cc
blob45706761095b7c8f166f409d463a5c8a0715f4cd
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
3 // found in the LICENSE file.
5 #include "chrome/browser/download/download_completion_blocker.h"
7 #include "base/logging.h"
9 DownloadCompletionBlocker::DownloadCompletionBlocker()
10 : is_complete_(false) {
13 DownloadCompletionBlocker::~DownloadCompletionBlocker() {
16 void DownloadCompletionBlocker::CompleteDownload() {
17 // Do not run |callback_| more than once.
18 if (is_complete_)
19 return;
20 is_complete_ = true;
22 if (callback_.is_null())
23 return;
24 callback_.Run();
25 // |callback_| may delete |this|, so do not rely on |this| after running
26 // |callback_|!