OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_distiller.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_distiller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 printing::PrintPreviewDialogController* dialog_controller = | 250 printing::PrintPreviewDialogController* dialog_controller = |
251 printing::PrintPreviewDialogController::GetInstance(); | 251 printing::PrintPreviewDialogController::GetInstance(); |
252 if (!dialog_controller) | 252 if (!dialog_controller) |
253 return; | 253 return; |
254 | 254 |
255 dialog_controller->AddProxyDialogForWebContents(web_contents_.get(), | 255 dialog_controller->AddProxyDialogForWebContents(web_contents_.get(), |
256 source_web_contents); | 256 source_web_contents); |
257 } | 257 } |
258 | 258 |
259 PrintPreviewDistiller::~PrintPreviewDistiller() { | 259 PrintPreviewDistiller::~PrintPreviewDistiller() { |
260 if (web_contents_) { | 260 DCHECK(web_contents_); |
261 printing::PrintPreviewDialogController* dialog_controller = | |
262 printing::PrintPreviewDialogController::GetInstance(); | |
263 if (!dialog_controller) | |
264 return; | |
265 | 261 |
266 dialog_controller->RemoveProxyDialogForWebContents(web_contents_.get()); | 262 printing::PrintPreviewDialogController* dialog_controller = |
267 } | 263 printing::PrintPreviewDialogController::GetInstance(); |
| 264 if (!dialog_controller) |
| 265 return; |
| 266 |
| 267 dialog_controller->RemoveProxyDialogForWebContents(web_contents_.get()); |
268 } | 268 } |
269 | 269 |
270 WebContents* PrintPreviewDistiller::CreateWebContents( | 270 WebContents* PrintPreviewDistiller::CreateWebContents( |
271 SessionStorageNamespace* session_storage_namespace, | 271 SessionStorageNamespace* session_storage_namespace, |
272 WebContents* source_web_contents) { | 272 WebContents* source_web_contents) { |
273 // TODO(ajwong): Remove the temporary map once prerendering is aware of | 273 // TODO(ajwong): Remove the temporary map once prerendering is aware of |
274 // multiple session storage namespaces per tab. | 274 // multiple session storage namespaces per tab. |
275 content::SessionStorageNamespaceMap session_storage_namespace_map; | 275 content::SessionStorageNamespaceMap session_storage_namespace_map; |
276 Profile* profile = | 276 Profile* profile = |
277 Profile::FromBrowserContext(source_web_contents->GetBrowserContext()); | 277 Profile::FromBrowserContext(source_web_contents->GetBrowserContext()); |
278 session_storage_namespace_map[std::string()] = session_storage_namespace; | 278 session_storage_namespace_map[std::string()] = session_storage_namespace; |
279 return WebContents::CreateWithSessionStorage( | 279 return WebContents::CreateWithSessionStorage( |
280 WebContents::CreateParams(profile), session_storage_namespace_map); | 280 WebContents::CreateParams(profile), session_storage_namespace_map); |
281 } | 281 } |
OLD | NEW |