favicon_fetcher_impl.cc 958 B

123456789101112131415161718192021222324252627
  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. #include "weblayer/browser/favicon/favicon_fetcher_impl.h"
  5. #include "ui/gfx/image/image.h"
  6. #include "weblayer/browser/favicon/favicon_tab_helper.h"
  7. #include "weblayer/public/favicon_fetcher_delegate.h"
  8. #include "base/logging.h"
  9. namespace weblayer {
  10. FaviconFetcherImpl::FaviconFetcherImpl(content::WebContents* web_contents,
  11. FaviconFetcherDelegate* delegate)
  12. : web_contents_(web_contents),
  13. observer_subscription_(FaviconTabHelper::FromWebContents(web_contents)
  14. ->RegisterFaviconFetcherDelegate(delegate)) {}
  15. FaviconFetcherImpl::~FaviconFetcherImpl() = default;
  16. gfx::Image FaviconFetcherImpl::GetFavicon() {
  17. return FaviconTabHelper::FromWebContents(web_contents_)->favicon();
  18. }
  19. } // namespace weblayer