Commit 56986f93 authored by abodenha@chromium.org's avatar abodenha@chromium.org

Allow off the record dialogs

Modify dialog creation flow to allow an off the record profile to be used in an html dialog.  Fixes issues with cloud print where the signed-in state of the page and dialogs are out of sync.

Adds DCHECKS that fire if a non-modal dialog is created with an off the record profile.

This provides a temporary solution to sign-in issues on most platforms.  A longer term solution is in the works to eliminate our dependency on html dialog.

BUG=99271
TEST=


Review URL: http://codereview.chromium.org/8343043

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108027 0039d316-1c4b-4281-b951-d872f2087c98
parent b2a9bbd4
......@@ -78,8 +78,17 @@ namespace browser {
gfx::NativeWindow ShowHtmlDialog(gfx::NativeWindow parent, Profile* profile,
HtmlDialogUIDelegate* delegate) {
// It's not always safe to display an html dialog with an off the record
// profile. If the last browser with that profile is closed it will go
// away.
// On most platforms we insist on the dialog being modal if we're off the
// record to prevent that. That wont work on the Mac since we don't have
// modal dialogs.
// Fall back to the old (incorrect) behavior of grabbing the original
// profile.
// NOTE: Use the parent parameter once we implement modal dialogs.
return [HtmlDialogWindowController showHtmlDialog:delegate profile:profile];
return [HtmlDialogWindowController showHtmlDialog:delegate
profile:profile->GetOriginalProfile()];
}
} // namespace html_dialog_window_controller
......
......@@ -22,6 +22,10 @@ namespace browser {
gfx::NativeWindow ShowHtmlDialog(gfx::NativeWindow parent, Profile* profile,
HtmlDialogUIDelegate* delegate) {
// It's not always safe to display an html dialog with an off the record
// profile. If the last browser with that profile is closed it will go
// away.
DCHECK(!profile->IsOffTheRecord() || delegate->IsDialogModal());
HtmlDialogGtk* html_dialog =
new HtmlDialogGtk(profile, delegate, parent);
return html_dialog->InitDialog();
......
......@@ -7,6 +7,7 @@
#include <vector>
#include "base/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/views/window.h"
#include "content/browser/tab_contents/tab_contents.h"
......@@ -31,6 +32,10 @@ namespace browser {
gfx::NativeWindow ShowHtmlDialog(gfx::NativeWindow parent,
Profile* profile,
HtmlDialogUIDelegate* delegate) {
// It's not always safe to display an html dialog with an off the record
// profile. If the last browser with that profile is closed it will go
// away.
DCHECK(!profile->IsOffTheRecord() || delegate->IsDialogModal());
HtmlDialogView* html_view = new HtmlDialogView(profile, delegate);
browser::CreateViewsWindow(parent, html_view);
html_view->InitDialog();
......
......@@ -18,7 +18,7 @@
// profile that's long-lived? Of course, we'd still have to clear it out
// when all incognito browsers close.
HtmlDialogTabContentsDelegate::HtmlDialogTabContentsDelegate(Profile* profile)
: profile_(profile->GetOriginalProfile()) {}
: profile_(profile) {}
HtmlDialogTabContentsDelegate::~HtmlDialogTabContentsDelegate() {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment