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

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

Issue 2882533003: [Mac] Hover/Active Omnibox Icon States for Secondary UI MD (Closed)
Patch Set: Rebased and applied tapted's changes Created 3 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <utility>
6
7 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_dialogs.h"
10 #include "chrome/browser/ui/cocoa/bubble_anchor_helper_views.h"
11 #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/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/task_manager_view.h"
16 #include "chrome/browser/ui/views/update_recommended_message_box.h"
17
18 // 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 // Cocoa build and definitions under chrome/browser/ui/cocoa may select at
21 // runtime whether to show a Cocoa dialog, or the toolkit-views dialog defined
22 // here (declared in browser_dialogs.h).
23
24 namespace chrome {
25
26 void ShowPageInfoBubbleViewsAtPoint(
27 const gfx::Point& anchor_point,
28 Profile* profile,
29 content::WebContents* web_contents,
30 const GURL& virtual_url,
31 const security_state::SecurityInfo& security_info) {
32 // Don't show the bubble again if it's already showing. A second click on the
33 // location icon in the omnibox will dismiss an open bubble. This behaviour is
34 // consistent with the non-Mac views implementation.
35 // 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 // mouse pressed). A Cocoa browser does both on mouse pressed, so a check
38 // when showing is sufficient.
39 if (PageInfoBubbleView::GetShownBubbleType() !=
40 PageInfoBubbleView::BUBBLE_NONE) {
41 return;
42 }
43
44 PageInfoBubbleView::ShowBubble(nullptr, nullptr,
45 gfx::Rect(anchor_point, gfx::Size()), profile,
46 web_contents, virtual_url, security_info);
47 }
48
49 void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point,
50 gfx::NativeView parent,
51 bookmarks::BookmarkBubbleObserver* observer,
52 Browser* browser,
53 const GURL& virtual_url,
54 bool already_bookmarked) {
55 // The Views dialog may prompt for sign in.
56 std::unique_ptr<BubbleSyncPromoDelegate> delegate(
57 new BookmarkBubbleSignInDelegate(browser));
58
59 BookmarkBubbleView::ShowBubble(
60 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer,
61 std::move(delegate), browser->profile(), virtual_url, already_bookmarked);
62 }
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
88 task_manager::TaskManagerTableModel* ShowTaskManagerViews(Browser* browser) {
89 return task_manager::TaskManagerView::Show(browser);
90 }
91
92 void HideTaskManagerViews() {
93 task_manager::TaskManagerView::Hide();
94 }
95
96 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view,
97 ContentSettingBubbleModel* model,
98 content::WebContents* web_contents,
99 const gfx::Point& anchor) {
100 ContentSettingBubbleContents* contents =
101 new ContentSettingBubbleContents(model, web_contents, nullptr,
102 views::BubbleBorder::Arrow::TOP_RIGHT);
103 contents->set_parent_window(parent_view);
104 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size()));
105 views::BubbleDialogDelegateView::CreateBubble(contents)->Show();
106 }
107
108 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) {
109 UpdateRecommendedMessageBox::Show(parent);
110 }
111
112 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tab_dialogs_views_mac.mm ('k') | chrome/browser/ui/views/page_info/page_info_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698