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

Side by Side Diff: chrome/browser/android/banners/app_banner_infobar_delegate_android.cc

Issue 2652903005: Use the manifest start URL to query the existence of a WebAPK (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | 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/android/banners/app_banner_infobar_delegate_android.h" 5 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 bool AppBannerInfoBarDelegateAndroid::Create( 49 bool AppBannerInfoBarDelegateAndroid::Create(
50 content::WebContents* web_contents, 50 content::WebContents* web_contents,
51 base::WeakPtr<AppBannerManager> weak_manager, 51 base::WeakPtr<AppBannerManager> weak_manager,
52 const base::string16& app_title, 52 const base::string16& app_title,
53 std::unique_ptr<ShortcutInfo> shortcut_info, 53 std::unique_ptr<ShortcutInfo> shortcut_info,
54 std::unique_ptr<SkBitmap> icon, 54 std::unique_ptr<SkBitmap> icon,
55 int event_request_id, 55 int event_request_id,
56 webapk::InstallSource webapk_install_source) { 56 webapk::InstallSource webapk_install_source) {
57 bool is_webapk = ChromeWebApkHost::AreWebApkEnabled(); 57 bool is_webapk = ChromeWebApkHost::AreWebApkEnabled();
58 std::string webapk_package_name = ""; 58 std::string webapk_package_name = "";
59 if (is_webapk) { 59 const GURL& url = shortcut_info->url;
60 webapk_package_name = ShortcutHelper::QueryWebApkPackage( 60 if (is_webapk)
61 web_contents->GetLastCommittedURL()); 61 webapk_package_name = ShortcutHelper::QueryWebApkPackage(url);
62 }
63 bool is_webapk_already_installed = !webapk_package_name.empty(); 62 bool is_webapk_already_installed = !webapk_package_name.empty();
64 const GURL& url = shortcut_info->url;
65 auto infobar_delegate = 63 auto infobar_delegate =
66 base::WrapUnique(new banners::AppBannerInfoBarDelegateAndroid( 64 base::WrapUnique(new banners::AppBannerInfoBarDelegateAndroid(
67 weak_manager, app_title, std::move(shortcut_info), std::move(icon), 65 weak_manager, app_title, std::move(shortcut_info), std::move(icon),
68 event_request_id, is_webapk, is_webapk_already_installed, 66 event_request_id, is_webapk, is_webapk_already_installed,
69 webapk_install_source)); 67 webapk_install_source));
70 auto raw_delegate = infobar_delegate.get(); 68 auto raw_delegate = infobar_delegate.get();
71 auto infobar = base::MakeUnique<AppBannerInfoBarAndroid>( 69 auto infobar = base::MakeUnique<AppBannerInfoBarAndroid>(
72 std::move(infobar_delegate), url, is_webapk); 70 std::move(infobar_delegate), url, is_webapk);
73 if (!InfoBarService::FromWebContents(web_contents) 71 if (!InfoBarService::FromWebContents(web_contents)
74 ->AddInfoBar(std::move(infobar))) 72 ->AddInfoBar(std::move(infobar)))
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 458
461 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); 459 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK);
462 return true; 460 return true;
463 } 461 }
464 462
465 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { 463 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) {
466 return RegisterNativesImpl(env); 464 return RegisterNativesImpl(env);
467 } 465 }
468 466
469 } // namespace banners 467 } // namespace banners
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698