OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ui.h" | 5 #include "chrome/browser/ui/webui/print_preview_ui.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 private: | 56 private: |
57 typedef std::map<std::string, int> PrintPreviewRequestIdMap; | 57 typedef std::map<std::string, int> PrintPreviewRequestIdMap; |
58 | 58 |
59 PrintPreviewRequestIdMap map_; | 59 PrintPreviewRequestIdMap map_; |
60 base::Lock lock_; | 60 base::Lock lock_; |
61 }; | 61 }; |
62 | 62 |
63 // Written to on the UI thread, read from any thread. | 63 // Written to on the UI thread, read from any thread. |
64 base::LazyInstance<PrintPreviewRequestIdMapWithLock> | 64 base::LazyInstance<PrintPreviewRequestIdMapWithLock> |
65 g_print_preview_request_id_map(base::LINKER_INITIALIZED); | 65 g_print_preview_request_id_map = LAZY_INSTANCE_INITIALIZER; |
66 | 66 |
67 } // namespace | 67 } // namespace |
68 | 68 |
69 PrintPreviewUI::PrintPreviewUI(TabContents* contents) | 69 PrintPreviewUI::PrintPreviewUI(TabContents* contents) |
70 : ChromeWebUI(contents), | 70 : ChromeWebUI(contents), |
71 initial_preview_start_time_(base::TimeTicks::Now()) { | 71 initial_preview_start_time_(base::TimeTicks::Now()) { |
72 // WebUI owns |handler_|. | 72 // WebUI owns |handler_|. |
73 handler_ = new PrintPreviewHandler(); | 73 handler_ = new PrintPreviewHandler(); |
74 AddMessageHandler(handler_->Attach(this)); | 74 AddMessageHandler(handler_->Attach(this)); |
75 | 75 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 CallJavascriptFunction("printPreviewFailed"); | 238 CallJavascriptFunction("printPreviewFailed"); |
239 } | 239 } |
240 | 240 |
241 void PrintPreviewUI::OnInvalidPrinterSettings() { | 241 void PrintPreviewUI::OnInvalidPrinterSettings() { |
242 CallJavascriptFunction("invalidPrinterSettings"); | 242 CallJavascriptFunction("invalidPrinterSettings"); |
243 } | 243 } |
244 | 244 |
245 PrintPreviewDataService* PrintPreviewUI::print_preview_data_service() { | 245 PrintPreviewDataService* PrintPreviewUI::print_preview_data_service() { |
246 return PrintPreviewDataService::GetInstance(); | 246 return PrintPreviewDataService::GetInstance(); |
247 } | 247 } |
OLD | NEW |