| 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/service/cloud_print/print_system.h" | 5 #include "chrome/service/cloud_print/print_system.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "printing/printing_utils.h" | 28 #include "printing/printing_utils.h" |
| 29 #include "ui/gfx/geometry/rect.h" | 29 #include "ui/gfx/geometry/rect.h" |
| 30 | 30 |
| 31 namespace cloud_print { | 31 namespace cloud_print { |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 class PrintSystemWatcherWin : public base::win::ObjectWatcher::Delegate { | 35 class PrintSystemWatcherWin : public base::win::ObjectWatcher::Delegate { |
| 36 public: | 36 public: |
| 37 PrintSystemWatcherWin() | 37 PrintSystemWatcherWin() |
| 38 : delegate_(NULL), | 38 : delegate_(NULL) { |
| 39 did_signal_(false) { | |
| 40 } | 39 } |
| 41 ~PrintSystemWatcherWin() override { Stop(); } | 40 ~PrintSystemWatcherWin() override { Stop(); } |
| 42 | 41 |
| 43 class Delegate { | 42 class Delegate { |
| 44 public: | 43 public: |
| 45 virtual ~Delegate() {} | 44 virtual ~Delegate() {} |
| 46 virtual void OnPrinterAdded() = 0; | 45 virtual void OnPrinterAdded() = 0; |
| 47 virtual void OnPrinterDeleted() = 0; | 46 virtual void OnPrinterDeleted() = 0; |
| 48 virtual void OnPrinterChanged() = 0; | 47 virtual void OnPrinterChanged() = 0; |
| 49 virtual void OnJobChanged() = 0; | 48 virtual void OnJobChanged() = 0; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 DCHECK(printer_info); | 113 DCHECK(printer_info); |
| 115 return InitBasicPrinterInfo(printer_.Get(), printer_info); | 114 return InitBasicPrinterInfo(printer_.Get(), printer_info); |
| 116 } | 115 } |
| 117 | 116 |
| 118 private: | 117 private: |
| 119 base::win::ObjectWatcher watcher_; | 118 base::win::ObjectWatcher watcher_; |
| 120 printing::ScopedPrinterHandle printer_; // The printer being watched | 119 printing::ScopedPrinterHandle printer_; // The printer being watched |
| 121 // Returned by FindFirstPrinterChangeNotifier. | 120 // Returned by FindFirstPrinterChangeNotifier. |
| 122 printing::ScopedPrinterChangeHandle printer_change_; | 121 printing::ScopedPrinterChangeHandle printer_change_; |
| 123 Delegate* delegate_; // Delegate to notify | 122 Delegate* delegate_; // Delegate to notify |
| 124 bool did_signal_; // DoneWaiting was called | |
| 125 std::string printer_info_; // For crash reporting. | 123 std::string printer_info_; // For crash reporting. |
| 126 }; | 124 }; |
| 127 | 125 |
| 128 class PrintServerWatcherWin | 126 class PrintServerWatcherWin |
| 129 : public PrintSystem::PrintServerWatcher, | 127 : public PrintSystem::PrintServerWatcher, |
| 130 public PrintSystemWatcherWin::Delegate { | 128 public PrintSystemWatcherWin::Delegate { |
| 131 public: | 129 public: |
| 132 PrintServerWatcherWin() : delegate_(NULL) {} | 130 PrintServerWatcherWin() : delegate_(NULL) {} |
| 133 | 131 |
| 134 // PrintSystem::PrintServerWatcher implementation. | 132 // PrintSystem::PrintServerWatcher implementation. |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 } | 814 } |
| 817 | 815 |
| 818 } // namespace | 816 } // namespace |
| 819 | 817 |
| 820 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( | 818 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( |
| 821 const base::DictionaryValue* print_system_settings) { | 819 const base::DictionaryValue* print_system_settings) { |
| 822 return new PrintSystemWin; | 820 return new PrintSystemWin; |
| 823 } | 821 } |
| 824 | 822 |
| 825 } // namespace cloud_print | 823 } // namespace cloud_print |
| OLD | NEW |