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

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: Fixed unit test compile error 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 namespace { 52 namespace {
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.
asanka 2013/10/11 16:02:35 Nit: Mention that dangerous downloads don't block
felt 2013/10/11 17:26:44 Done.
63 if (DownloadService::DownloadCountAllProfiles() > 0) 63 if (DownloadService::NonDangerousDownloadCountAllProfiles() > 0)
64 return false; 64 return false;
65 65
66 // Check TabsNeedBeforeUnloadFired(). 66 // Check TabsNeedBeforeUnloadFired().
67 for (; !browser_it.done(); browser_it.Next()) { 67 for (; !browser_it.done(); browser_it.Next()) {
68 if (browser_it->TabsNeedBeforeUnloadFired()) 68 if (browser_it->TabsNeedBeforeUnloadFired())
69 return false; 69 return false;
70 } 70 }
71 return true; 71 return true;
72 } 72 }
73 73
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // environment is still active. 379 // environment is still active.
380 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) 380 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE)
381 return !ash::Shell::HasInstance(); 381 return !ash::Shell::HasInstance();
382 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) 382 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH)
383 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); 383 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty();
384 #endif 384 #endif
385 return true; 385 return true;
386 } 386 }
387 387
388 } // namespace chrome 388 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698