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

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

Issue 99195: Fix for in-progress download confirmation dialog (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/tabs/tab_strip_model.h » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/idle_timer.h" 8 #include "base/idle_timer.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 // them. Once they have fired, we'll get a message back saying whether 1517 // them. Once they have fired, we'll get a message back saying whether
1518 // to proceed closing the page or not, which sends us back to this method 1518 // to proceed closing the page or not, which sends us back to this method
1519 // with the HasUnloadListener bit cleared. 1519 // with the HasUnloadListener bit cleared.
1520 web_contents->render_view_host()->FirePageBeforeUnload(); 1520 web_contents->render_view_host()->FirePageBeforeUnload();
1521 return true; 1521 return true;
1522 } 1522 }
1523 } 1523 }
1524 return false; 1524 return false;
1525 } 1525 }
1526 1526
1527 bool Browser::CanCloseContentsAt(int index) {
1528 if (tabstrip_model_.count() > 1)
1529 return true;
1530 // We are closing the last tab for this browser. Make sure to check for
1531 // in-progress downloads.
1532 // Note that the next call when it returns false will ask the user for
1533 // confirmation before closing the browser if the user decides so.
1534 return CanCloseWithInProgressDownloads();
1535 }
1527 1536
1528 /////////////////////////////////////////////////////////////////////////////// 1537 ///////////////////////////////////////////////////////////////////////////////
1529 // Browser, TabStripModelObserver implementation: 1538 // Browser, TabStripModelObserver implementation:
1530 1539
1531 void Browser::TabInsertedAt(TabContents* contents, 1540 void Browser::TabInsertedAt(TabContents* contents,
1532 int index, 1541 int index,
1533 bool foreground) { 1542 bool foreground) {
1534 contents->set_delegate(this); 1543 contents->set_delegate(this);
1535 contents->controller().SetWindowID(session_id()); 1544 contents->controller().SetWindowID(session_id());
1536 1545
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2644 2653
2645 // We need to register the window position pref. 2654 // We need to register the window position pref.
2646 std::wstring window_pref(prefs::kBrowserWindowPlacement); 2655 std::wstring window_pref(prefs::kBrowserWindowPlacement);
2647 window_pref.append(L"_"); 2656 window_pref.append(L"_");
2648 window_pref.append(app_name); 2657 window_pref.append(app_name);
2649 PrefService* prefs = g_browser_process->local_state(); 2658 PrefService* prefs = g_browser_process->local_state();
2650 DCHECK(prefs); 2659 DCHECK(prefs);
2651 2660
2652 prefs->RegisterDictionaryPref(window_pref.c_str()); 2661 prefs->RegisterDictionaryPref(window_pref.c_str());
2653 } 2662 }
OLDNEW
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/tabs/tab_strip_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698