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

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

Issue 2944283002: Replace --add-to-shelf flag with kAppBanners feature. (Closed)
Patch Set: Self nit Created 3 years, 6 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/feature_list.h"
8 #include "build/build_config.h" 9 #include "build/build_config.h"
9 #include "chrome/browser/banners/app_banner_infobar_delegate_desktop.h" 10 #include "chrome/browser/banners/app_banner_infobar_delegate_desktop.h"
10 #include "chrome/browser/banners/app_banner_metrics.h" 11 #include "chrome/browser/banners/app_banner_metrics.h"
11 #include "chrome/browser/banners/app_banner_settings_helper.h" 12 #include "chrome/browser/banners/app_banner_settings_helper.h"
12 #include "chrome/browser/extensions/bookmark_app_helper.h" 13 #include "chrome/browser/extensions/bookmark_app_helper.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_features.h"
15 #include "chrome/common/web_application_info.h" 16 #include "chrome/common/web_application_info.h"
16 #include "extensions/common/constants.h" 17 #include "extensions/common/constants.h"
17 18
18 DEFINE_WEB_CONTENTS_USER_DATA_KEY(banners::AppBannerManagerDesktop); 19 DEFINE_WEB_CONTENTS_USER_DATA_KEY(banners::AppBannerManagerDesktop);
19 20
20 namespace banners { 21 namespace banners {
21 22
22 bool AppBannerManagerDesktop::IsEnabled() { 23 bool AppBannerManagerDesktop::IsEnabled() {
23 #if defined(OS_CHROMEOS) 24 return base::FeatureList::IsEnabled(features::kAppBanners);
24 return !base::CommandLine::ForCurrentProcess()->HasSwitch(
25 switches::kDisableAddToShelf);
26 #else
27 return base::CommandLine::ForCurrentProcess()->HasSwitch(
28 switches::kEnableAddToShelf);
29 #endif
30 } 25 }
31 26
32 AppBannerManagerDesktop::AppBannerManagerDesktop( 27 AppBannerManagerDesktop::AppBannerManagerDesktop(
33 content::WebContents* web_contents) 28 content::WebContents* web_contents)
34 : AppBannerManager(web_contents) { } 29 : AppBannerManager(web_contents) { }
35 30
36 AppBannerManagerDesktop::~AppBannerManagerDesktop() { } 31 AppBannerManagerDesktop::~AppBannerManagerDesktop() { }
37 32
38 void AppBannerManagerDesktop::DidFinishCreatingBookmarkApp( 33 void AppBannerManagerDesktop::DidFinishCreatingBookmarkApp(
39 const extensions::Extension* extension, 34 const extensions::Extension* extension,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 double score) { 100 double score) {
106 // Explicitly forbid banners from triggering on navigation unless this is 101 // Explicitly forbid banners from triggering on navigation unless this is
107 // enabled. 102 // enabled.
108 if (!IsEnabled()) 103 if (!IsEnabled())
109 return; 104 return;
110 105
111 AppBannerManager::OnEngagementIncreased(web_contents, url, score); 106 AppBannerManager::OnEngagementIncreased(web_contents, url, score);
112 } 107 }
113 108
114 } // namespace banners 109 } // namespace banners
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698