OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_UMA_POLICY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_UMA_POLICY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_UMA_POLICY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_UMA_POLICY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 AD_REMOVED, | 49 AD_REMOVED, |
50 AD_REPLACED, | 50 AD_REPLACED, |
51 AD_LIKELY_INJECTED, | 51 AD_LIKELY_INJECTED, |
52 AD_LIKELY_REPLACED, | 52 AD_LIKELY_REPLACED, |
53 MAX_STATUS // Insert new page statuses right before this one. | 53 MAX_STATUS // Insert new page statuses right before this one. |
54 }; | 54 }; |
55 | 55 |
56 explicit UmaPolicy(Profile* profile); | 56 explicit UmaPolicy(Profile* profile); |
57 | 57 |
58 // ActivityLogPolicy implementation. | 58 // ActivityLogPolicy implementation. |
59 virtual void ProcessAction(scoped_refptr<Action> action) OVERRIDE; | 59 virtual void ProcessAction(scoped_refptr<Action> action) override; |
60 virtual void Close() OVERRIDE; | 60 virtual void Close() override; |
61 | 61 |
62 // Gets the histogram name associated with each PageStatus. | 62 // Gets the histogram name associated with each PageStatus. |
63 static const char* GetHistogramName(PageStatus status); | 63 static const char* GetHistogramName(PageStatus status); |
64 | 64 |
65 protected: | 65 protected: |
66 // Run when Close() is called. | 66 // Run when Close() is called. |
67 virtual ~UmaPolicy(); | 67 virtual ~UmaPolicy(); |
68 | 68 |
69 private: | 69 private: |
70 // Used as a special key in the ExtensionMap. | 70 // Used as a special key in the ExtensionMap. |
71 static const char kNumberOfTabs[]; | 71 static const char kNumberOfTabs[]; |
72 | 72 |
73 // The max number of tabs we track at a time. | 73 // The max number of tabs we track at a time. |
74 static const size_t kMaxTabsTracked; | 74 static const size_t kMaxTabsTracked; |
75 | 75 |
76 typedef std::map<std::string, int> ExtensionMap; | 76 typedef std::map<std::string, int> ExtensionMap; |
77 typedef std::map<std::string, ExtensionMap> SiteMap; | 77 typedef std::map<std::string, ExtensionMap> SiteMap; |
78 | 78 |
79 // BrowserListObserver | 79 // BrowserListObserver |
80 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; | 80 virtual void OnBrowserAdded(Browser* browser) override; |
81 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; | 81 virtual void OnBrowserRemoved(Browser* browser) override; |
82 | 82 |
83 // TabStripModelObserver | 83 // TabStripModelObserver |
84 // Fired when a page loads, either as a new tab or replacing the contents of | 84 // Fired when a page loads, either as a new tab or replacing the contents of |
85 // an older tab. | 85 // an older tab. |
86 virtual void TabChangedAt(content::WebContents* contents, | 86 virtual void TabChangedAt(content::WebContents* contents, |
87 int index, | 87 int index, |
88 TabChangeType change_type) OVERRIDE; | 88 TabChangeType change_type) override; |
89 // Fired when a tab closes. | 89 // Fired when a tab closes. |
90 virtual void TabClosingAt(TabStripModel* tab_strip_model, | 90 virtual void TabClosingAt(TabStripModel* tab_strip_model, |
91 content::WebContents* contents, | 91 content::WebContents* contents, |
92 int index) OVERRIDE; | 92 int index) override; |
93 | 93 |
94 // Assign a status bitmask based on the action's properties. | 94 // Assign a status bitmask based on the action's properties. |
95 int MatchActionToStatus(scoped_refptr<Action> action); | 95 int MatchActionToStatus(scoped_refptr<Action> action); |
96 | 96 |
97 // When a page is opened, add it to the SiteMap url_status_. | 97 // When a page is opened, add it to the SiteMap url_status_. |
98 void SetupOpenedPage(const std::string& url); | 98 void SetupOpenedPage(const std::string& url); |
99 | 99 |
100 // When a page is closing, remove it from the SiteMap url_status_. | 100 // When a page is closing, remove it from the SiteMap url_status_. |
101 void CleanupClosedPage(const std::string& cleaned_url, | 101 void CleanupClosedPage(const std::string& cleaned_url, |
102 content::WebContents* web_contents); | 102 content::WebContents* web_contents); |
(...skipping 18 matching lines...) Expand all Loading... |
121 | 121 |
122 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, CleanURLTest); | 122 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, CleanURLTest); |
123 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, MatchActionToStatusTest); | 123 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, MatchActionToStatusTest); |
124 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, ProcessActionTest); | 124 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, ProcessActionTest); |
125 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, SiteUrlTest); | 125 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, SiteUrlTest); |
126 }; | 126 }; |
127 | 127 |
128 } // namespace extensions | 128 } // namespace extensions |
129 | 129 |
130 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_UMA_POLICY_H_ | 130 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_UMA_POLICY_H_ |
OLD | NEW |