-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #547 from brave/ui/tor-icon
Toolbar Tor profile icon
- Loading branch information
Showing
9 changed files
with
230 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
import("//components/vector_icons/vector_icons.gni") | ||
|
||
aggregate_vector_icons("brave_vector_icons") { | ||
icon_directory = "." | ||
|
||
icons = [ | ||
"tor_profile.icon" | ||
] | ||
} | ||
|
||
source_set("vector_icons") { | ||
sources = get_target_outputs(":brave_vector_icons") | ||
|
||
deps = [ | ||
":brave_vector_icons", | ||
"//base", | ||
"//skia", | ||
"//ui/gfx", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
CANVAS_DIMENSIONS, 24, | ||
MOVE_TO, 8.97f, 6.47f, | ||
R_V_LINE_TO, 1.51f, | ||
H_LINE_TO, 6.34f, | ||
V_LINE_TO, 16, | ||
H_LINE_TO, 4.43f, | ||
V_LINE_TO, 7.98f, | ||
R_H_LINE_TO, -2.62f, | ||
V_LINE_TO, 6.47f, | ||
H_LINE_TO, 8.97f, | ||
CLOSE, | ||
R_MOVE_TO, 3.83f, 1.96f, | ||
R_CUBIC_TO, 0.73f, 0, 1.38f, 0.15f, 1.96f, 0.46f, | ||
R_ARC_TO, 3.36f, 3.36f, 0, 0, 1, 1.37f, 1.33f, | ||
R_CUBIC_TO, 0.33f, 0.58f, 0.5f, 1.26f, 0.5f, 2.05f, | ||
R_CUBIC_TO, 0, 0.78f, -0.17f, 1.46f, -0.5f, 2.04f, | ||
R_ARC_TO, 3.42f, 3.42f, 0, 0, 1, -1.37f, 1.33f, | ||
R_CUBIC_TO, -0.58f, 0.31f, -1.24f, 0.47f, -1.96f, 0.47f, | ||
R_CUBIC_TO, -0.73f, 0, -1.38f, -0.16f, -1.96f, -0.47f, | ||
R_ARC_TO, 3.42f, 3.42f, 0, 0, 1, -1.37f, -1.33f, | ||
R_CUBIC_TO, -0.33f, -0.58f, -0.5f, -1.25f, -0.5f, -2.04f, | ||
R_CUBIC_TO, 0, -0.78f, 0.17f, -1.46f, 0.5f, -2.05f, | ||
R_ARC_TO, 3.36f, 3.36f, 0, 0, 1, 1.37f, -1.33f, | ||
R_CUBIC_TO, 0.58f, -0.31f, 1.24f, -0.46f, 1.97f, -0.46f, | ||
CLOSE, | ||
R_MOVE_TO, 0, 1.65f, | ||
R_CUBIC_TO, -0.53f, 0, -0.98f, 0.19f, -1.35f, 0.56f, | ||
R_CUBIC_TO, -0.37f, 0.37f, -0.55f, 0.92f, -0.55f, 1.63f, | ||
R_CUBIC_TO, 0, 0.71f, 0.19f, 1.25f, 0.55f, 1.63f, | ||
R_CUBIC_TO, 0.37f, 0.37f, 0.82f, 0.56f, 1.35f, 0.56f, | ||
R_CUBIC_TO, 0.53f, 0, 0.98f, -0.19f, 1.35f, -0.56f, | ||
R_CUBIC_TO, 0.37f, -0.37f, 0.55f, -0.91f, 0.55f, -1.63f, | ||
R_CUBIC_TO, 0, -0.71f, -0.18f, -1.25f, -0.55f, -1.63f, | ||
R_ARC_TO, 1.83f, 1.83f, 0, 0, 0, -1.35f, -0.56f, | ||
CLOSE, | ||
R_MOVE_TO, 6.41f, -0.12f, | ||
R_ARC_TO, 3.13f, 3.13f, 0, 0, 1, 1.11f, -1.13f, | ||
R_ARC_TO, 2.94f, 2.94f, 0, 0, 1, 1.54f, -0.41f, | ||
R_V_LINE_TO, 2.04f, | ||
R_H_LINE_TO, -0.55f, | ||
R_CUBIC_TO, -1.39f, 0, -2.09f, 0.65f, -2.09f, 1.94f, | ||
V_LINE_TO, 16, | ||
R_H_LINE_TO, -1.9f, | ||
V_LINE_TO, 8.52f, | ||
R_H_LINE_TO, 1.9f, | ||
R_V_LINE_TO, 1.43f, | ||
CLOSE, | ||
|
||
CANVAS_DIMENSIONS, 20, | ||
MOVE_TO, 7.16f, 5.18f, | ||
R_V_LINE_TO, 1.4f, | ||
H_LINE_TO, 4.72f, | ||
V_LINE_TO, 14, | ||
H_LINE_TO, 2.96f, | ||
V_LINE_TO, 6.58f, | ||
H_LINE_TO, 0.53f, | ||
R_V_LINE_TO, -1.4f, | ||
R_H_LINE_TO, 6.63f, | ||
CLOSE, | ||
R_MOVE_TO, 3.55f, 1.81f, | ||
R_CUBIC_TO, 0.68f, 0, 1.28f, 0.14f, 1.82f, 0.42f, | ||
R_CUBIC_TO, 0.54f, 0.28f, 0.96f, 0.69f, 1.27f, 1.23f, | ||
R_CUBIC_TO, 0.31f, 0.54f, 0.46f, 1.17f, 0.46f, 1.89f, | ||
R_CUBIC_TO, 0, 0.73f, -0.15f, 1.36f, -0.46f, 1.89f, | ||
R_ARC_TO, 3.16f, 3.16f, 0, 0, 1, -1.27f, 1.23f, | ||
R_CUBIC_TO, -0.54f, 0.29f, -1.14f, 0.43f, -1.82f, 0.43f, | ||
R_CUBIC_TO, -0.68f, 0, -1.28f, -0.14f, -1.82f, -0.43f, | ||
R_ARC_TO, 3.16f, 3.16f, 0, 0, 1, -1.27f, -1.23f, | ||
R_CUBIC_TO, -0.31f, -0.53f, -0.46f, -1.16f, -0.46f, -1.89f, | ||
R_CUBIC_TO, 0, -0.72f, 0.15f, -1.36f, 0.46f, -1.89f, | ||
R_ARC_TO, 3.11f, 3.11f, 0, 0, 1, 1.27f, -1.23f, | ||
R_CUBIC_TO, 0.54f, -0.28f, 1.14f, -0.42f, 1.82f, -0.42f, | ||
CLOSE, | ||
R_MOVE_TO, 0, 1.52f, | ||
R_ARC_TO, 1.69f, 1.69f, 0, 0, 0, -1.25f, 0.52f, | ||
R_CUBIC_TO, -0.34f, 0.35f, -0.51f, 0.85f, -0.51f, 1.51f, | ||
R_CUBIC_TO, 0, 0.66f, 0.17f, 1.16f, 0.51f, 1.51f, | ||
R_ARC_TO, 1.69f, 1.69f, 0, 0, 0, 1.25f, 0.52f, | ||
R_ARC_TO, 1.69f, 1.69f, 0, 0, 0, 1.25f, -0.52f, | ||
R_CUBIC_TO, 0.34f, -0.35f, 0.51f, -0.85f, 0.51f, -1.51f, | ||
R_CUBIC_TO, 0, -0.66f, -0.17f, -1.16f, -0.51f, -1.51f, | ||
R_ARC_TO, 1.69f, 1.69f, 0, 0, 0, -1.25f, -0.52f, | ||
CLOSE, | ||
R_MOVE_TO, 5.94f, -0.11f, | ||
R_CUBIC_TO, 0.26f, -0.44f, 0.6f, -0.79f, 1.02f, -1.04f, | ||
R_CUBIC_TO, 0.43f, -0.25f, 0.9f, -0.38f, 1.43f, -0.38f, | ||
R_V_LINE_TO, 1.89f, | ||
R_H_LINE_TO, -0.51f, | ||
R_CUBIC_TO, -1.29f, 0, -1.94f, 0.6f, -1.94f, 1.8f, | ||
V_LINE_TO, 14, | ||
H_LINE_TO, 14.88f, | ||
V_LINE_TO, 7.08f, | ||
R_H_LINE_TO, 1.76f, | ||
V_LINE_TO, 8.4f, | ||
CLOSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
// vector_icons.cc.template is used to generate vector_icons.cc. Edit the former | ||
// rather than the latter. | ||
|
||
#include "brave/app/vector_icons/vector_icons.h" | ||
|
||
#include "base/logging.h" | ||
#include "ui/gfx/animation/tween.h" | ||
#include "ui/gfx/vector_icon_types.h" | ||
|
||
#include "components/vector_icons/cc_macros.h" | ||
|
||
using namespace gfx; | ||
|
||
TEMPLATE_PLACEHOLDER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
// vector_icons.h.template is used to generate vector_icons.h. Edit the former | ||
// rather than the latter. | ||
|
||
#ifndef BRAVE_APP_VECTOR_ICONS_VECTOR_ICONS_H_ | ||
#define BRAVE_APP_VECTOR_ICONS_VECTOR_ICONS_H_ | ||
|
||
namespace gfx { | ||
struct VectorIcon; | ||
} | ||
|
||
#define VECTOR_ICON_TEMPLATE_H(icon_name) \ | ||
extern const gfx::VectorIcon icon_name; | ||
|
||
TEMPLATE_PLACEHOLDER | ||
|
||
#undef VECTOR_ICON_TEMPLATE_H | ||
|
||
#endif // BRAVE_APP_VECTOR_ICONS_VECTOR_ICONS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "brave/browser/ui/views/profiles/brave_avatar_toolbar_button.h" | ||
|
||
#include "brave/app/vector_icons/vector_icons.h" | ||
#include "chrome/browser/profiles/profile.h" | ||
#include "chrome/browser/themes/theme_properties.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" | ||
#include "ui/gfx/image/image.h" | ||
#include "ui/gfx/paint_vector_icon.h" | ||
|
||
gfx::ImageSkia BraveAvatarToolbarButton::GetAvatarIcon() const { | ||
if (profile_->IsTorProfile()) { | ||
const int icon_size = | ||
ui::MaterialDesignController::IsTouchOptimizedUiEnabled() ? 24 : 20; | ||
const SkColor icon_color = | ||
GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); | ||
return gfx::CreateVectorIcon(kTorProfileIcon, icon_size, icon_color); | ||
} | ||
return AvatarToolbarButton::GetAvatarIcon(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_BROWSER_UI_VIEWS_PROFILES_BRAVE_AVATAR_TOOLBAR_BUTTON_H_ | ||
#define BRAVE_BROWSER_UI_VIEWS_PROFILES_BRAVE_AVATAR_TOOLBAR_BUTTON_H_ | ||
|
||
#include "chrome/browser/ui/views/profiles/avatar_toolbar_button.h" | ||
|
||
class BraveAvatarToolbarButton : public AvatarToolbarButton { | ||
public: | ||
using AvatarToolbarButton::AvatarToolbarButton; | ||
private: | ||
gfx::ImageSkia GetAvatarIcon() const override; | ||
DISALLOW_COPY_AND_ASSIGN(BraveAvatarToolbarButton); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
#include "chrome/browser/ui/views/location_bar/location_bar_view.h" | ||
#include "brave/browser/ui/views/location_bar/brave_location_bar_view.h" | ||
#include "chrome/browser/ui/views/profiles/avatar_toolbar_button.h" | ||
#include "brave/browser/ui/views/profiles/brave_avatar_toolbar_button.h" | ||
|
||
#define LocationBarView BraveLocationBarView | ||
#define AvatarToolbarButton BraveAvatarToolbarButton | ||
#include "../../../../../../../chrome/browser/ui/views/toolbar/toolbar_view.cc" | ||
#undef LocationBarView | ||
#undef AvatarToolbarButton |
21 changes: 21 additions & 0 deletions
21
patches/chrome-browser-ui-views-profiles-avatar_toolbar_button.h.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
diff --git a/chrome/browser/ui/views/profiles/avatar_toolbar_button.h b/chrome/browser/ui/views/profiles/avatar_toolbar_button.h | ||
index 123fcfa175708b5290df332b0f61af7725f6a597..3f99df509c0336660174401bf52d33e1875ce73f 100644 | ||
--- a/chrome/browser/ui/views/profiles/avatar_toolbar_button.h | ||
+++ b/chrome/browser/ui/views/profiles/avatar_toolbar_button.h | ||
@@ -24,6 +24,7 @@ class AvatarToolbarButton : public ToolbarButton, | ||
public GaiaCookieManagerService::Observer, | ||
public AccountTrackerService::Observer { | ||
public: | ||
+ friend class BraveAvatarToolbarButton; | ||
explicit AvatarToolbarButton(Browser* browser); | ||
~AvatarToolbarButton() override; | ||
|
||
@@ -65,7 +66,7 @@ class AvatarToolbarButton : public ToolbarButton, | ||
bool IsIncognito() const; | ||
bool ShouldShowGenericIcon() const; | ||
base::string16 GetAvatarTooltipText() const; | ||
- gfx::ImageSkia GetAvatarIcon() const; | ||
+ virtual gfx::ImageSkia GetAvatarIcon() const; | ||
gfx::Image GetIconImageFromProfile() const; | ||
SyncState GetSyncState() const; | ||
|