trusted_cdn_observer.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef WEBLAYER_BROWSER_URL_BAR_TRUSTED_CDN_OBSERVER_H_
  5. #define WEBLAYER_BROWSER_URL_BAR_TRUSTED_CDN_OBSERVER_H_
  6. #include "content/public/browser/web_contents_observer.h"
  7. #include "content/public/browser/web_contents_user_data.h"
  8. #include "url/gurl.h"
  9. namespace weblayer {
  10. // Monitors navigations to see if a publisher URL exists.
  11. class TrustedCDNObserver
  12. : public content::WebContentsObserver,
  13. public content::WebContentsUserData<TrustedCDNObserver> {
  14. public:
  15. ~TrustedCDNObserver() override;
  16. const GURL& publisher_url() const { return publisher_url_; }
  17. private:
  18. friend class content::WebContentsUserData<TrustedCDNObserver>;
  19. explicit TrustedCDNObserver(content::WebContents* web_contents);
  20. // content::WebContentsObserver implementation:
  21. void PrimaryPageChanged(content::Page& page) override;
  22. GURL publisher_url_;
  23. WEB_CONTENTS_USER_DATA_KEY_DECL();
  24. };
  25. } // namespace weblayer
  26. #endif // WEBLAYER_BROWSER_URL_BAR_TRUSTED_CDN_OBSERVER_H_