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 13bdae13fef8db709d446ecf3d562b727b5df074..d84061ba0a405c1b157dd6dd751b0b42ebbe086d 100644 |
--- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc |
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc |
@@ -4,14 +4,9 @@ |
#include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" |
-#include <utility> |
- |
-#include "base/macros.h" |
#include "base/metrics/user_metrics.h" |
-#include "base/strings/string16.h" |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
-#include "chrome/app/chrome_command_ids.h" |
#include "chrome/browser/bookmarks/bookmark_model_factory.h" |
#include "chrome/browser/platform_util.h" |
#include "chrome/browser/profiles/profile.h" |
@@ -29,11 +24,9 @@ |
#include "ui/accessibility/ax_node_data.h" |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/events/keycodes/keyboard_codes.h" |
-#include "ui/views/bubble/bubble_frame_view.h" |
#include "ui/views/controls/button/md_text_button.h" |
#include "ui/views/controls/combobox/combobox.h" |
#include "ui/views/controls/label.h" |
-#include "ui/views/controls/link.h" |
#include "ui/views/controls/textfield/textfield.h" |
#include "ui/views/layout/fill_layout.h" |
#include "ui/views/layout/grid_layout.h" |
@@ -60,6 +53,7 @@ class UnsizedCombobox : public views::Combobox { |
explicit UnsizedCombobox(ui::ComboboxModel* model) : views::Combobox(model) {} |
~UnsizedCombobox() override {} |
+ // views::Combobox: |
gfx::Size GetPreferredSize() const override { |
return gfx::Size(0, views::Combobox::GetPreferredSize().height()); |
} |
@@ -70,7 +64,7 @@ class UnsizedCombobox : public views::Combobox { |
} // namespace |
-BookmarkBubbleView* BookmarkBubbleView::bookmark_bubble_ = NULL; |
+BookmarkBubbleView* BookmarkBubbleView::bookmark_bubble_ = nullptr; |
// static |
views::Widget* BookmarkBubbleView::ShowBubble( |
@@ -100,7 +94,7 @@ views::Widget* BookmarkBubbleView::ShowBubble( |
views::BubbleDialogDelegateView::CreateBubble(bookmark_bubble_); |
bubble_widget->Show(); |
// Select the entire title textfield contents when the bubble is first shown. |
- bookmark_bubble_->title_tf_->SelectAll(true); |
+ bookmark_bubble_->name_field_->SelectAll(true); |
bookmark_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); |
if (bookmark_bubble_->observer_) { |
@@ -111,6 +105,7 @@ views::Widget* BookmarkBubbleView::ShowBubble( |
return bubble_widget; |
} |
+// static |
void BookmarkBubbleView::Hide() { |
if (bookmark_bubble_) |
bookmark_bubble_->GetWidget()->Close(); |
@@ -130,172 +125,7 @@ BookmarkBubbleView::~BookmarkBubbleView() { |
delete parent_combobox_; |
} |
-void BookmarkBubbleView::WindowClosing() { |
- // We have to reset |bubble_| here, not in our destructor, because we'll be |
- // 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(); |
-} |
- |
-bool BookmarkBubbleView::AcceleratorPressed( |
- const ui::Accelerator& accelerator) { |
- ui::KeyboardCode key_code = accelerator.key_code(); |
- if (key_code == ui::VKEY_RETURN) { |
- HandleButtonPressed(close_button_); |
- return true; |
- } |
- if (key_code == ui::VKEY_E && accelerator.IsAltDown()) { |
- HandleButtonPressed(edit_button_); |
- return true; |
- } |
- if (key_code == ui::VKEY_R && accelerator.IsAltDown()) { |
- HandleButtonPressed(remove_button_); |
- return true; |
- } |
- |
- return LocationBarBubbleDelegateView::AcceleratorPressed(accelerator); |
-} |
- |
-void BookmarkBubbleView::Init() { |
- remove_button_ = views::MdTextButton::CreateSecondaryUiButton( |
- this, l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK)); |
- |
- edit_button_ = views::MdTextButton::CreateSecondaryUiButton( |
- this, l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_OPTIONS)); |
- |
- close_button_ = views::MdTextButton::CreateSecondaryUiButton( |
- this, l10n_util::GetStringUTF16(IDS_DONE)); |
- close_button_->SetIsDefault(true); |
- |
- views::Label* combobox_label = new views::Label( |
- l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_FOLDER_TEXT)); |
- |
- parent_combobox_ = new UnsizedCombobox(&parent_model_); |
- parent_combobox_->set_listener(this); |
- parent_combobox_->SetAccessibleName( |
- l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_BUBBLE_FOLDER_TEXT)); |
- |
- SetLayoutManager(new views::FillLayout); |
- bookmark_details_view_ = base::MakeUnique<View>(); |
- GridLayout* layout = new GridLayout(bookmark_details_view_.get()); |
- bookmark_details_view_->SetLayoutManager(layout); |
- |
- // This column set is used for the labels and textfields as well as the |
- // buttons at the bottom. |
- const int cs_id = 0; |
- ColumnSet* cs = layout->AddColumnSet(cs_id); |
- ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
- |
- cs->AddColumn(provider->GetControlLabelGridAlignment(), GridLayout::CENTER, 0, |
- GridLayout::USE_PREF, 0, 0); |
- cs->AddPaddingColumn( |
- 0, provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL)); |
- |
- cs->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0, |
- GridLayout::USE_PREF, 0, 0); |
- cs->AddPaddingColumn(1, provider->GetDistanceMetric( |
- DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE)); |
- |
- cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, |
- GridLayout::USE_PREF, 0, 0); |
- cs->AddPaddingColumn(0, provider->GetDistanceMetric( |
- views::DISTANCE_RELATED_BUTTON_HORIZONTAL)); |
- cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, |
- GridLayout::USE_PREF, 0, 0); |
- |
- layout->StartRow(0, cs_id); |
- views::Label* label = new views::Label( |
- l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT)); |
- layout->AddView(label); |
- title_tf_ = new views::Textfield(); |
- title_tf_->SetText(GetTitle()); |
- title_tf_->SetAccessibleName( |
- l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_BUBBLE_TITLE_TEXT)); |
- |
- layout->AddView(title_tf_, 5, 1); |
- |
- layout->AddPaddingRow( |
- 0, provider->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS).top()); |
- |
- layout->StartRow(0, cs_id); |
- layout->AddView(combobox_label); |
- layout->AddView(parent_combobox_, 5, 1); |
- |
- layout->AddPaddingRow( |
- 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
- |
- layout->StartRow(0, cs_id); |
- layout->SkipColumns(2); |
- layout->AddView(remove_button_); |
- layout->AddView(edit_button_); |
- layout->AddView(close_button_); |
- |
- AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); |
- AddAccelerator(ui::Accelerator(ui::VKEY_E, ui::EF_ALT_DOWN)); |
- AddAccelerator(ui::Accelerator(ui::VKEY_R, ui::EF_ALT_DOWN)); |
- |
- AddChildView(bookmark_details_view_.get()); |
-} |
- |
-gfx::ImageSkia BookmarkBubbleView::GetWindowIcon() { |
-#if defined(OS_WIN) |
- if (is_showing_ios_promotion_) { |
- return desktop_ios_promotion::GetPromoImage( |
- GetNativeTheme()->GetSystemColor( |
- ui::NativeTheme::kColorId_TextfieldDefaultColor)); |
- } |
-#endif |
- return gfx::ImageSkia(); |
-} |
- |
-bool BookmarkBubbleView::ShouldShowWindowIcon() const { |
- return is_showing_ios_promotion_; |
-} |
- |
-base::string16 BookmarkBubbleView::GetWindowTitle() const { |
-#if defined(OS_WIN) |
- if (is_showing_ios_promotion_) { |
- return desktop_ios_promotion::GetPromoTitle( |
- desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_BUBBLE); |
- } |
-#endif |
- return l10n_util::GetStringUTF16(newly_bookmarked_ |
- ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED |
- : IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK); |
-} |
- |
-const char* BookmarkBubbleView::GetClassName() const { |
- return "BookmarkBubbleView"; |
-} |
- |
-views::View* BookmarkBubbleView::GetInitiallyFocusedView() { |
- return title_tf_; |
-} |
- |
-views::View* BookmarkBubbleView::CreateFootnoteView() { |
-#if defined(OS_WIN) |
- if (!is_showing_ios_promotion_ && |
- IsIOSPromotionEligible( |
- desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_FOOTNOTE)) { |
- footnote_view_ = new DesktopIOSPromotionFootnoteView(profile_, this); |
- return footnote_view_; |
- } |
-#endif |
- if (!SyncPromoUI::ShouldShowSyncPromo(profile_)) |
- return nullptr; |
- |
- base::RecordAction( |
- base::UserMetricsAction("Signin_Impression_FromBookmarkBubble")); |
- |
- footnote_view_ = |
- new BubbleSyncPromoView(delegate_.get(), IDS_BOOKMARK_SYNC_PROMO_LINK, |
- IDS_BOOKMARK_SYNC_PROMO_MESSAGE); |
- return footnote_view_; |
-} |
+// Private methods ------------------------------------------------------------- |
BookmarkBubbleView::BookmarkBubbleView( |
views::View* anchor_view, |
@@ -315,8 +145,8 @@ BookmarkBubbleView::BookmarkBubbleView( |
->GetMostRecentlyAddedUserNodeForURL(url)), |
remove_button_(nullptr), |
edit_button_(nullptr), |
- close_button_(nullptr), |
- title_tf_(nullptr), |
+ save_button_(nullptr), |
+ name_field_(nullptr), |
parent_combobox_(nullptr), |
ios_promo_view_(nullptr), |
footnote_view_(nullptr), |
@@ -326,7 +156,7 @@ BookmarkBubbleView::BookmarkBubbleView( |
chrome::RecordDialogCreation(chrome::DialogIdentifier::BOOKMARK); |
} |
-base::string16 BookmarkBubbleView::GetTitle() { |
+base::string16 BookmarkBubbleView::GetBookmarkName() { |
BookmarkModel* bookmark_model = |
BookmarkModelFactory::GetForBrowserContext(profile_); |
const BookmarkNode* node = |
@@ -338,25 +168,6 @@ base::string16 BookmarkBubbleView::GetTitle() { |
return base::string16(); |
} |
-void BookmarkBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
- LocationBarBubbleDelegateView::GetAccessibleNodeData(node_data); |
- node_data->SetName(l10n_util::GetStringUTF8( |
- newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED |
- : IDS_BOOKMARK_AX_BUBBLE_PAGE_BOOKMARK)); |
-} |
- |
-void BookmarkBubbleView::ButtonPressed(views::Button* sender, |
- const ui::Event& event) { |
- HandleButtonPressed(sender); |
-} |
- |
-void BookmarkBubbleView::OnPerformAction(views::Combobox* combobox) { |
- if (combobox->selected_index() + 1 == parent_model_.GetItemCount()) { |
- base::RecordAction(UserMetricsAction("BookmarkBubble_EditFromCombobox")); |
- ShowEditor(); |
- } |
-} |
- |
void BookmarkBubbleView::HandleButtonPressed(views::Button* sender) { |
if (sender == remove_button_) { |
base::RecordAction(UserMetricsAction("BookmarkBubble_Unstar")); |
@@ -368,7 +179,7 @@ void BookmarkBubbleView::HandleButtonPressed(views::Button* sender) { |
base::RecordAction(UserMetricsAction("BookmarkBubble_Edit")); |
ShowEditor(); |
} else { |
- DCHECK_EQ(close_button_, sender); |
+ DCHECK_EQ(save_button_, sender); |
#if defined(OS_WIN) |
if (IsIOSPromotionEligible( |
desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_BUBBLE)) { |
@@ -409,7 +220,7 @@ void BookmarkBubbleView::ApplyEdits() { |
BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile_); |
const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url_); |
if (node) { |
- const base::string16 new_title = title_tf_->text(); |
+ const base::string16 new_title = name_field_->text(); |
if (new_title != node->GetTitle()) { |
model->SetTitle(node, new_title); |
base::RecordAction( |
@@ -419,13 +230,6 @@ void BookmarkBubbleView::ApplyEdits() { |
} |
} |
-void BookmarkBubbleView::OnIOSPromotionFootnoteLinkClicked() { |
-#if defined(OS_WIN) |
- ShowIOSPromotion( |
- desktop_ios_promotion::PromotionEntryPoint::FOOTNOTE_FOLLOWUP_BUBBLE); |
-#endif |
-} |
- |
#if defined(OS_WIN) |
bool BookmarkBubbleView::IsIOSPromotionEligible( |
@@ -440,7 +244,8 @@ bool BookmarkBubbleView::IsIOSPromotionEligible( |
void BookmarkBubbleView::ShowIOSPromotion( |
desktop_ios_promotion::PromotionEntryPoint entry_point) { |
DCHECK(!is_showing_ios_promotion_); |
- RemoveChildView(bookmark_details_view_.get()); |
+ // Hide the contents, but don't delete. It's needed in the destructor. |
+ bookmark_contents_view_->SetVisible(false); |
delete footnote_view_; |
footnote_view_ = nullptr; |
is_showing_ios_promotion_ = true; |
@@ -452,3 +257,216 @@ void BookmarkBubbleView::ShowIOSPromotion( |
ios_promo_view_->UpdateBubbleHeight(); |
} |
#endif |
+ |
+// ui::DialogModel ------------------------------------------------------------- |
+ |
+int BookmarkBubbleView::GetDialogButtons() const { |
+ // TODO(tapted): DialogClientView should manage the buttons. |
+ return ui::DIALOG_BUTTON_NONE; |
+} |
+ |
+// views::WidgetDelegate ------------------------------------------------------- |
+ |
+views::View* BookmarkBubbleView::GetInitiallyFocusedView() { |
+ return name_field_; |
+} |
+ |
+base::string16 BookmarkBubbleView::GetWindowTitle() const { |
+#if defined(OS_WIN) |
+ if (is_showing_ios_promotion_) { |
+ return desktop_ios_promotion::GetPromoTitle( |
+ desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_BUBBLE); |
+ } |
+#endif |
+ return l10n_util::GetStringUTF16(newly_bookmarked_ |
+ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED |
+ : IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK); |
+} |
+ |
+gfx::ImageSkia BookmarkBubbleView::GetWindowIcon() { |
+#if defined(OS_WIN) |
+ if (is_showing_ios_promotion_) { |
+ return desktop_ios_promotion::GetPromoImage( |
+ GetNativeTheme()->GetSystemColor( |
+ ui::NativeTheme::kColorId_TextfieldDefaultColor)); |
+ } |
+#endif |
+ return gfx::ImageSkia(); |
+} |
+ |
+bool BookmarkBubbleView::ShouldShowWindowIcon() const { |
+ return is_showing_ios_promotion_; |
+} |
+ |
+void BookmarkBubbleView::WindowClosing() { |
+ // We have to reset |bubble_| here, not in our destructor, because we'll be |
+ // 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(); |
+} |
+ |
+// views::DialogDelegate ------------------------------------------------------- |
+ |
+views::View* BookmarkBubbleView::CreateFootnoteView() { |
+#if defined(OS_WIN) |
+ if (!is_showing_ios_promotion_ && |
+ IsIOSPromotionEligible( |
+ desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_FOOTNOTE)) { |
+ footnote_view_ = new DesktopIOSPromotionFootnoteView(profile_, this); |
+ return footnote_view_; |
+ } |
+#endif |
+ if (!SyncPromoUI::ShouldShowSyncPromo(profile_)) |
+ return nullptr; |
+ |
+ base::RecordAction(UserMetricsAction("Signin_Impression_FromBookmarkBubble")); |
+ |
+ footnote_view_ = |
+ new BubbleSyncPromoView(delegate_.get(), IDS_BOOKMARK_SYNC_PROMO_LINK, |
+ IDS_BOOKMARK_SYNC_PROMO_MESSAGE); |
+ return footnote_view_; |
+} |
+ |
+// views::View ----------------------------------------------------------------- |
+ |
+const char* BookmarkBubbleView::GetClassName() const { |
+ return "BookmarkBubbleView"; |
+} |
+ |
+bool BookmarkBubbleView::AcceleratorPressed( |
+ const ui::Accelerator& accelerator) { |
+ ui::KeyboardCode key_code = accelerator.key_code(); |
+ if (key_code == ui::VKEY_RETURN) { |
+ HandleButtonPressed(save_button_); |
+ return true; |
+ } |
+ if (key_code == ui::VKEY_E && accelerator.IsAltDown()) { |
+ HandleButtonPressed(edit_button_); |
+ return true; |
+ } |
+ if (key_code == ui::VKEY_R && accelerator.IsAltDown()) { |
+ HandleButtonPressed(remove_button_); |
+ return true; |
+ } |
+ |
+ return LocationBarBubbleDelegateView::AcceleratorPressed(accelerator); |
+} |
+ |
+void BookmarkBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
+ LocationBarBubbleDelegateView::GetAccessibleNodeData(node_data); |
+ node_data->SetName(l10n_util::GetStringUTF8( |
+ newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED |
+ : IDS_BOOKMARK_AX_BUBBLE_PAGE_BOOKMARK)); |
+} |
+ |
+// views::BubbleDialogDelegateView --------------------------------------------- |
+ |
+void BookmarkBubbleView::Init() { |
+ remove_button_ = views::MdTextButton::CreateSecondaryUiButton( |
+ this, l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK)); |
+ |
+ edit_button_ = views::MdTextButton::CreateSecondaryUiButton( |
+ this, l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_OPTIONS)); |
+ |
+ save_button_ = views::MdTextButton::CreateSecondaryUiButton( |
+ this, l10n_util::GetStringUTF16(IDS_DONE)); |
+ save_button_->SetIsDefault(true); |
+ |
+ views::Label* combobox_label = new views::Label( |
+ l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_FOLDER_TEXT)); |
+ |
+ parent_combobox_ = new UnsizedCombobox(&parent_model_); |
+ parent_combobox_->set_listener(this); |
+ parent_combobox_->SetAccessibleName( |
+ l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_BUBBLE_FOLDER_TEXT)); |
+ |
+ SetLayoutManager(new views::FillLayout); |
+ bookmark_contents_view_ = new views::View(); |
+ GridLayout* layout = new GridLayout(bookmark_contents_view_); |
+ bookmark_contents_view_->SetLayoutManager(layout); |
+ |
+ // This column set is used for the labels and textfields as well as the |
+ // buttons at the bottom. |
+ const int cs_id = 0; |
+ ColumnSet* cs = layout->AddColumnSet(cs_id); |
+ ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
+ |
+ cs->AddColumn(provider->GetControlLabelGridAlignment(), GridLayout::CENTER, 0, |
+ GridLayout::USE_PREF, 0, 0); |
+ cs->AddPaddingColumn( |
+ 0, provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL)); |
+ |
+ cs->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0, GridLayout::USE_PREF, |
+ 0, 0); |
+ cs->AddPaddingColumn(1, provider->GetDistanceMetric( |
+ DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE)); |
+ |
+ cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, |
+ GridLayout::USE_PREF, 0, 0); |
+ cs->AddPaddingColumn(0, provider->GetDistanceMetric( |
+ views::DISTANCE_RELATED_BUTTON_HORIZONTAL)); |
+ cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, |
+ GridLayout::USE_PREF, 0, 0); |
+ |
+ layout->StartRow(0, cs_id); |
+ views::Label* label = new views::Label( |
+ l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT)); |
+ layout->AddView(label); |
+ name_field_ = new views::Textfield(); |
+ name_field_->SetText(GetBookmarkName()); |
+ name_field_->SetAccessibleName( |
+ l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_BUBBLE_TITLE_TEXT)); |
+ |
+ layout->AddView(name_field_, 5, 1); |
+ |
+ layout->AddPaddingRow( |
+ 0, provider->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS).top()); |
+ |
+ layout->StartRow(0, cs_id); |
+ layout->AddView(combobox_label); |
+ layout->AddView(parent_combobox_, 5, 1); |
+ |
+ layout->AddPaddingRow( |
+ 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
+ |
+ layout->StartRow(0, cs_id); |
+ layout->SkipColumns(2); |
+ layout->AddView(remove_button_); |
+ layout->AddView(edit_button_); |
+ layout->AddView(save_button_); |
+ |
+ AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); |
+ AddAccelerator(ui::Accelerator(ui::VKEY_E, ui::EF_ALT_DOWN)); |
+ AddAccelerator(ui::Accelerator(ui::VKEY_R, ui::EF_ALT_DOWN)); |
+ |
+ AddChildView(bookmark_contents_view_); |
+} |
+ |
+// views::ButtonListener ------------------------------------------------------- |
+ |
+void BookmarkBubbleView::ButtonPressed(views::Button* sender, |
+ const ui::Event& event) { |
+ HandleButtonPressed(sender); |
+} |
+ |
+// views::ComboboxListener ----------------------------------------------------- |
+ |
+void BookmarkBubbleView::OnPerformAction(views::Combobox* combobox) { |
+ if (combobox->selected_index() + 1 == parent_model_.GetItemCount()) { |
+ base::RecordAction(UserMetricsAction("BookmarkBubble_EditFromCombobox")); |
+ ShowEditor(); |
+ } |
+} |
+ |
+// DesktopIOSPromotionFootnoteDelegate ----------------------------------------- |
+ |
+void BookmarkBubbleView::OnIOSPromotionFootnoteLinkClicked() { |
+#if defined(OS_WIN) |
+ ShowIOSPromotion( |
+ desktop_ios_promotion::PromotionEntryPoint::FOOTNOTE_FOLLOWUP_BUBBLE); |
+#endif |
+} |