blob: d940e46cd493700418012e0625424e2e60a33ff6 [file] [log] [blame]
// Copyright (c) 2012 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 <memory>
#include <string>
#include "base/optional.h"
#include "url/gurl.h"
namespace extensions {
// Extra information about an event that is used in event filtering.
// This is the information that is matched against criteria specified in JS
// extension event listeners. Eg:
// chrome.someApi.onSomeEvent.addListener(cb,
// {url: [{hostSuffix: ''}],
// tabId: 1});
struct EventFilteringInfo {
EventFilteringInfo(const EventFilteringInfo& other);
base::Optional<GURL> url;
base::Optional<std::string> service_type;
base::Optional<int> instance_id;
// Note: window type & visible are Chrome concepts, so arguably
// doesn't belong in the extensions module. If the number of Chrome
// concept grows, consider a delegation model with a
// ChromeEventFilteringInfo class.
base::Optional<std::string> window_type;
// By default events related to windows are filtered based on the
// listener's extension. This parameter will be set if the listener
// didn't set any filter on window types.
base::Optional<bool> window_exposed_by_default;
bool is_empty() const {
return !url && !service_type && !instance_id && !window_type &&
} // namespace extensions