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

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

Issue 2393513004: Convert app banners to use Mojo. (Closed)
Patch Set: Fix Win clang compile Created 4 years, 2 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_manager_desktop.h" 5 #include "chrome/browser/banners/app_banner_manager_desktop.h"
6 6
7 #include <utility>
8
7 #include "base/command_line.h" 9 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "build/build_config.h" 10 #include "build/build_config.h"
10 #include "chrome/browser/banners/app_banner_infobar_delegate_desktop.h" 11 #include "chrome/browser/banners/app_banner_infobar_delegate_desktop.h"
11 #include "chrome/browser/banners/app_banner_metrics.h" 12 #include "chrome/browser/banners/app_banner_metrics.h"
12 #include "chrome/browser/banners/app_banner_settings_helper.h" 13 #include "chrome/browser/banners/app_banner_settings_helper.h"
13 #include "chrome/browser/extensions/bookmark_app_helper.h" 14 #include "chrome/browser/extensions/bookmark_app_helper.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/render_messages.h"
17 #include "chrome/common/web_application_info.h" 17 #include "chrome/common/web_application_info.h"
18 #include "content/public/browser/render_frame_host.h" 18 #include "content/public/browser/render_frame_host.h"
19 #include "extensions/common/constants.h" 19 #include "extensions/common/constants.h"
20 20
21 DEFINE_WEB_CONTENTS_USER_DATA_KEY(banners::AppBannerManagerDesktop); 21 DEFINE_WEB_CONTENTS_USER_DATA_KEY(banners::AppBannerManagerDesktop);
22 22
23 namespace banners { 23 namespace banners {
24 24
25 bool AppBannerManagerDesktop::IsEnabled() { 25 bool AppBannerManagerDesktop::IsEnabled() {
26 #if defined(OS_CHROMEOS) 26 #if defined(OS_CHROMEOS)
(...skipping 11 matching lines...) Expand all
38 38
39 AppBannerManagerDesktop::~AppBannerManagerDesktop() { } 39 AppBannerManagerDesktop::~AppBannerManagerDesktop() { }
40 40
41 void AppBannerManagerDesktop::DidFinishCreatingBookmarkApp( 41 void AppBannerManagerDesktop::DidFinishCreatingBookmarkApp(
42 const extensions::Extension* extension, 42 const extensions::Extension* extension,
43 const WebApplicationInfo& web_app_info) { 43 const WebApplicationInfo& web_app_info) {
44 content::WebContents* contents = web_contents(); 44 content::WebContents* contents = web_contents();
45 if (contents) { 45 if (contents) {
46 // A null extension pointer indicates that the bookmark app install was 46 // A null extension pointer indicates that the bookmark app install was
47 // not successful. 47 // not successful.
48 if (extension == nullptr) { 48 if (extension != nullptr) {
49 contents->GetMainFrame()->Send(new ChromeViewMsg_AppBannerDismissed( 49 SendBannerAccepted(event_request_id());
50 contents->GetMainFrame()->GetRoutingID(), event_request_id()));
51
52 AppBannerSettingsHelper::RecordBannerDismissEvent(
53 contents, GetAppIdentifier(), AppBannerSettingsHelper::WEB);
54 } else {
55 contents->GetMainFrame()->Send(new ChromeViewMsg_AppBannerAccepted(
56 contents->GetMainFrame()->GetRoutingID(), event_request_id(),
57 GetBannerType()));
58 50
59 AppBannerSettingsHelper::RecordBannerInstallEvent( 51 AppBannerSettingsHelper::RecordBannerInstallEvent(
60 contents, GetAppIdentifier(), AppBannerSettingsHelper::WEB); 52 contents, GetAppIdentifier(), AppBannerSettingsHelper::WEB);
61 } 53 }
62 } 54 }
63 } 55 }
64 56
65 bool AppBannerManagerDesktop::IsWebAppInstalled( 57 bool AppBannerManagerDesktop::IsWebAppInstalled(
66 content::BrowserContext* browser_context, 58 content::BrowserContext* browser_context,
67 const GURL& start_url) { 59 const GURL& start_url) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 double score) { 104 double score) {
113 // Explicitly forbid banners from triggering on navigation unless this is 105 // Explicitly forbid banners from triggering on navigation unless this is
114 // enabled. 106 // enabled.
115 if (!IsEnabled()) 107 if (!IsEnabled())
116 return; 108 return;
117 109
118 AppBannerManager::OnEngagementIncreased(web_contents, url, score); 110 AppBannerManager::OnEngagementIncreased(web_contents, url, score);
119 } 111 }
120 112
121 } // namespace banners 113 } // namespace banners
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698