Commit 062431be authored by Collin Baker's avatar Collin Baker Committed by Commit Bot

Allow clients to supply the raw text for a bubble

Fixed: 1143461
Change-Id: Ifc5df8a84188e403af6986bf7e5a7d30c4d066ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2508909Reviewed-by: default avatarDana Fried <dfried@chromium.org>
Commit-Queue: Collin Baker <collinbaker@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822775}
parent 57508200
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/optional.h" #include "base/optional.h"
#include "base/strings/string16.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "ui/base/accelerators/accelerator.h" #include "ui/base/accelerators/accelerator.h"
#include "ui/views/bubble/bubble_border.h" #include "ui/views/bubble/bubble_border.h"
...@@ -27,6 +28,15 @@ struct FeaturePromoBubbleParams { ...@@ -27,6 +28,15 @@ struct FeaturePromoBubbleParams {
// The main promo text. Must be set to a valid string specifier. // The main promo text. Must be set to a valid string specifier.
int body_string_specifier = -1; int body_string_specifier = -1;
// If |body_string_specifier| is not set, this will be used instead.
// Only use if your string has placeholders that need to be filled in
// dynamically.
//
// TODO(crbug.com/1143971): enable filling placeholders in
// |body_string_specifier| with context-specific information then
// remove this.
base::string16 body_text_raw;
// Title shown larger at top of bubble. Optional. // Title shown larger at top of bubble. Optional.
base::Optional<int> title_string_specifier; base::Optional<int> title_string_specifier;
......
...@@ -144,7 +144,9 @@ FeaturePromoBubbleView::FeaturePromoBubbleView( ...@@ -144,7 +144,9 @@ FeaturePromoBubbleView::FeaturePromoBubbleView(
} }
const base::string16 body_text = const base::string16 body_text =
l10n_util::GetStringUTF16(params.body_string_specifier); params.body_string_specifier != -1
? l10n_util::GetStringUTF16(params.body_string_specifier)
: params.body_text_raw;
// Feature promos are purely informational. We can skip reading the UI // Feature promos are purely informational. We can skip reading the UI
// elements inside the bubble and just have the information announced when the // elements inside the bubble and just have the information announced when the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment