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

Unified Diff: chrome/browser/extensions/api/log_private/filter_handler.cc

Issue 2934163002: Delete the logPrivate APIs (Closed)
Patch Set: Roll back docs changes Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/log_private/filter_handler.cc
diff --git a/chrome/browser/extensions/api/log_private/filter_handler.cc b/chrome/browser/extensions/api/log_private/filter_handler.cc
deleted file mode 100644
index 51e7f18296ec8324bef150ec62c3fdaf3ff84cb8..0000000000000000000000000000000000000000
--- a/chrome/browser/extensions/api/log_private/filter_handler.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/extensions/api/log_private/filter_handler.h"
-
-#include <algorithm>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "chrome/common/extensions/api/log_private.h"
-
-namespace extensions {
-
-namespace {
-
-template <typename T>
-bool IsValidField(const std::vector<T>& filter, const T& field) {
- return (filter.empty() ||
- std::find(filter.begin(), filter.end(), field) != filter.end());
-}
-
-} // namespace
-
-FilterHandler::FilterHandler(const api::log_private::Filter& filter) {
- std::unique_ptr<base::DictionaryValue> filter_value = filter.ToValue();
- api::log_private::Filter::Populate(*filter_value, &filter_);
-}
-
-FilterHandler::~FilterHandler() {}
-
-bool FilterHandler::IsValidLogEntry(
- const api::log_private::LogEntry& entry) const {
- return (IsValidProcess(entry.process) && IsValidLevel(entry.level) &&
- IsValidTime(entry.timestamp));
-}
-
-bool FilterHandler::IsValidTime(double time) const {
- const double kInvalidTime = 0;
- if (filter_.start_timestamp != kInvalidTime &&
- (filter_.start_timestamp > time || filter_.end_timestamp < time)) {
- return false;
- }
- return true;
-}
-
-bool FilterHandler::IsValidSource(const std::string& source) const {
- return IsValidField(filter_.sources, source);
-}
-
-bool FilterHandler::IsValidLevel(const std::string& level) const {
- return IsValidField(filter_.level, level);
-}
-
-bool FilterHandler::IsValidProcess(const std::string& process) const {
- return IsValidField(filter_.process, process);
-}
-
-} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/api/log_private/filter_handler.h ('k') | chrome/browser/extensions/api/log_private/log_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698