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

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

Issue 2578723002: Reduce BrowsingDataRemover's dependencies on Chrome (Closed)
Patch Set: Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/settings_clear_browsing_data_handler. h" 5 #include "chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler. h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 std::string webui_callback_id; 207 std::string webui_callback_id;
208 CHECK_EQ(1U, args->GetSize()); 208 CHECK_EQ(1U, args->GetSize());
209 CHECK(args->GetString(0, &webui_callback_id)); 209 CHECK(args->GetString(0, &webui_callback_id));
210 210
211 BrowsingDataRemover* remover = 211 BrowsingDataRemover* remover =
212 BrowsingDataRemoverFactory::GetForBrowserContext(profile_); 212 BrowsingDataRemoverFactory::GetForBrowserContext(profile_);
213 task_observer_ = base::MakeUnique<TaskObserver>( 213 task_observer_ = base::MakeUnique<TaskObserver>(
214 remover, 214 remover,
215 base::Bind(&ClearBrowsingDataHandler::OnClearingTaskFinished, 215 base::Bind(&ClearBrowsingDataHandler::OnClearingTaskFinished,
216 base::Unretained(this), webui_callback_id)); 216 base::Unretained(this), webui_callback_id));
217 browsing_data::TimePeriod time_period =
218 static_cast<browsing_data::TimePeriod>(period_selected);
219 browsing_data::RecordDeletionForPeriod(time_period);
217 remover->RemoveAndReply( 220 remover->RemoveAndReply(
218 BrowsingDataRemover::Period( 221 browsing_data::CalculateBeginDeleteTime(time_period),
219 static_cast<browsing_data::TimePeriod>(period_selected)), 222 browsing_data::CalculateEndDeleteTime(time_period),
220 remove_mask, origin_mask, task_observer_.get()); 223 remove_mask, origin_mask, task_observer_.get());
221 } 224 }
222 225
223 void ClearBrowsingDataHandler::OnClearingTaskFinished( 226 void ClearBrowsingDataHandler::OnClearingTaskFinished(
224 const std::string& webui_callback_id) { 227 const std::string& webui_callback_id) {
225 PrefService* prefs = profile_->GetPrefs(); 228 PrefService* prefs = profile_->GetPrefs();
226 int notice_shown_times = prefs->GetInteger( 229 int notice_shown_times = prefs->GetInteger(
227 browsing_data::prefs::kClearBrowsingDataHistoryNoticeShownTimes); 230 browsing_data::prefs::kClearBrowsingDataHistoryNoticeShownTimes);
228 231
229 // When the deletion is complete, we might show an additional dialog with 232 // When the deletion is complete, we might show an additional dialog with
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 void ClearBrowsingDataHandler::UpdateCounterText( 337 void ClearBrowsingDataHandler::UpdateCounterText(
335 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { 338 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) {
336 CallJavascriptFunction( 339 CallJavascriptFunction(
337 "cr.webUIListenerCallback", 340 "cr.webUIListenerCallback",
338 base::StringValue("update-counter-text"), 341 base::StringValue("update-counter-text"),
339 base::StringValue(result->source()->GetPrefName()), 342 base::StringValue(result->source()->GetPrefName()),
340 base::StringValue(GetChromeCounterTextFromResult(result.get()))); 343 base::StringValue(GetChromeCounterTextFromResult(result.get())));
341 } 344 }
342 345
343 } // namespace settings 346 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698