Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: chrome/browser/ui/web_contents_modal_dialog_manager.cc

Issue 12224020: Use gfx::NativeView rather than gfx::NativeWindow to identify web contents modal dialogs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/web_contents_modal_dialog_manager.h" 5 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
6 6
7 #include "chrome/browser/ui/web_contents_modal_dialog.h" 7 #include "chrome/browser/ui/web_contents_modal_dialog.h"
8 #include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h" 8 #include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "content/public/browser/navigation_details.h" 10 #include "content/public/browser/navigation_details.h"
11 #include "content/public/browser/navigation_entry.h" 11 #include "content/public/browser/navigation_entry.h"
12 #include "content/public/browser/render_view_host.h" 12 #include "content/public/browser/render_view_host.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 14 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
15 15
16 using content::WebContents; 16 using content::WebContents;
17 17
18 DEFINE_WEB_CONTENTS_USER_DATA_KEY(WebContentsModalDialogManager); 18 DEFINE_WEB_CONTENTS_USER_DATA_KEY(WebContentsModalDialogManager);
19 19
20 WebContentsModalDialogManager::~WebContentsModalDialogManager() { 20 WebContentsModalDialogManager::~WebContentsModalDialogManager() {
21 DCHECK(child_dialogs_.empty()); 21 DCHECK(child_dialogs_.empty());
22 } 22 }
23 23
24 void WebContentsModalDialogManager::AddDialog( 24 void WebContentsModalDialogManager::AddDialog(
25 WebContentsModalDialog* dialog) { 25 WebContentsModalDialog* dialog) {
26 child_dialogs_.push_back(dialog); 26 child_dialogs_.push_back(dialog);
27 27
28 if (native_manager_) 28 if (native_manager_)
29 native_manager_->ManageDialog(dialog->GetNativeWindow()); 29 native_manager_->ManageDialog(dialog->GetNativeView());
30 30
31 if (child_dialogs_.size() == 1) { 31 if (child_dialogs_.size() == 1) {
32 dialog->ShowWebContentsModalDialog(); 32 dialog->ShowWebContentsModalDialog();
33 BlockWebContentsInteraction(true); 33 BlockWebContentsInteraction(true);
34 } 34 }
35 } 35 }
36 36
37 void WebContentsModalDialogManager::WillClose(WebContentsModalDialog* dialog) { 37 void WebContentsModalDialogManager::WillClose(WebContentsModalDialog* dialog) {
38 WebContentsModalDialogList::iterator i( 38 WebContentsModalDialogList::iterator i(
39 std::find(child_dialogs_.begin(), child_dialogs_.end(), dialog)); 39 std::find(child_dialogs_.begin(), child_dialogs_.end(), dialog));
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 } 119 }
120 120
121 void WebContentsModalDialogManager::WebContentsDestroyed(WebContents* tab) { 121 void WebContentsModalDialogManager::WebContentsDestroyed(WebContents* tab) {
122 // First cleanly close all child dialogs. 122 // First cleanly close all child dialogs.
123 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked 123 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked
124 // some of these to close. CloseAllDialogs is async, so it might get called 124 // some of these to close. CloseAllDialogs is async, so it might get called
125 // twice before it runs. 125 // twice before it runs.
126 CloseAllDialogs(); 126 CloseAllDialogs();
127 } 127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698