OLD | NEW |
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/printing/print_preview_dialog_controller.h" | 5 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 119 } |
120 | 120 |
121 void PrintPreviewDialogDelegate::GetWebUIMessageHandlers( | 121 void PrintPreviewDialogDelegate::GetWebUIMessageHandlers( |
122 std::vector<WebUIMessageHandler*>* /* handlers */) const { | 122 std::vector<WebUIMessageHandler*>* /* handlers */) const { |
123 // PrintPreviewUI adds its own message handlers. | 123 // PrintPreviewUI adds its own message handlers. |
124 } | 124 } |
125 | 125 |
126 void PrintPreviewDialogDelegate::GetDialogSize(gfx::Size* size) const { | 126 void PrintPreviewDialogDelegate::GetDialogSize(gfx::Size* size) const { |
127 DCHECK(size); | 127 DCHECK(size); |
128 const gfx::Size kMinDialogSize(800, 480); | 128 const gfx::Size kMinDialogSize(800, 480); |
129 const int kBorder = 50; | 129 const int kBorder = 25; |
| 130 const int kConstrainedWindowOverlap = 3; |
130 gfx::Rect rect; | 131 gfx::Rect rect; |
131 initiator_tab_->GetView()->GetContainerBounds(&rect); | 132 initiator_tab_->GetView()->GetContainerBounds(&rect); |
132 size->set_width(std::max(rect.width(), kMinDialogSize.width()) - kBorder); | 133 size->set_width(std::max(rect.width(), kMinDialogSize.width()) - 2 * kBorder); |
133 size->set_height(std::max(rect.height(), kMinDialogSize.height()) - kBorder); | 134 size->set_height(std::max(rect.height(), kMinDialogSize.height()) - kBorder + |
| 135 kConstrainedWindowOverlap); |
134 | 136 |
135 #if defined(OS_MACOSX) | 137 #if defined(OS_MACOSX) |
136 // Limit the maximum size on MacOS X. | 138 // Limit the maximum size on MacOS X. |
137 // http://crbug.com/105815 | 139 // http://crbug.com/105815 |
138 const gfx::Size kMaxDialogSize(1000, 660); | 140 const gfx::Size kMaxDialogSize(1000, 660); |
139 size->set_width(std::min(size->width(), kMaxDialogSize.width())); | 141 size->set_width(std::min(size->width(), kMaxDialogSize.width())); |
140 size->set_height(std::min(size->height(), kMaxDialogSize.height())); | 142 size->set_height(std::min(size->height(), kMaxDialogSize.height())); |
141 #endif | 143 #endif |
142 } | 144 } |
143 | 145 |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 PrintPreviewUI* print_preview_ui = | 513 PrintPreviewUI* print_preview_ui = |
512 static_cast<PrintPreviewUI*>(preview_dialog->GetWebUI()->GetController()); | 514 static_cast<PrintPreviewUI*>(preview_dialog->GetWebUI()->GetController()); |
513 if (print_preview_ui) | 515 if (print_preview_ui) |
514 print_preview_ui->OnPrintPreviewDialogDestroyed(); | 516 print_preview_ui->OnPrintPreviewDialogDestroyed(); |
515 | 517 |
516 preview_dialog_map_.erase(preview_dialog); | 518 preview_dialog_map_.erase(preview_dialog); |
517 RemoveObservers(preview_dialog); | 519 RemoveObservers(preview_dialog); |
518 } | 520 } |
519 | 521 |
520 } // namespace printing | 522 } // namespace printing |
OLD | NEW |