OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <utility> | 5 #include <utility> |
6 | 6 |
7 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" | 7 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_dialogs.h" | 9 #include "chrome/browser/ui/browser_dialogs.h" |
10 #include "chrome/browser/ui/cocoa/bubble_anchor_helper_views.h" | 10 #include "chrome/browser/ui/cocoa/bubble_anchor_helper_views.h" |
11 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | |
11 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" | 12 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" |
12 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" | 13 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
13 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" | 14 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
14 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" | 15 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" |
15 #include "chrome/browser/ui/views/task_manager_view.h" | 16 #include "chrome/browser/ui/views/task_manager_view.h" |
16 #include "chrome/browser/ui/views/update_recommended_message_box.h" | 17 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
17 | 18 |
18 // This file provides definitions of desktop browser dialog-creation methods for | 19 // This file provides definitions of desktop browser dialog-creation methods for |
19 // Mac where a Cocoa browser is using Views dialogs. I.e. it is included in the | 20 // Mac where a Cocoa browser is using Views dialogs. I.e. it is included in the |
20 // Cocoa build and definitions under chrome/browser/ui/cocoa may select at | 21 // Cocoa build and definitions under chrome/browser/ui/cocoa may select at |
(...skipping 13 matching lines...) Expand all Loading... | |
34 // consistent with the non-Mac views implementation. | 35 // consistent with the non-Mac views implementation. |
35 // Note that when the browser is toolkit-views, IsBubbleShowing() is checked | 36 // Note that when the browser is toolkit-views, IsBubbleShowing() is checked |
36 // earlier because the bubble is shown on mouse release (but dismissed on | 37 // earlier because the bubble is shown on mouse release (but dismissed on |
37 // mouse pressed). A Cocoa browser does both on mouse pressed, so a check | 38 // mouse pressed). A Cocoa browser does both on mouse pressed, so a check |
38 // when showing is sufficient. | 39 // when showing is sufficient. |
39 if (PageInfoBubbleView::GetShownBubbleType() != | 40 if (PageInfoBubbleView::GetShownBubbleType() != |
40 PageInfoBubbleView::BUBBLE_NONE) { | 41 PageInfoBubbleView::BUBBLE_NONE) { |
41 return; | 42 return; |
42 } | 43 } |
43 | 44 |
44 PageInfoBubbleView::ShowBubble(nullptr, gfx::Rect(anchor_point, gfx::Size()), | 45 views::BubbleDialogDelegateView* bubble = PageInfoBubbleView::ShowBubble( |
45 profile, web_contents, virtual_url, | 46 nullptr, gfx::Rect(anchor_point, gfx::Size()), profile, web_contents, |
46 security_info); | 47 virtual_url, security_info); |
48 KeepBubbleAnchored(bubble, GetPageInfoDecoration(bubble)); | |
47 } | 49 } |
48 | 50 |
49 void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point, | 51 void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point, |
50 gfx::NativeView parent, | 52 gfx::NativeView parent, |
51 bookmarks::BookmarkBubbleObserver* observer, | 53 bookmarks::BookmarkBubbleObserver* observer, |
52 Browser* browser, | 54 Browser* browser, |
53 const GURL& virtual_url, | 55 const GURL& virtual_url, |
54 bool already_bookmarked) { | 56 bool already_bookmarked) { |
55 // The Views dialog may prompt for sign in. | 57 // The Views dialog may prompt for sign in. |
56 std::unique_ptr<BubbleSyncPromoDelegate> delegate( | 58 std::unique_ptr<BubbleSyncPromoDelegate> delegate( |
57 new BookmarkBubbleSignInDelegate(browser)); | 59 new BookmarkBubbleSignInDelegate(browser)); |
58 | 60 |
59 BookmarkBubbleView::ShowBubble( | 61 BookmarkBubbleView::ShowBubble( |
60 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer, | 62 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer, |
61 std::move(delegate), browser->profile(), virtual_url, already_bookmarked); | 63 std::move(delegate), browser->profile(), virtual_url, already_bookmarked); |
64 | |
65 views::BubbleDialogDelegateView* bubble = | |
66 BookmarkBubbleView::bookmark_bubble(); | |
67 if (bubble) | |
tapted
2017/05/16 07:39:37
is there a known case where this is null? (comment
spqchan
2017/05/17 01:39:40
Whoops, no. I removed it
| |
68 KeepBubbleAnchored(bubble, GetStarDecoration(bubble)); | |
62 } | 69 } |
63 | 70 |
64 void ShowZoomBubbleViewsAtPoint(content::WebContents* web_contents, | 71 void ShowZoomBubbleViewsAtPoint(content::WebContents* web_contents, |
65 const gfx::Point& anchor_point, | 72 const gfx::Point& anchor_point, |
66 bool user_action) { | 73 bool user_action) { |
67 ZoomBubbleView::ShowBubble(web_contents, anchor_point, | 74 ZoomBubbleView::ShowBubble(web_contents, anchor_point, |
68 user_action | 75 user_action |
69 ? LocationBarBubbleDelegateView::USER_GESTURE | 76 ? LocationBarBubbleDelegateView::USER_GESTURE |
70 : LocationBarBubbleDelegateView::AUTOMATIC); | 77 : LocationBarBubbleDelegateView::AUTOMATIC); |
71 if (ZoomBubbleView::GetZoomBubble()) | 78 if (ZoomBubbleView::GetZoomBubble()) |
(...skipping 24 matching lines...) Expand all Loading... | |
96 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, | 103 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, |
97 ContentSettingBubbleModel* model, | 104 ContentSettingBubbleModel* model, |
98 content::WebContents* web_contents, | 105 content::WebContents* web_contents, |
99 const gfx::Point& anchor) { | 106 const gfx::Point& anchor) { |
100 ContentSettingBubbleContents* contents = | 107 ContentSettingBubbleContents* contents = |
101 new ContentSettingBubbleContents(model, web_contents, nullptr, | 108 new ContentSettingBubbleContents(model, web_contents, nullptr, |
102 views::BubbleBorder::Arrow::TOP_RIGHT); | 109 views::BubbleBorder::Arrow::TOP_RIGHT); |
103 contents->set_parent_window(parent_view); | 110 contents->set_parent_window(parent_view); |
104 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); | 111 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); |
105 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); | 112 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); |
113 KeepBubbleAnchored(contents, model->decoration()); | |
106 } | 114 } |
107 | 115 |
108 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) { | 116 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) { |
109 UpdateRecommendedMessageBox::Show(parent); | 117 UpdateRecommendedMessageBox::Show(parent); |
110 } | 118 } |
111 | 119 |
112 } // namespace chrome | 120 } // namespace chrome |
OLD | NEW |