| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/component_updater/sw_reporter_installer_win.h" | 5 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // |reporter_runner| function passed to the |SwReporterInstallerTraits| | 130 // |reporter_runner| function passed to the |SwReporterInstallerTraits| |
| 131 // constructor in |RegisterSwReporterComponent| below.) | 131 // constructor in |RegisterSwReporterComponent| below.) |
| 132 void RunSwReportersAfterStartup( | 132 void RunSwReportersAfterStartup( |
| 133 const safe_browsing::SwReporterQueue& invocations, | 133 const safe_browsing::SwReporterQueue& invocations, |
| 134 const base::Version& version) { | 134 const base::Version& version) { |
| 135 content::BrowserThread::PostAfterStartupTask( | 135 content::BrowserThread::PostAfterStartupTask( |
| 136 FROM_HERE, base::ThreadTaskRunnerHandle::Get(), | 136 FROM_HERE, base::ThreadTaskRunnerHandle::Get(), |
| 137 base::Bind(&safe_browsing::RunSwReporters, invocations, version, | 137 base::Bind(&safe_browsing::RunSwReporters, invocations, version, |
| 138 base::ThreadTaskRunnerHandle::Get(), | 138 base::ThreadTaskRunnerHandle::Get(), |
| 139 // Runs LaunchAndWaitForExit() which creates (MayBlock()) and | 139 // Runs LaunchAndWaitForExit() which creates (MayBlock()) and |
| 140 // joins (WithSyncPrimitives()) a process. | 140 // joins (WithBaseSyncPrimitives()) a process. |
| 141 base::CreateTaskRunnerWithTraits( | 141 base::CreateTaskRunnerWithTraits( |
| 142 base::TaskTraits() | 142 base::TaskTraits() |
| 143 .WithShutdownBehavior( | 143 .WithShutdownBehavior( |
| 144 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) | 144 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) |
| 145 .WithPriority(base::TaskPriority::BACKGROUND) | 145 .WithPriority(base::TaskPriority::BACKGROUND) |
| 146 .MayBlock() | 146 .MayBlock() |
| 147 .WithSyncPrimitives()))); | 147 .WithBaseSyncPrimitives()))); |
| 148 } | 148 } |
| 149 | 149 |
| 150 // Ensures |str| contains only alphanumeric characters and characters from | 150 // Ensures |str| contains only alphanumeric characters and characters from |
| 151 // |extras|, and is not longer than |max_length|. | 151 // |extras|, and is not longer than |max_length|. |
| 152 bool ValidateString(const std::string& str, | 152 bool ValidateString(const std::string& str, |
| 153 const std::string& extras, | 153 const std::string& extras, |
| 154 size_t max_length) { | 154 size_t max_length) { |
| 155 return str.size() <= max_length && | 155 return str.size() <= max_length && |
| 156 std::all_of(str.cbegin(), str.cend(), [&extras](char c) { | 156 std::all_of(str.cbegin(), str.cend(), [&extras](char c) { |
| 157 return base::IsAsciiAlpha(c) || base::IsAsciiDigit(c) || | 157 return base::IsAsciiAlpha(c) || base::IsAsciiDigit(c) || |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 } | 499 } |
| 500 | 500 |
| 501 void RegisterProfilePrefsForSwReporter( | 501 void RegisterProfilePrefsForSwReporter( |
| 502 user_prefs::PrefRegistrySyncable* registry) { | 502 user_prefs::PrefRegistrySyncable* registry) { |
| 503 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); | 503 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); |
| 504 | 504 |
| 505 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); | 505 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); |
| 506 } | 506 } |
| 507 | 507 |
| 508 } // namespace component_updater | 508 } // namespace component_updater |
| OLD | NEW |