Index: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc |
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc |
index bb12026e436057ea5504ac4343fcdc0df5dc8e5b..aaf24c7c47e4616110611a17b73eb518609a51a1 100644 |
--- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc |
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc |
@@ -43,6 +43,7 @@ |
#if defined(OS_WIN) |
#include "chrome/browser/sync/profile_sync_service_factory.h" |
#include "chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bubble_view.h" |
+#include "chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_footnote_view.h" |
#include "components/browser_sync/profile_sync_service.h" |
#endif |
@@ -135,6 +136,7 @@ void BookmarkBubbleView::WindowClosing() { |
// destroyed asynchronously and the shown state will be checked before then. |
DCHECK_EQ(bookmark_bubble_, this); |
bookmark_bubble_ = NULL; |
+ is_showing_ios_promotion_ = false; |
if (observer_) |
observer_->OnBookmarkBubbleHidden(); |
@@ -269,6 +271,13 @@ views::View* BookmarkBubbleView::GetInitiallyFocusedView() { |
} |
views::View* BookmarkBubbleView::CreateFootnoteView() { |
+ if (!is_showing_ios_promotion_ && |
+ IsIOSPromotionEligible( |
+ desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_FOOTNOTE)) { |
+ footnote_view_ = new DesktopIOSPromotionFootnoteView(profile_, this); |
+ return footnote_view_; |
+ } |
+ |
if (!SyncPromoUI::ShouldShowSyncPromo(profile_)) |
return nullptr; |
@@ -351,13 +360,10 @@ void BookmarkBubbleView::HandleButtonPressed(views::Button* sender) { |
} else { |
DCHECK_EQ(close_button_, sender); |
#if defined(OS_WIN) |
- PrefService* prefs = profile_->GetPrefs(); |
- const browser_sync::ProfileSyncService* sync_service = |
- ProfileSyncServiceFactory::GetForProfile(profile_); |
- if (desktop_ios_promotion::IsEligibleForIOSPromotion( |
- prefs, sync_service, |
+ if (IsIOSPromotionEligible( |
desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_BUBBLE)) { |
- ShowIOSPromotion(); |
+ ShowIOSPromotion( |
+ desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_BUBBLE); |
} else { |
GetWidget()->Close(); |
} |
@@ -403,13 +409,33 @@ void BookmarkBubbleView::ApplyEdits() { |
} |
} |
+void BookmarkBubbleView::OnIOSPromotionFootnoteLinkClicked() { |
#if defined(OS_WIN) |
-void BookmarkBubbleView::ShowIOSPromotion() { |
+ ShowIOSPromotion( |
+ desktop_ios_promotion::PromotionEntryPoint::FOOTNOTE_FOLLOWUP_BUBBLE); |
+#endif |
+} |
+ |
+#if defined(OS_WIN) |
+ |
+bool BookmarkBubbleView::IsIOSPromotionEligible( |
+ desktop_ios_promotion::PromotionEntryPoint entry_point) { |
+ PrefService* prefs = profile_->GetPrefs(); |
+ const browser_sync::ProfileSyncService* sync_service = |
+ ProfileSyncServiceFactory::GetForProfile(profile_); |
+ return desktop_ios_promotion::IsEligibleForIOSPromotion(prefs, sync_service, |
+ entry_point); |
+} |
+ |
+void BookmarkBubbleView::ShowIOSPromotion( |
+ desktop_ios_promotion::PromotionEntryPoint entry_point) { |
DCHECK(!is_showing_ios_promotion_); |
RemoveChildView(bookmark_details_view_.get()); |
+ views::BubbleFrameView* frame = static_cast<views::BubbleFrameView*>( |
+ GetWidget()->non_client_view()->frame_view()); |
+ frame->RemoveFootnoteView(); |
is_showing_ios_promotion_ = true; |
- ios_promo_view_ = new DesktopIOSPromotionBubbleView( |
- profile_, desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_BUBBLE); |
+ ios_promo_view_ = new DesktopIOSPromotionBubbleView(profile_, entry_point); |
AddChildView(ios_promo_view_); |
GetWidget()->UpdateWindowIcon(); |
GetWidget()->UpdateWindowTitle(); |