OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/prerender/prerender_manager.h" | 5 #include "chrome/browser/prerender/prerender_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 class PrerenderManager::OnCloseTabContentsDeleter : public TabContentsDelegate { | 73 class PrerenderManager::OnCloseTabContentsDeleter : public TabContentsDelegate { |
74 public: | 74 public: |
75 OnCloseTabContentsDeleter(PrerenderManager* manager, | 75 OnCloseTabContentsDeleter(PrerenderManager* manager, |
76 TabContentsWrapper* tab) | 76 TabContentsWrapper* tab) |
77 : manager_(manager), | 77 : manager_(manager), |
78 tab_(tab) { | 78 tab_(tab) { |
79 tab_->tab_contents()->set_delegate(this); | 79 tab_->tab_contents()->set_delegate(this); |
80 } | 80 } |
81 | 81 |
82 virtual void CloseContents(TabContents* source) OVERRIDE { | 82 virtual void CloseContents(TabContents* source) OVERRIDE { |
83 manager_->ScheduleDeleteOldTabContents(tab_.release(), this); | 83 TabContentsWrapper* tab = tab_.release(); |
84 tab->tab_contents()->set_delegate(NULL); | |
85 manager_->ScheduleDeleteOldTabContents(tab, this); | |
mmenke
2011/06/08 22:29:05
nit: Any reason for not just doing:
tab_->tab_co
cbentzel
2011/06/09 00:49:49
Nope. Changed to save one vertical line.
| |
84 } | 86 } |
85 | 87 |
86 virtual bool ShouldSuppressDialogs() OVERRIDE { | 88 virtual bool ShouldSuppressDialogs() OVERRIDE { |
87 return true; | 89 return true; |
88 } | 90 } |
89 | 91 |
90 // TabContentsDelegate implementation (pure virtual methods). Since we are | 92 // TabContentsDelegate implementation (pure virtual methods). Since we are |
91 // waiting for the tab to close, none of this matters. | 93 // waiting for the tab to close, none of this matters. |
92 virtual void OpenURLFromTab(TabContents*, const GURL&, const GURL&, | 94 virtual void OpenURLFromTab(TabContents*, const GURL&, const GURL&, |
93 WindowOpenDisposition, PageTransition::Type) OVERRIDE {} | 95 WindowOpenDisposition, PageTransition::Type) OVERRIDE {} |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
976 ScopedVector<OnCloseTabContentsDeleter>::iterator i = std::find( | 978 ScopedVector<OnCloseTabContentsDeleter>::iterator i = std::find( |
977 on_close_tab_contents_deleters_.begin(), | 979 on_close_tab_contents_deleters_.begin(), |
978 on_close_tab_contents_deleters_.end(), | 980 on_close_tab_contents_deleters_.end(), |
979 deleter); | 981 deleter); |
980 DCHECK(i != on_close_tab_contents_deleters_.end()); | 982 DCHECK(i != on_close_tab_contents_deleters_.end()); |
981 on_close_tab_contents_deleters_.erase(i); | 983 on_close_tab_contents_deleters_.erase(i); |
982 } | 984 } |
983 } | 985 } |
984 | 986 |
985 } // namespace prerender | 987 } // namespace prerender |
OLD | NEW |