| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 "chrome/browser/platform_util.h" |
| 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/browser_window.h" |
| 8 #import "chrome/browser/ui/cocoa/global_error_bubble_controller.h" |
| 9 #include "chrome/browser/ui/views/global_error_bubble_view.h" |
| 10 #import "chrome/browser/ui/cocoa/bubble_anchor_helper_views.h" |
| 11 #import "ui/base/cocoa/cocoa_base_utils.h" |
| 12 #import "ui/gfx/mac/coordinate_conversion.h" |
| 13 |
| 14 GlobalErrorBubbleViewBase* ShowViewsGlobalErrorBubbleOnCocoaBrowser( |
| 15 NSPoint anchor, |
| 16 Browser* browser, |
| 17 const base::WeakPtr<GlobalErrorWithStandardBubble>& error) { |
| 18 gfx::Point anchor_point = |
| 19 gfx::ScreenPointFromNSPoint(ui::ConvertPointFromWindowToScreen( |
| 20 browser->window()->GetNativeWindow(), anchor)); |
| 21 gfx::NativeView parent = |
| 22 platform_util::GetViewForWindow(browser->window()->GetNativeWindow()); |
| 23 DCHECK(parent); |
| 24 |
| 25 GlobalErrorBubbleView* bubble_view = new GlobalErrorBubbleView( |
| 26 nullptr, anchor_point, views::BubbleBorder::TOP_RIGHT, browser, error); |
| 27 bubble_view->set_parent_window(parent); |
| 28 views::BubbleDialogDelegateView::CreateBubble(bubble_view); |
| 29 bubble_view->GetWidget()->Show(); |
| 30 KeepBubbleAnchored(bubble_view); |
| 31 return bubble_view; |
| 32 } |
| OLD | NEW |