| OLD | NEW |
| 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 #include <utility> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/metrics/sparse_histogram.h" | 15 #include "base/metrics/sparse_histogram.h" |
| 15 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
| 16 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 } | 456 } |
| 456 | 457 |
| 457 void ClearBrowserDataHandler::AddCounter( | 458 void ClearBrowserDataHandler::AddCounter( |
| 458 scoped_ptr<BrowsingDataCounter> counter) { | 459 scoped_ptr<BrowsingDataCounter> counter) { |
| 459 DCHECK(AreCountersEnabled()); | 460 DCHECK(AreCountersEnabled()); |
| 460 | 461 |
| 461 counter->Init( | 462 counter->Init( |
| 462 Profile::FromWebUI(web_ui()), | 463 Profile::FromWebUI(web_ui()), |
| 463 base::Bind(&ClearBrowserDataHandler::UpdateCounterText, | 464 base::Bind(&ClearBrowserDataHandler::UpdateCounterText, |
| 464 base::Unretained(this))); | 465 base::Unretained(this))); |
| 465 counters_.push_back(counter.Pass()); | 466 counters_.push_back(std::move(counter)); |
| 466 } | 467 } |
| 467 | 468 |
| 468 void ClearBrowserDataHandler::UpdateCounterText( | 469 void ClearBrowserDataHandler::UpdateCounterText( |
| 469 scoped_ptr<BrowsingDataCounter::Result> result) { | 470 scoped_ptr<BrowsingDataCounter::Result> result) { |
| 470 DCHECK(AreCountersEnabled()); | 471 DCHECK(AreCountersEnabled()); |
| 471 web_ui()->CallJavascriptFunction( | 472 web_ui()->CallJavascriptFunction( |
| 472 "ClearBrowserDataOverlay.updateCounter", | 473 "ClearBrowserDataOverlay.updateCounter", |
| 473 base::StringValue(result->source()->GetPrefName()), | 474 base::StringValue(result->source()->GetPrefName()), |
| 474 base::StringValue(GetCounterTextFromResult(result.get()))); | 475 base::StringValue(GetCounterTextFromResult(result.get()))); |
| 475 } | 476 } |
| 476 | 477 |
| 477 void ClearBrowserDataHandler::OnStateChanged() { | 478 void ClearBrowserDataHandler::OnStateChanged() { |
| 478 web_ui()->CallJavascriptFunction( | 479 web_ui()->CallJavascriptFunction( |
| 479 "ClearBrowserDataOverlay.updateSyncWarning", | 480 "ClearBrowserDataOverlay.updateSyncWarning", |
| 480 base::FundamentalValue(sync_service_ && sync_service_->IsSyncActive())); | 481 base::FundamentalValue(sync_service_ && sync_service_->IsSyncActive())); |
| 481 } | 482 } |
| 482 | 483 |
| 483 } // namespace options | 484 } // namespace options |
| OLD | NEW |