| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/browsing_data/clear_site_data_throttle.h" | 5 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Record the call parameters. | 149 // Record the call parameters. |
| 150 UMA_HISTOGRAM_ENUMERATION( | 150 UMA_HISTOGRAM_ENUMERATION( |
| 151 "Navigation.ClearSiteData.Parameters", | 151 "Navigation.ClearSiteData.Parameters", |
| 152 ParametersMask(clear_cookies, clear_storage, clear_cache), (1 << 3)); | 152 ParametersMask(clear_cookies, clear_storage, clear_cache), (1 << 3)); |
| 153 | 153 |
| 154 // If the header is valid, clear the data for this browser context and origin. | 154 // If the header is valid, clear the data for this browser context and origin. |
| 155 BrowserContext* browser_context = | 155 BrowserContext* browser_context = |
| 156 navigation_handle()->GetWebContents()->GetBrowserContext(); | 156 navigation_handle()->GetWebContents()->GetBrowserContext(); |
| 157 url::Origin origin(current_url_); | 157 url::Origin origin(current_url_); |
| 158 | 158 |
| 159 if (origin.unique()) { | 159 if (origin.opaque()) { |
| 160 ConsoleLog(&messages_, current_url_, "Not supported for unique origins.", | 160 ConsoleLog(&messages_, current_url_, "Not supported for opaque origins.", |
| 161 CONSOLE_MESSAGE_LEVEL_ERROR); | 161 CONSOLE_MESSAGE_LEVEL_ERROR); |
| 162 return; | 162 return; |
| 163 } | 163 } |
| 164 | 164 |
| 165 clearing_in_progress_ = true; | 165 clearing_in_progress_ = true; |
| 166 clearing_started_ = base::TimeTicks::Now(); | 166 clearing_started_ = base::TimeTicks::Now(); |
| 167 GetContentClient()->browser()->ClearSiteData( | 167 GetContentClient()->browser()->ClearSiteData( |
| 168 browser_context, origin, clear_cookies, clear_storage, clear_cache, | 168 browser_context, origin, clear_cookies, clear_storage, clear_cache, |
| 169 base::Bind(&ClearSiteDataThrottle::TaskFinished, | 169 base::Bind(&ClearSiteDataThrottle::TaskFinished, |
| 170 weak_ptr_factory_.GetWeakPtr())); | 170 weak_ptr_factory_.GetWeakPtr())); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.ClearSiteData.Duration", | 274 UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.ClearSiteData.Duration", |
| 275 base::TimeTicks::Now() - clearing_started_, | 275 base::TimeTicks::Now() - clearing_started_, |
| 276 base::TimeDelta::FromMilliseconds(1), | 276 base::TimeDelta::FromMilliseconds(1), |
| 277 base::TimeDelta::FromSeconds(1), 50); | 277 base::TimeDelta::FromSeconds(1), 50); |
| 278 | 278 |
| 279 navigation_handle()->Resume(); | 279 navigation_handle()->Resume(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace content | 282 } // namespace content |
| OLD | NEW |