Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/ui/webui/settings/site_settings_handler.cc

Issue 2358563002: Site Settings Desktop: Fix crash when deleting storage for a site. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/ui/webui/settings/site_settings_handler.h" 5 #include "chrome/browser/ui/webui/settings/site_settings_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 = new StorageInfoFetcher(profile_); 313 = new StorageInfoFetcher(profile_);
314 storage_info_fetcher->FetchStorageInfo( 314 storage_info_fetcher->FetchStorageInfo(
315 base::Bind(&SiteSettingsHandler::OnGetUsageInfo, base::Unretained(this))); 315 base::Bind(&SiteSettingsHandler::OnGetUsageInfo, base::Unretained(this)));
316 } 316 }
317 317
318 void SiteSettingsHandler::HandleClearUsage( 318 void SiteSettingsHandler::HandleClearUsage(
319 const base::ListValue* args) { 319 const base::ListValue* args) {
320 CHECK_EQ(2U, args->GetSize()); 320 CHECK_EQ(2U, args->GetSize());
321 std::string origin; 321 std::string origin;
322 CHECK(args->GetString(0, &origin)); 322 CHECK(args->GetString(0, &origin));
323 std::string type; 323 double storage_type;
324 CHECK(args->GetString(1, &type)); 324 CHECK(args->GetDouble(1, &storage_type));
Finnur 2016/09/20 11:37:27 This was the source of the crash. When I checked t
dschuyler 2016/09/20 18:28:51 Would it be ok to GetInteger here instead of GetDo
Dan Beam 2016/09/20 19:01:59 I don't think that will work
325 325
326 GURL url(origin); 326 GURL url(origin);
327 if (url.is_valid()) { 327 if (url.is_valid()) {
328 clearing_origin_ = origin; 328 clearing_origin_ = origin;
329 329
330 // Start by clearing the storage data asynchronously. 330 // Start by clearing the storage data asynchronously.
331 scoped_refptr<StorageInfoFetcher> storage_info_fetcher 331 scoped_refptr<StorageInfoFetcher> storage_info_fetcher
332 = new StorageInfoFetcher(profile_); 332 = new StorageInfoFetcher(profile_);
333 storage_info_fetcher->ClearStorage( 333 storage_info_fetcher->ClearStorage(
334 url.host(), 334 url.host(),
335 static_cast<storage::StorageType>(static_cast<int>( 335 static_cast<storage::StorageType>(static_cast<int>(storage_type)),
336 site_settings::ContentSettingsTypeFromGroupName(type))),
337 base::Bind(&SiteSettingsHandler::OnUsageInfoCleared, 336 base::Bind(&SiteSettingsHandler::OnUsageInfoCleared,
338 base::Unretained(this))); 337 base::Unretained(this)));
339 338
340 // Also clear the *local* storage data. 339 // Also clear the *local* storage data.
341 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper = 340 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper =
342 new BrowsingDataLocalStorageHelper(profile_); 341 new BrowsingDataLocalStorageHelper(profile_);
343 local_storage_helper->DeleteOrigin(url); 342 local_storage_helper->DeleteOrigin(url);
344 } 343 }
345 } 344 }
346 345
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 origin = content::kUnreachableWebDataURL; 708 origin = content::kUnreachableWebDataURL;
710 } 709 }
711 710
712 content::HostZoomMap* host_zoom_map; 711 content::HostZoomMap* host_zoom_map;
713 host_zoom_map = content::HostZoomMap::GetDefaultForBrowserContext(profile_); 712 host_zoom_map = content::HostZoomMap::GetDefaultForBrowserContext(profile_);
714 double default_level = host_zoom_map->GetDefaultZoomLevel(); 713 double default_level = host_zoom_map->GetDefaultZoomLevel();
715 host_zoom_map->SetZoomLevelForHost(origin, default_level); 714 host_zoom_map->SetZoomLevelForHost(origin, default_level);
716 } 715 }
717 716
718 } // namespace settings 717 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698