| 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_BANNERS_APP_BANNER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ | 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_weak_ref.h" | 9 #include "base/android/jni_weak_ref.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 // Called when the Java-side has retrieved information for the app. | 88 // Called when the Java-side has retrieved information for the app. |
| 89 // Returns |false| if an icon fetch couldn't be kicked off. | 89 // Returns |false| if an icon fetch couldn't be kicked off. |
| 90 bool OnAppDetailsRetrieved(JNIEnv* env, | 90 bool OnAppDetailsRetrieved(JNIEnv* env, |
| 91 jobject obj, | 91 jobject obj, |
| 92 jobject japp_data, | 92 jobject japp_data, |
| 93 jstring japp_title, | 93 jstring japp_title, |
| 94 jstring japp_package, | 94 jstring japp_package, |
| 95 jstring jicon_url); | 95 jstring jicon_url); |
| 96 | 96 |
| 97 // Called when the installation Intent has been handled and focus has been |
| 98 // returned to Chrome. |
| 99 void OnInstallIntentReturned(JNIEnv* env, |
| 100 jobject obj, |
| 101 jboolean jis_installing); |
| 102 |
| 103 // Called when the InstallerDelegate task has finished. |
| 104 void OnInstallFinished(JNIEnv* env, |
| 105 jobject obj, |
| 106 jboolean success); |
| 107 |
| 97 // Fetches the icon at the given URL asynchronously. | 108 // Fetches the icon at the given URL asynchronously. |
| 98 // Returns |false| if this couldn't be kicked off. | 109 // Returns |false| if this couldn't be kicked off. |
| 99 bool FetchIcon(const GURL& image_url); | 110 bool FetchIcon(const GURL& image_url); |
| 100 | 111 |
| 101 // Installs the app defined by the manifest. | 112 // Installs the app defined by the manifest. |
| 102 // TODO(dfalcantara): Fold into Install() when more CLs land. | 113 // TODO(dfalcantara): Fold into Install() when more CLs land. |
| 103 static void InstallManifestApp(const content::Manifest& manifest, | 114 static void InstallManifestApp(const content::Manifest& manifest, |
| 104 const SkBitmap& icon); | 115 const SkBitmap& icon); |
| 105 | 116 |
| 117 // Called when the AppBannerInfoBar's button needs to be updated. |
| 118 void UpdateInstallState(JNIEnv* env, jobject obj); |
| 119 |
| 106 // WebContentsObserver overrides. | 120 // WebContentsObserver overrides. |
| 107 void DidNavigateMainFrame( | 121 void DidNavigateMainFrame( |
| 108 const content::LoadCommittedDetails& details, | 122 const content::LoadCommittedDetails& details, |
| 109 const content::FrameNavigateParams& params) override; | 123 const content::FrameNavigateParams& params) override; |
| 110 void DidFinishLoad(content::RenderFrameHost* render_frame_host, | 124 void DidFinishLoad(content::RenderFrameHost* render_frame_host, |
| 111 const GURL& validated_url) override; | 125 const GURL& validated_url) override; |
| 112 bool OnMessageReceived(const IPC::Message& message) override; | 126 bool OnMessageReceived(const IPC::Message& message) override; |
| 113 | 127 |
| 114 // BitmapFetcherDelegate overrides. | 128 // BitmapFetcherDelegate overrides. |
| 115 void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override; | 129 void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override; |
| 116 | 130 |
| 117 // AppBannerInfoBarDelegate::AppDelegate overrides. | 131 // AppBannerInfoBarDelegate::AppDelegate overrides. |
| 118 void Block() const override; | 132 void Block() const override; |
| 119 bool OnButtonClicked() const override; | 133 bool OnButtonClicked() const override; |
| 134 bool OnLinkClicked() const override; |
| 120 void OnInfoBarDestroyed() override; | 135 void OnInfoBarDestroyed() override; |
| 121 base::string16 GetTitle() const override; | 136 base::string16 GetTitle() const override; |
| 122 gfx::Image GetIcon() const override; | 137 gfx::Image GetIcon() const override; |
| 123 | 138 |
| 124 private: | 139 private: |
| 125 // Gets the preferred icon size for the banner icons. | 140 // Gets the preferred icon size for the banner icons. |
| 126 int GetPreferredIconSize(); | 141 int GetPreferredIconSize(); |
| 127 | 142 |
| 128 // Called when the manifest has been retrieved, or if there is no manifest to | 143 // Called when the manifest has been retrieved, or if there is no manifest to |
| 129 // retrieve. | 144 // retrieve. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 189 |
| 175 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); | 190 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
| 176 }; // class AppBannerManager | 191 }; // class AppBannerManager |
| 177 | 192 |
| 178 // Register native methods | 193 // Register native methods |
| 179 bool RegisterAppBannerManager(JNIEnv* env); | 194 bool RegisterAppBannerManager(JNIEnv* env); |
| 180 | 195 |
| 181 } // namespace banners | 196 } // namespace banners |
| 182 | 197 |
| 183 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ | 198 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ |
| OLD | NEW |