-
Notifications
You must be signed in to change notification settings - Fork 926
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 #15822 from brave/use_infobar_for_wdp_cta
Use the infobar for WDP CTA instead of dialog
- Loading branch information
Showing
48 changed files
with
1,361 additions
and
461 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
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
Binary file removed
BIN
-3.43 KB
app/theme/default_100_percent/brave/brave_search_logo_in_web_discovery_dialog.png
Binary file not shown.
Binary file added
BIN
+73.2 KB
app/theme/default_100_percent/brave/brave_web_discovery_infobar_bg_graphic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+60.1 KB
...theme/default_100_percent/brave/brave_web_discovery_infobar_bg_graphic_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+869 Bytes
app/theme/default_100_percent/brave/brave_web_discovery_infobar_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-7.13 KB
app/theme/default_200_percent/brave/brave_search_logo_in_web_discovery_dialog.png
Binary file not shown.
Binary file added
BIN
+268 KB
app/theme/default_200_percent/brave/brave_web_discovery_infobar_bg_graphic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+202 KB
...theme/default_200_percent/brave/brave_web_discovery_infobar_bg_graphic_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.76 KB
app/theme/default_200_percent/brave/brave_web_discovery_infobar_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
// Copyright (c) 2022 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/. | ||
|
||
CANVAS_DIMENSIONS, 20, | ||
MOVE_TO, 4.99f, 4.99f, | ||
R_ARC_TO, 0.71f, 0.71f, 0, 0, 0, 0, 1, | ||
LINE_TO, 9, 10, | ||
LINE_TO, 4.99f, 14.01f, | ||
R_ARC_TO, 0.71f, 0.71f, 0, 1, 0, 1, 1, | ||
LINE_TO, 10, 11, | ||
R_LINE_TO, 4.01f, 4.01f, | ||
R_ARC_TO, 0.71f, 0.71f, 0, 0, 0, 1, -1, | ||
LINE_TO, 11, 10, | ||
R_LINE_TO, 4.01f, -4.01f, | ||
R_ARC_TO, 0.71f, 0.71f, 0, 1, 0, -1, -1, | ||
LINE_TO, 10, 9, | ||
LINE_TO, 6, 4.99f, | ||
R_ARC_TO, 0.71f, 0.71f, 0, 0, 0, -1, 0, | ||
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
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
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
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,19 @@ | ||
/* Copyright (c) 2022 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/browser/ui/views/infobars/brave_infobar_container_view.h" | ||
|
||
#include <memory> | ||
|
||
BraveInfoBarContainerView::BraveInfoBarContainerView( | ||
infobars::InfoBarContainer::Delegate* delegate) | ||
: InfoBarContainerView(delegate) { | ||
// To hide shadow, replace it with empty view. | ||
DCHECK(content_shadow_); | ||
RemoveChildViewT(content_shadow_); | ||
content_shadow_ = AddChildView(std::make_unique<views::View>()); | ||
} | ||
|
||
BraveInfoBarContainerView::~BraveInfoBarContainerView() = default; |
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 @@ | ||
/* Copyright (c) 2022 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 "chrome/browser/ui/views/infobars/infobar_container_view.h" | ||
|
||
#ifndef BRAVE_BROWSER_UI_VIEWS_INFOBARS_BRAVE_INFOBAR_CONTAINER_VIEW_H_ | ||
#define BRAVE_BROWSER_UI_VIEWS_INFOBARS_BRAVE_INFOBAR_CONTAINER_VIEW_H_ | ||
|
||
class BraveInfoBarContainerView : public InfoBarContainerView { | ||
public: | ||
explicit BraveInfoBarContainerView( | ||
infobars::InfoBarContainer::Delegate* delegate); | ||
BraveInfoBarContainerView(const BraveInfoBarContainerView&) = delete; | ||
BraveInfoBarContainerView& operator=(const BraveInfoBarContainerView&) = | ||
delete; | ||
~BraveInfoBarContainerView() override; | ||
}; | ||
|
||
#endif // BRAVE_BROWSER_UI_VIEWS_INFOBARS_BRAVE_INFOBAR_CONTAINER_VIEW_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* Copyright (c) 2022 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/browser/ui/views/infobars/custom_styled_label.h" | ||
|
||
#include <utility> | ||
|
||
#include "ui/base/metadata/metadata_impl_macros.h" | ||
#include "ui/views/controls/link_fragment.h" | ||
|
||
CustomStyledLabel::~CustomStyledLabel() = default; | ||
|
||
std::unique_ptr<views::Label> CustomStyledLabel::CreateLabel( | ||
const std::u16string& text, | ||
const RangeStyleInfo& style_info, | ||
const gfx::Range& range, | ||
views::LinkFragment** previous_link_fragment) const { | ||
if (style_info.text_style != views::style::STYLE_LINK) | ||
return StyledLabel::CreateLabel(text, style_info, range, | ||
previous_link_fragment); | ||
|
||
std::unique_ptr<views::Label> result; | ||
auto link = std::make_unique<views::LinkFragment>( | ||
text, text_context_, views::style::STYLE_LINK, *previous_link_fragment); | ||
*previous_link_fragment = link.get(); | ||
link->SetCallback(style_info.callback); | ||
link->SetFontList(style_info.custom_font.value()); | ||
if (!style_info.accessible_name.empty()) | ||
link->SetAccessibleName(style_info.accessible_name); | ||
|
||
result = std::move(link); | ||
|
||
if (style_info.override_color) | ||
result->SetEnabledColor(style_info.override_color.value()); | ||
if (!style_info.tooltip.empty()) | ||
result->SetTooltipText(style_info.tooltip); | ||
if (!style_info.accessible_name.empty()) | ||
result->SetAccessibleName(style_info.accessible_name); | ||
if (displayed_on_background_color_) | ||
result->SetBackgroundColor(displayed_on_background_color_.value()); | ||
result->SetAutoColorReadabilityEnabled(auto_color_readability_enabled_); | ||
result->SetSubpixelRenderingEnabled(subpixel_rendering_enabled_); | ||
return result; | ||
} | ||
|
||
BEGIN_METADATA(CustomStyledLabel, views::StyledLabel) | ||
END_METADATA |
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,35 @@ | ||
/* Copyright (c) 2022 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/. */ | ||
|
||
#ifndef BRAVE_BROWSER_UI_VIEWS_INFOBARS_CUSTOM_STYLED_LABEL_H_ | ||
#define BRAVE_BROWSER_UI_VIEWS_INFOBARS_CUSTOM_STYLED_LABEL_H_ | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "ui/base/metadata/metadata_header_macros.h" | ||
#include "ui/views/controls/styled_label.h" | ||
|
||
// TODO(simonhong): Move common place if needed. | ||
// StyledLabel doesn't allow using custom font for link style. | ||
// Use for setting custom font for link. | ||
class CustomStyledLabel : public views::StyledLabel { | ||
public: | ||
METADATA_HEADER(CustomStyledLabel); | ||
using StyledLabel::StyledLabel; | ||
CustomStyledLabel(const CustomStyledLabel&) = delete; | ||
CustomStyledLabel& operator=(const CustomStyledLabel&) = delete; | ||
~CustomStyledLabel() override; | ||
|
||
private: | ||
// views::StyledLabel overrides: | ||
std::unique_ptr<views::Label> CreateLabel( | ||
const std::u16string& text, | ||
const RangeStyleInfo& style_info, | ||
const gfx::Range& range, | ||
views::LinkFragment** previous_link_component) const override; | ||
}; | ||
|
||
#endif // BRAVE_BROWSER_UI_VIEWS_INFOBARS_CUSTOM_STYLED_LABEL_H_ |
Oops, something went wrong.