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

Side by Side Diff: chrome/browser/ui/tabs/tab_strip_model.cc

Issue 10905301: Switch CoreTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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/ui/tab_contents/tab_contents.cc ('k') | no next file » | 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) 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/ui/tabs/tab_strip_model.h" 5 #include "chrome/browser/ui/tabs/tab_strip_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 case CommandNewTab: 749 case CommandNewTab:
750 case CommandCloseTab: 750 case CommandCloseTab:
751 return true; 751 return true;
752 752
753 case CommandReload: { 753 case CommandReload: {
754 std::vector<int> indices = GetIndicesForCommand(context_index); 754 std::vector<int> indices = GetIndicesForCommand(context_index);
755 for (size_t i = 0; i < indices.size(); ++i) { 755 for (size_t i = 0; i < indices.size(); ++i) {
756 TabContents* tab = GetTabContentsAt(indices[i]); 756 TabContents* tab = GetTabContentsAt(indices[i]);
757 if (tab) { 757 if (tab) {
758 CoreTabHelperDelegate* core_delegate = 758 CoreTabHelperDelegate* core_delegate =
759 tab->core_tab_helper()->delegate(); 759 CoreTabHelper::FromWebContents(tab->web_contents())->delegate();
760 if (!core_delegate || core_delegate->CanReloadContents(tab)) 760 if (!core_delegate ||
761 core_delegate->CanReloadContents(tab->web_contents()))
761 return true; 762 return true;
762 } 763 }
763 } 764 }
764 return false; 765 return false;
765 } 766 }
766 767
767 case CommandCloseOtherTabs: 768 case CommandCloseOtherTabs:
768 case CommandCloseTabsToRight: 769 case CommandCloseTabsToRight:
769 return !GetIndicesClosedByCommand(context_index, command_id).empty(); 770 return !GetIndicesClosedByCommand(context_index, command_id).empty();
770 771
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 delegate()->AddBlankTabAt(context_index + 1, true); 816 delegate()->AddBlankTabAt(context_index + 1, true);
816 break; 817 break;
817 818
818 case CommandReload: { 819 case CommandReload: {
819 content::RecordAction(UserMetricsAction("TabContextMenu_Reload")); 820 content::RecordAction(UserMetricsAction("TabContextMenu_Reload"));
820 std::vector<int> indices = GetIndicesForCommand(context_index); 821 std::vector<int> indices = GetIndicesForCommand(context_index);
821 for (size_t i = 0; i < indices.size(); ++i) { 822 for (size_t i = 0; i < indices.size(); ++i) {
822 TabContents* tab = GetTabContentsAt(indices[i]); 823 TabContents* tab = GetTabContentsAt(indices[i]);
823 if (tab) { 824 if (tab) {
824 CoreTabHelperDelegate* core_delegate = 825 CoreTabHelperDelegate* core_delegate =
825 tab->core_tab_helper()->delegate(); 826 CoreTabHelper::FromWebContents(tab->web_contents())->delegate();
826 if (!core_delegate || core_delegate->CanReloadContents(tab)) 827 if (!core_delegate ||
828 core_delegate->CanReloadContents(tab->web_contents()))
827 tab->web_contents()->GetController().Reload(true); 829 tab->web_contents()->GetController().Reload(true);
828 } 830 }
829 } 831 }
830 break; 832 break;
831 } 833 }
832 834
833 case CommandDuplicate: { 835 case CommandDuplicate: {
834 content::RecordAction(UserMetricsAction("TabContextMenu_Duplicate")); 836 content::RecordAction(UserMetricsAction("TabContextMenu_Duplicate"));
835 std::vector<int> indices = GetIndicesForCommand(context_index); 837 std::vector<int> indices = GetIndicesForCommand(context_index);
836 // Copy the TabContents off as the indices will change as tabs are 838 // Copy the TabContents off as the indices will change as tabs are
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 void TabStripModel::ForgetOpenersAndGroupsReferencing( 1315 void TabStripModel::ForgetOpenersAndGroupsReferencing(
1314 const NavigationController* tab) { 1316 const NavigationController* tab) {
1315 for (TabContentsDataVector::const_iterator i = contents_data_.begin(); 1317 for (TabContentsDataVector::const_iterator i = contents_data_.begin();
1316 i != contents_data_.end(); ++i) { 1318 i != contents_data_.end(); ++i) {
1317 if ((*i)->group == tab) 1319 if ((*i)->group == tab)
1318 (*i)->group = NULL; 1320 (*i)->group = NULL;
1319 if ((*i)->opener == tab) 1321 if ((*i)->opener == tab)
1320 (*i)->opener = NULL; 1322 (*i)->opener = NULL;
1321 } 1323 }
1322 } 1324 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tab_contents/tab_contents.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698