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

Unified Diff: chrome/browser/android/webapps/add_to_homescreen_manager.cc

Issue 2968693003: [Android Webapps] Make AddToHomescreenDataFetcher easier to test (Closed)
Patch Set: Merge branch 'master' into homescreen_fetcher_weak_ptr2 Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/webapps/add_to_homescreen_manager.cc
diff --git a/chrome/browser/android/webapps/add_to_homescreen_manager.cc b/chrome/browser/android/webapps/add_to_homescreen_manager.cc
index 17be74754228df42db24c3813bb941a51c9fa773..5a808995dfb3bf130b459b7a7fff9492c050b915 100644
--- a/chrome/browser/android/webapps/add_to_homescreen_manager.cc
+++ b/chrome/browser/android/webapps/add_to_homescreen_manager.cc
@@ -74,8 +74,7 @@ void AddToHomescreenManager::AddShortcut(
base::string16 user_title =
base::android::ConvertJavaStringToUTF16(env, j_user_title);
- if (!user_title.empty())
- data_fetcher_->shortcut_info().user_title = user_title;
+ data_fetcher_->shortcut_info().user_title = user_title;
RecordAddToHomescreen();
ShortcutHelper::AddToLauncherWithSkBitmap(web_contents,
@@ -97,7 +96,7 @@ void AddToHomescreenManager::Start(content::WebContents* web_contents) {
ShowDialog();
}
- data_fetcher_ = new AddToHomescreenDataFetcher(
+ data_fetcher_ = base::MakeUnique<AddToHomescreenDataFetcher>(
web_contents, ShortcutHelper::GetIdealHomescreenIconSizeInPx(),
ShortcutHelper::GetMinimumHomescreenIconSizeInPx(),
ShortcutHelper::GetIdealSplashImageSizeInPx(),
@@ -106,12 +105,7 @@ void AddToHomescreenManager::Start(content::WebContents* web_contents) {
check_webapk_compatible, this);
}
-AddToHomescreenManager::~AddToHomescreenManager() {
- if (data_fetcher_) {
- data_fetcher_->set_weak_observer(nullptr);
- data_fetcher_ = nullptr;
- }
-}
+AddToHomescreenManager::~AddToHomescreenManager() {}
void AddToHomescreenManager::ShowDialog() {
JNIEnv* env = base::android::AttachCurrentThread();
@@ -189,13 +183,3 @@ void AddToHomescreenManager::CreateInfoBarForWebApk(
-1 /* event_request_id */, true /* is_webapk */,
webapk::INSTALL_SOURCE_MENU);
}
-
-SkBitmap AddToHomescreenManager::FinalizeLauncherIconInBackground(
- const SkBitmap& bitmap,
- const GURL& url,
- bool* is_generated) {
- base::ThreadRestrictions::AssertIOAllowed();
-
- return ShortcutHelper::FinalizeLauncherIconInBackground(bitmap, url,
- is_generated);
-}

Powered by Google App Engine
This is Rietveld 408576698