| 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/ui/views/tab_dialogs_views.h" |
| 6 |
| 7 #import <Cocoa/Cocoa.h> |
| 8 |
| 9 #include "chrome/browser/ui/cocoa/tab_dialogs_cocoa.h" |
| 10 #include "content/public/browser/web_contents.h" |
| 11 |
| 12 namespace { |
| 13 |
| 14 // Implementation of TabDialogs interface for toolkit-views dialogs on Mac. |
| 15 class TabDialogsViewsMac : public TabDialogsViews { |
| 16 public: |
| 17 explicit TabDialogsViewsMac(content::WebContents* contents); |
| 18 ~TabDialogsViewsMac() override {} |
| 19 |
| 20 // TabDialogs: |
| 21 gfx::NativeView GetDialogParentView() const override; |
| 22 |
| 23 private: |
| 24 DISALLOW_COPY_AND_ASSIGN(TabDialogsViewsMac); |
| 25 }; |
| 26 |
| 27 TabDialogsViewsMac::TabDialogsViewsMac(content::WebContents* contents) |
| 28 : TabDialogsViews(contents) {} |
| 29 |
| 30 // The browser is still Cocoa, so this matches TabDialogsCocoa. |
| 31 gfx::NativeView TabDialogsViewsMac::GetDialogParentView() const { |
| 32 // View hierarchy of the contents view: |
| 33 // NSView -- switchView, same for all tabs |
| 34 // +- TabContentsContainerView -- TabContentsController's view |
| 35 // +- WebContentsViewCocoa |
| 36 // |
| 37 // Changing it? Do not forget to modify |
| 38 // -[TabStripController swapInTabAtIndex:] too. |
| 39 return [web_contents()->GetNativeView() superview]; |
| 40 } |
| 41 |
| 42 } // namespace |
| 43 |
| 44 // static |
| 45 TabDialogs* TabDialogsCocoa::CreateTabDialogsViewsMac( |
| 46 content::WebContents* contents) { |
| 47 return new TabDialogsViewsMac(contents); |
| 48 } |
| OLD | NEW |