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

Side by Side Diff: content/public/test/download_test_observer.cc

Issue 2228403003: content: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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
« no previous file with comments | « content/common/origin_util.cc ('k') | content/public/test/mock_special_storage_policy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/public/test/download_test_observer.h" 5 #include "content/public/test/download_test_observer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Stop observing. Do not do anything with it, as it is about to be gone. 131 // Stop observing. Do not do anything with it, as it is about to be gone.
132 DownloadSet::iterator it = downloads_observed_.find(download); 132 DownloadSet::iterator it = downloads_observed_.find(download);
133 ASSERT_TRUE(it != downloads_observed_.end()); 133 ASSERT_TRUE(it != downloads_observed_.end());
134 downloads_observed_.erase(it); 134 downloads_observed_.erase(it);
135 download->RemoveObserver(this); 135 download->RemoveObserver(this);
136 } 136 }
137 137
138 void DownloadTestObserver::OnDownloadUpdated(DownloadItem* download) { 138 void DownloadTestObserver::OnDownloadUpdated(DownloadItem* download) {
139 // Real UI code gets the user's response after returning from the observer. 139 // Real UI code gets the user's response after returning from the observer.
140 if (download->IsDangerous() && 140 if (download->IsDangerous() &&
141 !ContainsKey(dangerous_downloads_seen_, download->GetId())) { 141 !base::ContainsKey(dangerous_downloads_seen_, download->GetId())) {
142 dangerous_downloads_seen_.insert(download->GetId()); 142 dangerous_downloads_seen_.insert(download->GetId());
143 143
144 // Calling ValidateDangerousDownload() at this point will 144 // Calling ValidateDangerousDownload() at this point will
145 // cause the download to be completed twice. Do what the real UI 145 // cause the download to be completed twice. Do what the real UI
146 // code does: make the call as a delayed task. 146 // code does: make the call as a delayed task.
147 switch (dangerous_download_action_) { 147 switch (dangerous_download_action_) {
148 case ON_DANGEROUS_DOWNLOAD_ACCEPT: 148 case ON_DANGEROUS_DOWNLOAD_ACCEPT:
149 // Fake user click on "Accept". Delay the actual click, as the 149 // Fake user click on "Accept". Delay the actual click, as the
150 // real UI would. 150 // real UI would.
151 BrowserThread::PostTask( 151 BrowserThread::PostTask(
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 base::MessageLoopForUI::current()->QuitWhenIdle(); 446 base::MessageLoopForUI::current()->QuitWhenIdle();
447 } 447 }
448 448
449 const DownloadUrlParameters::OnStartedCallback 449 const DownloadUrlParameters::OnStartedCallback
450 DownloadTestItemCreationObserver::callback() { 450 DownloadTestItemCreationObserver::callback() {
451 return base::Bind( 451 return base::Bind(
452 &DownloadTestItemCreationObserver::DownloadItemCreationCallback, this); 452 &DownloadTestItemCreationObserver::DownloadItemCreationCallback, this);
453 } 453 }
454 454
455 } // namespace content 455 } // namespace content
OLDNEW
« no previous file with comments | « content/common/origin_util.cc ('k') | content/public/test/mock_special_storage_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698