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

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

Issue 2238453002: Merge //components/browsing_data_ui into //components/browsing_data/core (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase over https://codereview.chromium.org/2345843003/ 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
« no previous file with comments | « chrome/browser/ui/webui/options/clear_browser_data_handler.cc ('k') | components/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/metrics/sparse_histogram.h" 12 #include "base/metrics/sparse_histogram.h"
13 #include "chrome/browser/browsing_data/browsing_data_counter_factory.h" 13 #include "chrome/browser/browsing_data/browsing_data_counter_factory.h"
14 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" 14 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h"
15 #include "chrome/browser/browsing_data/browsing_data_helper.h" 15 #include "chrome/browser/browsing_data/browsing_data_helper.h"
16 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" 16 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
17 #include "chrome/browser/history/web_history_service_factory.h" 17 #include "chrome/browser/history/web_history_service_factory.h"
18 #include "chrome/browser/sync/profile_sync_service_factory.h" 18 #include "chrome/browser/sync/profile_sync_service_factory.h"
19 #include "chrome/common/channel_info.h" 19 #include "chrome/common/channel_info.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "components/browsing_data/core/history_notice_utils.h"
21 #include "components/browsing_data/core/pref_names.h" 22 #include "components/browsing_data/core/pref_names.h"
22 #include "components/browsing_data_ui/history_notice_utils.h"
23 #include "components/prefs/pref_service.h" 23 #include "components/prefs/pref_service.h"
24 #include "content/public/browser/web_ui.h" 24 #include "content/public/browser/web_ui.h"
25 25
26 namespace { 26 namespace {
27 27
28 const int kMaxTimesHistoryNoticeShown = 1; 28 const int kMaxTimesHistoryNoticeShown = 1;
29 29
30 // TODO(msramek): Get the list of deletion preferences from the JS side. 30 // TODO(msramek): Get the list of deletion preferences from the JS side.
31 const char* kCounterPrefs[] = { 31 const char* kCounterPrefs[] = {
32 browsing_data::prefs::kDeleteBrowsingHistory, 32 browsing_data::prefs::kDeleteBrowsingHistory,
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 void ClearBrowsingDataHandler::OnStateChanged() { 278 void ClearBrowsingDataHandler::OnStateChanged() {
279 CallJavascriptFunction( 279 CallJavascriptFunction(
280 "cr.webUIListenerCallback", 280 "cr.webUIListenerCallback",
281 base::StringValue("update-footer"), 281 base::StringValue("update-footer"),
282 base::FundamentalValue(sync_service_ && sync_service_->IsSyncActive()), 282 base::FundamentalValue(sync_service_ && sync_service_->IsSyncActive()),
283 base::FundamentalValue(show_history_footer_)); 283 base::FundamentalValue(show_history_footer_));
284 } 284 }
285 285
286 void ClearBrowsingDataHandler::RefreshHistoryNotice() { 286 void ClearBrowsingDataHandler::RefreshHistoryNotice() {
287 browsing_data_ui::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( 287 browsing_data::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory(
288 sync_service_, 288 sync_service_,
289 WebHistoryServiceFactory::GetForProfile(profile_), 289 WebHistoryServiceFactory::GetForProfile(profile_),
290 base::Bind(&ClearBrowsingDataHandler::UpdateHistoryNotice, 290 base::Bind(&ClearBrowsingDataHandler::UpdateHistoryNotice,
291 weak_ptr_factory_.GetWeakPtr())); 291 weak_ptr_factory_.GetWeakPtr()));
292 292
293 // If the dialog with history notice has been shown less than 293 // If the dialog with history notice has been shown less than
294 // |kMaxTimesHistoryNoticeShown| times, we might have to show it when the 294 // |kMaxTimesHistoryNoticeShown| times, we might have to show it when the
295 // user deletes history. Find out if the conditions are met. 295 // user deletes history. Find out if the conditions are met.
296 int notice_shown_times = profile_->GetPrefs()->GetInteger( 296 int notice_shown_times = profile_->GetPrefs()->GetInteger(
297 browsing_data::prefs::kClearBrowsingDataHistoryNoticeShownTimes); 297 browsing_data::prefs::kClearBrowsingDataHistoryNoticeShownTimes);
298 298
299 if (notice_shown_times < kMaxTimesHistoryNoticeShown) { 299 if (notice_shown_times < kMaxTimesHistoryNoticeShown) {
300 browsing_data_ui::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( 300 browsing_data::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory(
301 sync_service_, 301 sync_service_,
302 WebHistoryServiceFactory::GetForProfile(profile_), 302 WebHistoryServiceFactory::GetForProfile(profile_),
303 chrome::GetChannel(), 303 chrome::GetChannel(),
304 base::Bind(&ClearBrowsingDataHandler::UpdateHistoryDeletionDialog, 304 base::Bind(&ClearBrowsingDataHandler::UpdateHistoryDeletionDialog,
305 weak_ptr_factory_.GetWeakPtr())); 305 weak_ptr_factory_.GetWeakPtr()));
306 } 306 }
307 } 307 }
308 308
309 void ClearBrowsingDataHandler::UpdateHistoryNotice(bool show) { 309 void ClearBrowsingDataHandler::UpdateHistoryNotice(bool show) {
310 show_history_footer_ = show; 310 show_history_footer_ = show;
(...skipping 21 matching lines...) Expand all
332 void ClearBrowsingDataHandler::UpdateCounterText( 332 void ClearBrowsingDataHandler::UpdateCounterText(
333 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { 333 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) {
334 CallJavascriptFunction( 334 CallJavascriptFunction(
335 "cr.webUIListenerCallback", 335 "cr.webUIListenerCallback",
336 base::StringValue("update-counter-text"), 336 base::StringValue("update-counter-text"),
337 base::StringValue(result->source()->GetPrefName()), 337 base::StringValue(result->source()->GetPrefName()),
338 base::StringValue(GetChromeCounterTextFromResult(result.get()))); 338 base::StringValue(GetChromeCounterTextFromResult(result.get())));
339 } 339 }
340 340
341 } // namespace settings 341 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/clear_browser_data_handler.cc ('k') | components/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698