| 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_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 <memory> | 10 #include <memory> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace doodle { | 21 namespace doodle { |
| 22 class DoodleService; | 22 class DoodleService; |
| 23 } // namespace doodle | 23 } // namespace doodle |
| 24 | 24 |
| 25 namespace gfx { | 25 namespace gfx { |
| 26 class Image; | 26 class Image; |
| 27 } // namespace gfx | 27 } // namespace gfx |
| 28 | 28 |
| 29 namespace image_fetcher { | 29 namespace image_fetcher { |
| 30 class ImageFetcher; | 30 class ImageFetcher; |
| 31 struct RequestMetadata; |
| 31 } // namespace image_fetcher | 32 } // namespace image_fetcher |
| 32 | 33 |
| 33 // The C++ counterpart to LogoBridge.java. Enables Java code to access the | 34 // The C++ counterpart to LogoBridge.java. Enables Java code to access the |
| 34 // default search provider's logo. | 35 // default search provider's logo. |
| 35 class LogoBridge : public doodle::DoodleService::Observer { | 36 class LogoBridge : public doodle::DoodleService::Observer { |
| 36 public: | 37 public: |
| 37 explicit LogoBridge(jobject j_profile); | 38 explicit LogoBridge(jobject j_profile); |
| 38 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 39 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 39 | 40 |
| 40 // Gets the current non-animated logo (downloading it if necessary) and passes | 41 // Gets the current non-animated logo (downloading it if necessary) and passes |
| (...skipping 23 matching lines...) Expand all Loading... |
| 64 | 65 |
| 65 void DoodleConfigReceived( | 66 void DoodleConfigReceived( |
| 66 const base::Optional<doodle::DoodleConfig>& maybe_doodle_config, | 67 const base::Optional<doodle::DoodleConfig>& maybe_doodle_config, |
| 67 bool from_cache); | 68 bool from_cache); |
| 68 | 69 |
| 69 void DoodleImageFetched(bool config_from_cache, | 70 void DoodleImageFetched(bool config_from_cache, |
| 70 const GURL& on_click_url, | 71 const GURL& on_click_url, |
| 71 const std::string& alt_text, | 72 const std::string& alt_text, |
| 72 const GURL& animated_image_url, | 73 const GURL& animated_image_url, |
| 73 const std::string& image_fetch_id, | 74 const std::string& image_fetch_id, |
| 74 const gfx::Image& image); | 75 const gfx::Image& image, |
| 76 const image_fetcher::RequestMetadata& metadata); |
| 75 | 77 |
| 76 // Only valid if UseNewDoodleApi is disabled. | 78 // Only valid if UseNewDoodleApi is disabled. |
| 77 LogoService* logo_service_; | 79 LogoService* logo_service_; |
| 78 | 80 |
| 79 // Only valid if UseNewDoodleApi is enabled. | 81 // Only valid if UseNewDoodleApi is enabled. |
| 80 doodle::DoodleService* doodle_service_; | 82 doodle::DoodleService* doodle_service_; |
| 81 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_; | 83 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_; |
| 82 base::android::ScopedJavaGlobalRef<jobject> j_logo_observer_; | 84 base::android::ScopedJavaGlobalRef<jobject> j_logo_observer_; |
| 83 ScopedObserver<doodle::DoodleService, doodle::DoodleService::Observer> | 85 ScopedObserver<doodle::DoodleService, doodle::DoodleService::Observer> |
| 84 doodle_observer_; | 86 doodle_observer_; |
| 85 | 87 |
| 86 std::unique_ptr<AnimatedLogoFetcher> animated_logo_fetcher_; | 88 std::unique_ptr<AnimatedLogoFetcher> animated_logo_fetcher_; |
| 87 | 89 |
| 88 base::WeakPtrFactory<LogoBridge> weak_ptr_factory_; | 90 base::WeakPtrFactory<LogoBridge> weak_ptr_factory_; |
| 89 | 91 |
| 90 DISALLOW_COPY_AND_ASSIGN(LogoBridge); | 92 DISALLOW_COPY_AND_ASSIGN(LogoBridge); |
| 91 }; | 93 }; |
| 92 | 94 |
| 93 bool RegisterLogoBridge(JNIEnv* env); | 95 bool RegisterLogoBridge(JNIEnv* env); |
| 94 | 96 |
| 95 #endif // CHROME_BROWSER_ANDROID_LOGO_BRIDGE_H_ | 97 #endif // CHROME_BROWSER_ANDROID_LOGO_BRIDGE_H_ |
| OLD | NEW |