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 KeepBubbleAnchored(bubble, GetStarDecoration(bubble)); | |
62 } | 68 } |
63 | 69 |
64 void ShowZoomBubbleViewsAtPoint(content::WebContents* web_contents, | 70 void ShowZoomBubbleViewsAtPoint(content::WebContents* web_contents, |
65 const gfx::Point& anchor_point, | 71 const gfx::Point& anchor_point, |
66 bool user_action) { | 72 bool user_action) { |
67 ZoomBubbleView::ShowBubble(web_contents, anchor_point, | 73 ZoomBubbleView::ShowBubble(web_contents, anchor_point, |
68 user_action | 74 user_action |
69 ? LocationBarBubbleDelegateView::USER_GESTURE | 75 ? LocationBarBubbleDelegateView::USER_GESTURE |
70 : LocationBarBubbleDelegateView::AUTOMATIC); | 76 : LocationBarBubbleDelegateView::AUTOMATIC); |
71 if (ZoomBubbleView::GetZoomBubble()) | 77 if (ZoomBubbleView::GetZoomBubble()) |
(...skipping 14 matching lines...) Expand all Loading... | |
86 } | 92 } |
87 | 93 |
88 task_manager::TaskManagerTableModel* ShowTaskManagerViews(Browser* browser) { | 94 task_manager::TaskManagerTableModel* ShowTaskManagerViews(Browser* browser) { |
89 return task_manager::TaskManagerView::Show(browser); | 95 return task_manager::TaskManagerView::Show(browser); |
90 } | 96 } |
91 | 97 |
92 void HideTaskManagerViews() { | 98 void HideTaskManagerViews() { |
93 task_manager::TaskManagerView::Hide(); | 99 task_manager::TaskManagerView::Hide(); |
94 } | 100 } |
95 | 101 |
96 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, | 102 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, |
tapted
2017/05/17 01:57:49
(is it possible to add a LocationBarDecoration* ar
spqchan
2017/05/17 23:58:46
Done. I was hesitant to add a platform exclusive p
| |
97 ContentSettingBubbleModel* model, | 103 ContentSettingBubbleModel* model, |
98 content::WebContents* web_contents, | 104 content::WebContents* web_contents, |
99 const gfx::Point& anchor) { | 105 const gfx::Point& anchor) { |
100 ContentSettingBubbleContents* contents = | 106 ContentSettingBubbleContents* contents = |
101 new ContentSettingBubbleContents(model, web_contents, nullptr, | 107 new ContentSettingBubbleContents(model, web_contents, nullptr, |
102 views::BubbleBorder::Arrow::TOP_RIGHT); | 108 views::BubbleBorder::Arrow::TOP_RIGHT); |
103 contents->set_parent_window(parent_view); | 109 contents->set_parent_window(parent_view); |
104 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); | 110 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); |
105 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); | 111 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); |
112 KeepBubbleAnchored(contents, GetContentSettingDecoration(contents, anchor)); | |
106 } | 113 } |
107 | 114 |
108 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) { | 115 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) { |
109 UpdateRecommendedMessageBox::Show(parent); | 116 UpdateRecommendedMessageBox::Show(parent); |
110 } | 117 } |
111 | 118 |
112 } // namespace chrome | 119 } // namespace chrome |
OLD | NEW |