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

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: Fixes for tapted 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/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
21 // runtime whether to show a Cocoa dialog, or the toolkit-views dialog defined 22 // runtime whether to show a Cocoa dialog, or the toolkit-views dialog defined
22 // here (declared in browser_dialogs.h). 23 // here (declared in browser_dialogs.h).
23 24
24 namespace chrome { 25 namespace chrome {
25 26
26 void ShowPageInfoBubbleViewsAtPoint( 27 void ShowPageInfoBubbleViewsAtPoint(
27 const gfx::Point& anchor_point, 28 const gfx::Point& anchor_point,
28 Profile* profile, 29 Profile* profile,
29 content::WebContents* web_contents, 30 content::WebContents* web_contents,
30 const GURL& virtual_url, 31 const GURL& virtual_url,
31 const security_state::SecurityInfo& security_info) { 32 const security_state::SecurityInfo& security_info,
33 LocationBarDecoration* decoration) {
32 // Don't show the bubble again if it's already showing. A second click on the 34 // 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 35 // location icon in the omnibox will dismiss an open bubble. This behaviour is
34 // consistent with the non-Mac views implementation. 36 // consistent with the non-Mac views implementation.
35 // Note that when the browser is toolkit-views, IsBubbleShowing() is checked 37 // Note that when the browser is toolkit-views, IsBubbleShowing() is checked
36 // earlier because the bubble is shown on mouse release (but dismissed on 38 // 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 39 // mouse pressed). A Cocoa browser does both on mouse pressed, so a check
38 // when showing is sufficient. 40 // when showing is sufficient.
39 if (PageInfoBubbleView::GetShownBubbleType() != 41 if (PageInfoBubbleView::GetShownBubbleType() !=
40 PageInfoBubbleView::BUBBLE_NONE) { 42 PageInfoBubbleView::BUBBLE_NONE) {
41 return; 43 return;
42 } 44 }
43 45
44 PageInfoBubbleView::ShowBubble(nullptr, gfx::Rect(anchor_point, gfx::Size()), 46 views::BubbleDialogDelegateView* bubble = PageInfoBubbleView::ShowBubble(
45 profile, web_contents, virtual_url, 47 nullptr, gfx::Rect(anchor_point, gfx::Size()), profile, web_contents,
46 security_info); 48 virtual_url, security_info);
49 KeepBubbleAnchored(bubble, decoration);
47 } 50 }
48 51
49 void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point, 52 void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point,
50 gfx::NativeView parent, 53 gfx::NativeView parent,
51 bookmarks::BookmarkBubbleObserver* observer, 54 bookmarks::BookmarkBubbleObserver* observer,
52 Browser* browser, 55 Browser* browser,
53 const GURL& virtual_url, 56 const GURL& virtual_url,
54 bool already_bookmarked) { 57 bool already_bookmarked,
58 LocationBarDecoration* decoration) {
55 // The Views dialog may prompt for sign in. 59 // The Views dialog may prompt for sign in.
56 std::unique_ptr<BubbleSyncPromoDelegate> delegate( 60 std::unique_ptr<BubbleSyncPromoDelegate> delegate(
57 new BookmarkBubbleSignInDelegate(browser)); 61 new BookmarkBubbleSignInDelegate(browser));
58 62
59 BookmarkBubbleView::ShowBubble( 63 BookmarkBubbleView::ShowBubble(
60 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer, 64 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer,
61 std::move(delegate), browser->profile(), virtual_url, already_bookmarked); 65 std::move(delegate), browser->profile(), virtual_url, already_bookmarked);
66
67 views::BubbleDialogDelegateView* bubble =
68 BookmarkBubbleView::bookmark_bubble();
69 KeepBubbleAnchored(bubble, decoration);
62 } 70 }
63 71
64 void ShowZoomBubbleViewsAtPoint(content::WebContents* web_contents, 72 void ShowZoomBubbleViewsAtPoint(content::WebContents* web_contents,
65 const gfx::Point& anchor_point, 73 const gfx::Point& anchor_point,
66 bool user_action) { 74 bool user_action) {
67 ZoomBubbleView::ShowBubble(web_contents, anchor_point, 75 ZoomBubbleView::ShowBubble(web_contents, anchor_point,
68 user_action 76 user_action
69 ? LocationBarBubbleDelegateView::USER_GESTURE 77 ? LocationBarBubbleDelegateView::USER_GESTURE
70 : LocationBarBubbleDelegateView::AUTOMATIC); 78 : LocationBarBubbleDelegateView::AUTOMATIC);
71 if (ZoomBubbleView::GetZoomBubble()) 79 if (ZoomBubbleView::GetZoomBubble())
(...skipping 17 matching lines...) Expand all
89 return task_manager::TaskManagerView::Show(browser); 97 return task_manager::TaskManagerView::Show(browser);
90 } 98 }
91 99
92 void HideTaskManagerViews() { 100 void HideTaskManagerViews() {
93 task_manager::TaskManagerView::Hide(); 101 task_manager::TaskManagerView::Hide();
94 } 102 }
95 103
96 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, 104 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view,
97 ContentSettingBubbleModel* model, 105 ContentSettingBubbleModel* model,
98 content::WebContents* web_contents, 106 content::WebContents* web_contents,
99 const gfx::Point& anchor) { 107 const gfx::Point& anchor,
108 LocationBarDecoration* decoration) {
100 ContentSettingBubbleContents* contents = 109 ContentSettingBubbleContents* contents =
101 new ContentSettingBubbleContents(model, web_contents, nullptr, 110 new ContentSettingBubbleContents(model, web_contents, nullptr,
102 views::BubbleBorder::Arrow::TOP_RIGHT); 111 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

Powered by Google App Engine
This is Rietveld 408576698