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.
5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_
6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_
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"
14 struct FrameNavigateParams;
15 struct LoadCommittedDetails;
16 } // namespace content
19 * Manages when an app banner is created or dismissed.
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
26 class AppBannerManager : public MetaTagObserver {
28 AppBannerManager(JNIEnv* env, jobject obj);
29 virtual ~AppBannerManager();
31 // Destroys the AppBannerManager.
32 void Destroy(JNIEnv* env, jobject obj);
34 // Observes a new WebContents, if necessary.
35 void ReplaceWebContents(JNIEnv* env,
37 jobject jweb_contents);
39 // WebContentsObserver overrides.
40 virtual void DidNavigateMainFrame(
41 const content::LoadCommittedDetails& details,
42 const content::FrameNavigateParams& params) OVERRIDE;
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;
50 JavaObjectWeakGlobalRef weak_java_banner_view_manager_;
52 DISALLOW_COPY_AND_ASSIGN(AppBannerManager);
53 }; // class AppBannerManager
55 // Register native methods
56 bool RegisterAppBannerManager(JNIEnv* env);
58 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_