OLD | NEW |
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/prerender/prerender_manager.h" | 5 #include "chrome/browser/prerender/prerender_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <functional> | 10 #include <functional> |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 base::Bind(&OnCloseWebContentsDeleter::ScheduleWebContentsForDeletion, | 101 base::Bind(&OnCloseWebContentsDeleter::ScheduleWebContentsForDeletion, |
102 AsWeakPtr(), true), | 102 AsWeakPtr(), true), |
103 base::TimeDelta::FromSeconds(kDeleteWithExtremePrejudiceSeconds)); | 103 base::TimeDelta::FromSeconds(kDeleteWithExtremePrejudiceSeconds)); |
104 } | 104 } |
105 | 105 |
106 void CloseContents(WebContents* source) override { | 106 void CloseContents(WebContents* source) override { |
107 DCHECK_EQ(tab_.get(), source); | 107 DCHECK_EQ(tab_.get(), source); |
108 ScheduleWebContentsForDeletion(false); | 108 ScheduleWebContentsForDeletion(false); |
109 } | 109 } |
110 | 110 |
111 bool ShouldSuppressDialogs(WebContents* source) override { | 111 bool ShouldSuppressDialogs(WebContents* source, bool before_unload) override { |
112 // Use this as a proxy for getting statistics on how often we fail to honor | 112 // Use this as a proxy for getting statistics on how often we fail to honor |
113 // the beforeunload event. | 113 // the beforeunload event. |
114 DCHECK_EQ(tab_.get(), source); | 114 DCHECK_EQ(tab_.get(), source); |
115 suppressed_dialog_ = true; | 115 suppressed_dialog_ = true; |
116 return true; | 116 return true; |
117 } | 117 } |
118 | 118 |
119 private: | 119 private: |
120 static const int kDeleteWithExtremePrejudiceSeconds = 3; | 120 static const int kDeleteWithExtremePrejudiceSeconds = 3; |
121 | 121 |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 DCHECK_EQ(1u, erased); | 1283 DCHECK_EQ(1u, erased); |
1284 } | 1284 } |
1285 | 1285 |
1286 void PrerenderManager::SetPrerenderContentsFactoryForTest( | 1286 void PrerenderManager::SetPrerenderContentsFactoryForTest( |
1287 PrerenderContents::Factory* prerender_contents_factory) { | 1287 PrerenderContents::Factory* prerender_contents_factory) { |
1288 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1288 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1289 prerender_contents_factory_.reset(prerender_contents_factory); | 1289 prerender_contents_factory_.reset(prerender_contents_factory); |
1290 } | 1290 } |
1291 | 1291 |
1292 } // namespace prerender | 1292 } // namespace prerender |
OLD | NEW |