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

Side by Side Diff: chrome/browser/android/banners/app_banner_manager.h

Issue 893793005: Check if there is a SW controlling the start page for app banner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android compile Created 5 years, 10 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_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/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/android/banners/app_banner_infobar_delegate.h" 13 #include "chrome/browser/android/banners/app_banner_infobar_delegate.h"
12 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" 14 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"
13 #include "content/public/browser/web_contents_observer.h" 15 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/common/manifest.h" 16 #include "content/public/common/manifest.h"
15 17
16 namespace content { 18 namespace content {
17 struct FrameNavigateParams; 19 struct FrameNavigateParams;
18 struct LoadCommittedDetails; 20 struct LoadCommittedDetails;
19 struct Manifest; 21 struct Manifest;
20 } // namespace content 22 } // namespace content
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 104
103 // BitmapFetcherDelegate overrides. 105 // BitmapFetcherDelegate overrides.
104 virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override; 106 virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override;
105 107
106 // AppBannerInfoBarDelegate::AppDelegate overrides. 108 // AppBannerInfoBarDelegate::AppDelegate overrides.
107 virtual void Block() const override; 109 virtual void Block() const override;
108 virtual void Install() const override; 110 virtual void Install() const override;
109 virtual gfx::Image GetIcon() const override; 111 virtual gfx::Image GetIcon() const override;
110 112
111 private: 113 private:
114 class IOThreadHandler;
115
112 // Gets the preferred icon size for the banner icons. 116 // Gets the preferred icon size for the banner icons.
113 int GetPreferredIconSize(); 117 int GetPreferredIconSize();
114 118
115 // Called when the manifest has been retrieved, or if there is no manifest to 119 // Called when the manifest has been retrieved, or if there is no manifest to
116 // retrieve. 120 // retrieve.
117 void OnDidGetManifest(const content::Manifest& manifest); 121 void OnDidGetManifest(const content::Manifest& manifest);
118 122
119 // Called when the renderer has returned information about the meta tag. 123 // Called when the renderer has returned information about the meta tag.
120 // If there is some metadata for the play store tag, this kicks off the 124 // If there is some metadata for the play store tag, this kicks off the
121 // process of showing a banner for the package designated by |tag_content| on 125 // process of showing a banner for the package designated by |tag_content| on
122 // the page at the |expected_url|. 126 // the page at the |expected_url|.
123 void OnDidRetrieveMetaTagContent(bool success, 127 void OnDidRetrieveMetaTagContent(bool success,
124 const std::string& tag_name, 128 const std::string& tag_name,
125 const std::string& tag_content, 129 const std::string& tag_content,
126 const GURL& expected_url); 130 const GURL& expected_url);
127 131
132 // Called when the result of the CheckHasSameServiceWorker query has
133 // completed.
134 void OnDidCheckHasSameServiceWorker(bool has_same);
135
128 // Fetches the icon for an app. 136 // Fetches the icon for an app.
129 scoped_ptr<chrome::BitmapFetcher> fetcher_; 137 scoped_ptr<chrome::BitmapFetcher> fetcher_;
130 GURL validated_url_; 138 GURL validated_url_;
131 content::Manifest manifest_; 139 content::Manifest manifest_;
132 scoped_ptr<SkBitmap> app_icon_; 140 scoped_ptr<SkBitmap> app_icon_;
133 141
134 // AppBannerManager on the Java side. 142 // AppBannerManager on the Java side.
135 JavaObjectWeakGlobalRef weak_java_banner_view_manager_; 143 JavaObjectWeakGlobalRef weak_java_banner_view_manager_;
136 144
145 // Object to handle responses that are returned on the IO thread.
146 scoped_refptr<IOThreadHandler> io_thread_handler_;
147
148 // A weak pointer is used as the lifetime of the ServiceWorkerContext is
149 // longer than the lifetime of this banner manager. The banner manager
150 // may be destroyed when calls sent to the ServiceWorkerContext are
151 // completed.
152 base::WeakPtrFactory<AppBannerManager> weak_factory_;
153
137 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); 154 DISALLOW_COPY_AND_ASSIGN(AppBannerManager);
138 }; // class AppBannerManager 155 }; // class AppBannerManager
139 156
140 // Register native methods 157 // Register native methods
141 bool RegisterAppBannerManager(JNIEnv* env); 158 bool RegisterAppBannerManager(JNIEnv* env);
142 159
143 } // namespace banners 160 } // namespace banners
144 161
145 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ 162 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698