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

Side by Side Diff: chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc

Issue 1845233002: Store standalone web app data in WebappDataStorage as well as the homescreen intent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notification-deep-linking
Patch Set: Final nit Created 4 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 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" 5 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h"
6 6
7 #include "base/bind.h"
8 #include "base/callback.h"
7 #include "base/location.h" 9 #include "base/location.h"
8 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
9 #include "base/task/cancelable_task_tracker.h" 11 #include "base/task/cancelable_task_tracker.h"
10 #include "chrome/browser/android/offline_pages/offline_page_utils.h" 12 #include "chrome/browser/android/offline_pages/offline_page_utils.h"
11 #include "chrome/browser/android/shortcut_helper.h" 13 #include "chrome/browser/android/shortcut_helper.h"
12 #include "chrome/browser/favicon/favicon_service_factory.h" 14 #include "chrome/browser/favicon/favicon_service_factory.h"
13 #include "chrome/browser/manifest/manifest_icon_downloader.h" 15 #include "chrome/browser/manifest/manifest_icon_downloader.h"
14 #include "chrome/browser/manifest/manifest_icon_selector.h" 16 #include "chrome/browser/manifest/manifest_icon_selector.h"
15 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/chrome_constants.h" 18 #include "chrome/common/chrome_constants.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 IPC_MESSAGE_UNHANDLED(handled = false) 158 IPC_MESSAGE_UNHANDLED(handled = false)
157 IPC_END_MESSAGE_MAP() 159 IPC_END_MESSAGE_MAP()
158 160
159 return handled; 161 return handled;
160 } 162 }
161 163
162 AddToHomescreenDataFetcher::~AddToHomescreenDataFetcher() { 164 AddToHomescreenDataFetcher::~AddToHomescreenDataFetcher() {
163 DCHECK(!weak_observer_); 165 DCHECK(!weak_observer_);
164 } 166 }
165 167
166 void AddToHomescreenDataFetcher::FetchSplashScreenImage( 168 base::Closure AddToHomescreenDataFetcher::FetchSplashScreenImageCallback(
167 const std::string& webapp_id) { 169 const std::string& webapp_id) {
168 ShortcutHelper::FetchSplashScreenImage( 170 return base::Bind(&ShortcutHelper::FetchSplashScreenImage, web_contents(),
169 web_contents(), 171 splash_screen_url_, ideal_splash_image_size_in_dp_,
170 splash_screen_url_, 172 minimum_splash_image_size_in_dp_, webapp_id);
171 ideal_splash_image_size_in_dp_,
172 minimum_splash_image_size_in_dp_,
173 webapp_id,
174 shortcut_info_.url.spec());
175 } 173 }
176 174
177 void AddToHomescreenDataFetcher::FetchFavicon() { 175 void AddToHomescreenDataFetcher::FetchFavicon() {
178 if (!web_contents() || !weak_observer_) return; 176 if (!web_contents() || !weak_observer_) return;
179 177
180 Profile* profile = 178 Profile* profile =
181 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 179 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
182 180
183 // Grab the best, largest icon we can find to represent this bookmark. 181 // Grab the best, largest icon we can find to represent this bookmark.
184 // TODO(dfalcantara): Try combining with the new BookmarksHandler once its 182 // TODO(dfalcantara): Try combining with the new BookmarksHandler once its
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(actual_url); 270 dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(actual_url);
273 271
274 // If URL points to an offline content, get original URL. 272 // If URL points to an offline content, get original URL.
275 GURL online_url = offline_pages::OfflinePageUtils::GetOnlineURLForOfflineURL( 273 GURL online_url = offline_pages::OfflinePageUtils::GetOnlineURLForOfflineURL(
276 web_contents()->GetBrowserContext(), original_url); 274 web_contents()->GetBrowserContext(), original_url);
277 if (online_url.is_valid()) 275 if (online_url.is_valid())
278 return online_url; 276 return online_url;
279 277
280 return original_url; 278 return original_url;
281 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698