| 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/page_info/website_settings_popup_view.h" | 12 #include "chrome/browser/ui/views/page_info/page_info_popup_view.h" |
| 13 #include "chrome/browser/ui/views/task_manager_view.h" | 13 #include "chrome/browser/ui/views/task_manager_view.h" |
| 14 #include "chrome/browser/ui/views/update_recommended_message_box.h" | 14 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
| 15 | 15 |
| 16 // This file provides definitions of desktop browser dialog-creation methods for | 16 // 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 | 17 // 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 | 18 // 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 | 19 // runtime whether to show a Cocoa dialog, or the toolkit-views dialog defined |
| 20 // here (declared in browser_dialogs.h). | 20 // here (declared in browser_dialogs.h). |
| 21 | 21 |
| 22 namespace chrome { | 22 namespace chrome { |
| 23 | 23 |
| 24 void ShowWebsiteSettingsBubbleViewsAtPoint( | 24 void ShowPageInfoBubbleViewsAtPoint( |
| 25 const gfx::Point& anchor_point, | 25 const gfx::Point& anchor_point, |
| 26 Profile* profile, | 26 Profile* profile, |
| 27 content::WebContents* web_contents, | 27 content::WebContents* web_contents, |
| 28 const GURL& virtual_url, | 28 const GURL& virtual_url, |
| 29 const security_state::SecurityInfo& security_info) { | 29 const security_state::SecurityInfo& security_info) { |
| 30 // Don't show the bubble again if it's already showing. A second click on the | 30 // Don't show the bubble again if it's already showing. A second click on the |
| 31 // location icon in the omnibox will dismiss an open bubble. This behaviour is | 31 // location icon in the omnibox will dismiss an open bubble. This behaviour is |
| 32 // consistent with the non-Mac views implementation. | 32 // consistent with the non-Mac views implementation. |
| 33 // Note that when the browser is toolkit-views, IsPopupShowing() is checked | 33 // Note that when the browser is toolkit-views, IsPopupShowing() is checked |
| 34 // earlier because the popup is shown on mouse release (but dismissed on | 34 // earlier because the popup is shown on mouse release (but dismissed on |
| 35 // mouse pressed). A Cocoa browser does both on mouse pressed, so a check | 35 // mouse pressed). A Cocoa browser does both on mouse pressed, so a check |
| 36 // when showing is sufficient. | 36 // when showing is sufficient. |
| 37 if (WebsiteSettingsPopupView::GetShownPopupType() != | 37 if (PageInfoPopupView::GetShownPopupType() != PageInfoPopupView::POPUP_NONE) { |
| 38 WebsiteSettingsPopupView::POPUP_NONE) { | |
| 39 return; | 38 return; |
| 40 } | 39 } |
| 41 | 40 |
| 42 WebsiteSettingsPopupView::ShowPopup( | 41 PageInfoPopupView::ShowPopup(nullptr, gfx::Rect(anchor_point, gfx::Size()), |
| 43 nullptr, gfx::Rect(anchor_point, gfx::Size()), profile, web_contents, | 42 profile, web_contents, virtual_url, |
| 44 virtual_url, security_info); | 43 security_info); |
| 45 } | 44 } |
| 46 | 45 |
| 47 void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point, | 46 void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point, |
| 48 gfx::NativeView parent, | 47 gfx::NativeView parent, |
| 49 bookmarks::BookmarkBubbleObserver* observer, | 48 bookmarks::BookmarkBubbleObserver* observer, |
| 50 Browser* browser, | 49 Browser* browser, |
| 51 const GURL& virtual_url, | 50 const GURL& virtual_url, |
| 52 bool already_bookmarked) { | 51 bool already_bookmarked) { |
| 53 // The Views dialog may prompt for sign in. | 52 // The Views dialog may prompt for sign in. |
| 54 std::unique_ptr<BubbleSyncPromoDelegate> delegate( | 53 std::unique_ptr<BubbleSyncPromoDelegate> delegate( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 contents->set_parent_window(parent_view); | 76 contents->set_parent_window(parent_view); |
| 78 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); | 77 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); |
| 79 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); | 78 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); |
| 80 } | 79 } |
| 81 | 80 |
| 82 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) { | 81 void ShowUpdateChromeDialogViews(gfx::NativeWindow parent) { |
| 83 UpdateRecommendedMessageBox::Show(parent); | 82 UpdateRecommendedMessageBox::Show(parent); |
| 84 } | 83 } |
| 85 | 84 |
| 86 } // namespace chrome | 85 } // namespace chrome |
| OLD | NEW |