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

Side by Side Diff: chrome/browser/ui/webui/web_dialog_controller.cc

Issue 10353007: Extract a minimal subset of WebDialogUI/WebDialogDelegate from src/chrome -> src/ui/web_dialogs Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 7 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/webui/web_dialog_controller.h" 5 #include "chrome/browser/ui/webui/web_dialog_controller.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/common/chrome_notification_types.h" 9 #include "chrome/common/chrome_notification_types.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
11 #include "content/public/browser/notification_source.h" 11 #include "content/public/browser/notification_source.h"
12 12
13 WebDialogController::WebDialogController( 13 WebDialogController::WebDialogController(
14 WebDialogDelegate* delegate, 14 views::WebDialogDelegate* delegate,
15 Profile* profile, 15 Profile* profile,
16 Browser* browser) 16 Browser* browser)
17 : dialog_delegate_(delegate) { 17 : dialog_delegate_(delegate) {
18 // It's only safe to show an off the record profile under one of two 18 // It's only safe to show an off the record profile under one of two
19 // circumstances: 19 // circumstances:
20 // 1. For a modal dialog where the parent will maintain the profile. 20 // 1. For a modal dialog where the parent will maintain the profile.
21 // 2. If we have a browser which will keep the reference to this profile 21 // 2. If we have a browser which will keep the reference to this profile
22 // alive. The dialog will be closed if this browser is closed. 22 // alive. The dialog will be closed if this browser is closed.
23 DCHECK(!profile->IsOffTheRecord() || 23 DCHECK(!profile->IsOffTheRecord() ||
24 delegate->GetDialogModalType() != ui::MODAL_TYPE_NONE || 24 delegate->GetDialogModalType() != ui::MODAL_TYPE_NONE ||
(...skipping 11 matching lines...) Expand all
36 void WebDialogController::Observe( 36 void WebDialogController::Observe(
37 int type, 37 int type,
38 const content::NotificationSource& source, 38 const content::NotificationSource& source,
39 const content::NotificationDetails& details) { 39 const content::NotificationDetails& details) {
40 DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSING); 40 DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSING);
41 41
42 // If the browser creating this dialog is closed, close the dialog to prevent 42 // If the browser creating this dialog is closed, close the dialog to prevent
43 // using potentially destroyed profiles. 43 // using potentially destroyed profiles.
44 dialog_delegate_->OnDialogClosed(std::string()); 44 dialog_delegate_->OnDialogClosed(std::string());
45 } 45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698