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

Unified Diff: chrome/browser/android/webapps/add_to_homescreen_helper.h

Issue 1288903002: Refactor ShortcutHelper and merge in BookmarkUtils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 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_helper.h
diff --git a/chrome/browser/android/shortcut_helper.h b/chrome/browser/android/webapps/add_to_homescreen_helper.h
similarity index 66%
copy from chrome/browser/android/shortcut_helper.h
copy to chrome/browser/android/webapps/add_to_homescreen_helper.h
index 7e302c3ed84b1338e05bd8d2cbe53f7db0b32d78..4cea8b7f4487372e817e06e70caa1c0bd1feaee4 100644
--- a/chrome/browser/android/shortcut_helper.h
+++ b/chrome/browser/android/webapps/add_to_homescreen_helper.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
-#define CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
+#ifndef CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_HELPER_H_
+#define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_HELPER_H_
#include "base/android/jni_android.h"
#include "base/android/jni_weak_ref.h"
#include "base/basictypes.h"
-#include "chrome/browser/android/shortcut_data_fetcher.h"
#include "chrome/browser/android/shortcut_info.h"
+#include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h"
#include "content/public/common/manifest.h"
namespace content {
@@ -25,33 +25,28 @@ class GURL;
// ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's
gone 2015/08/13 20:54:28 you didn't change any of the comments to change th
Lalit Maganti 2015/08/26 13:57:08 Done in https://codereview.chromium.org/1321463002
Lalit Maganti 2015/08/26 13:57:08 Done in later patchset in this series.
// ShortcutHelper in Java. The object is owned by the Java object. It is created
// from there via a JNI (Initialize) call and MUST BE DESTROYED via Destroy().
-class ShortcutHelper : public ShortcutDataFetcher::Observer {
+class AddToHomescreenHelper : public AddToHomescreenDataFetcher::Observer {
public:
- ShortcutHelper(JNIEnv* env,
- jobject obj,
- content::WebContents* web_contents);
+ AddToHomescreenHelper(JNIEnv* env,
+ jobject obj,
+ content::WebContents* web_contents);
// Called by the Java counterpart to destroy its native half.
void Destroy(JNIEnv* env, jobject obj);
// Registers JNI hooks.
- static bool RegisterShortcutHelper(JNIEnv* env);
+ static bool RegisterAddToHomescreenHelper(JNIEnv* env);
// Adds a shortcut to the current URL to the Android home screen.
void AddShortcut(JNIEnv* env, jobject obj, jstring title);
- // Adds a shortcut to the launcher using a SkBitmap.
- // Must be called on the IO thread.
- static void AddShortcutInBackgroundWithSkBitmap(const ShortcutInfo& info,
- const SkBitmap& icon_bitmap);
-
- // ShortcutDataFetcher::Observer
+ // AddToHomescreenDataFetcher::Observer
void OnUserTitleAvailable(const base::string16& user_title) override;
void OnDataAvailable(const ShortcutInfo& info, const SkBitmap& icon) override;
SkBitmap FinalizeLauncherIcon(const SkBitmap& icon, const GURL& url) override;
private:
- virtual ~ShortcutHelper();
+ virtual ~AddToHomescreenHelper();
// Called only when the ShortcutDataFetcher has retrieved all of the
// data needed to add the shortcut.
@@ -67,9 +62,9 @@ class ShortcutHelper : public ShortcutDataFetcher::Observer {
bool add_shortcut_pending_;
// Fetches data required to add a shortcut.
- scoped_refptr<ShortcutDataFetcher> data_fetcher_;
+ scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_;
- DISALLOW_COPY_AND_ASSIGN(ShortcutHelper);
+ DISALLOW_COPY_AND_ASSIGN(AddToHomescreenHelper);
};
-#endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
+#endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698