Skip to content

Commit

Permalink
Uplift of #3771 (squashed) to dev
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-browser-releases authored and bsclifton committed Oct 28, 2019
1 parent 6cc6a65 commit ce5258a
Show file tree
Hide file tree
Showing 64 changed files with 308 additions and 106 deletions.
127 changes: 96 additions & 31 deletions app/brave_generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -498,52 +498,117 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U
Brave Browser Development Apps
</message>
</if>
<!-- Avatars -->
<message name="IDS_BRAVE_AVATAR_LABEL_PLACEHOLDER" desc="The label for the avatar_braveorange.png avatar.">
Brave Orange
<!-- Avatars. Generated via zsh and node:
declare -i a=56
for file in $(cat < avatarlist); do node -e "console.log(\`<message name=\"IDS_BRAVE_AVATAR_LABEL_$a\" desc=\"The label for the $file avatar.\">
\${\`$file\`.split('_').map(w => w[0].toUpperCase() + w.substr(1)).join(' ').replace('.png', '')}
</message>\`)"; a=a+1; done | pbcopy
-->
<message name="IDS_BRAVE_AVATAR_LABEL_PLACEHOLDER" desc="The label for the avatar_edgy_rewards.png avatar.">
Avatar Edgy Rewards
</message>
<if expr="not is_android">
<message name="IDS_BRAVE_AVATAR_LABEL_56" desc="The label for the avatar_orangepeel.png avatar.">
Orange
<message name="IDS_BRAVE_AVATAR_LABEL_56" desc="The label for the avatar_edgy_brave.png avatar.">
Avatar Edgy Brave
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_57" desc="The label for the avatar_nana.png avatar.">
Yellow
<message name="IDS_BRAVE_AVATAR_LABEL_57" desc="The label for the avatar_edgy_ocean.png avatar.">
Avatar Edgy Ocean
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_58" desc="The label for the avatar_envy.png avatar.">
Green
<message name="IDS_BRAVE_AVATAR_LABEL_58" desc="The label for the avatar_edgy_grass.png avatar.">
Avatar Edgy Grass
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_59" desc="The label for the avatar_clearskies.png avatar.">
Light Blue
<message name="IDS_BRAVE_AVATAR_LABEL_59" desc="The label for the avatar_edgy_corn.png avatar.">
Avatar Edgy Corn
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_60" desc="The label for the avatar_bondyblue.png avatar.">
Blue
<message name="IDS_BRAVE_AVATAR_LABEL_60" desc="The label for the avatar_edgy_royal.png avatar.">
Avatar Edgy Royal
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_61" desc="The label for the avatar_blurple.png avatar.">
Purple
<message name="IDS_BRAVE_AVATAR_LABEL_61" desc="The label for the avatar_edgy_ninja.png avatar.">
Avatar Edgy Ninja
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_62" desc="The label for the avatar_darknight.png avatar.">
Black
<message name="IDS_BRAVE_AVATAR_LABEL_62" desc="The label for the avatar_paladin_rewards.png avatar.">
Avatar Paladin Rewards
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_63" desc="The label for the avatar_orangepeel_shape.png avatar.">
Orange Dot
<message name="IDS_BRAVE_AVATAR_LABEL_63" desc="The label for the avatar_paladin_brave.png avatar.">
Avatar Paladin Brave
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_64" desc="The label for the avatar_nana_shape.png avatar.">
Yellow Slice
<message name="IDS_BRAVE_AVATAR_LABEL_64" desc="The label for the avatar_paladin_ocean.png avatar.">
Avatar Paladin Ocean
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_65" desc="The label for the avatar_envy_shape.png avatar.">
Green Circles
<message name="IDS_BRAVE_AVATAR_LABEL_65" desc="The label for the avatar_paladin_grass.png avatar.">
Avatar Paladin Grass
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_66" desc="The label for the avatar_clearskies_shape.png avatar.">
Light Blue Stripe
<message name="IDS_BRAVE_AVATAR_LABEL_66" desc="The label for the avatar_paladin_corn.png avatar.">
Avatar Paladin Corn
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_67" desc="The label for the avatar_bondyblue_shape.png avatar.">
Blue Stripe
<message name="IDS_BRAVE_AVATAR_LABEL_67" desc="The label for the avatar_paladin_royal.png avatar.">
Avatar Paladin Royal
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_68" desc="The label for the avatar_blurple_shape.png avatar.">
Purple Stripes
<message name="IDS_BRAVE_AVATAR_LABEL_68" desc="The label for the avatar_paladin_ninja.png avatar.">
Avatar Paladin Ninja
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_69" desc="The label for the avatar_darknight_shape.png avatar.">
Black Stripes
<message name="IDS_BRAVE_AVATAR_LABEL_69" desc="The label for the avatar_gleam_rewards.png avatar.">
Avatar Gleam Rewards
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_70" desc="The label for the avatar_gleam_brave.png avatar.">
Avatar Gleam Brave
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_71" desc="The label for the avatar_gleam_ocean.png avatar.">
Avatar Gleam Ocean
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_72" desc="The label for the avatar_gleam_grass.png avatar.">
Avatar Gleam Grass
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_73" desc="The label for the avatar_gleam_corn.png avatar.">
Avatar Gleam Corn
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_74" desc="The label for the avatar_gleam_royal.png avatar.">
Avatar Gleam Royal
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_75" desc="The label for the avatar_gleam_ninja.png avatar.">
Avatar Gleam Ninja
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_76" desc="The label for the avatar_oval_rewards.png avatar.">
Avatar Oval Rewards
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_77" desc="The label for the avatar_oval_brave.png avatar.">
Avatar Oval Brave
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_78" desc="The label for the avatar_oval_ocean.png avatar.">
Avatar Oval Ocean
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_79" desc="The label for the avatar_oval_grass.png avatar.">
Avatar Oval Grass
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_80" desc="The label for the avatar_oval_corn.png avatar.">
Avatar Oval Corn
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_81" desc="The label for the avatar_oval_royal.png avatar.">
Avatar Oval Royal
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_82" desc="The label for the avatar_oval_ninja.png avatar.">
Avatar Oval Ninja
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_83" desc="The label for the avatar_bonbon_rewards.png avatar.">
Avatar Bonbon Rewards
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_84" desc="The label for the avatar_bonbon_brave.png avatar.">
Avatar Bonbon Brave
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_85" desc="The label for the avatar_bonbon_ocean.png avatar.">
Avatar Bonbon Ocean
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_86" desc="The label for the avatar_bonbon_grass.png avatar.">
Avatar Bonbon Grass
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_87" desc="The label for the avatar_bonbon_corn.png avatar.">
Avatar Bonbon Corn
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_88" desc="The label for the avatar_bonbon_royal.png avatar.">
Avatar Bonbon Royal
</message>
<message name="IDS_BRAVE_AVATAR_LABEL_89" desc="The label for the avatar_bonbon_ninja.png avatar.">
Avatar Bonbon Ninja
</message>
</if>
<!-- P3A -->
Expand Down
48 changes: 34 additions & 14 deletions app/theme/brave_theme_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,40 @@
> declare -i a=56
> for file in $(cat < avatarlist); do echo "<structure type=\"chrome_scaled_image\" name=\"IDR_PROFILE_AVATAR_$a\" file=\"common/avatars/$file\" />"; a=a+1 done | pbcopy
-->
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_56" file="common/avatars/avatar_orangepeel.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_57" file="common/avatars/avatar_nana.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_58" file="common/avatars/avatar_envy.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_59" file="common/avatars/avatar_clearskies.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_60" file="common/avatars/avatar_bondyblue.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_61" file="common/avatars/avatar_blurple.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_62" file="common/avatars/avatar_darknight.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_63" file="common/avatars/avatar_orangepeel_shape.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_64" file="common/avatars/avatar_nana_shape.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_65" file="common/avatars/avatar_envy_shape.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_66" file="common/avatars/avatar_clearskies_shape.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_67" file="common/avatars/avatar_bondyblue_shape.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_68" file="common/avatars/avatar_blurple_shape.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_69" file="common/avatars/avatar_darknight_shape.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_56" file="common/avatars/avatar_edgy_brave.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_57" file="common/avatars/avatar_edgy_ocean.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_58" file="common/avatars/avatar_edgy_grass.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_59" file="common/avatars/avatar_edgy_corn.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_60" file="common/avatars/avatar_edgy_royal.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_61" file="common/avatars/avatar_edgy_ninja.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_62" file="common/avatars/avatar_paladin_rewards.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_63" file="common/avatars/avatar_paladin_brave.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_64" file="common/avatars/avatar_paladin_ocean.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_65" file="common/avatars/avatar_paladin_grass.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_66" file="common/avatars/avatar_paladin_corn.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_67" file="common/avatars/avatar_paladin_royal.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_68" file="common/avatars/avatar_paladin_ninja.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_69" file="common/avatars/avatar_gleam_rewards.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_70" file="common/avatars/avatar_gleam_brave.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_71" file="common/avatars/avatar_gleam_ocean.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_72" file="common/avatars/avatar_gleam_grass.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_73" file="common/avatars/avatar_gleam_corn.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_74" file="common/avatars/avatar_gleam_royal.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_75" file="common/avatars/avatar_gleam_ninja.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_76" file="common/avatars/avatar_oval_rewards.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_77" file="common/avatars/avatar_oval_brave.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_78" file="common/avatars/avatar_oval_ocean.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_79" file="common/avatars/avatar_oval_grass.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_80" file="common/avatars/avatar_oval_corn.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_81" file="common/avatars/avatar_oval_royal.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_82" file="common/avatars/avatar_oval_ninja.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_83" file="common/avatars/avatar_bonbon_rewards.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_84" file="common/avatars/avatar_bonbon_brave.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_85" file="common/avatars/avatar_bonbon_ocean.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_86" file="common/avatars/avatar_bonbon_grass.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_87" file="common/avatars/avatar_bonbon_corn.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_88" file="common/avatars/avatar_bonbon_royal.png" />
<structure type="chrome_scaled_image" name="IDR_PROFILE_AVATAR_89" file="common/avatars/avatar_bonbon_ninja.png" />
</if>
</structures>
</release>
Expand Down
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
48 changes: 34 additions & 14 deletions app/theme/default_100_percent/common/avatars/avatarlist
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
avatar_orangepeel.png
avatar_nana.png
avatar_envy.png
avatar_clearskies.png
avatar_bondyblue.png
avatar_blurple.png
avatar_darknight.png
avatar_orangepeel_shape.png
avatar_nana_shape.png
avatar_envy_shape.png
avatar_clearskies_shape.png
avatar_bondyblue_shape.png
avatar_blurple_shape.png
avatar_darknight_shape.png
avatar_edgy_brave.png
avatar_edgy_ocean.png
avatar_edgy_grass.png
avatar_edgy_corn.png
avatar_edgy_royal.png
avatar_edgy_ninja.png
avatar_paladin_rewards.png
avatar_paladin_brave.png
avatar_paladin_ocean.png
avatar_paladin_grass.png
avatar_paladin_corn.png
avatar_paladin_royal.png
avatar_paladin_ninja.png
avatar_gleam_rewards.png
avatar_gleam_brave.png
avatar_gleam_ocean.png
avatar_gleam_grass.png
avatar_gleam_corn.png
avatar_gleam_royal.png
avatar_gleam_ninja.png
avatar_oval_rewards.png
avatar_oval_brave.png
avatar_oval_ocean.png
avatar_oval_grass.png
avatar_oval_corn.png
avatar_oval_royal.png
avatar_oval_ninja.png
avatar_bonbon_rewards.png
avatar_bonbon_brave.png
avatar_bonbon_ocean.png
avatar_bonbon_grass.png
avatar_bonbon_corn.png
avatar_bonbon_royal.png
avatar_bonbon_ninja.png
20 changes: 20 additions & 0 deletions browser/ui/views/profiles/brave_avatar_toolbar_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

#include "brave/app/vector_icons/vector_icons.h"
#include "brave/browser/profiles/profile_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/views/profiles/avatar_toolbar_button.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/theme_provider.h"
Expand All @@ -20,6 +23,23 @@ void BraveAvatarToolbarButton::SetText(const base::string16& text) {
: text);
}

bool BraveAvatarToolbarButton::ShouldShowGenericIcon() const {
const bool chromium_should_show =
AvatarToolbarButton::ShouldShowGenericIcon();
if (chromium_should_show) {
// We don't want to show the skia icon image as the Brave placeholder image
// has a gradient and is best rendered by bitmap.
ProfileAttributesEntry* entry;
if (g_browser_process->profile_manager()
->GetProfileAttributesStorage()
.GetProfileAttributesWithPath(profile_->GetPath(), &entry) &&
entry->GetAvatarIconIndex() == profiles::GetPlaceholderAvatarIndex()) {
return false;
}
}
return chromium_should_show;
}

gfx::ImageSkia BraveAvatarToolbarButton::GetAvatarIcon(
const gfx::Image& gaia_image) const {
if (brave::IsTorProfile(profile_)) {
Expand Down
1 change: 1 addition & 0 deletions browser/ui/views/profiles/brave_avatar_toolbar_button.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class BraveAvatarToolbarButton : public AvatarToolbarButton {
void SetText(const base::string16& text) override;

private:
bool ShouldShowGenericIcon() const override;
gfx::ImageSkia GetAvatarIcon(const gfx::Image& gaia_image) const override;
DISALLOW_COPY_AND_ASSIGN(BraveAvatarToolbarButton);
};
Expand Down
Loading

0 comments on commit ce5258a

Please sign in to comment.