chrome/browser/ui/search/search.cc
// Determine what embedded search page version to request from the user's
// default search provider.  If 0, the embedded search UI should not be enabled.
// Note that the profile object here isn't const because we need to determine
// whether or not the user has a theme installed as part of this check, and
// that logic requires a non-const profile for whatever reason.
Determine what embedded search page version to request from the user's
default search provider.  If 0, the embedded search UI should not be enabled.
Note that the profile object here isn't const because we need to determine
whether or not the user has a theme installed as part of this check, and
that logic requires a non-const profile for whatever reason.
Determine what embedded search page version to request from the user ' s default search provider . If 0 the embedded search UI should not be enabled . Note that the profile object here isn ' t const because we need to determine whether or not the user has a theme installed as part of this check and that logic requires a non - const profile for whatever reason .
uint64 EmbeddedSearchPageVersion(Profile* profile) {
  if (!profile || profile->IsOffTheRecord())
    return 0;
  FieldTrialFlags flags;
  uint64 group_number = 0;
  base::FieldTrial* trial =
      base::FieldTrialList::Find(kInstantExtendedFieldTrialName);
  if (trial) {
    std::string group_name = trial->group_name();
    GetFieldTrialInfo(group_name, &flags, &group_number);
  }
  if (group_number > 0) {
    uint64 espv = GetUInt64ValueForFlagWithDefault(
        kEmbeddedPageVersionFlagName,
        kEmbeddedPageVersionDefault,
        flags);
    bool has_theme = false;
#if !defined(OS_ANDROID)
    has_theme =
        !ThemeServiceFactory::GetForProfile(profile)->UsingDefaultTheme();
#endif
    bool enable_for_themes =
        GetBoolValueForFlagWithDefault(kEnableOnThemesFlagName,
                                       kEnableOnThemesDefault,
                                       flags);
    if (!has_theme || enable_for_themes)
      return espv;
  }
  if (CommandLine::ForCurrentProcess()->HasSwitch(
          switches::kEnableInstantExtendedAPI)) {
    return kEmbeddedPageVersionDefault;
  }
  return 0;
}
uint64 EmbeddedSearchPageVersion ( Profile * profile ) { if ( ! profile || profile -> IsOffTheRecord ( ) ) return 0 ; FieldTrialFlags flags ; uint64 group_number = 0 ; base :: FieldTrial * trial = base :: FieldTrialList :: Find ( kInstantExtendedFieldTrialName ) ; if ( trial ) { std :: string group_name = trial -> group_name ( ) ; GetFieldTrialInfo ( group_name , & flags , & group_number ) ; } if ( group_number > 0 ) { uint64 espv = GetUInt64ValueForFlagWithDefault ( kEmbeddedPageVersionFlagName , kEmbeddedPageVersionDefault , flags ) ; bool has_theme = false ; #if ! defined ( OS_ANDROID ) has_theme = ! ThemeServiceFactory :: GetForProfile ( profile ) -> UsingDefaultTheme ( ) ; #endif bool enable_for_themes = GetBoolValueForFlagWithDefault ( kEnableOnThemesFlagName , kEnableOnThemesDefault , flags ) ; if ( ! has_theme || enable_for_themes ) return espv ; } if ( CommandLine :: ForCurrentProcess ( ) -> HasSwitch ( switches :: kEnableInstantExtendedAPI ) ) { return kEmbeddedPageVersionDefault ; } return 0 ; }
Determine what embedded search page version to request from the user's
default search provider.
Determine what embedded search page version to request from the user ' s default search provider .
// Incognito windows do not currently use the embedded search API. // Check Finch field trials. // Check for themes. // The user has manually flipped the about:flags switch - give the default // UI version.