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

Side by Side Diff: chrome/browser/ui/cocoa/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
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/browser_dialogs_views_mac.h"
10 #include "chrome/browser/ui/cocoa/bubble_anchor_helper_views.h" 11 #include "chrome/browser/ui/cocoa/bubble_anchor_helper_views.h"
12 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
11 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" 13 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
12 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" 14 #include "chrome/browser/ui/views/content_setting_bubble_contents.h"
13 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" 15 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h"
14 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" 16 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h"
15 #include "chrome/browser/ui/views/task_manager_view.h" 17 #include "chrome/browser/ui/views/task_manager_view.h"
16 #include "chrome/browser/ui/views/update_recommended_message_box.h" 18 #include "chrome/browser/ui/views/update_recommended_message_box.h"
17 19
18 // This file provides definitions of desktop browser dialog-creation methods for 20 // 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 21 // 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 22 // 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 23 // runtime whether to show a Cocoa dialog, or the toolkit-views dialog defined
22 // here (declared in browser_dialogs.h). 24 // here (declared in browser_dialogs.h).
23 25
24 namespace chrome { 26 namespace chrome {
25 27
26 void ShowPageInfoBubbleViewsAtPoint( 28 void ShowPageInfoBubbleViewsAtPoint(
27 const gfx::Point& anchor_point, 29 const gfx::Point& anchor_point,
28 Profile* profile, 30 Profile* profile,
29 content::WebContents* web_contents, 31 content::WebContents* web_contents,
30 const GURL& virtual_url, 32 const GURL& virtual_url,
31 const security_state::SecurityInfo& security_info) { 33 const security_state::SecurityInfo& security_info,
34 LocationBarDecoration* decoration) {
32 // Don't show the bubble again if it's already showing. A second click on the 35 // 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 36 // location icon in the omnibox will dismiss an open bubble. This behaviour is
34 // consistent with the non-Mac views implementation. 37 // consistent with the non-Mac views implementation.
35 // Note that when the browser is toolkit-views, IsBubbleShowing() is checked 38 // Note that when the browser is toolkit-views, IsBubbleShowing() is checked
36 // earlier because the bubble is shown on mouse release (but dismissed on 39 // 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 40 // mouse pressed). A Cocoa browser does both on mouse pressed, so a check
38 // when showing is sufficient. 41 // when showing is sufficient.
39 if (PageInfoBubbleView::GetShownBubbleType() != 42 if (PageInfoBubbleView::GetShownBubbleType() !=
40 PageInfoBubbleView::BUBBLE_NONE) { 43 PageInfoBubbleView::BUBBLE_NONE) {
41 return; 44 return;
42 } 45 }
43 46
44 PageInfoBubbleView::ShowBubble(nullptr, nullptr, 47 views::BubbleDialogDelegateView* bubble = PageInfoBubbleView::ShowBubble(
45 gfx::Rect(anchor_point, gfx::Size()), profile, 48 nullptr, nullptr, gfx::Rect(anchor_point, gfx::Size()), profile,
46 web_contents, virtual_url, security_info); 49 web_contents, virtual_url, security_info);
50 KeepBubbleAnchored(bubble, decoration);
47 } 51 }
48 52
49 void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point, 53 void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point,
50 gfx::NativeView parent, 54 gfx::NativeView parent,
51 bookmarks::BookmarkBubbleObserver* observer, 55 bookmarks::BookmarkBubbleObserver* observer,
52 Browser* browser, 56 Browser* browser,
53 const GURL& virtual_url, 57 const GURL& virtual_url,
54 bool already_bookmarked) { 58 bool already_bookmarked,
59 LocationBarDecoration* decoration) {
55 // The Views dialog may prompt for sign in. 60 // The Views dialog may prompt for sign in.
56 std::unique_ptr<BubbleSyncPromoDelegate> delegate( 61 std::unique_ptr<BubbleSyncPromoDelegate> delegate(
57 new BookmarkBubbleSignInDelegate(browser)); 62 new BookmarkBubbleSignInDelegate(browser));
58 63
59 BookmarkBubbleView::ShowBubble( 64 BookmarkBubbleView::ShowBubble(
60 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer, 65 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer,
61 std::move(delegate), browser->profile(), virtual_url, already_bookmarked); 66 std::move(delegate), browser->profile(), virtual_url, already_bookmarked);
67
68 views::BubbleDialogDelegateView* bubble =
69 BookmarkBubbleView::bookmark_bubble();
70 KeepBubbleAnchored(bubble, decoration);
62 } 71 }
63 72
64 void ShowZoomBubbleViewsAtPoint(content::WebContents* web_contents, 73 void ShowZoomBubbleViewsAtPoint(content::WebContents* web_contents,
65 const gfx::Point& anchor_point, 74 const gfx::Point& anchor_point,
66 bool user_action) { 75 bool user_action) {
67 ZoomBubbleView::ShowBubble(web_contents, anchor_point, 76 ZoomBubbleView::ShowBubble(web_contents, anchor_point,
68 user_action 77 user_action
69 ? LocationBarBubbleDelegateView::USER_GESTURE 78 ? LocationBarBubbleDelegateView::USER_GESTURE
70 : LocationBarBubbleDelegateView::AUTOMATIC); 79 : LocationBarBubbleDelegateView::AUTOMATIC);
71 if (ZoomBubbleView::GetZoomBubble()) 80 if (ZoomBubbleView::GetZoomBubble())
(...skipping 17 matching lines...) Expand all
89 return task_manager::TaskManagerView::Show(browser); 98 return task_manager::TaskManagerView::Show(browser);
90 } 99 }
91 100
92 void HideTaskManagerViews() { 101 void HideTaskManagerViews() {
93 task_manager::TaskManagerView::Hide(); 102 task_manager::TaskManagerView::Hide();
94 } 103 }
95 104
96 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, 105 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view,
97 ContentSettingBubbleModel* model, 106 ContentSettingBubbleModel* model,
98 content::WebContents* web_contents, 107 content::WebContents* web_contents,
99 const gfx::Point& anchor) { 108 const gfx::Point& anchor,
100 ContentSettingBubbleContents* contents = 109 LocationBarDecoration* decoration) {
101 new ContentSettingBubbleContents(model, web_contents, nullptr, 110 ContentSettingBubbleContents* contents = new ContentSettingBubbleContents(
102 views::BubbleBorder::Arrow::TOP_RIGHT); 111 model, web_contents, nullptr, views::BubbleBorder::Arrow::TOP_RIGHT);
103 contents->set_parent_window(parent_view); 112 contents->set_parent_window(parent_view);
104 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); 113 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size()));
105 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); 114 views::BubbleDialogDelegateView::CreateBubble(contents)->Show();
115 KeepBubbleAnchored(contents, decoration);
106 } 116 }
107 117
108 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) { 118 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) {
109 UpdateRecommendedMessageBox::Show(parent); 119 UpdateRecommendedMessageBox::Show(parent);
110 } 120 }
111 121
112 } // namespace chrome 122 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_dialogs_views_mac.h ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698