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

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

Issue 2292133003: Determine whether to show "Add to Homescreen" dialog or WebAPK infobar (Closed)
Patch Set: Clean up. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/webapps/add_to_homescreen_manager.h
diff --git a/chrome/browser/android/webapps/add_to_homescreen_dialog_helper.h b/chrome/browser/android/webapps/add_to_homescreen_manager.h
similarity index 64%
copy from chrome/browser/android/webapps/add_to_homescreen_dialog_helper.h
copy to chrome/browser/android/webapps/add_to_homescreen_manager.h
index 4780185c021dc67a9e47803416a3e31c7c6b4630..34c81a740a5ab3fe52730375b53f5fe5cedd0250 100644
--- a/chrome/browser/android/webapps/add_to_homescreen_dialog_helper.h
+++ b/chrome/browser/android/webapps/add_to_homescreen_manager.h
@@ -1,15 +1,14 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DIALOG_HELPER_H_
-#define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DIALOG_HELPER_H_
+#ifndef CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_
+#define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_
#include "base/android/jni_android.h"
#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
#include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h"
-#include "third_party/skia/include/core/SkBitmap.h"
namespace content {
class WebContents;
@@ -20,21 +19,19 @@ class Message;
}
class GURL;
+class SkBitmap;
struct ShortcutInfo;
-// AddToHomescreenDialogHelper is the C++ counterpart of
-// org.chromium.chrome.browser's AddToHomescreenDialogHelper 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 AddToHomescreenDialogHelper :
- public AddToHomescreenDataFetcher::Observer {
+// AddToHomescreenManager is the C++ counterpart of
+// org.chromium.chrome.browser's AddToHomescreenManager in Java. The object
+// is owned by the Java object. It is created from there via a JNI
+// (InitializeAndStart) call and MUST BE DESTROYED via Destroy().
+class AddToHomescreenManager : public AddToHomescreenDataFetcher::Observer {
public:
- // Registers JNI hooks.
- static bool RegisterAddToHomescreenDialogHelper(JNIEnv* env);
+ AddToHomescreenManager(JNIEnv* env, jobject obj);
- AddToHomescreenDialogHelper(JNIEnv* env,
- jobject obj,
- content::WebContents* web_contents);
+ // Registers JNI hooks.
+ static bool Register(JNIEnv* env);
// Called by the Java counterpart to destroy its native half.
void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
@@ -44,8 +41,14 @@ class AddToHomescreenDialogHelper :
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& title);
+ // Starts the add-to-homescreen process.
+ void Start(content::WebContents* web_contents);
+
private:
- virtual ~AddToHomescreenDialogHelper();
+ ~AddToHomescreenManager() override;
+
+ // Shows alert to prompt user for name of home screen shortcut.
+ void ShowDialog();
// Called only when the AddToHomescreenDataFetcher has retrieved all of the
// data needed to add the shortcut.
@@ -54,6 +57,7 @@ class AddToHomescreenDialogHelper :
void RecordAddToHomescreen();
// AddToHomescreenDataFetcher::Observer:
+ void OnDidDetermineWebApkCompatibility(bool is_webapk_compatible) override;
void OnUserTitleAvailable(const base::string16& user_title) override;
void OnDataAvailable(const ShortcutInfo& info, const SkBitmap& icon) override;
SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon,
@@ -70,7 +74,7 @@ class AddToHomescreenDialogHelper :
// Fetches data required to add a shortcut.
scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_;
- DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDialogHelper);
+ DISALLOW_COPY_AND_ASSIGN(AddToHomescreenManager);
};
-#endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DIALOG_HELPER_H_
+#endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698