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

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

Issue 2808263004: Add a new WebAPK-specific app banner shortcut source. (Closed)
Patch Set: Rebase Created 3 years, 7 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
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 <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/location.h" 11 #include "base/location.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "chrome/browser/android/shortcut_helper.h" 13 #include "chrome/browser/android/shortcut_helper.h"
14 #include "chrome/browser/android/shortcut_info.h" 14 #include "chrome/browser/android/shortcut_info.h"
15 #include "chrome/browser/android/tab_android.h" 15 #include "chrome/browser/android/tab_android.h"
16 #include "chrome/browser/android/webapk/chrome_webapk_host.h"
17 #include "chrome/browser/android/webapk/webapk_install_service.h" 16 #include "chrome/browser/android/webapk/webapk_install_service.h"
18 #include "chrome/browser/banners/app_banner_manager.h" 17 #include "chrome/browser/banners/app_banner_manager.h"
19 #include "chrome/browser/banners/app_banner_metrics.h" 18 #include "chrome/browser/banners/app_banner_metrics.h"
20 #include "chrome/browser/banners/app_banner_settings_helper.h" 19 #include "chrome/browser/banners/app_banner_settings_helper.h"
21 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/infobars/infobar_service.h" 21 #include "chrome/browser/infobars/infobar_service.h"
23 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h" 22 #include "chrome/browser/ui/android/infobars/app_banner_infobar_android.h"
24 #include "components/rappor/public/rappor_utils.h" 23 #include "components/rappor/public/rappor_utils.h"
25 #include "components/rappor/rappor_service_impl.h" 24 #include "components/rappor/rappor_service_impl.h"
26 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
(...skipping 21 matching lines...) Expand all
48 47
49 // static 48 // static
50 bool AppBannerInfoBarDelegateAndroid::Create( 49 bool AppBannerInfoBarDelegateAndroid::Create(
51 content::WebContents* web_contents, 50 content::WebContents* web_contents,
52 base::WeakPtr<AppBannerManager> weak_manager, 51 base::WeakPtr<AppBannerManager> weak_manager,
53 const base::string16& app_title, 52 const base::string16& app_title,
54 std::unique_ptr<ShortcutInfo> shortcut_info, 53 std::unique_ptr<ShortcutInfo> shortcut_info,
55 const SkBitmap& primary_icon, 54 const SkBitmap& primary_icon,
56 const SkBitmap& badge_icon, 55 const SkBitmap& badge_icon,
57 int event_request_id, 56 int event_request_id,
57 bool is_webapk,
58 webapk::InstallSource webapk_install_source) { 58 webapk::InstallSource webapk_install_source) {
59 bool is_webapk = ChromeWebApkHost::CanInstallWebApk();
60 const GURL url = shortcut_info->url; 59 const GURL url = shortcut_info->url;
61 auto infobar_delegate = 60 auto infobar_delegate =
62 base::WrapUnique(new banners::AppBannerInfoBarDelegateAndroid( 61 base::WrapUnique(new banners::AppBannerInfoBarDelegateAndroid(
63 weak_manager, app_title, std::move(shortcut_info), primary_icon, 62 weak_manager, app_title, std::move(shortcut_info), primary_icon,
64 badge_icon, event_request_id, is_webapk, webapk_install_source)); 63 badge_icon, event_request_id, is_webapk, webapk_install_source));
65 auto* raw_delegate = infobar_delegate.get(); 64 auto* raw_delegate = infobar_delegate.get();
66 auto infobar = base::MakeUnique<AppBannerInfoBarAndroid>( 65 auto infobar = base::MakeUnique<AppBannerInfoBarAndroid>(
67 std::move(infobar_delegate), url, is_webapk); 66 std::move(infobar_delegate), url, is_webapk);
68 if (!InfoBarService::FromWebContents(web_contents) 67 if (!InfoBarService::FromWebContents(web_contents)
69 ->AddInfoBar(std::move(infobar))) 68 ->AddInfoBar(std::move(infobar)))
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 466
468 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); 467 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK);
469 return true; 468 return true;
470 } 469 }
471 470
472 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { 471 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) {
473 return RegisterNativesImpl(env); 472 return RegisterNativesImpl(env);
474 } 473 }
475 474
476 } // namespace banners 475 } // namespace banners
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698