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

Side by Side Diff: chrome/browser/banners/app_banner_data_fetcher_desktop.cc

Issue 2064943002: Pass in extra parameters to WebApkBuilder#buildWebApkAsync() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_manifest000 Created 4 years, 5 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/banners/app_banner_data_fetcher_desktop.h" 5 #include "chrome/browser/banners/app_banner_data_fetcher_desktop.h"
6 6
7 #include "chrome/browser/banners/app_banner_infobar_delegate_desktop.h" 7 #include "chrome/browser/banners/app_banner_infobar_delegate_desktop.h"
8 #include "chrome/browser/banners/app_banner_metrics.h" 8 #include "chrome/browser/banners/app_banner_metrics.h"
9 #include "chrome/browser/banners/app_banner_settings_helper.h" 9 #include "chrome/browser/banners/app_banner_settings_helper.h"
10 #include "chrome/browser/extensions/bookmark_app_helper.h" 10 #include "chrome/browser/extensions/bookmark_app_helper.h"
(...skipping 23 matching lines...) Expand all
34 AppBannerDataFetcherDesktop::~AppBannerDataFetcherDesktop() { 34 AppBannerDataFetcherDesktop::~AppBannerDataFetcherDesktop() {
35 } 35 }
36 36
37 bool AppBannerDataFetcherDesktop::IsWebAppInstalled( 37 bool AppBannerDataFetcherDesktop::IsWebAppInstalled(
38 content::BrowserContext* browser_context, 38 content::BrowserContext* browser_context,
39 const GURL& start_url) { 39 const GURL& start_url) {
40 return extensions::BookmarkAppHelper::BookmarkOrHostedAppInstalled( 40 return extensions::BookmarkAppHelper::BookmarkOrHostedAppInstalled(
41 browser_context, start_url); 41 browser_context, start_url);
42 } 42 }
43 43
44 void AppBannerDataFetcherDesktop::ShowBanner(const SkBitmap* icon, 44 void AppBannerDataFetcherDesktop::ShowBanner(const GURL& icon_url,
45 const SkBitmap* icon,
45 const base::string16& title, 46 const base::string16& title,
46 const std::string& referrer) { 47 const std::string& referrer) {
47 content::WebContents* web_contents = GetWebContents(); 48 content::WebContents* web_contents = GetWebContents();
48 DCHECK(web_contents && !web_app_data().IsEmpty()); 49 DCHECK(web_contents && !manifest().IsEmpty());
49 50
50 Profile* profile = 51 Profile* profile =
51 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 52 Profile::FromBrowserContext(web_contents->GetBrowserContext());
52 WebApplicationInfo web_app_info; 53 WebApplicationInfo web_app_info;
53 54
54 bookmark_app_helper_.reset( 55 bookmark_app_helper_.reset(
55 new extensions::BookmarkAppHelper(profile, web_app_info, web_contents)); 56 new extensions::BookmarkAppHelper(profile, web_app_info, web_contents));
56 57
57 // This differs from the Android infobar creation, which has an explicit 58 // This differs from the Android infobar creation, which has an explicit
58 // InfoBarAndroid class interfacing with Java. On Android, the data fetcher 59 // InfoBarAndroid class interfacing with Java. On Android, the data fetcher
59 // calls the InfoBarService to show the banner. On desktop, an InfoBar class 60 // calls the InfoBarService to show the banner. On desktop, an InfoBar class
60 // is not required, so the InfoBarService call is made within the delegate. 61 // is not required, so the InfoBarService call is made within the delegate.
61 infobars::InfoBar* infobar = AppBannerInfoBarDelegateDesktop::Create( 62 infobars::InfoBar* infobar = AppBannerInfoBarDelegateDesktop::Create(
62 make_scoped_refptr(this), web_contents, web_app_data(), 63 make_scoped_refptr(this), web_contents, manifest(),
63 bookmark_app_helper_.get(), event_request_id()); 64 bookmark_app_helper_.get(), event_request_id());
64 if (infobar) { 65 if (infobar) {
65 RecordDidShowBanner("AppBanner.WebApp.Shown"); 66 RecordDidShowBanner("AppBanner.WebApp.Shown");
66 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED); 67 TrackDisplayEvent(DISPLAY_EVENT_WEB_APP_BANNER_CREATED);
67 } 68 }
68 } 69 }
69 70
70 void AppBannerDataFetcherDesktop::FinishCreateBookmarkApp( 71 void AppBannerDataFetcherDesktop::FinishCreateBookmarkApp(
71 const extensions::Extension* extension, 72 const extensions::Extension* extension,
72 const WebApplicationInfo& web_app_info) { 73 const WebApplicationInfo& web_app_info) {
73 content::WebContents* web_contents = GetWebContents(); 74 content::WebContents* web_contents = GetWebContents();
74 if (web_contents) { 75 if (web_contents) {
75 // A null extension pointer indicates that the bookmark app install was 76 // A null extension pointer indicates that the bookmark app install was
76 // not successful. 77 // not successful.
77 if (extension == nullptr) { 78 if (extension == nullptr) {
78 web_contents->GetMainFrame()->Send( 79 web_contents->GetMainFrame()->Send(
79 new ChromeViewMsg_AppBannerDismissed( 80 new ChromeViewMsg_AppBannerDismissed(
80 web_contents->GetMainFrame()->GetRoutingID(), 81 web_contents->GetMainFrame()->GetRoutingID(),
81 event_request_id())); 82 event_request_id()));
82 83
83 AppBannerSettingsHelper::RecordBannerDismissEvent( 84 AppBannerSettingsHelper::RecordBannerDismissEvent(
84 web_contents, web_app_data().start_url.spec(), 85 web_contents, manifest().start_url.spec(),
85 AppBannerSettingsHelper::WEB); 86 AppBannerSettingsHelper::WEB);
86 } else { 87 } else {
87 web_contents->GetMainFrame()->Send( 88 web_contents->GetMainFrame()->Send(
88 new ChromeViewMsg_AppBannerAccepted( 89 new ChromeViewMsg_AppBannerAccepted(
89 web_contents->GetMainFrame()->GetRoutingID(), 90 web_contents->GetMainFrame()->GetRoutingID(),
90 event_request_id(), "web")); 91 event_request_id(), "web"));
91 92
92 AppBannerSettingsHelper::RecordBannerInstallEvent( 93 AppBannerSettingsHelper::RecordBannerInstallEvent(
93 web_contents, web_app_data().start_url.spec(), 94 web_contents, manifest().start_url.spec(),
94 AppBannerSettingsHelper::WEB); 95 AppBannerSettingsHelper::WEB);
95 } 96 }
96 } 97 }
97 } 98 }
98 99
99 } // namespace banners 100 } // namespace banners
OLDNEW
« no previous file with comments | « chrome/browser/banners/app_banner_data_fetcher_desktop.h ('k') | chrome/browser/extensions/bookmark_app_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698