Commit aa369ed9 authored by Hector Carmona's avatar Hector Carmona Committed by Commit Bot

NUX Google Apps - Add option to specify string for bookmark bubble.

Bug: 832938
Change-Id: I315fa5a1fbb25d321828b922271c067f38a54535
Reviewed-on: https://chromium-review.googlesource.com/1157513
Commit-Queue: Hector Carmona <hcarmona@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580338}
parent 0190a578
...@@ -5015,14 +5015,6 @@ the Bookmarks menu."> ...@@ -5015,14 +5015,6 @@ the Bookmarks menu.">
Open a new tab to browse two sites at once Open a new tab to browse two sites at once
</message> </message>
<!-- NUX Experiment strings -->
<if expr="is_win">
<!-- Note: Each experiment should add their own message instead of using this default -->
<message name="IDS_BOOKMARK_BAR_PROMO_DEFAULT" desc="Default text shown when promoting a bookmark in the bookmark bar.">
A bookmark has been added for you
</message>
</if>
<!-- Browser Hung Plugin Detector --> <!-- Browser Hung Plugin Detector -->
<if expr="is_win"> <if expr="is_win">
<message name="IDS_BROWSER_HANGMONITOR" desc="A plugin on a page has hung"> <message name="IDS_BROWSER_HANGMONITOR" desc="A plugin on a page has hung">
......
...@@ -11,23 +11,25 @@ ...@@ -11,23 +11,25 @@
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/bookmarks/browser/bookmark_node.h" #include "components/bookmarks/browser/bookmark_node.h"
std::unique_ptr<ShowPromoDelegate> ShowPromoDelegate::CreatePromoDelegate() { std::unique_ptr<ShowPromoDelegate> ShowPromoDelegate::CreatePromoDelegate(
return std::make_unique<BookmarkBarPromoBubbleView>(); int string_specifier) {
return std::make_unique<BookmarkBarPromoBubbleView>(string_specifier);
} }
struct BookmarkBarPromoBubbleView::BubbleImpl : public FeaturePromoBubbleView { struct BookmarkBarPromoBubbleView::BubbleImpl : public FeaturePromoBubbleView {
// Anchors the BookmarkBarPromoBubbleView to |anchor_view|. // Anchors the BookmarkBarPromoBubbleView to |anchor_view|.
// The bubble widget and promo are owned by their native widget. // The bubble widget and promo are owned by their native widget.
explicit BubbleImpl(views::View* anchor_view) explicit BubbleImpl(views::View* anchor_view, int string_specifier)
: FeaturePromoBubbleView(anchor_view, : FeaturePromoBubbleView(anchor_view,
views::BubbleBorder::TOP_LEFT, views::BubbleBorder::TOP_LEFT,
IDS_BOOKMARK_BAR_PROMO_DEFAULT, string_specifier,
ActivationAction::DO_NOT_ACTIVATE) {} ActivationAction::DO_NOT_ACTIVATE) {}
~BubbleImpl() override = default; ~BubbleImpl() override = default;
}; };
BookmarkBarPromoBubbleView::BookmarkBarPromoBubbleView() = default; BookmarkBarPromoBubbleView::BookmarkBarPromoBubbleView(int string_specifier)
: string_specifier(string_specifier) {}
void BookmarkBarPromoBubbleView::ShowForNode( void BookmarkBarPromoBubbleView::ShowForNode(
const bookmarks::BookmarkNode* node) { const bookmarks::BookmarkNode* node) {
...@@ -36,5 +38,5 @@ void BookmarkBarPromoBubbleView::ShowForNode( ...@@ -36,5 +38,5 @@ void BookmarkBarPromoBubbleView::ShowForNode(
BrowserList::GetInstance()->GetLastActive()) BrowserList::GetInstance()->GetLastActive())
->bookmark_bar() ->bookmark_bar()
->GetBookmarkButtonForNode(node); ->GetBookmarkButtonForNode(node);
new BookmarkBarPromoBubbleView::BubbleImpl(anchor_view); new BookmarkBarPromoBubbleView::BubbleImpl(anchor_view, string_specifier);
} }
...@@ -21,7 +21,7 @@ class BookmarkNode; ...@@ -21,7 +21,7 @@ class BookmarkNode;
// relevant bookmark node. // relevant bookmark node.
class BookmarkBarPromoBubbleView : public ShowPromoDelegate { class BookmarkBarPromoBubbleView : public ShowPromoDelegate {
public: public:
BookmarkBarPromoBubbleView(); explicit BookmarkBarPromoBubbleView(int string_specifier);
~BookmarkBarPromoBubbleView() override = default; ~BookmarkBarPromoBubbleView() override = default;
// ShowPromoDelegate: // ShowPromoDelegate:
...@@ -32,6 +32,9 @@ class BookmarkBarPromoBubbleView : public ShowPromoDelegate { ...@@ -32,6 +32,9 @@ class BookmarkBarPromoBubbleView : public ShowPromoDelegate {
private: private:
struct BubbleImpl; struct BubbleImpl;
// The string that will be shown on this bubble.
int string_specifier;
DISALLOW_COPY_AND_ASSIGN(BookmarkBarPromoBubbleView); DISALLOW_COPY_AND_ASSIGN(BookmarkBarPromoBubbleView);
}; };
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
#include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/test/bookmark_test_helpers.h" #include "components/bookmarks/test/bookmark_test_helpers.h"
#include "components/strings/grit/components_strings.h"
class BookmarkBarPromoDialogTest : public DialogBrowserTest { class BookmarkBarPromoDialogTest : public DialogBrowserTest {
public: public:
...@@ -25,7 +26,8 @@ class BookmarkBarPromoDialogTest : public DialogBrowserTest { ...@@ -25,7 +26,8 @@ class BookmarkBarPromoDialogTest : public DialogBrowserTest {
"a "); "a ");
// Now actually show the promo. // Now actually show the promo.
BookmarkBarPromoBubbleView bubble_view; BookmarkBarPromoBubbleView bubble_view(
IDS_NUX_GOOGLE_APPS_DESCRIPTION_PROMO_BUBBLE);
bubble_view.ShowForNode(model->bookmark_bar_node()->GetChild(0)); bubble_view.ShowForNode(model->bookmark_bar_node()->GetChild(0));
} }
......
...@@ -19,7 +19,8 @@ class ShowPromoDelegate { ...@@ -19,7 +19,8 @@ class ShowPromoDelegate {
virtual void ShowForNode(const bookmarks::BookmarkNode* node) = 0; virtual void ShowForNode(const bookmarks::BookmarkNode* node) = 0;
// Return an instance of the promo delegate. // Return an instance of the promo delegate.
static std::unique_ptr<ShowPromoDelegate> CreatePromoDelegate(); static std::unique_ptr<ShowPromoDelegate> CreatePromoDelegate(
int string_specifier);
}; };
#endif // COMPONENTS_NUX_SHOW_PROMO_DELEGATE_H_ #endif // COMPONENTS_NUX_SHOW_PROMO_DELEGATE_H_
...@@ -103,8 +103,9 @@ void GoogleAppsHandler::HandleAddGoogleApps(const base::ListValue* args) { ...@@ -103,8 +103,9 @@ void GoogleAppsHandler::HandleAddGoogleApps(const base::ListValue* args) {
// TODO(hcarmona): Any advice here would be helpful. // TODO(hcarmona): Any advice here would be helpful.
// Show bookmark bubble. // Show bookmark bubble.
ShowPromoDelegate::CreatePromoDelegate()->ShowForNode( ShowPromoDelegate::CreatePromoDelegate(
bookmark_model_->bookmark_bar_node()->GetChild(0)); IDS_NUX_GOOGLE_APPS_DESCRIPTION_PROMO_BUBBLE)
->ShowForNode(bookmark_model_->bookmark_bar_node()->GetChild(0));
UMA_HISTOGRAM_ENUMERATION(kGoogleAppsInteractionHistogram, UMA_HISTOGRAM_ENUMERATION(kGoogleAppsInteractionHistogram,
GoogleAppsInteraction::kGetStarted, GoogleAppsInteraction::kGetStarted,
......
...@@ -6,4 +6,7 @@ ...@@ -6,4 +6,7 @@
<message name="IDS_NUX_GOOGLE_APPS_DESCRIPTION" desc="Description of what selecting apps and pressing 'Get started' will do."> <message name="IDS_NUX_GOOGLE_APPS_DESCRIPTION" desc="Description of what selecting apps and pressing 'Get started' will do.">
Get quick access to your favorite Google Apps Get quick access to your favorite Google Apps
</message> </message>
<message name="IDS_NUX_GOOGLE_APPS_DESCRIPTION_PROMO_BUBBLE" desc="Text shown when Google Apps have been added to highlight where bookmarks have been placed.">
Open apps easily with bookmarks
</message>
</grit-part> </grit-part>
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