Skip to content

Commit

Permalink
Brave browser actions avoid a small jump from small to large image
Browse files Browse the repository at this point in the history
The default extension browser action image was set to 16dp when brave browser actions currently uses 18dp. This was barely noticeable when the extensions were loaded on profile creation since only the first window would make this jump and it would happen when the window is opening whilst other paints are occurring. Now that the rewards extension is delay-loaded when the button is clicked, it is more noticeable.
  • Loading branch information
petemill committed Oct 17, 2019
1 parent 6892e97 commit 84a4825
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
21 changes: 21 additions & 0 deletions chromium_src/chrome/browser/extensions/extension_action_manager.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) 2019 The Brave Authors. All rights reserved.
// 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/.

#include "brave/common/extensions/extension_constants.h"
#include "brave/browser/ui/brave_actions/constants.h"

// Avoid a jump from small image to large image when the non-default
// image is set.
#define BRAVE_GET_EXTENSION_ACTION \
if (action->default_icon() && ( \
extension.id() == brave_rewards_extension_id || \
extension.id() == brave_extension_id)) { \
action->SetDefaultIconImage(std::make_unique<IconImage>( \
profile_, &extension, *action->default_icon(), \
brave_actions::kBraveActionGraphicSize, \
ExtensionAction::FallbackIcon().AsImageSkia(), nullptr)); \
}
#include "../../../../../chrome/browser/extensions/extension_action_manager.cc"
#undef BRAVE_GET_EXTENSION_ACTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/chrome/browser/extensions/extension_action_manager.cc b/chrome/browser/extensions/extension_action_manager.cc
index 90884f9916494778fc182c49ac7709bc91f536b9..0b099db863682c226da5f6e2f67e684ed56da3ef 100644
--- a/chrome/browser/extensions/extension_action_manager.cc
+++ b/chrome/browser/extensions/extension_action_manager.cc
@@ -109,6 +109,7 @@ ExtensionAction* ExtensionActionManager::GetExtensionAction(
ExtensionAction::ActionIconSize(),
ExtensionAction::FallbackIcon().AsImageSkia(), nullptr));
}
+ BRAVE_GET_EXTENSION_ACTION

ExtensionAction* raw_action = action.get();
actions_[extension.id()] = std::move(action);

0 comments on commit 84a4825

Please sign in to comment.