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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc

Issue 1308713002: [Mac] Enable MacViews bookmark bubble behind --enable-mac-views-dialogs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pulse
Patch Set: Address comments. Created 5 years, 4 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
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 924b1617624d1b8aefee3abe4493348928a453e6..1f43a345eeb2da7e946fecd8b7bf4d7853a44518 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
@@ -9,9 +9,11 @@
#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"
#include "chrome/browser/ui/bookmarks/bookmark_bubble_observer.h"
#include "chrome/browser/ui/bookmarks/bookmark_editor.h"
+#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/sync/sync_promo_ui.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view.h"
#include "chrome/grit/generated_resources.h"
@@ -63,20 +65,23 @@ BookmarkBubbleView* BookmarkBubbleView::bookmark_bubble_ = NULL;
// static
void BookmarkBubbleView::ShowBubble(views::View* anchor_view,
+ const gfx::Rect& anchor_rect,
+ gfx::NativeView parent_window,
bookmarks::BookmarkBubbleObserver* observer,
scoped_ptr<BookmarkBubbleDelegate> delegate,
Profile* profile,
const GURL& url,
- bool newly_bookmarked) {
+ bool already_bookmarked) {
if (bookmark_bubble_)
return;
- bookmark_bubble_ = new BookmarkBubbleView(anchor_view,
- observer,
- delegate.Pass(),
- profile,
- url,
- newly_bookmarked);
+ bookmark_bubble_ =
+ new BookmarkBubbleView(anchor_view, observer, delegate.Pass(), profile,
+ url, !already_bookmarked);
+ if (!anchor_view) {
+ bookmark_bubble_->SetAnchorRect(anchor_rect);
+ bookmark_bubble_->set_parent_window(parent_window);
+ }
views::BubbleDelegateView::CreateBubble(bookmark_bubble_)->Show();
// Select the entire title textfield contents when the bubble is first shown.
bookmark_bubble_->title_tf_->SelectAll(true);
@@ -346,15 +351,17 @@ void BookmarkBubbleView::HandleButtonPressed(views::Button* sender) {
void BookmarkBubbleView::ShowEditor() {
const BookmarkNode* node = BookmarkModelFactory::GetForProfile(
profile_)->GetMostRecentlyAddedUserNodeForURL(url_);
- views::Widget* parent = anchor_widget();
- DCHECK(parent);
+ gfx::NativeWindow native_parent =
+ anchor_widget() ? anchor_widget()->GetNativeWindow()
+ : platform_util::GetTopLevel(parent_window());
+ DCHECK(native_parent);
Profile* profile = profile_;
ApplyEdits();
GetWidget()->Close();
- if (node && parent)
- BookmarkEditor::Show(parent->GetNativeWindow(), profile,
+ if (node && native_parent)
+ BookmarkEditor::Show(native_parent, profile,
BookmarkEditor::EditDetails::EditNode(node),
BookmarkEditor::SHOW_TREE);
}
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h ('k') | chrome/browser/ui/views/browser_dialogs_views_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698