Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1822)

Unified Diff: chrome/browser/ui/views/toolbar/toolbar_view.cc

Issue 2374253002: Fix bookmark bubble/star view highlighting for Harmony. (Closed)
Patch Set: fix tests, move bubble creation to toolbar Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/toolbar/toolbar_view.cc
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc
index 027ae25570322a0b412b2ac25f88ea3a6be52273..4e999c86943d81b21935214e034b23e2596d3f10 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_properties.h"
+#include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_commands.h"
@@ -29,6 +30,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/autofill/save_card_icon_view.h"
+#include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
#include "chrome/browser/ui/views/extensions/extension_popup.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
@@ -285,12 +287,26 @@ bool ToolbarView::IsAppMenuFocused() {
return app_menu_button_ && app_menu_button_->HasFocus();
}
-views::View* ToolbarView::GetBookmarkBubbleAnchor() {
- if (ui::MaterialDesignController::IsSecondaryUiMaterial())
- return location_bar();
+void ToolbarView::ShowBookmarkBubble(
+ const GURL& url,
+ bool already_bookmarked,
+ bookmarks::BookmarkBubbleObserver* observer) {
+ views::View* anchor_view = location_bar();
+ StarView* star_view = location_bar()->star_view();
+ if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) {
+ if (star_view && star_view->visible())
+ anchor_view = star_view;
+ else
+ anchor_view = app_menu_button_;
+ }
- views::View* star_view = location_bar()->star_view();
- return (star_view && star_view->visible()) ? star_view : app_menu_button_;
+ std::unique_ptr<BubbleSyncPromoDelegate> delegate;
+ delegate.reset(new BookmarkBubbleSignInDelegate(browser_));
+ views::Widget* bubble_widget = BookmarkBubbleView::ShowBubble(
+ anchor_view, gfx::Rect(), nullptr, observer, std::move(delegate),
+ browser_->profile(), url, already_bookmarked);
+ if (star_view)
+ bubble_widget->AddObserver(star_view);
}
views::View* ToolbarView::GetSaveCreditCardBubbleAnchor() {
@@ -311,8 +327,7 @@ views::View* ToolbarView::GetTranslateBubbleAnchor() {
void ToolbarView::OnBubbleCreatedForAnchor(views::View* anchor_view,
views::Widget* bubble_widget) {
if (bubble_widget &&
- (anchor_view == location_bar()->star_view() ||
- anchor_view == location_bar()->save_credit_card_icon_view() ||
+ (anchor_view == location_bar()->save_credit_card_icon_view() ||
anchor_view == location_bar()->translate_icon_view())) {
DCHECK(anchor_view);
bubble_widget->AddObserver(static_cast<BubbleIconView*>(anchor_view));
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698