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 void CoreTabHelper::DidStartLoading(content::RenderViewHost* render_view_host) { | 144 void CoreTabHelper::DidStartLoading(content::RenderViewHost* render_view_host) { |
145 UpdateContentRestrictions(0); | 145 UpdateContentRestrictions(0); |
146 } | 146 } |
147 | 147 |
148 void CoreTabHelper::WasShown() { | 148 void CoreTabHelper::WasShown() { |
149 WebCacheManager::GetInstance()->ObserveActivity( | 149 WebCacheManager::GetInstance()->ObserveActivity( |
150 web_contents()->GetRenderProcessHost()->GetID()); | 150 web_contents()->GetRenderProcessHost()->GetID()); |
151 } | 151 } |
152 | 152 |
153 void CoreTabHelper::WebContentsDestroyed(WebContents* web_contents) { | 153 void CoreTabHelper::WebContentsDestroyed() { |
154 // OnCloseStarted isn't called in unit tests. | 154 // OnCloseStarted isn't called in unit tests. |
155 if (!close_start_time_.is_null()) { | 155 if (!close_start_time_.is_null()) { |
156 bool fast_tab_close_enabled = CommandLine::ForCurrentProcess()->HasSwitch( | 156 bool fast_tab_close_enabled = CommandLine::ForCurrentProcess()->HasSwitch( |
157 switches::kEnableFastUnload); | 157 switches::kEnableFastUnload); |
158 | 158 |
159 if (fast_tab_close_enabled) { | 159 if (fast_tab_close_enabled) { |
160 base::TimeTicks now = base::TimeTicks::Now(); | 160 base::TimeTicks now = base::TimeTicks::Now(); |
161 base::TimeDelta close_time = now - close_start_time_; | 161 base::TimeDelta close_time = now - close_start_time_; |
162 UMA_HISTOGRAM_TIMES("Tab.Close", close_time); | 162 UMA_HISTOGRAM_TIMES("Tab.Close", close_time); |
163 | 163 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 DCHECK(!content_type.empty()); | 248 DCHECK(!content_type.empty()); |
249 open_url_params.uses_post = true; | 249 open_url_params.uses_post = true; |
250 open_url_params.browser_initiated_post_data = | 250 open_url_params.browser_initiated_post_data = |
251 base::RefCountedString::TakeString(post_data); | 251 base::RefCountedString::TakeString(post_data); |
252 open_url_params.extra_headers += base::StringPrintf( | 252 open_url_params.extra_headers += base::StringPrintf( |
253 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, | 253 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, |
254 content_type.c_str()); | 254 content_type.c_str()); |
255 } | 255 } |
256 web_contents()->OpenURL(open_url_params); | 256 web_contents()->OpenURL(open_url_params); |
257 } | 257 } |
OLD | NEW |