| Index: chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
|
| diff --git a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
|
| index fae9849fdc34ba05c385ef58dbd9beed600911a0..54ef9193bc946603d87b228b302c86ac2a9fe963 100644
|
| --- a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
|
| +++ b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
|
| @@ -8,7 +8,7 @@
|
| #include "base/location.h"
|
| #include "base/strings/string16.h"
|
| #include "base/task/cancelable_task_tracker.h"
|
| -#include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
|
| +#include "chrome/browser/android/offline_pages/offline_page_utils.h"
|
| #include "chrome/browser/android/shortcut_helper.h"
|
| #include "chrome/browser/favicon/favicon_service_factory.h"
|
| #include "chrome/browser/manifest/manifest_icon_downloader.h"
|
| @@ -19,9 +19,6 @@
|
| #include "chrome/common/web_application_info.h"
|
| #include "components/dom_distiller/core/url_utils.h"
|
| #include "components/favicon/core/favicon_service.h"
|
| -#include "components/offline_pages/offline_page_feature.h"
|
| -#include "components/offline_pages/offline_page_item.h"
|
| -#include "components/offline_pages/offline_page_model.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/user_metrics.h"
|
| #include "content/public/browser/web_contents.h"
|
| @@ -276,21 +273,14 @@ void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& bitmap,
|
| }
|
|
|
| GURL AddToHomescreenDataFetcher::GetShortcutUrl(const GURL& actual_url) {
|
| - GURL shortcut_url =
|
| + GURL original_url =
|
| dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(actual_url);
|
|
|
| - if (!offline_pages::IsOfflinePagesEnabled())
|
| - return shortcut_url;
|
| + // If URL points to an offline content, get original URL.
|
| + GURL online_url = offline_pages::OfflinePageUtils::GetOnlineURLForOfflineURL(
|
| + web_contents()->GetBrowserContext(), original_url);
|
| + if (online_url.is_valid())
|
| + return online_url;
|
|
|
| - Profile* profile =
|
| - Profile::FromBrowserContext(web_contents()->GetBrowserContext());
|
| -
|
| - offline_pages::OfflinePageModel* offline_page_model =
|
| - offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile);
|
| - const offline_pages::OfflinePageItem* offline_page =
|
| - offline_page_model->GetPageByOfflineURL(shortcut_url);
|
| - if (!offline_page)
|
| - return shortcut_url;
|
| -
|
| - return offline_page->url;
|
| + return original_url;
|
| }
|
|
|