diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/platform_util.h | 5 | ||||
-rw-r--r-- | chrome/browser/platform_util_aura.cc | 5 | ||||
-rw-r--r-- | chrome/browser/platform_util_mac.mm | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/chrome_constrained_window_views_client.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/chrome_constrained_window_views_client_mac.cc | 12 | ||||
-rw-r--r-- | chrome/chrome_browser_ui.gypi | 5 |
6 files changed, 23 insertions, 16 deletions
diff --git a/chrome/browser/platform_util.h b/chrome/browser/platform_util.h index 916f3a3..3e93469 100644 --- a/chrome/browser/platform_util.h +++ b/chrome/browser/platform_util.h @@ -37,6 +37,11 @@ void OpenExternal(Profile* profile, const GURL& url); // Get the top level window for the native view. This can return NULL. gfx::NativeWindow GetTopLevel(gfx::NativeView view); +// Returns a NativeView handle for parenting dialogs off |window|. This can be +// used to position a dialog using a NativeWindow, when a NativeView (e.g. +// browser tab) isn't available. +gfx::NativeView GetViewForWindow(gfx::NativeWindow window); + // Get the direct parent of |view|, may return NULL. gfx::NativeView GetParent(gfx::NativeView view); diff --git a/chrome/browser/platform_util_aura.cc b/chrome/browser/platform_util_aura.cc index c56591f..db3a343 100644 --- a/chrome/browser/platform_util_aura.cc +++ b/chrome/browser/platform_util_aura.cc @@ -17,6 +17,11 @@ gfx::NativeWindow GetTopLevel(gfx::NativeView view) { return view->GetToplevelWindow(); } +gfx::NativeView GetViewForWindow(gfx::NativeWindow window) { + DCHECK(window); + return window; +} + gfx::NativeView GetParent(gfx::NativeView view) { return view->parent(); } diff --git a/chrome/browser/platform_util_mac.mm b/chrome/browser/platform_util_mac.mm index ef5fbe7..15622f1 100644 --- a/chrome/browser/platform_util_mac.mm +++ b/chrome/browser/platform_util_mac.mm @@ -149,6 +149,12 @@ gfx::NativeWindow GetTopLevel(gfx::NativeView view) { return [view window]; } +gfx::NativeView GetViewForWindow(gfx::NativeWindow window) { + DCHECK(window); + DCHECK([window contentView]); + return [window contentView]; +} + gfx::NativeView GetParent(gfx::NativeView view) { return nil; } diff --git a/chrome/browser/ui/views/chrome_constrained_window_views_client.cc b/chrome/browser/ui/views/chrome_constrained_window_views_client.cc index c286b3e4..7575b14 100644 --- a/chrome/browser/ui/views/chrome_constrained_window_views_client.cc +++ b/chrome/browser/ui/views/chrome_constrained_window_views_client.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" +#include "chrome/browser/platform_util.h" #include "chrome/browser/ui/browser_finder.h" #include "components/web_modal/web_contents_modal_dialog_host.h" #include "extensions/browser/guest_view/guest_view_base.h" @@ -26,7 +27,7 @@ class ChromeConstrainedWindowViewsClient guest_view->embedder_web_contents() : initiator_web_contents; } web_modal::ModalDialogHost* GetModalDialogHost( - gfx::NativeView parent) override { + gfx::NativeWindow parent) override { // Get the browser dialog management and hosting components from |parent|. Browser* browser = chrome::FindBrowserWithWindow(parent); if (browser) { @@ -35,6 +36,9 @@ class ChromeConstrainedWindowViewsClient } return nullptr; } + gfx::NativeView GetDialogHostView(gfx::NativeWindow parent) override { + return platform_util::GetViewForWindow(parent); + } DISALLOW_COPY_AND_ASSIGN(ChromeConstrainedWindowViewsClient); }; diff --git a/chrome/browser/ui/views/chrome_constrained_window_views_client_mac.cc b/chrome/browser/ui/views/chrome_constrained_window_views_client_mac.cc deleted file mode 100644 index 142f45f..0000000 --- a/chrome/browser/ui/views/chrome_constrained_window_views_client_mac.cc +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" - -scoped_ptr<ConstrainedWindowViewsClient> -CreateChromeConstrainedWindowViewsClient() { - // Mac toolkit-views doesn't use constrained windows yet. - // TODO(tapted): Delete this file when it does. - return nullptr; -} diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 521aeed..9a6c69a 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -1928,8 +1928,6 @@ 'browser/ui/views/bookmarks/bookmark_sync_promo_view.cc', 'browser/ui/views/bookmarks/bookmark_sync_promo_view.h', 'browser/ui/views/certificate_viewer_win.cc', - 'browser/ui/views/chrome_constrained_window_views_client.cc', - 'browser/ui/views/chrome_constrained_window_views_client.h', 'browser/ui/views/chrome_javascript_native_dialog_factory_views.cc', 'browser/ui/views/chrome_views_delegate_chromeos.cc', 'browser/ui/views/chrome_web_dialog_view.cc', @@ -2243,7 +2241,8 @@ 'browser/ui/views/accessibility/accessibility_event_router_views.h', 'browser/ui/views/chrome_browser_main_extra_parts_views.cc', 'browser/ui/views/chrome_browser_main_extra_parts_views.h', - 'browser/ui/views/chrome_constrained_window_views_client_mac.cc', + 'browser/ui/views/chrome_constrained_window_views_client.cc', + 'browser/ui/views/chrome_constrained_window_views_client.h', 'browser/ui/views/chrome_views_delegate.cc', 'browser/ui/views/chrome_views_delegate.h', 'browser/ui/views/find_bar_host.cc', |