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

Side by Side Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 26938003: Don't prompt to save malicious downloads on exit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unneeded code Created 7 years, 2 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) 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/lifetime/application_lifetime.h" 5 #include "chrome/browser/lifetime/application_lifetime.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 // Returns true if all browsers can be closed without user interaction. 54 // Returns true if all browsers can be closed without user interaction.
55 // This currently checks if there is pending download, or if it needs to 55 // This currently checks if there is pending download, or if it needs to
56 // handle unload handler. 56 // handle unload handler.
57 bool AreAllBrowsersCloseable() { 57 bool AreAllBrowsersCloseable() {
58 chrome::BrowserIterator browser_it; 58 chrome::BrowserIterator browser_it;
59 if (browser_it.done()) 59 if (browser_it.done())
60 return true; 60 return true;
61 61
62 // If there are any downloads active, all browsers are not closeable. 62 // If there are any downloads active, all browsers are not closeable.
63 if (DownloadService::DownloadCountAllProfiles() > 0) 63 // However, this does not block for malicious downloads.
64 if (DownloadService::NonMaliciousDownloadCountAllProfiles() > 0)
64 return false; 65 return false;
65 66
66 // Check TabsNeedBeforeUnloadFired(). 67 // Check TabsNeedBeforeUnloadFired().
67 for (; !browser_it.done(); browser_it.Next()) { 68 for (; !browser_it.done(); browser_it.Next()) {
68 if (browser_it->TabsNeedBeforeUnloadFired()) 69 if (browser_it->TabsNeedBeforeUnloadFired())
69 return false; 70 return false;
70 } 71 }
71 return true; 72 return true;
72 } 73 }
73 74
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // environment is still active. 380 // environment is still active.
380 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) 381 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE)
381 return !ash::Shell::HasInstance(); 382 return !ash::Shell::HasInstance();
382 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) 383 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH)
383 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); 384 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty();
384 #endif 385 #endif
385 return true; 386 return true;
386 } 387 }
387 388
388 } // namespace chrome 389 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc ('k') | chrome/browser/lifetime/browser_close_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698