| 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/new_task_manager_view.h" | 12 #include "chrome/browser/ui/views/new_task_manager_view.h" |
| 13 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" | 13 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" |
| 14 | 14 |
| 15 // This file provides definitions of desktop browser dialog-creation methods for | 15 // This file provides definitions of desktop browser dialog-creation methods for |
| 16 // Mac where a Cocoa browser is using Views dialogs. I.e. it is included in the | 16 // Mac where a Cocoa browser is using Views dialogs. I.e. it is included in the |
| 17 // Cocoa build and definitions under chrome/browser/ui/cocoa may select at | 17 // Cocoa build and definitions under chrome/browser/ui/cocoa may select at |
| 18 // runtime whether to show a Cocoa dialog, or the toolkit-views dialog defined | 18 // runtime whether to show a Cocoa dialog, or the toolkit-views dialog defined |
| 19 // here (declared in browser_dialogs.h). | 19 // here (declared in browser_dialogs.h). |
| 20 | 20 |
| 21 namespace chrome { | 21 namespace chrome { |
| 22 | 22 |
| 23 void ShowWebsiteSettingsBubbleViewsAtPoint( | 23 void ShowWebsiteSettingsBubbleViewsAtPoint( |
| 24 const gfx::Point& anchor_point, | 24 const gfx::Point& anchor_point, |
| 25 Profile* profile, | 25 Profile* profile, |
| 26 content::WebContents* web_contents, | 26 content::WebContents* web_contents, |
| 27 const GURL& url, | 27 const GURL& virtual_url, |
| 28 const security_state::SecurityStateModel::SecurityInfo& security_info) { | 28 const security_state::SecurityStateModel::SecurityInfo& security_info) { |
| 29 WebsiteSettingsPopupView::ShowPopup( | 29 WebsiteSettingsPopupView::ShowPopup( |
| 30 nullptr, gfx::Rect(anchor_point, gfx::Size()), profile, web_contents, url, | 30 nullptr, gfx::Rect(anchor_point, gfx::Size()), profile, web_contents, |
| 31 security_info); | 31 virtual_url, security_info); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point, | 34 void ShowBookmarkBubbleViewsAtPoint(const gfx::Point& anchor_point, |
| 35 gfx::NativeView parent, | 35 gfx::NativeView parent, |
| 36 bookmarks::BookmarkBubbleObserver* observer, | 36 bookmarks::BookmarkBubbleObserver* observer, |
| 37 Browser* browser, | 37 Browser* browser, |
| 38 const GURL& url, | 38 const GURL& virtual_url, |
| 39 bool already_bookmarked) { | 39 bool already_bookmarked) { |
| 40 // The Views dialog may prompt for sign in. | 40 // The Views dialog may prompt for sign in. |
| 41 std::unique_ptr<BubbleSyncPromoDelegate> delegate( | 41 std::unique_ptr<BubbleSyncPromoDelegate> delegate( |
| 42 new BookmarkBubbleSignInDelegate(browser)); | 42 new BookmarkBubbleSignInDelegate(browser)); |
| 43 | 43 |
| 44 BookmarkBubbleView::ShowBubble(nullptr, gfx::Rect(anchor_point, gfx::Size()), | 44 BookmarkBubbleView::ShowBubble( |
| 45 parent, observer, std::move(delegate), | 45 nullptr, gfx::Rect(anchor_point, gfx::Size()), parent, observer, |
| 46 browser->profile(), url, already_bookmarked); | 46 std::move(delegate), browser->profile(), virtual_url, already_bookmarked); |
| 47 } | 47 } |
| 48 | 48 |
| 49 ui::TableModel* ShowTaskManagerViews(Browser* browser) { | 49 ui::TableModel* ShowTaskManagerViews(Browser* browser) { |
| 50 // On platforms other than Mac, the new task manager is shown unless | 50 // On platforms other than Mac, the new task manager is shown unless |
| 51 // explicitly disabled. Assume that running with ToolkitViewsDialogsEnabled() | 51 // explicitly disabled. Assume that running with ToolkitViewsDialogsEnabled() |
| 52 // on Mac also means the new task manager is desired. | 52 // on Mac also means the new task manager is desired. |
| 53 return task_management::NewTaskManagerView::Show(browser); | 53 return task_management::NewTaskManagerView::Show(browser); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void HideTaskManagerViews() { | 56 void HideTaskManagerViews() { |
| 57 task_management::NewTaskManagerView::Hide(); | 57 task_management::NewTaskManagerView::Hide(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, | 60 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, |
| 61 ContentSettingBubbleModel* model, | 61 ContentSettingBubbleModel* model, |
| 62 content::WebContents* web_contents, | 62 content::WebContents* web_contents, |
| 63 const gfx::Point& anchor) { | 63 const gfx::Point& anchor) { |
| 64 ContentSettingBubbleContents* contents = | 64 ContentSettingBubbleContents* contents = |
| 65 new ContentSettingBubbleContents(model, web_contents, nullptr, | 65 new ContentSettingBubbleContents(model, web_contents, nullptr, |
| 66 views::BubbleBorder::Arrow::TOP_RIGHT); | 66 views::BubbleBorder::Arrow::TOP_RIGHT); |
| 67 contents->set_parent_window(parent_view); | 67 contents->set_parent_window(parent_view); |
| 68 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); | 68 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); |
| 69 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); | 69 views::BubbleDialogDelegateView::CreateBubble(contents)->Show(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace chrome | 72 } // namespace chrome |
| OLD | NEW |