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

Side by Side Diff: chrome/browser/banners/app_banner_data_fetcher.h

Issue 1092193004: Use related_applications manifest fields when showing native app banners (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_BANNERS_APP_BANNER_DATA_FETCHER_H_ 5 #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_
6 #define CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ 6 #define CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 25 matching lines...) Expand all
36 public: 36 public:
37 class Observer { 37 class Observer {
38 public: 38 public:
39 virtual void OnDecidedWhetherToShow(AppBannerDataFetcher* fetcher, 39 virtual void OnDecidedWhetherToShow(AppBannerDataFetcher* fetcher,
40 bool will_show) = 0; 40 bool will_show) = 0;
41 virtual void OnFetcherDestroyed(AppBannerDataFetcher* fetcher) = 0; 41 virtual void OnFetcherDestroyed(AppBannerDataFetcher* fetcher) = 0;
42 }; 42 };
43 43
44 class Delegate { 44 class Delegate {
45 public: 45 public:
46 // Called when no valid manifest was found. Returns |true| if the fetcher 46 // Called to handle a non-web app. Returns |true| if the non-web app can be
47 // needs to remain active and wait for a callback. 47 // handled, and the fetcher needs to remain active and wait for a callback.
48 virtual bool OnInvalidManifest(AppBannerDataFetcher* fetcher) = 0; 48 virtual bool HandleNonWebApp(const std::string& platform,
49 const GURL& url,
50 const std::string& id) = 0;
49 }; 51 };
50 52
51 // Returns the current time. 53 // Returns the current time.
52 static base::Time GetCurrentTime(); 54 static base::Time GetCurrentTime();
53 55
54 // Fast-forwards the current time for testing. 56 // Fast-forwards the current time for testing.
55 static void SetTimeDeltaForTesting(int days); 57 static void SetTimeDeltaForTesting(int days);
56 58
57 AppBannerDataFetcher(content::WebContents* web_contents, 59 AppBannerDataFetcher(content::WebContents* web_contents,
58 base::WeakPtr<Delegate> weak_delegate, 60 base::WeakPtr<Delegate> weak_delegate,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 132
131 // Record that the banner could be shown at this point, if the triggering 133 // Record that the banner could be shown at this point, if the triggering
132 // heuristic allowed. 134 // heuristic allowed.
133 void RecordCouldShowBanner(); 135 void RecordCouldShowBanner();
134 136
135 // Returns whether the banner should be shown. 137 // Returns whether the banner should be shown.
136 bool CheckIfShouldShowBanner(); 138 bool CheckIfShouldShowBanner();
137 139
138 // Returns whether the given Manifest is following the requirements to show 140 // Returns whether the given Manifest is following the requirements to show
139 // a web app banner. 141 // a web app banner.
140 static bool IsManifestValid(const content::Manifest& manifest); 142 static bool IsManifestValidForWebApp(const content::Manifest& manifest);
141 143
142 const int ideal_icon_size_; 144 const int ideal_icon_size_;
143 const base::WeakPtr<Delegate> weak_delegate_; 145 const base::WeakPtr<Delegate> weak_delegate_;
144 ObserverList<Observer> observer_list_; 146 ObserverList<Observer> observer_list_;
145 bool is_active_; 147 bool is_active_;
146 scoped_ptr<chrome::BitmapFetcher> bitmap_fetcher_; 148 scoped_ptr<chrome::BitmapFetcher> bitmap_fetcher_;
147 scoped_ptr<SkBitmap> app_icon_; 149 scoped_ptr<SkBitmap> app_icon_;
148 150
149 GURL validated_url_; 151 GURL validated_url_;
150 base::string16 app_title_; 152 base::string16 app_title_;
151 content::Manifest web_app_data_; 153 content::Manifest web_app_data_;
152 154
153 friend class AppBannerDataFetcherUnitTest; 155 friend class AppBannerDataFetcherUnitTest;
154 friend class base::RefCounted<AppBannerDataFetcher>; 156 friend class base::RefCounted<AppBannerDataFetcher>;
155 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcher); 157 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcher);
156 }; 158 };
157 159
158 } // namespace banners 160 } // namespace banners
159 161
160 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ 162 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/banners/app_banner_manager_android.cc ('k') | chrome/browser/banners/app_banner_data_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698