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

Side by Side Diff: chrome/browser/ui/android/infobars/app_banner_infobar_android.cc

Issue 2259553002: Make AppBannerInfoBar install WebAPK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/android/infobars/app_banner_infobar_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h" 5 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
11 #include "base/android/scoped_java_ref.h" 11 #include "base/android/scoped_java_ref.h"
12 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" 12 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h"
13 #include "jni/AppBannerInfoBarAndroid_jni.h" 13 #include "jni/AppBannerInfoBarAndroid_jni.h"
14 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 14 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
15 #include "ui/gfx/android/java_bitmap.h" 15 #include "ui/gfx/android/java_bitmap.h"
16 #include "ui/gfx/image/image.h" 16 #include "ui/gfx/image/image.h"
17 17
18 AppBannerInfoBarAndroid::AppBannerInfoBarAndroid( 18 AppBannerInfoBarAndroid::AppBannerInfoBarAndroid(
19 std::unique_ptr<banners::AppBannerInfoBarDelegateAndroid> delegate, 19 std::unique_ptr<banners::AppBannerInfoBarDelegateAndroid> delegate,
20 const base::android::ScopedJavaGlobalRef<jobject>& japp_data) 20 const base::android::ScopedJavaGlobalRef<jobject>& japp_data)
21 : ConfirmInfoBar(std::move(delegate)), japp_data_(japp_data) {} 21 : ConfirmInfoBar(std::move(delegate)), japp_data_(japp_data) {}
22 22
23 AppBannerInfoBarAndroid::AppBannerInfoBarAndroid( 23 AppBannerInfoBarAndroid::AppBannerInfoBarAndroid(
24 std::unique_ptr<banners::AppBannerInfoBarDelegateAndroid> delegate, 24 std::unique_ptr<banners::AppBannerInfoBarDelegateAndroid> delegate,
25 const GURL& app_url) 25 const GURL& app_url,
26 : ConfirmInfoBar(std::move(delegate)), app_url_(app_url) {} 26 bool is_webapk)
27 : ConfirmInfoBar(std::move(delegate)),
28 app_url_(app_url),
29 is_webapk_(is_webapk) {}
27 30
28 AppBannerInfoBarAndroid::~AppBannerInfoBarAndroid() { 31 AppBannerInfoBarAndroid::~AppBannerInfoBarAndroid() {
29 } 32 }
30 33
31 base::android::ScopedJavaLocalRef<jobject> 34 base::android::ScopedJavaLocalRef<jobject>
32 AppBannerInfoBarAndroid::CreateRenderInfoBar(JNIEnv* env) { 35 AppBannerInfoBarAndroid::CreateRenderInfoBar(JNIEnv* env) {
33 ConfirmInfoBarDelegate* app_banner_infobar_delegate = GetDelegate(); 36 ConfirmInfoBarDelegate* app_banner_infobar_delegate = GetDelegate();
34 37
35 base::android::ScopedJavaLocalRef<jstring> app_title = 38 base::android::ScopedJavaLocalRef<jstring> app_title =
36 base::android::ConvertUTF16ToJavaString( 39 base::android::ConvertUTF16ToJavaString(
(...skipping 13 matching lines...) Expand all
50 // Trim down the app URL to the domain and registry. 53 // Trim down the app URL to the domain and registry.
51 std::string trimmed_url = 54 std::string trimmed_url =
52 net::registry_controlled_domains::GetDomainAndRegistry( 55 net::registry_controlled_domains::GetDomainAndRegistry(
53 app_url_, 56 app_url_,
54 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); 57 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
55 58
56 base::android::ScopedJavaLocalRef<jstring> app_url = 59 base::android::ScopedJavaLocalRef<jstring> app_url =
57 base::android::ConvertUTF8ToJavaString(env, trimmed_url); 60 base::android::ConvertUTF8ToJavaString(env, trimmed_url);
58 61
59 infobar.Reset(Java_AppBannerInfoBarAndroid_createWebAppInfoBar( 62 infobar.Reset(Java_AppBannerInfoBarAndroid_createWebAppInfoBar(
60 env, app_title, java_bitmap, app_url)); 63 env, app_title, java_bitmap, app_url, is_webapk_));
61 } 64 }
62 65
63 java_infobar_.Reset(env, infobar.obj()); 66 java_infobar_.Reset(env, infobar.obj());
64 return infobar; 67 return infobar;
65 } 68 }
66 69
67 void AppBannerInfoBarAndroid::OnInstallStateChanged(int new_state) { 70 void AppBannerInfoBarAndroid::OnInstallStateChanged(int new_state) {
68 JNIEnv* env = base::android::AttachCurrentThread(); 71 JNIEnv* env = base::android::AttachCurrentThread();
69 Java_AppBannerInfoBarAndroid_onInstallStateChanged(env, java_infobar_, 72 Java_AppBannerInfoBarAndroid_onInstallStateChanged(env, java_infobar_,
70 new_state); 73 new_state);
71 } 74 }
72 75
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/infobars/app_banner_infobar_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698