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/ui/tab_contents/core_tab_helper.h" | 5 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 143 } |
144 | 144 |
145 void CoreTabHelper::WasShown() { | 145 void CoreTabHelper::WasShown() { |
146 web_cache::WebCacheManager::GetInstance()->ObserveActivity( | 146 web_cache::WebCacheManager::GetInstance()->ObserveActivity( |
147 web_contents()->GetRenderProcessHost()->GetID()); | 147 web_contents()->GetRenderProcessHost()->GetID()); |
148 } | 148 } |
149 | 149 |
150 void CoreTabHelper::WebContentsDestroyed() { | 150 void CoreTabHelper::WebContentsDestroyed() { |
151 // OnCloseStarted isn't called in unit tests. | 151 // OnCloseStarted isn't called in unit tests. |
152 if (!close_start_time_.is_null()) { | 152 if (!close_start_time_.is_null()) { |
153 bool fast_tab_close_enabled = CommandLine::ForCurrentProcess()->HasSwitch( | 153 bool fast_tab_close_enabled = |
154 switches::kEnableFastUnload); | 154 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 155 switches::kEnableFastUnload); |
155 | 156 |
156 if (fast_tab_close_enabled) { | 157 if (fast_tab_close_enabled) { |
157 base::TimeTicks now = base::TimeTicks::Now(); | 158 base::TimeTicks now = base::TimeTicks::Now(); |
158 base::TimeDelta close_time = now - close_start_time_; | 159 base::TimeDelta close_time = now - close_start_time_; |
159 UMA_HISTOGRAM_TIMES("Tab.Close", close_time); | 160 UMA_HISTOGRAM_TIMES("Tab.Close", close_time); |
160 | 161 |
161 base::TimeTicks unload_start_time = close_start_time_; | 162 base::TimeTicks unload_start_time = close_start_time_; |
162 base::TimeTicks unload_end_time = now; | 163 base::TimeTicks unload_end_time = now; |
163 if (!before_unload_end_time_.is_null()) | 164 if (!before_unload_end_time_.is_null()) |
164 unload_start_time = before_unload_end_time_; | 165 unload_start_time = before_unload_end_time_; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 DCHECK(!content_type.empty()); | 240 DCHECK(!content_type.empty()); |
240 open_url_params.uses_post = true; | 241 open_url_params.uses_post = true; |
241 open_url_params.browser_initiated_post_data = | 242 open_url_params.browser_initiated_post_data = |
242 base::RefCountedString::TakeString(post_data); | 243 base::RefCountedString::TakeString(post_data); |
243 open_url_params.extra_headers += base::StringPrintf( | 244 open_url_params.extra_headers += base::StringPrintf( |
244 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, | 245 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, |
245 content_type.c_str()); | 246 content_type.c_str()); |
246 } | 247 } |
247 web_contents()->OpenURL(open_url_params); | 248 web_contents()->OpenURL(open_url_params); |
248 } | 249 } |
OLD | NEW |