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

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

Issue 896243004: Start piping Android app promos through AppBannerInfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nits Created 5 years, 10 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.h" 5 #include "chrome/browser/android/banners/app_banner_infobar_delegate.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ui/android/infobars/app_banner_infobar.h" 10 #include "chrome/browser/ui/android/infobars/app_banner_infobar.h"
11 #include "chrome/grit/generated_resources.h" 11 #include "chrome/grit/generated_resources.h"
12 #include "components/infobars/core/infobar.h" 12 #include "components/infobars/core/infobar.h"
13 #include "components/infobars/core/infobar_manager.h" 13 #include "components/infobars/core/infobar_manager.h"
14 14
15 namespace banners { 15 namespace banners {
16 16
17 // static 17 // static
18 AppBannerInfoBar* AppBannerInfoBarDelegate::CreateForNativeApp(
19 infobars::InfoBarManager* infobar_manager,
20 AppDelegate* app_delegate,
21 const base::android::ScopedJavaGlobalRef<jobject>& japp_data) {
22 scoped_ptr<AppBannerInfoBarDelegate> delegate(new AppBannerInfoBarDelegate(
23 app_delegate));
24 AppBannerInfoBar* infobar = new AppBannerInfoBar(delegate.Pass(), japp_data);
25 return infobar_manager->AddInfoBar(make_scoped_ptr(infobar))
26 ? infobar : nullptr;
27 }
28
29 // static
18 AppBannerInfoBar* AppBannerInfoBarDelegate::CreateForWebApp( 30 AppBannerInfoBar* AppBannerInfoBarDelegate::CreateForWebApp(
19 infobars::InfoBarManager* infobar_manager, 31 infobars::InfoBarManager* infobar_manager,
20 AppDelegate* app_delegate, 32 AppDelegate* app_delegate,
21 const GURL& url) { 33 const GURL& url) {
22 scoped_ptr<AppBannerInfoBarDelegate> delegate(new AppBannerInfoBarDelegate( 34 scoped_ptr<AppBannerInfoBarDelegate> delegate(new AppBannerInfoBarDelegate(
23 app_delegate)); 35 app_delegate));
24 AppBannerInfoBar* infobar = new AppBannerInfoBar(delegate.Pass(), url); 36 AppBannerInfoBar* infobar = new AppBannerInfoBar(delegate.Pass(), url);
25 return infobar_manager->AddInfoBar(make_scoped_ptr(infobar)) 37 return infobar_manager->AddInfoBar(make_scoped_ptr(infobar))
26 ? infobar : nullptr; 38 ? infobar : nullptr;
27 } 39 }
(...skipping 25 matching lines...) Expand all
53 DCHECK(delegate_); 65 DCHECK(delegate_);
54 delegate_->Block(); 66 delegate_->Block();
55 } 67 }
56 68
57 bool AppBannerInfoBarDelegate::Accept() { 69 bool AppBannerInfoBarDelegate::Accept() {
58 DCHECK(delegate_); 70 DCHECK(delegate_);
59 return delegate_->OnButtonClicked(); 71 return delegate_->OnButtonClicked();
60 } 72 }
61 73
62 } // namespace banners 74 } // namespace banners
OLDNEW
« no previous file with comments | « chrome/browser/android/banners/app_banner_infobar_delegate.h ('k') | chrome/browser/android/banners/app_banner_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698