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/views/bookmarks/bookmark_bubble_view.h" | 10 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" |
11 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" | 11 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
| 12 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
12 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" | 13 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" |
13 #include "chrome/browser/ui/views/task_manager_view.h" | 14 #include "chrome/browser/ui/views/task_manager_view.h" |
14 #include "chrome/browser/ui/views/update_recommended_message_box.h" | 15 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
15 | 16 |
16 // This file provides definitions of desktop browser dialog-creation methods for | 17 // This file provides definitions of desktop browser dialog-creation methods for |
17 // Mac where a Cocoa browser is using Views dialogs. I.e. it is included in the | 18 // Mac where a Cocoa browser is using Views dialogs. I.e. it is included in the |
18 // Cocoa build and definitions under chrome/browser/ui/cocoa may select at | 19 // Cocoa build and definitions under chrome/browser/ui/cocoa may select at |
19 // runtime whether to show a Cocoa dialog, or the toolkit-views dialog defined | 20 // runtime whether to show a Cocoa dialog, or the toolkit-views dialog defined |
20 // here (declared in browser_dialogs.h). | 21 // here (declared in browser_dialogs.h). |
21 | 22 |
(...skipping 30 matching lines...) Expand all Loading... |
52 bool already_bookmarked) { | 53 bool already_bookmarked) { |
53 // The Views dialog may prompt for sign in. | 54 // The Views dialog may prompt for sign in. |
54 std::unique_ptr<BubbleSyncPromoDelegate> delegate( | 55 std::unique_ptr<BubbleSyncPromoDelegate> delegate( |
55 new BookmarkBubbleSignInDelegate(browser)); | 56 new BookmarkBubbleSignInDelegate(browser)); |
56 | 57 |
57 BookmarkBubbleView::ShowBubble( | 58 BookmarkBubbleView::ShowBubble( |
58 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer, | 59 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer, |
59 std::move(delegate), browser->profile(), virtual_url, already_bookmarked); | 60 std::move(delegate), browser->profile(), virtual_url, already_bookmarked); |
60 } | 61 } |
61 | 62 |
| 63 void ShowZoomBubbleViewsAtPoint(content::WebContents* web_contents, |
| 64 const gfx::Point& anchor_point, |
| 65 bool user_action) { |
| 66 ZoomBubbleView::ShowBubble(web_contents, anchor_point, |
| 67 user_action |
| 68 ? LocationBarBubbleDelegateView::USER_GESTURE |
| 69 : LocationBarBubbleDelegateView::AUTOMATIC); |
| 70 } |
| 71 |
| 72 void CloseZoomBubbleViews() { |
| 73 ZoomBubbleView::CloseCurrentBubble(); |
| 74 } |
| 75 |
| 76 void RefreshZoomBubbleViews() { |
| 77 if (ZoomBubbleView::GetZoomBubble()) |
| 78 ZoomBubbleView::GetZoomBubble()->Refresh(); |
| 79 } |
| 80 |
| 81 bool IsZoomBubbleViewsShown() { |
| 82 return ZoomBubbleView::GetZoomBubble() != nullptr; |
| 83 } |
| 84 |
62 task_manager::TaskManagerTableModel* ShowTaskManagerViews(Browser* browser) { | 85 task_manager::TaskManagerTableModel* ShowTaskManagerViews(Browser* browser) { |
63 return task_manager::TaskManagerView::Show(browser); | 86 return task_manager::TaskManagerView::Show(browser); |
64 } | 87 } |
65 | 88 |
66 void HideTaskManagerViews() { | 89 void HideTaskManagerViews() { |
67 task_manager::TaskManagerView::Hide(); | 90 task_manager::TaskManagerView::Hide(); |
68 } | 91 } |
69 | 92 |
70 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, | 93 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, |
71 ContentSettingBubbleModel* model, | 94 ContentSettingBubbleModel* model, |
72 content::WebContents* web_contents, | 95 content::WebContents* web_contents, |
73 const gfx::Point& anchor) { | 96 const gfx::Point& anchor) { |
74 ContentSettingBubbleContents* contents = | 97 ContentSettingBubbleContents* contents = |
75 new ContentSettingBubbleContents(model, web_contents, nullptr, | 98 new ContentSettingBubbleContents(model, web_contents, nullptr, |
76 views::BubbleBorder::Arrow::TOP_RIGHT); | 99 views::BubbleBorder::Arrow::TOP_RIGHT); |
77 contents->set_parent_window(parent_view); | 100 contents->set_parent_window(parent_view); |
78 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); | 101 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); |
79 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); | 102 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); |
80 } | 103 } |
81 | 104 |
82 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) { | 105 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) { |
83 UpdateRecommendedMessageBox::Show(parent); | 106 UpdateRecommendedMessageBox::Show(parent); |
84 } | 107 } |
85 | 108 |
86 } // namespace chrome | 109 } // namespace chrome |
OLD | NEW |