OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ |
| 7 |
| 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_helper.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/android/meta_tag_observer.h" |
| 12 |
| 13 namespace content { |
| 14 struct FrameNavigateParams; |
| 15 struct LoadCommittedDetails; |
| 16 } // namespace content |
| 17 |
| 18 /** |
| 19 * Manages when an app banner is created or dismissed. |
| 20 * |
| 21 * Hooks the wiring together for getting the data for a particular app. |
| 22 * Monitors at most one package at a time, and tracks the info for the |
| 23 * most recent app that was requested. Any work in progress for other apps is |
| 24 * discarded. |
| 25 */ |
| 26 class AppBannerManager : public MetaTagObserver { |
| 27 public: |
| 28 AppBannerManager(JNIEnv* env, jobject obj); |
| 29 virtual ~AppBannerManager(); |
| 30 |
| 31 // Destroys the AppBannerManager. |
| 32 void Destroy(JNIEnv* env, jobject obj); |
| 33 |
| 34 // Observes a new WebContents, if necessary. |
| 35 void ReplaceWebContents(JNIEnv* env, |
| 36 jobject obj, |
| 37 jobject jweb_contents); |
| 38 |
| 39 // WebContentsObserver overrides. |
| 40 virtual void DidNavigateMainFrame( |
| 41 const content::LoadCommittedDetails& details, |
| 42 const content::FrameNavigateParams& params) OVERRIDE; |
| 43 |
| 44 private: |
| 45 // Kicks off the process of showing a banner for the package designated by |
| 46 // |tag_content| on the page at the |expected_url|. |
| 47 virtual void HandleMetaTagContent(const std::string& tag_content, |
| 48 const GURL& expected_url) OVERRIDE; |
| 49 |
| 50 JavaObjectWeakGlobalRef weak_java_banner_view_manager_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
| 53 }; // class AppBannerManager |
| 54 |
| 55 // Register native methods |
| 56 bool RegisterAppBannerManager(JNIEnv* env); |
| 57 |
| 58 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ |
OLD | NEW |