| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 content::WebContents* contents, | 89 content::WebContents* contents, |
| 90 int index) OVERRIDE; | 90 int index) OVERRIDE; |
| 91 | 91 |
| 92 // Assign a status bitmask based on the action's properties. | 92 // Assign a status bitmask based on the action's properties. |
| 93 int MatchActionToStatus(scoped_refptr<Action> action); | 93 int MatchActionToStatus(scoped_refptr<Action> action); |
| 94 | 94 |
| 95 // When a page is opened, add it to the SiteMap url_status_. | 95 // When a page is opened, add it to the SiteMap url_status_. |
| 96 void SetupOpenedPage(const std::string& url); | 96 void SetupOpenedPage(const std::string& url); |
| 97 | 97 |
| 98 // When a page is closing, remove it from the SiteMap url_status_. | 98 // When a page is closing, remove it from the SiteMap url_status_. |
| 99 void CleanupClosedPage(const std::string& url); | 99 void CleanupClosedPage(const std::string& url, |
| 100 content::WebContents* web_contents); |
| 100 | 101 |
| 101 // When a page is closing, save statistics about the page to histograms. | 102 // When a page is closing, save statistics about the page to histograms. |
| 102 void HistogramOnClose(const std::string& url); | 103 void HistogramOnClose(const std::string& url, |
| 104 content::WebContents* web_contents); |
| 103 | 105 |
| 104 // Standardizes the way URLs are treated. | 106 // Standardizes the way URLs are treated. |
| 105 static std::string CleanURL(const GURL& gurl); | 107 static std::string CleanURL(const GURL& gurl); |
| 106 | 108 |
| 107 // Used by UmaPolicyTest.ProcessActionTest. | 109 // Used by UmaPolicyTest.ProcessActionTest. |
| 108 SiteMap url_status() { return url_status_; } | 110 SiteMap url_status() { return url_status_; } |
| 109 | 111 |
| 110 Profile* profile_; | 112 Profile* profile_; |
| 111 | 113 |
| 112 // URL -> extension id -> page status. | 114 // URL -> extension id -> page status. |
| 113 SiteMap url_status_; | 115 SiteMap url_status_; |
| 114 | 116 |
| 115 // tab index -> URL. | 117 // tab index -> URL. |
| 116 std::map<int32, std::string> tab_list_; | 118 std::map<int32, std::string> tab_list_; |
| 117 | 119 |
| 118 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, CleanURLTest); | 120 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, CleanURLTest); |
| 119 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, MatchActionToStatusTest); | 121 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, MatchActionToStatusTest); |
| 120 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, ProcessActionTest); | 122 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, ProcessActionTest); |
| 121 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, SiteUrlTest); | 123 FRIEND_TEST_ALL_PREFIXES(UmaPolicyTest, SiteUrlTest); |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 } // namespace extensions | 126 } // namespace extensions |
| 125 | 127 |
| 126 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_UMA_POLICY_H_ | 128 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_UMA_POLICY_H_ |
| OLD | NEW |