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

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

Issue 2284933002: Remove OfflineURL from offline page (Closed)
Patch Set: Fix trybot Created 4 years, 3 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 <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 19 matching lines...) Expand all
30 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h" 30 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h"
31 #include "ui/display/display.h" 31 #include "ui/display/display.h"
32 #include "ui/display/screen.h" 32 #include "ui/display/screen.h"
33 #include "ui/gfx/codec/png_codec.h" 33 #include "ui/gfx/codec/png_codec.h"
34 #include "ui/gfx/favicon_size.h" 34 #include "ui/gfx/favicon_size.h"
35 #include "url/gurl.h" 35 #include "url/gurl.h"
36 36
37 namespace { 37 namespace {
38 38
39 // Looks up the original, online URL of the site requested. The URL from the 39 // Looks up the original, online URL of the site requested. The URL from the
40 // WebContents may be an offline page or a distilled article which is not 40 // WebContents may be a distilled article which is not appropriate for a home
41 // appropriate for a home screen shortcut. 41 // screen shortcut.
42 GURL GetShortcutUrl(content::BrowserContext* browser_context, 42 GURL GetShortcutUrl(content::BrowserContext* browser_context,
43 const GURL& actual_url) { 43 const GURL& actual_url) {
44 GURL original_url = 44 return dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(actual_url);
45 dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(actual_url);
46
47 // If URL points to an offline content, get original URL.
48 GURL online_url =
49 offline_pages::OfflinePageUtils::MaybeGetOnlineURLForOfflineURL(
50 browser_context, original_url);
51 if (online_url.is_valid())
52 return online_url;
53
54 return original_url;
55 } 45 }
56 46
57 InstallableParams ParamsToPerformInstallableCheck(int ideal_icon_size_in_dp, 47 InstallableParams ParamsToPerformInstallableCheck(int ideal_icon_size_in_dp,
58 int minimum_icon_size_in_dp) { 48 int minimum_icon_size_in_dp) {
59 // TODO(hanxi): change check_installable to true for WebAPKs. 49 // TODO(hanxi): change check_installable to true for WebAPKs.
60 InstallableParams params; 50 InstallableParams params;
61 params.ideal_icon_size_in_dp = ideal_icon_size_in_dp; 51 params.ideal_icon_size_in_dp = ideal_icon_size_in_dp;
62 params.minimum_icon_size_in_dp = minimum_icon_size_in_dp; 52 params.minimum_icon_size_in_dp = minimum_icon_size_in_dp;
63 params.check_installable = false; 53 params.check_installable = false;
64 params.fetch_valid_icon = true; 54 params.fetch_valid_icon = true;
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& icon) { 285 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& icon) {
296 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 286 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
297 if (!web_contents() || !weak_observer_ || is_icon_saved_) 287 if (!web_contents() || !weak_observer_ || is_icon_saved_)
298 return; 288 return;
299 289
300 is_icon_saved_ = true; 290 is_icon_saved_ = true;
301 shortcut_icon_ = icon; 291 shortcut_icon_ = icon;
302 is_ready_ = true; 292 is_ready_ = true;
303 weak_observer_->OnDataAvailable(shortcut_info_, shortcut_icon_); 293 weak_observer_->OnDataAvailable(shortcut_info_, shortcut_icon_);
304 } 294 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698