1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51

ash / system / channel_indicator / channel_indicator_utils.h [blame]

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SYSTEM_CHANNEL_INDICATOR_CHANNEL_INDICATOR_UTILS_H_
#define ASH_SYSTEM_CHANNEL_INDICATOR_CHANNEL_INDICATOR_UTILS_H_

#include <string>

#include "ash/ash_export.h"
#include "components/version_info/channel.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/color/color_id.h"
#include "ui/gfx/vector_icon_types.h"

namespace ash::channel_indicator_utils {

// Returns 'true' if `channel` is a release track name we want to show the user.
ASH_EXPORT bool IsDisplayableChannel(version_info::Channel channel);

// Returns a string resource ID for the release track `channel`. If
// `append_channel` is 'true' then the resource ID returned is for a string that
// has "channel" at the end e.g. "Beta Channel" instead of just "Beta". If
// `channel` is `STABLE` or `UNKNOWN` this function will return -1.
ASH_EXPORT int GetChannelNameStringResourceID(version_info::Channel channel,
                                              bool append_channel);

// Returns the foreground `ui::ColorId` for release track `channel`.
// If `channel` is one of the displayable values then the expected `ColorId` is
// returned, a value of `ui::ColorId()` otherwise.
ASH_EXPORT ui::ColorId GetFgColorJelly(version_info::Channel channel);

// Returns the background `ui::ColorId` for release track `channel`.
// If `channel` is one of the displayable values then the expected `ColorId` is
// returned, a value of `ui::ColorId()` otherwise.
ASH_EXPORT ui::ColorId GetBgColorJelly(version_info::Channel channel);

// Returns the text for the version button text, for release track `channel`
// e.g. "Beta 105.0.5167.0". If `channel` is not one of the displayable values,
// the function will return an empty std::u16string.
ASH_EXPORT std::u16string GetFullReleaseTrackString(
    version_info::Channel channel);

// Returns a reference to the pre-constructed vector icon for release track
// `channel`. The function performs a DCHECK() that `channel` is one of the
// displayable values, but if it isn't then the icon for `CANARY` is returned.
const gfx::VectorIcon& GetVectorIcon(version_info::Channel channel);

}  // namespace ash::channel_indicator_utils

#endif  // ASH_SYSTEM_CHANNEL_INDICATOR_CHANNEL_INDICATOR_UTILS_H_