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

Unified Diff: chrome/common/extensions/event_filtering_info.h

Issue 10388135: Add common code for extensions event filtering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: self review Created 8 years, 7 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/common/extensions/event_filtering_info.h
diff --git a/chrome/common/extensions/event_filtering_info.h b/chrome/common/extensions/event_filtering_info.h
new file mode 100644
index 0000000000000000000000000000000000000000..83ef1f2d0d2234fdd4dd9f57714f153f1bc15ef3
--- /dev/null
+++ b/chrome/common/extensions/event_filtering_info.h
@@ -0,0 +1,36 @@
+// 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.
+
+#ifndef CHROME_COMMON_EXTENSIONS_EVENT_FILTERING_INFO_H_
+#define CHROME_COMMON_EXTENSIONS_EVENT_FILTERING_INFO_H_
+#pragma once
+
+#include "googleurl/src/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: 'google.com'}],
+// tabId: 1});
+class EventFilteringInfo {
+ public:
+ EventFilteringInfo();
Matt Perry 2012/05/15 20:42:59 any complex class should define an empty destructo
koz (OOO until 15th September) 2012/05/16 00:14:00 Done.
+ void SetURL(const GURL& url);
+
+ bool has_url() const { return has_url_; }
+ const GURL& url() const { return url_; }
+
+ private:
+ bool has_url_;
battre 2012/05/15 13:12:32 optional: could you use GURL::is_empty()?
koz (OOO until 15th September) 2012/05/16 00:14:00 Better to be explicit, I think.
+ GURL url_;
battre 2012/05/15 13:12:32 DISALLOW_COPY_AND_ASSIGN
koz (OOO until 15th September) 2012/05/16 00:14:00 Done.
+};
+
+} // namespace extensions
+
+#endif // CHROME_COMMON_EXTENSIONS_EVENT_FILTERING_INFO_H_

Powered by Google App Engine
This is Rietveld 408576698