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

Side by Side Diff: chrome/browser/ui/webui/options/clear_browser_data_handler.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 (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/webui/options/clear_browser_data_handler.h" 5 #include "chrome/browser/ui/webui/options/clear_browser_data_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8
8 #include <utility> 9 #include <utility>
9 10
10 #include "base/bind.h" 11 #include "base/bind.h"
11 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h"
13 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
14 #include "base/metrics/sparse_histogram.h" 16 #include "base/metrics/sparse_histogram.h"
15 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
16 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
18 #include "base/values.h" 20 #include "base/values.h"
19 #include "chrome/app/chrome_command_ids.h" 21 #include "chrome/app/chrome_command_ids.h"
20 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/browsing_data/autofill_counter.h" 23 #include "chrome/browser/browsing_data/autofill_counter.h"
22 #include "chrome/browser/browsing_data/browsing_data_counter.h" 24 #include "chrome/browser/browsing_data/browsing_data_counter.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled, prefs); 83 clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled, prefs);
82 pepper_flash_settings_enabled_.Init(prefs::kPepperFlashSettingsEnabled, 84 pepper_flash_settings_enabled_.Init(prefs::kPepperFlashSettingsEnabled,
83 prefs); 85 prefs);
84 allow_deleting_browser_history_.Init( 86 allow_deleting_browser_history_.Init(
85 prefs::kAllowDeletingBrowserHistory, 87 prefs::kAllowDeletingBrowserHistory,
86 prefs, 88 prefs,
87 base::Bind(&ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged, 89 base::Bind(&ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged,
88 base::Unretained(this))); 90 base::Unretained(this)));
89 91
90 if (AreCountersEnabled()) { 92 if (AreCountersEnabled()) {
91 AddCounter(make_scoped_ptr(new PasswordsCounter())); 93 AddCounter(base::WrapUnique(new PasswordsCounter()));
92 AddCounter(make_scoped_ptr(new HistoryCounter())); 94 AddCounter(base::WrapUnique(new HistoryCounter()));
93 AddCounter(make_scoped_ptr(new CacheCounter())); 95 AddCounter(base::WrapUnique(new CacheCounter()));
94 AddCounter(make_scoped_ptr(new AutofillCounter())); 96 AddCounter(base::WrapUnique(new AutofillCounter()));
95 97
96 sync_service_ = 98 sync_service_ =
97 ProfileSyncServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); 99 ProfileSyncServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()));
98 if (sync_service_) 100 if (sync_service_)
99 sync_service_->AddObserver(this); 101 sync_service_->AddObserver(this);
100 } 102 }
101 } 103 }
102 104
103 void ClearBrowserDataHandler::InitializePage() { 105 void ClearBrowserDataHandler::InitializePage() {
104 web_ui()->CallJavascriptFunction( 106 web_ui()->CallJavascriptFunction(
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 base::FundamentalValue(show_notice)); 353 base::FundamentalValue(show_notice));
352 } 354 }
353 355
354 void ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged() { 356 void ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged() {
355 web_ui()->CallJavascriptFunction( 357 web_ui()->CallJavascriptFunction(
356 "ClearBrowserDataOverlay.setAllowDeletingHistory", 358 "ClearBrowserDataOverlay.setAllowDeletingHistory",
357 base::FundamentalValue(*allow_deleting_browser_history_)); 359 base::FundamentalValue(*allow_deleting_browser_history_));
358 } 360 }
359 361
360 void ClearBrowserDataHandler::AddCounter( 362 void ClearBrowserDataHandler::AddCounter(
361 scoped_ptr<BrowsingDataCounter> counter) { 363 std::unique_ptr<BrowsingDataCounter> counter) {
362 DCHECK(AreCountersEnabled()); 364 DCHECK(AreCountersEnabled());
363 365
364 counter->Init( 366 counter->Init(
365 Profile::FromWebUI(web_ui()), 367 Profile::FromWebUI(web_ui()),
366 base::Bind(&ClearBrowserDataHandler::UpdateCounterText, 368 base::Bind(&ClearBrowserDataHandler::UpdateCounterText,
367 base::Unretained(this))); 369 base::Unretained(this)));
368 counters_.push_back(std::move(counter)); 370 counters_.push_back(std::move(counter));
369 } 371 }
370 372
371 void ClearBrowserDataHandler::UpdateCounterText( 373 void ClearBrowserDataHandler::UpdateCounterText(
372 scoped_ptr<BrowsingDataCounter::Result> result) { 374 std::unique_ptr<BrowsingDataCounter::Result> result) {
373 DCHECK(AreCountersEnabled()); 375 DCHECK(AreCountersEnabled());
374 web_ui()->CallJavascriptFunction( 376 web_ui()->CallJavascriptFunction(
375 "ClearBrowserDataOverlay.updateCounter", 377 "ClearBrowserDataOverlay.updateCounter",
376 base::StringValue(result->source()->GetPrefName()), 378 base::StringValue(result->source()->GetPrefName()),
377 base::StringValue(GetCounterTextFromResult(result.get()))); 379 base::StringValue(GetCounterTextFromResult(result.get())));
378 } 380 }
379 381
380 void ClearBrowserDataHandler::OnStateChanged() { 382 void ClearBrowserDataHandler::OnStateChanged() {
381 web_ui()->CallJavascriptFunction( 383 web_ui()->CallJavascriptFunction(
382 "ClearBrowserDataOverlay.updateSyncWarningAndHistoryFooter", 384 "ClearBrowserDataOverlay.updateSyncWarningAndHistoryFooter",
(...skipping 27 matching lines...) Expand all
410 should_show_history_notice_ = show; 412 should_show_history_notice_ = show;
411 OnStateChanged(); 413 OnStateChanged();
412 } 414 }
413 415
414 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { 416 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) {
415 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). 417 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes).
416 should_show_history_deletion_dialog_ = show; 418 should_show_history_deletion_dialog_ = show;
417 } 419 }
418 420
419 } // namespace options 421 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698