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

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

Issue 2284933002: Remove OfflineURL from offline page (Closed)
Patch Set: Remove accidentally added new file during rebase Created 4 years, 2 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 20 matching lines...) Expand all
31 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h" 31 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationLockType.h"
32 #include "ui/display/display.h" 32 #include "ui/display/display.h"
33 #include "ui/display/screen.h" 33 #include "ui/display/screen.h"
34 #include "ui/gfx/codec/png_codec.h" 34 #include "ui/gfx/codec/png_codec.h"
35 #include "ui/gfx/favicon_size.h" 35 #include "ui/gfx/favicon_size.h"
36 #include "url/gurl.h" 36 #include "url/gurl.h"
37 37
38 namespace { 38 namespace {
39 39
40 // Looks up the original, online URL of the site requested. The URL from the 40 // Looks up the original, online URL of the site requested. The URL from the
41 // WebContents may be an offline page or a distilled article which is not 41 // WebContents may be a distilled article which is not appropriate for a home
42 // appropriate for a home screen shortcut. 42 // screen shortcut.
43 GURL GetShortcutUrl(content::BrowserContext* browser_context, 43 GURL GetShortcutUrl(content::BrowserContext* browser_context,
44 const GURL& actual_url) { 44 const GURL& actual_url) {
45 GURL original_url = 45 return dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(actual_url);
46 dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(actual_url);
47
48 // If URL points to an offline content, get original URL.
49 GURL online_url =
50 offline_pages::OfflinePageUtils::MaybeGetOnlineURLForOfflineURL(
51 browser_context, original_url);
52 if (online_url.is_valid())
53 return online_url;
54
55 return original_url;
56 } 46 }
57 47
58 InstallableParams ParamsToPerformInstallableCheck(int ideal_icon_size_in_dp, 48 InstallableParams ParamsToPerformInstallableCheck(int ideal_icon_size_in_dp,
59 int minimum_icon_size_in_dp, 49 int minimum_icon_size_in_dp,
60 bool check_installable) { 50 bool check_installable) {
61 InstallableParams params; 51 InstallableParams params;
62 params.ideal_icon_size_in_dp = ideal_icon_size_in_dp; 52 params.ideal_icon_size_in_dp = ideal_icon_size_in_dp;
63 params.minimum_icon_size_in_dp = minimum_icon_size_in_dp; 53 params.minimum_icon_size_in_dp = minimum_icon_size_in_dp;
64 params.check_installable = check_installable; 54 params.check_installable = check_installable;
65 params.fetch_valid_icon = true; 55 params.fetch_valid_icon = true;
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& icon) { 314 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& icon) {
325 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 315 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
326 if (!web_contents() || !weak_observer_ || is_icon_saved_) 316 if (!web_contents() || !weak_observer_ || is_icon_saved_)
327 return; 317 return;
328 318
329 is_icon_saved_ = true; 319 is_icon_saved_ = true;
330 shortcut_icon_ = icon; 320 shortcut_icon_ = icon;
331 is_ready_ = true; 321 is_ready_ = true;
332 weak_observer_->OnDataAvailable(shortcut_info_, shortcut_icon_); 322 weak_observer_->OnDataAvailable(shortcut_info_, shortcut_icon_);
333 } 323 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698