 Chromium Code Reviews
 Chromium Code Reviews Issue 1017193002:
  [App banners] Be less strict about navigations  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1017193002:
  [App banners] Be less strict about navigations  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 
| 6 #define CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 6 #define CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 
| 7 | 7 | 
| 8 #include <set> | 8 #include <set> | 
| 9 #include <string> | 9 #include <string> | 
| 10 #include <vector> | 10 #include <vector> | 
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 class AppBannerSettingsHelper { | 39 class AppBannerSettingsHelper { | 
| 40 public: | 40 public: | 
| 41 enum AppBannerEvent { | 41 enum AppBannerEvent { | 
| 42 APP_BANNER_EVENT_COULD_SHOW, | 42 APP_BANNER_EVENT_COULD_SHOW, | 
| 43 APP_BANNER_EVENT_DID_SHOW, | 43 APP_BANNER_EVENT_DID_SHOW, | 
| 44 APP_BANNER_EVENT_DID_BLOCK, | 44 APP_BANNER_EVENT_DID_BLOCK, | 
| 45 APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, | 45 APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, | 
| 46 APP_BANNER_EVENT_NUM_EVENTS, | 46 APP_BANNER_EVENT_NUM_EVENTS, | 
| 47 }; | 47 }; | 
| 48 | 48 | 
| 49 // Returns whether or not the URLs match for everything except for the ref. | |
| 50 static bool URLsAreForTheSamePage(const GURL& first, const GURL& second); | |
| 
benwells
2015/03/19 07:18:55
Why is this is AppBannerSettingsHelper? Seems like
 
gone
2015/03/19 19:01:35
Done.
 | |
| 51 | |
| 49 // The content setting basically records a simplified subset of history. | 52 // The content setting basically records a simplified subset of history. | 
| 50 // For privacy reasons this needs to be cleared. The ClearHistoryForURLs | 53 // For privacy reasons this needs to be cleared. The ClearHistoryForURLs | 
| 51 // function removes any information from the banner content settings for the | 54 // function removes any information from the banner content settings for the | 
| 52 // given URls. | 55 // given URls. | 
| 53 static void ClearHistoryForURLs(Profile* profile, | 56 static void ClearHistoryForURLs(Profile* profile, | 
| 54 const std::set<GURL>& origin_urls); | 57 const std::set<GURL>& origin_urls); | 
| 55 | 58 | 
| 56 static void RecordBannerEvent(content::WebContents* web_contents, | 59 static void RecordBannerEvent(content::WebContents* web_contents, | 
| 57 const GURL& origin_url, | 60 const GURL& origin_url, | 
| 58 const std::string& package_name_or_start_url, | 61 const std::string& package_name_or_start_url, | 
| (...skipping 16 matching lines...) Expand all Loading... | |
| 75 | 78 | 
| 76 // Get the recorded event for an event type that only records the last event. | 79 // Get the recorded event for an event type that only records the last event. | 
| 77 // Should not be used with APP_BANNER_EVENT_COULD_SHOW. This is only exposed | 80 // Should not be used with APP_BANNER_EVENT_COULD_SHOW. This is only exposed | 
| 78 // for testing. | 81 // for testing. | 
| 79 static base::Time GetSingleBannerEvent( | 82 static base::Time GetSingleBannerEvent( | 
| 80 content::WebContents* web_contents, | 83 content::WebContents* web_contents, | 
| 81 const GURL& origin_url, | 84 const GURL& origin_url, | 
| 82 const std::string& package_name_or_start_url, | 85 const std::string& package_name_or_start_url, | 
| 83 AppBannerEvent event); | 86 AppBannerEvent event); | 
| 84 | 87 | 
| 85 // Checks if a URL is allowed to show a banner for the given package or start | |
| 86 // url. | |
| 87 static bool IsAllowed(content::WebContents* web_contents, | |
| 88 const GURL& origin_url, | |
| 89 const std::string& package_name_or_start_url); | |
| 90 | |
| 91 // Blocks a URL from showing a banner for the given package or start url. | |
| 92 static void Block(content::WebContents* web_contents, | |
| 93 const GURL& origin_url, | |
| 94 const std::string& package_name_or_start_url); | |
| 95 | |
| 96 private: | 88 private: | 
| 97 DISALLOW_IMPLICIT_CONSTRUCTORS(AppBannerSettingsHelper); | 89 DISALLOW_IMPLICIT_CONSTRUCTORS(AppBannerSettingsHelper); | 
| 98 }; | 90 }; | 
| 99 | 91 | 
| 100 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 92 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 
| OLD | NEW |