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/background_printing_manager.h" | 5 #include "chrome/browser/printing/background_printing_manager.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 if (preview_contents->GetBrowserContext() == browser_context) { | 106 if (preview_contents->GetBrowserContext() == browser_context) { |
107 preview_contents_to_delete.push_back(preview_contents); | 107 preview_contents_to_delete.push_back(preview_contents); |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 for (size_t i = 0; i < preview_contents_to_delete.size(); i++) { | 111 for (size_t i = 0; i < preview_contents_to_delete.size(); i++) { |
112 DeletePreviewContents(preview_contents_to_delete[i]); | 112 DeletePreviewContents(preview_contents_to_delete[i]); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
| 116 void BackgroundPrintingManager::OnPrintRequestCancelled( |
| 117 WebContents* preview_contents) { |
| 118 DeletePreviewContents(preview_contents); |
| 119 } |
| 120 |
116 void BackgroundPrintingManager::DeletePreviewContents( | 121 void BackgroundPrintingManager::DeletePreviewContents( |
117 WebContents* preview_contents) { | 122 WebContents* preview_contents) { |
118 auto i = printing_contents_map_.find(preview_contents); | 123 auto i = printing_contents_map_.find(preview_contents); |
119 if (i == printing_contents_map_.end()) { | 124 if (i == printing_contents_map_.end()) { |
120 // Everyone is racing to be the first to delete the |preview_contents|. If | 125 // Everyone is racing to be the first to delete the |preview_contents|. If |
121 // this case is hit, someone else won the race, so there is no need to | 126 // this case is hit, someone else won the race, so there is no need to |
122 // continue. <http://crbug.com/100806> | 127 // continue. <http://crbug.com/100806> |
123 return; | 128 return; |
124 } | 129 } |
125 | 130 |
(...skipping 15 matching lines...) Expand all Loading... |
141 | 146 |
142 return result; | 147 return result; |
143 } | 148 } |
144 | 149 |
145 bool BackgroundPrintingManager::HasPrintPreviewDialog( | 150 bool BackgroundPrintingManager::HasPrintPreviewDialog( |
146 WebContents* preview_dialog) { | 151 WebContents* preview_dialog) { |
147 return base::ContainsKey(printing_contents_map_, preview_dialog); | 152 return base::ContainsKey(printing_contents_map_, preview_dialog); |
148 } | 153 } |
149 | 154 |
150 } // namespace printing | 155 } // namespace printing |
OLD | NEW |