| 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/ui/webui/print_preview/print_preview_ui.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 PrintPreviewUI::PrintPreviewUI(content::WebUI* web_ui) | 341 PrintPreviewUI::PrintPreviewUI(content::WebUI* web_ui) |
| 342 : ConstrainedWebDialogUI(web_ui), | 342 : ConstrainedWebDialogUI(web_ui), |
| 343 initial_preview_start_time_(base::TimeTicks::Now()), | 343 initial_preview_start_time_(base::TimeTicks::Now()), |
| 344 id_(g_print_preview_ui_id_map.Get().Add(this)), | 344 id_(g_print_preview_ui_id_map.Get().Add(this)), |
| 345 handler_(NULL), | 345 handler_(NULL), |
| 346 source_is_modifiable_(true), | 346 source_is_modifiable_(true), |
| 347 dialog_closed_(false) { | 347 dialog_closed_(false) { |
| 348 // Set up the chrome://print/ data source. | 348 // Set up the chrome://print/ data source. |
| 349 Profile* profile = Profile::FromWebUI(web_ui); | 349 Profile* profile = Profile::FromWebUI(web_ui); |
| 350 ChromeURLDataManager::AddDataSource(profile, CreatePrintPreviewUISource()); | 350 ChromeURLDataManager::AddDataSourceImpl(profile, |
| 351 CreatePrintPreviewUISource()); |
| 351 | 352 |
| 352 // Set up the chrome://theme/ source. | 353 // Set up the chrome://theme/ source. |
| 353 ChromeURLDataManager::AddDataSource(profile, new ThemeSource(profile)); | 354 ChromeURLDataManager::AddDataSource(profile, new ThemeSource(profile)); |
| 354 | 355 |
| 355 // WebUI owns |handler_|. | 356 // WebUI owns |handler_|. |
| 356 handler_ = new PrintPreviewHandler(); | 357 handler_ = new PrintPreviewHandler(); |
| 357 web_ui->AddMessageHandler(handler_); | 358 web_ui->AddMessageHandler(handler_); |
| 358 | 359 |
| 359 g_print_preview_request_id_map.Get().Set(id_, -1); | 360 g_print_preview_request_id_map.Get().Set(id_, -1); |
| 360 } | 361 } |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 delegate->OnDialogCloseFromWebUI(); | 572 delegate->OnDialogCloseFromWebUI(); |
| 572 } | 573 } |
| 573 | 574 |
| 574 void PrintPreviewUI::OnReloadPrintersList() { | 575 void PrintPreviewUI::OnReloadPrintersList() { |
| 575 web_ui()->CallJavascriptFunction("reloadPrintersList"); | 576 web_ui()->CallJavascriptFunction("reloadPrintersList"); |
| 576 } | 577 } |
| 577 | 578 |
| 578 void PrintPreviewUI::OnPrintPreviewScalingDisabled() { | 579 void PrintPreviewUI::OnPrintPreviewScalingDisabled() { |
| 579 web_ui()->CallJavascriptFunction("printScalingDisabledForSourcePDF"); | 580 web_ui()->CallJavascriptFunction("printScalingDisabledForSourcePDF"); |
| 580 } | 581 } |
| OLD | NEW |