Commit 52f2305e authored by Hector Carmona's avatar Hector Carmona Committed by Commit Bot

Navi: Don't show onboarding if all modules are disabled.

Bug: 951840
Change-Id: I628d3c86af68f2b36231b2497bdabf701c7ad8b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1574607Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Hector Carmona <hcarmona@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652448}
parent 285ee2f1
...@@ -64,6 +64,10 @@ ...@@ -64,6 +64,10 @@
#include "rlz/buildflags/buildflags.h" #include "rlz/buildflags/buildflags.h"
#include "ui/base/buildflags.h" #include "ui/base/buildflags.h"
#if !defined(OS_CHROMEOS)
#include "chrome/browser/ui/webui/welcome/nux_helper.h"
#endif // !defined(OS_CHROMEOS)
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#include "base/mac/mac_util.h" #include "base/mac/mac_util.h"
#import "chrome/browser/mac/dock.h" #import "chrome/browser/mac/dock.h"
...@@ -603,6 +607,12 @@ void StartupBrowserCreatorImpl::DetermineURLsAndLaunch( ...@@ -603,6 +607,12 @@ void StartupBrowserCreatorImpl::DetermineURLsAndLaunch(
!SessionStartupPref::TypeHasRecommendedValue(profile_->GetPrefs()); !SessionStartupPref::TypeHasRecommendedValue(profile_->GetPrefs());
} }
#if !defined(OS_CHROMEOS)
// No promo if we *could* onboard, but have no modules to show.
if (nux::IsNuxOnboardingEnabled(profile_))
promotional_tabs_enabled &= nux::DoesOnboardingHaveModulesToShow(profile_);
#endif // !defined(OS_CHROMEOS)
StartupTabs tabs = DetermineStartupTabs( StartupTabs tabs = DetermineStartupTabs(
StartupTabProviderImpl(), cmd_line_tabs, process_startup, StartupTabProviderImpl(), cmd_line_tabs, process_startup,
is_incognito_or_guest, is_post_crash_launch, is_incognito_or_guest, is_post_crash_launch,
......
...@@ -196,6 +196,10 @@ std::vector<std::string> GetAvailableModules( ...@@ -196,6 +196,10 @@ std::vector<std::string> GetAvailableModules(
return available_modules; return available_modules;
} }
bool DoesOnboardingHaveModulesToShow(Profile* profile) {
return !GetAvailableModules(GetPoliciesFromProfile(profile)).empty();
}
std::string FilterModules(const std::string& requested_modules, std::string FilterModules(const std::string& requested_modules,
const std::vector<std::string>& available_modules) { const std::vector<std::string>& available_modules) {
std::vector<std::string> requested_list = base::SplitString( std::vector<std::string> requested_list = base::SplitString(
......
...@@ -36,6 +36,8 @@ std::string GetOnboardingGroup(Profile* profile); ...@@ -36,6 +36,8 @@ std::string GetOnboardingGroup(Profile* profile);
bool IsNuxOnboardingEnabled(Profile* profile); bool IsNuxOnboardingEnabled(Profile* profile);
bool DoesOnboardingHaveModulesToShow(Profile* profile);
base::DictionaryValue GetNuxOnboardingModules(Profile* profile); base::DictionaryValue GetNuxOnboardingModules(Profile* profile);
} // namespace nux } // namespace nux
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment