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

Unified Diff: chrome/browser/android/banners/app_banner_infobar_delegate_android.cc

Issue 2393513004: Convert app banners to use Mojo. (Closed)
Patch Set: Fix Win clang compile 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
diff --git a/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc b/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
index a42484fb8d4db0ff0a5209d5a031302f937b13bc..7757148b309f916d992c558bb2423a92cdc9e7cb 100644
--- a/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
+++ b/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
@@ -9,21 +9,16 @@
#include "base/guid.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
-#include "base/strings/string16.h"
-#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/android/shortcut_helper.h"
#include "chrome/browser/android/shortcut_info.h"
#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/android/webapk/webapk_installer.h"
-#include "chrome/browser/banners/app_banner_manager.h"
#include "chrome/browser/banners/app_banner_metrics.h"
#include "chrome/browser/banners/app_banner_settings_helper.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h"
-#include "chrome/common/render_messages.h"
#include "components/rappor/rappor_utils.h"
-#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/manifest.h"
#include "jni/AppBannerInfoBarDelegateAndroid_jni.h"
@@ -187,7 +182,7 @@ bool AppBannerInfoBarDelegateAndroid::AcceptWebApk(
Java_AppBannerInfoBarDelegateAndroid_openWebApk(env, java_delegate_,
java_webapk_package_name);
webapk::TrackUserAction(webapk::USER_ACTION_INSTALLED_OPEN);
- SendBannerAccepted(web_contents, "web");
+ SendBannerAccepted();
return true;
}
@@ -211,7 +206,7 @@ bool AppBannerInfoBarDelegateAndroid::AcceptWebApk(
ShortcutHelper::InstallWebApkWithSkBitmap(web_contents->GetBrowserContext(),
*shortcut_info_,
*icon_.get(), callback);
- SendBannerAccepted(web_contents, "web");
+ SendBannerAccepted();
// Prevent the infobar from disappearing, because the infobar will show
// "Adding" during the installation process.
@@ -271,14 +266,9 @@ void AppBannerInfoBarDelegateAndroid::CreateJavaDelegate() {
reinterpret_cast<intptr_t>(this)));
}
-void AppBannerInfoBarDelegateAndroid::SendBannerAccepted(
- content::WebContents* web_contents,
- const std::string& platform) {
- web_contents->GetMainFrame()->Send(
- new ChromeViewMsg_AppBannerAccepted(
- web_contents->GetMainFrame()->GetRoutingID(),
- event_request_id_,
- platform));
+void AppBannerInfoBarDelegateAndroid::SendBannerAccepted() {
+ if (weak_manager_)
+ weak_manager_->SendBannerAccepted(event_request_id_);
}
infobars::InfoBarDelegate::InfoBarIdentifier
@@ -296,10 +286,8 @@ void AppBannerInfoBarDelegateAndroid::InfoBarDismissed() {
content::WebContents* web_contents =
InfoBarService::WebContentsFromInfoBar(infobar());
- web_contents->GetMainFrame()->Send(
- new ChromeViewMsg_AppBannerDismissed(
- web_contents->GetMainFrame()->GetRoutingID(),
- event_request_id_));
+ if (weak_manager_)
+ weak_manager_->SendBannerDismissed(event_request_id_);
if (native_app_data_.is_null()) {
if (is_webapk_)
@@ -361,7 +349,7 @@ bool AppBannerInfoBarDelegateAndroid::AcceptNativeApp(
else
TrackInstallEvent(INSTALL_EVENT_NATIVE_APP_INSTALL_TRIGGERED);
- SendBannerAccepted(web_contents, "play");
+ SendBannerAccepted();
return was_opened;
}
@@ -381,7 +369,7 @@ bool AppBannerInfoBarDelegateAndroid::AcceptWebApp(
*icon_.get(), weak_manager_->FetchWebappSplashScreenImageCallback(uid));
}
- SendBannerAccepted(web_contents, "web");
+ SendBannerAccepted();
return true;
}
@@ -444,7 +432,7 @@ bool AppBannerInfoBarDelegateAndroid::LinkClicked(
}
bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) {
- return RegisterNativesImpl(env);
+ return RegisterNativesImpl(env);
}
} // namespace banners

Powered by Google App Engine
This is Rietveld 408576698