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

Side by Side Diff: chrome/browser/android/logo_bridge.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, 2 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
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_ANDROID_LOGO_BRIDGE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_LOGO_BRIDGE_H_
6 #define CHROME_BROWSER_ANDROID_LOGO_BRIDGE_H_ 6 #define CHROME_BROWSER_ANDROID_LOGO_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/scoped_java_ref.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "net/url_request/url_fetcher_delegate.h"
12 14
13 class LogoService; 15 class LogoService;
14 16
17 namespace net {
18 class URLFetcher;
19 class URLRequestContextGetter;
20 }
21
15 // The C++ counterpart to LogoBridge.java. Enables Java code to access the 22 // The C++ counterpart to LogoBridge.java. Enables Java code to access the
16 // default search provider's logo. 23 // default search provider's logo.
17 class LogoBridge { 24 class LogoBridge : public net::URLFetcherDelegate {
18 public: 25 public:
19 explicit LogoBridge(jobject j_profile); 26 explicit LogoBridge(jobject j_profile);
20 void Destroy(JNIEnv* env, jobject obj); 27 void Destroy(JNIEnv* env, jobject obj);
21 void GetCurrentLogo(JNIEnv* env, jobject obj, jobject j_logo_observer); 28 void GetCurrentLogo(JNIEnv* env, jobject obj, jobject j_logo_observer);
22 29
30 void GetAnimatedLogo(JNIEnv* env,
31 jobject obj,
32 jobject j_callback,
33 jstring j_url);
34
35 // net::URLFetcherDelegate:
36 void OnURLFetchComplete(const net::URLFetcher* source) override;
37
23 private: 38 private:
24 ~LogoBridge(); 39 ~LogoBridge() override;
40
41 // Clears and resets the URLFetcher for animated logo.
42 void ClearFetcher();
25 43
26 LogoService* logo_service_; 44 LogoService* logo_service_;
45
46 // The URLFetcher currently fetching the animated logo. NULL when not
47 // fetching.
48 scoped_ptr<net::URLFetcher> fetcher_;
49
50 // The URLRequestContextGetter used to download the animated logo.
51 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
52
53 base::android::ScopedJavaGlobalRef<jobject> j_callback_;
54
27 base::WeakPtrFactory<LogoBridge> weak_ptr_factory_; 55 base::WeakPtrFactory<LogoBridge> weak_ptr_factory_;
28 56
29 DISALLOW_COPY_AND_ASSIGN(LogoBridge); 57 DISALLOW_COPY_AND_ASSIGN(LogoBridge);
30 }; 58 };
31 59
32 bool RegisterLogoBridge(JNIEnv* env); 60 bool RegisterLogoBridge(JNIEnv* env);
33 61
34 #endif // CHROME_BROWSER_ANDROID_LOGO_BRIDGE_H_ 62 #endif // CHROME_BROWSER_ANDROID_LOGO_BRIDGE_H_
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java ('k') | chrome/browser/android/logo_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698