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

Unified Diff: chrome/browser/extensions/activity_log/activity_actions.h

Issue 292313006: Improve activity log ad metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/browser/extensions/activity_log/activity_actions.h
diff --git a/chrome/browser/extensions/activity_log/activity_actions.h b/chrome/browser/extensions/activity_log/activity_actions.h
index 9e82f367ab1b912e5e1df8097fd258257a599c35..211331285551ea177752b077c64acc0db1b1b71a 100644
--- a/chrome/browser/extensions/activity_log/activity_actions.h
+++ b/chrome/browser/extensions/activity_log/activity_actions.h
@@ -45,7 +45,8 @@ class Action : public base::RefCountedThreadSafe<Action> {
ACTION_ANY = 1001, // Used for lookups of unspecified type.
};
- // The type of ad injection an action performed.
+ // The type of ad injection an action performed. Do not delete or reorder
+ // these metrics, as they are used in histogramming.
enum InjectionType {
// No ad injection occurred.
NO_AD_INJECTION = 0,
@@ -66,6 +67,17 @@ class Action : public base::RefCountedThreadSafe<Action> {
NUM_INJECTION_TYPES
};
+ // The type of ad which was injected.
+ enum AdType {
+ AD_TYPE_NONE,
+ AD_TYPE_IFRAME,
+ AD_TYPE_EMBED,
+ AD_TYPE_ANCHOR,
+
+ // Place any new injection types above this entry.
+ NUM_AD_TYPES
+ };
+
// A useful shorthand for methods that take or return collections of Action
// objects.
typedef std::vector<scoped_refptr<Action> > ActionVector;
@@ -166,14 +178,24 @@ class Action : public base::RefCountedThreadSafe<Action> {
private:
friend class base::RefCountedThreadSafe<Action>;
+ // Returns true if a given |url| could be an ad.
+ bool UrlCouldBeAd(const GURL& url) const;
+
// Uploads the URL to RAPPOR (preserving privacy) if this might have been an
// ad injection.
void MaybeUploadUrl(rappor::RapporService* rappor_service) const;
- // Checks an action with the appendChild API for ad injection.
- InjectionType CheckAppendChild() const;
// Checks an action that modified the src of an element for ad injection.
InjectionType CheckSrcModification() const;
+ // Checks an action with the appendChild API for ad injection.
+ // |ad_type_out| is populated with the type of ad which was injected, if there
+ // was an injection.
+ InjectionType CheckAppendChild(AdType* ad_type_out) const;
+ // Checks a DOM object (e.g. an appended child) for ad injection.
+ // |ad_type_out| is populated with the type of ad which was injected, if there
+ // was an injection.
+ InjectionType CheckDomObject(const base::DictionaryValue* object,
+ AdType* ad_type_out) const;
std::string extension_id_;
base::Time time_;
« no previous file with comments | « chrome/browser/extensions/active_script_controller.cc ('k') | chrome/browser/extensions/activity_log/activity_actions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698