Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: components/search_provider_logos/animated_logo_tracker.h

Issue 1343913002: Introduce Animated Logo to Chrome on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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
5 #ifndef COMPONENTS_SEARCH_PROVIDER_LOGOS_ANIMATED_LOGO_TRACKER_H_
6 #define COMPONENTS_SEARCH_PROVIDER_LOGOS_ANIMATED_LOGO_TRACKER_H_
7
8 #include "base/callback.h"
9 #include "net/url_request/url_fetcher_delegate.h"
10 #include "url/gurl.h"
11
12 namespace net {
13 class URLFetcher;
14 class URLRequestContextGetter;
15 }
16
17 namespace search_provider_logos {
18
19 typedef base::Callback<void(const std::string&)> AnimatedLogoCallback;
20
21 // This class fetches the animated logo for given urls, which are specified in
22 // the logo downloaded by LogoTracker.
23 class AnimatedLogoTracker : public net::URLFetcherDelegate {
24 public:
25 explicit AnimatedLogoTracker(
26 scoped_refptr<net::URLRequestContextGetter> request_context_getter);
27
28 ~AnimatedLogoTracker() override;
29
30 // Gets the animated logo asynchronously for the given url, and cancels all
31 // previous fetches.
32 void GetAnimatedLogo(const GURL& animated_logo_url,
33 AnimatedLogoCallback listener);
34
35 private:
36 // Cancels the current fetch, if any, and resets all member variables.
37 void ReturnToIdle();
38
39 // net::URLFetcherDelegate:
40 void OnURLFetchComplete(const net::URLFetcher* source) override;
41
42 // The URLRequestContextGetter used for network requests.
43 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
44
45 // The URLFetcher currently fetching the logo. NULL when not fetching.
46 scoped_ptr<net::URLFetcher> fetcher_;
47
48 // The callback that will be executed when the animated logo is successfully
49 // downloaded.
50 AnimatedLogoCallback animated_logo_callback_;
51
52 DISALLOW_COPY_AND_ASSIGN(AnimatedLogoTracker);
53 };
54
55 } // namespace search_provider_logos
56
57 #endif // COMPONENTS_SEARCH_PROVIDER_LOGOS_ANIMATED_LOGO_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698