Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: chrome/browser/ui/views/browser_dialogs_views_mac.cc

Issue 2834493007: MacViews: Allows the toolkit-views Zoom Dialog to be used (Closed)
Patch Set: MacViews: Allows the toolkit-views Zoom Dialog to be used (keep anchoring) Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/views/bookmarks/bookmark_bubble_view.h" 11 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
11 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" 12 #include "chrome/browser/ui/views/content_setting_bubble_contents.h"
13 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h"
12 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" 14 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h"
13 #include "chrome/browser/ui/views/task_manager_view.h" 15 #include "chrome/browser/ui/views/task_manager_view.h"
14 #include "chrome/browser/ui/views/update_recommended_message_box.h" 16 #include "chrome/browser/ui/views/update_recommended_message_box.h"
15 17
16 // This file provides definitions of desktop browser dialog-creation methods for 18 // 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 19 // 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 20 // 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 21 // runtime whether to show a Cocoa dialog, or the toolkit-views dialog defined
20 // here (declared in browser_dialogs.h). 22 // here (declared in browser_dialogs.h).
21 23
(...skipping 30 matching lines...) Expand all
52 bool already_bookmarked) { 54 bool already_bookmarked) {
53 // The Views dialog may prompt for sign in. 55 // The Views dialog may prompt for sign in.
54 std::unique_ptr<BubbleSyncPromoDelegate> delegate( 56 std::unique_ptr<BubbleSyncPromoDelegate> delegate(
55 new BookmarkBubbleSignInDelegate(browser)); 57 new BookmarkBubbleSignInDelegate(browser));
56 58
57 BookmarkBubbleView::ShowBubble( 59 BookmarkBubbleView::ShowBubble(
58 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer, 60 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer,
59 std::move(delegate), browser->profile(), virtual_url, already_bookmarked); 61 std::move(delegate), browser->profile(), virtual_url, already_bookmarked);
60 } 62 }
61 63
64 void ShowZoomBubbleViewsAtPoint(content::WebContents* web_contents,
65 const gfx::Point& anchor_point,
66 bool user_action) {
67 ZoomBubbleView::ShowBubble(web_contents, anchor_point,
68 user_action
69 ? LocationBarBubbleDelegateView::USER_GESTURE
70 : LocationBarBubbleDelegateView::AUTOMATIC);
71 if (ZoomBubbleView::GetZoomBubble())
72 KeepBubbleAnchored(ZoomBubbleView::GetZoomBubble());
73 }
74
75 void CloseZoomBubbleViews() {
76 ZoomBubbleView::CloseCurrentBubble();
77 }
78
79 void RefreshZoomBubbleViews() {
80 if (ZoomBubbleView::GetZoomBubble())
81 ZoomBubbleView::GetZoomBubble()->Refresh();
82 }
83
84 bool IsZoomBubbleViewsShown() {
85 return ZoomBubbleView::GetZoomBubble() != nullptr;
86 }
87
62 task_manager::TaskManagerTableModel* ShowTaskManagerViews(Browser* browser) { 88 task_manager::TaskManagerTableModel* ShowTaskManagerViews(Browser* browser) {
63 return task_manager::TaskManagerView::Show(browser); 89 return task_manager::TaskManagerView::Show(browser);
64 } 90 }
65 91
66 void HideTaskManagerViews() { 92 void HideTaskManagerViews() {
67 task_manager::TaskManagerView::Hide(); 93 task_manager::TaskManagerView::Hide();
68 } 94 }
69 95
70 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, 96 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view,
71 ContentSettingBubbleModel* model, 97 ContentSettingBubbleModel* model,
72 content::WebContents* web_contents, 98 content::WebContents* web_contents,
73 const gfx::Point& anchor) { 99 const gfx::Point& anchor) {
74 ContentSettingBubbleContents* contents = 100 ContentSettingBubbleContents* contents =
75 new ContentSettingBubbleContents(model, web_contents, nullptr, 101 new ContentSettingBubbleContents(model, web_contents, nullptr,
76 views::BubbleBorder::Arrow::TOP_RIGHT); 102 views::BubbleBorder::Arrow::TOP_RIGHT);
77 contents->set_parent_window(parent_view); 103 contents->set_parent_window(parent_view);
78 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); 104 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size()));
79 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); 105 views::BubbleDialogDelegateView::CreateBubble(contents)->Show();
80 } 106 }
81 107
82 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) { 108 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) {
83 UpdateRecommendedMessageBox::Show(parent); 109 UpdateRecommendedMessageBox::Show(parent);
84 } 110 }
85 111
86 } // namespace chrome 112 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698