| 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 66aef8123fa940e9339716ccd73d747f37be0e05..32e74c66548549a15e51ca299cd085aca1172a2f 100644
|
| --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
|
| +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
|
| @@ -9,10 +9,12 @@
|
| #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_bubble_view_observer.h"
|
| #include "chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view.h"
|
| #include "chrome/grit/generated_resources.h"
|
| #include "components/bookmarks/browser/bookmark_model.h"
|
| @@ -63,7 +65,9 @@ BookmarkBubbleView* BookmarkBubbleView::bookmark_bubble_ = NULL;
|
|
|
| // static
|
| void BookmarkBubbleView::ShowBubble(views::View* anchor_view,
|
| - BookmarkBubbleViewObserver* observer,
|
| + const gfx::Rect& anchor_rect,
|
| + gfx::NativeView parent_window,
|
| + bookmarks::BookmarkBubbleObserver* observer,
|
| scoped_ptr<BookmarkBubbleDelegate> delegate,
|
| Profile* profile,
|
| const GURL& url,
|
| @@ -77,6 +81,10 @@ void BookmarkBubbleView::ShowBubble(views::View* anchor_view,
|
| profile,
|
| url,
|
| newly_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);
|
| @@ -264,7 +272,7 @@ views::View* BookmarkBubbleView::GetInitiallyFocusedView() {
|
|
|
| BookmarkBubbleView::BookmarkBubbleView(
|
| views::View* anchor_view,
|
| - BookmarkBubbleViewObserver* observer,
|
| + bookmarks::BookmarkBubbleObserver* observer,
|
| scoped_ptr<BookmarkBubbleDelegate> delegate,
|
| Profile* profile,
|
| const GURL& url,
|
| @@ -275,10 +283,9 @@ BookmarkBubbleView::BookmarkBubbleView(
|
| profile_(profile),
|
| url_(url),
|
| newly_bookmarked_(newly_bookmarked),
|
| - parent_model_(
|
| - BookmarkModelFactory::GetForProfile(profile_),
|
| - BookmarkModelFactory::GetForProfile(profile_)->
|
| - GetMostRecentlyAddedUserNodeForURL(url)),
|
| + parent_model_(BookmarkModelFactory::GetForProfile(profile_),
|
| + BookmarkModelFactory::GetForProfile(profile_)
|
| + ->GetMostRecentlyAddedUserNodeForURL(url)),
|
| remove_button_(NULL),
|
| edit_button_(NULL),
|
| close_button_(NULL),
|
| @@ -343,17 +350,19 @@ 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_window =
|
| + anchor_widget() ? anchor_widget()->GetNativeWindow()
|
| + : platform_util::GetTopLevel(parent_window());
|
| + DCHECK(native_window);
|
|
|
| Profile* profile = profile_;
|
| ApplyEdits();
|
| GetWidget()->Close();
|
|
|
| - if (node && parent)
|
| - BookmarkEditor::Show(parent->GetNativeWindow(), profile,
|
| - BookmarkEditor::EditDetails::EditNode(node),
|
| - BookmarkEditor::SHOW_TREE);
|
| + if (node && native_window)
|
| + chrome::ShowBookmarkEditorView(native_window, profile,
|
| + BookmarkEditor::EditDetails::EditNode(node),
|
| + BookmarkEditor::SHOW_TREE);
|
| }
|
|
|
| void BookmarkBubbleView::ApplyEdits() {
|
|
|