| 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 "app/animation.h" | 7 #include "app/animation.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
| (...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 // confirmation before closing the browser if the user decides so. | 1647 // confirmation before closing the browser if the user decides so. |
| 1648 return CanCloseWithInProgressDownloads(); | 1648 return CanCloseWithInProgressDownloads(); |
| 1649 } | 1649 } |
| 1650 | 1650 |
| 1651 bool Browser::CanBookmarkAllTabs() const { | 1651 bool Browser::CanBookmarkAllTabs() const { |
| 1652 BookmarkModel* model = profile()->GetBookmarkModel(); | 1652 BookmarkModel* model = profile()->GetBookmarkModel(); |
| 1653 return (model && model->IsLoaded() && (tab_count() > 1)); | 1653 return (model && model->IsLoaded() && (tab_count() > 1)); |
| 1654 } | 1654 } |
| 1655 | 1655 |
| 1656 void Browser::BookmarkAllTabs() { | 1656 void Browser::BookmarkAllTabs() { |
| 1657 const BookmarkNode* node = bookmark_utils::CreateBookmarkForAllTabs(this); | 1657 BookmarkModel* model = profile()->GetBookmarkModel(); |
| 1658 if (!node) | 1658 DCHECK(model && model->IsLoaded()); |
| 1659 return; | 1659 |
| 1660 BookmarkEditor::EditDetails details; |
| 1661 details.type = BookmarkEditor::EditDetails::NEW_FOLDER; |
| 1662 bookmark_utils::GetURLsForOpenTabs(this, &(details.urls)); |
| 1663 DCHECK(!details.urls.empty()); |
| 1660 | 1664 |
| 1661 BookmarkEditor::Show(window()->GetNativeHandle(), profile_, | 1665 BookmarkEditor::Show(window()->GetNativeHandle(), profile_, |
| 1662 node->GetParent(), node, BookmarkEditor::SHOW_TREE, | 1666 model->GetParentForNewNodes(), details, |
| 1663 NULL); | 1667 BookmarkEditor::SHOW_TREE, NULL); |
| 1664 } | 1668 } |
| 1665 | 1669 |
| 1666 /////////////////////////////////////////////////////////////////////////////// | 1670 /////////////////////////////////////////////////////////////////////////////// |
| 1667 // Browser, TabStripModelObserver implementation: | 1671 // Browser, TabStripModelObserver implementation: |
| 1668 | 1672 |
| 1669 void Browser::TabInsertedAt(TabContents* contents, | 1673 void Browser::TabInsertedAt(TabContents* contents, |
| 1670 int index, | 1674 int index, |
| 1671 bool foreground) { | 1675 bool foreground) { |
| 1672 contents->set_delegate(this); | 1676 contents->set_delegate(this); |
| 1673 contents->controller().SetWindowID(session_id()); | 1677 contents->controller().SetWindowID(session_id()); |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2914 /////////////////////////////////////////////////////////////////////////////// | 2918 /////////////////////////////////////////////////////////////////////////////// |
| 2915 // BrowserToolbarModel (private): | 2919 // BrowserToolbarModel (private): |
| 2916 | 2920 |
| 2917 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2921 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
| 2918 // This |current_tab| can be NULL during the initialization of the | 2922 // This |current_tab| can be NULL during the initialization of the |
| 2919 // toolbar during window creation (i.e. before any tabs have been added | 2923 // toolbar during window creation (i.e. before any tabs have been added |
| 2920 // to the window). | 2924 // to the window). |
| 2921 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2925 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 2922 return current_tab ? ¤t_tab->controller() : NULL; | 2926 return current_tab ? ¤t_tab->controller() : NULL; |
| 2923 } | 2927 } |
| OLD | NEW |