OLD | NEW |
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 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 // them. Once they have fired, we'll get a message back saying whether | 1518 // them. Once they have fired, we'll get a message back saying whether |
1519 // to proceed closing the page or not, which sends us back to this method | 1519 // to proceed closing the page or not, which sends us back to this method |
1520 // with the HasUnloadListener bit cleared. | 1520 // with the HasUnloadListener bit cleared. |
1521 web_contents->render_view_host()->FirePageBeforeUnload(); | 1521 web_contents->render_view_host()->FirePageBeforeUnload(); |
1522 return true; | 1522 return true; |
1523 } | 1523 } |
1524 } | 1524 } |
1525 return false; | 1525 return false; |
1526 } | 1526 } |
1527 | 1527 |
| 1528 bool Browser::CanCloseContentsAt(int index) { |
| 1529 if (tabstrip_model_.count() > 1) |
| 1530 return true; |
| 1531 // We are closing the last tab for this browser. Make sure to check for |
| 1532 // in-progress downloads. |
| 1533 // Note that the next call when it returns false will ask the user for |
| 1534 // confirmation before closing the browser if the user decides so. |
| 1535 return CanCloseWithInProgressDownloads(); |
| 1536 } |
1528 | 1537 |
1529 /////////////////////////////////////////////////////////////////////////////// | 1538 /////////////////////////////////////////////////////////////////////////////// |
1530 // Browser, TabStripModelObserver implementation: | 1539 // Browser, TabStripModelObserver implementation: |
1531 | 1540 |
1532 void Browser::TabInsertedAt(TabContents* contents, | 1541 void Browser::TabInsertedAt(TabContents* contents, |
1533 int index, | 1542 int index, |
1534 bool foreground) { | 1543 bool foreground) { |
1535 contents->set_delegate(this); | 1544 contents->set_delegate(this); |
1536 contents->controller().SetWindowID(session_id()); | 1545 contents->controller().SetWindowID(session_id()); |
1537 | 1546 |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 | 2660 |
2652 // We need to register the window position pref. | 2661 // We need to register the window position pref. |
2653 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2662 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
2654 window_pref.append(L"_"); | 2663 window_pref.append(L"_"); |
2655 window_pref.append(app_name); | 2664 window_pref.append(app_name); |
2656 PrefService* prefs = g_browser_process->local_state(); | 2665 PrefService* prefs = g_browser_process->local_state(); |
2657 DCHECK(prefs); | 2666 DCHECK(prefs); |
2658 | 2667 |
2659 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2668 prefs->RegisterDictionaryPref(window_pref.c_str()); |
2660 } | 2669 } |
OLD | NEW |