Chromium Code Reviews| 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..a8c61caa2a207de10014b1c393150c779f6eb5f4 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,6 +65,8 @@ 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, |
| @@ -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); |
| @@ -346,15 +354,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_window = |
|
tapted
2015/08/25 00:00:45
nit: native_window -> parent (or native_parent) -
jackhou1
2015/08/25 04:55:39
Done.
|
| + 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, |
| + if (node && native_window) |
| + BookmarkEditor::Show(native_window, profile, |
| BookmarkEditor::EditDetails::EditNode(node), |
| BookmarkEditor::SHOW_TREE); |
| } |