summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc19
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_setup_flow.h3
2 files changed, 17 insertions, 5 deletions
diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
index a8ebbbb..ba5d2de 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
@@ -57,7 +57,8 @@ string16& DoneIframeXPath() {
// static
CloudPrintSetupFlow* CloudPrintSetupFlow::OpenDialog(
- Profile* profile, const base::WeakPtr<Delegate>& delegate,
+ Profile* profile,
+ const base::WeakPtr<Delegate>& delegate,
gfx::NativeWindow parent_window) {
DCHECK(profile);
// Set the arguments for showing the gaia login page.
@@ -149,6 +150,17 @@ void CloudPrintSetupFlow::GetDialogSize(gfx::Size* size) const {
}
#if !defined(OS_WIN)
+ // NOTE(scottbyer):The following comment comes from
+ // SyncSetupFlow::GetDialogSize, where this hack was copied from. By starting
+ // off development of the UI on Windows, the hack is seemingly backwards.
+
+ // NOTE(akalin): This is a hack to work around a problem with font height on
+ // windows. Basically font metrics are incorrectly returned in logical units
+ // instead of pixels on Windows. Logical units are very commonly 96 DPI
+ // so our localized char/line counts are too small by a factor of 96/72.
+ // So we compensate for this on non-windows platform.
+
+ // TODO(scottbyer): Fix the root cause, kill the hacks.
float scale_hack = 96.f/72.f;
size->set_width(size->width() * scale_hack);
size->set_height(size->height() * scale_hack);
@@ -161,14 +173,13 @@ void CloudPrintSetupFlow::OnDialogClosed(const std::string& json_retval) {
if (authenticator_.get())
authenticator_->CancelRequest();
- if (delegate_) {
+ if (delegate_)
delegate_->OnDialogClosed();
- }
delete this;
}
std::string CloudPrintSetupFlow::GetDialogArgs() const {
- return dialog_start_args_;
+ return dialog_start_args_;
}
void CloudPrintSetupFlow::OnCloseContents(TabContents* source,
diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.h b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.h
index 5be3b31..7ecc50b 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.h
+++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.h
@@ -116,7 +116,8 @@ class CloudPrintSetupFlow : public HtmlDialogUIDelegate,
const string16& js);
// Pointer to the Web UI. This is provided by CloudPrintSetupMessageHandler
- // when attached.
+ // when attached. We do not own the pointer, instead WebUI owns it's delegate
+ // (us) and controls our lifetime.
WebUI* web_ui_;
// The args to pass to the initial page.