Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/service/cloud_print/print_system_win.cc

Issue 628083002: Replacing the OVERRIDE with override and FINAL with final in chrome/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 }; 133 };
134 134
135 class PrintServerWatcherWin 135 class PrintServerWatcherWin
136 : public PrintSystem::PrintServerWatcher, 136 : public PrintSystem::PrintServerWatcher,
137 public PrintSystemWatcherWin::Delegate { 137 public PrintSystemWatcherWin::Delegate {
138 public: 138 public:
139 PrintServerWatcherWin() : delegate_(NULL) {} 139 PrintServerWatcherWin() : delegate_(NULL) {}
140 140
141 // PrintSystem::PrintServerWatcher implementation. 141 // PrintSystem::PrintServerWatcher implementation.
142 virtual bool StartWatching( 142 virtual bool StartWatching(
143 PrintSystem::PrintServerWatcher::Delegate* delegate) OVERRIDE{ 143 PrintSystem::PrintServerWatcher::Delegate* delegate) override{
144 delegate_ = delegate; 144 delegate_ = delegate;
145 return watcher_.Start(std::string(), this); 145 return watcher_.Start(std::string(), this);
146 } 146 }
147 147
148 virtual bool StopWatching() OVERRIDE{ 148 virtual bool StopWatching() override{
149 bool ret = watcher_.Stop(); 149 bool ret = watcher_.Stop();
150 delegate_ = NULL; 150 delegate_ = NULL;
151 return ret; 151 return ret;
152 } 152 }
153 153
154 // PrintSystemWatcherWin::Delegate implementation. 154 // PrintSystemWatcherWin::Delegate implementation.
155 virtual void OnPrinterAdded() OVERRIDE { 155 virtual void OnPrinterAdded() override {
156 delegate_->OnPrinterAdded(); 156 delegate_->OnPrinterAdded();
157 } 157 }
158 virtual void OnPrinterDeleted() OVERRIDE {} 158 virtual void OnPrinterDeleted() override {}
159 virtual void OnPrinterChanged() OVERRIDE {} 159 virtual void OnPrinterChanged() override {}
160 virtual void OnJobChanged() OVERRIDE {} 160 virtual void OnJobChanged() override {}
161 161
162 protected: 162 protected:
163 virtual ~PrintServerWatcherWin() {} 163 virtual ~PrintServerWatcherWin() {}
164 164
165 private: 165 private:
166 PrintSystem::PrintServerWatcher::Delegate* delegate_; 166 PrintSystem::PrintServerWatcher::Delegate* delegate_;
167 PrintSystemWatcherWin watcher_; 167 PrintSystemWatcherWin watcher_;
168 168
169 DISALLOW_COPY_AND_ASSIGN(PrintServerWatcherWin); 169 DISALLOW_COPY_AND_ASSIGN(PrintServerWatcherWin);
170 }; 170 };
171 171
172 class PrinterWatcherWin 172 class PrinterWatcherWin
173 : public PrintSystem::PrinterWatcher, 173 : public PrintSystem::PrinterWatcher,
174 public PrintSystemWatcherWin::Delegate { 174 public PrintSystemWatcherWin::Delegate {
175 public: 175 public:
176 explicit PrinterWatcherWin(const std::string& printer_name) 176 explicit PrinterWatcherWin(const std::string& printer_name)
177 : printer_name_(printer_name), 177 : printer_name_(printer_name),
178 delegate_(NULL) { 178 delegate_(NULL) {
179 } 179 }
180 180
181 // PrintSystem::PrinterWatcher implementation. 181 // PrintSystem::PrinterWatcher implementation.
182 virtual bool StartWatching( 182 virtual bool StartWatching(
183 PrintSystem::PrinterWatcher::Delegate* delegate) OVERRIDE { 183 PrintSystem::PrinterWatcher::Delegate* delegate) override {
184 delegate_ = delegate; 184 delegate_ = delegate;
185 return watcher_.Start(printer_name_, this); 185 return watcher_.Start(printer_name_, this);
186 } 186 }
187 187
188 virtual bool StopWatching() OVERRIDE { 188 virtual bool StopWatching() override {
189 bool ret = watcher_.Stop(); 189 bool ret = watcher_.Stop();
190 delegate_ = NULL; 190 delegate_ = NULL;
191 return ret; 191 return ret;
192 } 192 }
193 193
194 virtual bool GetCurrentPrinterInfo( 194 virtual bool GetCurrentPrinterInfo(
195 printing::PrinterBasicInfo* printer_info) OVERRIDE { 195 printing::PrinterBasicInfo* printer_info) override {
196 return watcher_.GetCurrentPrinterInfo(printer_info); 196 return watcher_.GetCurrentPrinterInfo(printer_info);
197 } 197 }
198 198
199 // PrintSystemWatcherWin::Delegate implementation. 199 // PrintSystemWatcherWin::Delegate implementation.
200 virtual void OnPrinterAdded() OVERRIDE { 200 virtual void OnPrinterAdded() override {
201 NOTREACHED(); 201 NOTREACHED();
202 } 202 }
203 virtual void OnPrinterDeleted() OVERRIDE { 203 virtual void OnPrinterDeleted() override {
204 delegate_->OnPrinterDeleted(); 204 delegate_->OnPrinterDeleted();
205 } 205 }
206 virtual void OnPrinterChanged() OVERRIDE { 206 virtual void OnPrinterChanged() override {
207 delegate_->OnPrinterChanged(); 207 delegate_->OnPrinterChanged();
208 } 208 }
209 virtual void OnJobChanged() OVERRIDE { 209 virtual void OnJobChanged() override {
210 delegate_->OnJobChanged(); 210 delegate_->OnJobChanged();
211 } 211 }
212 212
213 protected: 213 protected:
214 virtual ~PrinterWatcherWin() {} 214 virtual ~PrinterWatcherWin() {}
215 215
216 private: 216 private:
217 std::string printer_name_; 217 std::string printer_name_;
218 PrintSystem::PrinterWatcher::Delegate* delegate_; 218 PrintSystem::PrinterWatcher::Delegate* delegate_;
219 PrintSystemWatcherWin watcher_; 219 PrintSystemWatcherWin watcher_;
220 220
221 DISALLOW_COPY_AND_ASSIGN(PrinterWatcherWin); 221 DISALLOW_COPY_AND_ASSIGN(PrinterWatcherWin);
222 }; 222 };
223 223
224 class JobSpoolerWin : public PrintSystem::JobSpooler { 224 class JobSpoolerWin : public PrintSystem::JobSpooler {
225 public: 225 public:
226 JobSpoolerWin() : core_(new Core) {} 226 JobSpoolerWin() : core_(new Core) {}
227 227
228 // PrintSystem::JobSpooler implementation. 228 // PrintSystem::JobSpooler implementation.
229 virtual bool Spool(const std::string& print_ticket, 229 virtual bool Spool(const std::string& print_ticket,
230 const std::string& print_ticket_mime_type, 230 const std::string& print_ticket_mime_type,
231 const base::FilePath& print_data_file_path, 231 const base::FilePath& print_data_file_path,
232 const std::string& print_data_mime_type, 232 const std::string& print_data_mime_type,
233 const std::string& printer_name, 233 const std::string& printer_name,
234 const std::string& job_title, 234 const std::string& job_title,
235 const std::vector<std::string>& tags, 235 const std::vector<std::string>& tags,
236 JobSpooler::Delegate* delegate) OVERRIDE { 236 JobSpooler::Delegate* delegate) override {
237 // TODO(gene): add tags handling. 237 // TODO(gene): add tags handling.
238 scoped_refptr<printing::PrintBackend> print_backend( 238 scoped_refptr<printing::PrintBackend> print_backend(
239 printing::PrintBackend::CreateInstance(NULL)); 239 printing::PrintBackend::CreateInstance(NULL));
240 crash_keys::ScopedPrinterInfo crash_key( 240 crash_keys::ScopedPrinterInfo crash_key(
241 print_backend->GetPrinterDriverInfo(printer_name)); 241 print_backend->GetPrinterDriverInfo(printer_name));
242 return core_->Spool(print_ticket, print_ticket_mime_type, 242 return core_->Spool(print_ticket, print_ticket_mime_type,
243 print_data_file_path, print_data_mime_type, 243 print_data_file_path, print_data_mime_type,
244 printer_name, job_title, delegate); 244 printer_name, job_title, delegate);
245 } 245 }
246 246
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 XFORM xform = {0}; 332 XFORM xform = {0};
333 xform.eDx = static_cast<float>(-offset_x); 333 xform.eDx = static_cast<float>(-offset_x);
334 xform.eDy = static_cast<float>(-offset_y); 334 xform.eDy = static_cast<float>(-offset_y);
335 xform.eM11 = xform.eM22 = 1.0 / scale_factor; 335 xform.eM11 = xform.eM22 = 1.0 / scale_factor;
336 SetWorldTransform(printer_dc_.Get(), &xform); 336 SetWorldTransform(printer_dc_.Get(), &xform);
337 } 337 }
338 338
339 // ServiceUtilityProcessHost::Client implementation. 339 // ServiceUtilityProcessHost::Client implementation.
340 virtual void OnRenderPDFPagesToMetafilePageDone( 340 virtual void OnRenderPDFPagesToMetafilePageDone(
341 double scale_factor, 341 double scale_factor,
342 const printing::MetafilePlayer& emf) OVERRIDE { 342 const printing::MetafilePlayer& emf) override {
343 PreparePageDCForPrinting(printer_dc_.Get(), scale_factor); 343 PreparePageDCForPrinting(printer_dc_.Get(), scale_factor);
344 ::StartPage(printer_dc_.Get()); 344 ::StartPage(printer_dc_.Get());
345 emf.SafePlayback(printer_dc_.Get()); 345 emf.SafePlayback(printer_dc_.Get());
346 ::EndPage(printer_dc_.Get()); 346 ::EndPage(printer_dc_.Get());
347 } 347 }
348 348
349 // ServiceUtilityProcessHost::Client implementation. 349 // ServiceUtilityProcessHost::Client implementation.
350 virtual void OnRenderPDFPagesToMetafileDone(bool success) OVERRIDE { 350 virtual void OnRenderPDFPagesToMetafileDone(bool success) override {
351 PrintJobDone(success); 351 PrintJobDone(success);
352 } 352 }
353 353
354 virtual void OnChildDied() OVERRIDE { PrintJobDone(false); } 354 virtual void OnChildDied() override { PrintJobDone(false); }
355 355
356 // base::win::ObjectWatcher::Delegate implementation. 356 // base::win::ObjectWatcher::Delegate implementation.
357 virtual void OnObjectSignaled(HANDLE object) OVERRIDE { 357 virtual void OnObjectSignaled(HANDLE object) override {
358 // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. 358 // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed.
359 tracked_objects::ScopedProfile tracking_profile( 359 tracked_objects::ScopedProfile tracking_profile(
360 FROM_HERE_WITH_EXPLICIT_FUNCTION( 360 FROM_HERE_WITH_EXPLICIT_FUNCTION(
361 "Core_OnObjectSignaled")); 361 "Core_OnObjectSignaled"));
362 362
363 DCHECK(xps_print_job_); 363 DCHECK(xps_print_job_);
364 DCHECK(object == job_progress_event_.Get()); 364 DCHECK(object == job_progress_event_.Get());
365 ResetEvent(job_progress_event_.Get()); 365 ResetEvent(job_progress_event_.Get());
366 if (!delegate_) 366 if (!delegate_)
367 return; 367 return;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 // request to fetch printer capabilities and defaults. 527 // request to fetch printer capabilities and defaults.
528 class PrinterCapsHandler : public ServiceUtilityProcessHost::Client { 528 class PrinterCapsHandler : public ServiceUtilityProcessHost::Client {
529 public: 529 public:
530 PrinterCapsHandler( 530 PrinterCapsHandler(
531 const std::string& printer_name, 531 const std::string& printer_name,
532 const PrintSystem::PrinterCapsAndDefaultsCallback& callback) 532 const PrintSystem::PrinterCapsAndDefaultsCallback& callback)
533 : printer_name_(printer_name), callback_(callback) { 533 : printer_name_(printer_name), callback_(callback) {
534 } 534 }
535 535
536 // ServiceUtilityProcessHost::Client implementation. 536 // ServiceUtilityProcessHost::Client implementation.
537 virtual void OnChildDied() OVERRIDE { 537 virtual void OnChildDied() override {
538 OnGetPrinterCapsAndDefaults(false, printer_name_, 538 OnGetPrinterCapsAndDefaults(false, printer_name_,
539 printing::PrinterCapsAndDefaults()); 539 printing::PrinterCapsAndDefaults());
540 } 540 }
541 541
542 virtual void OnGetPrinterCapsAndDefaults( 542 virtual void OnGetPrinterCapsAndDefaults(
543 bool succeeded, 543 bool succeeded,
544 const std::string& printer_name, 544 const std::string& printer_name,
545 const printing::PrinterCapsAndDefaults& caps_and_defaults) OVERRIDE { 545 const printing::PrinterCapsAndDefaults& caps_and_defaults) override {
546 callback_.Run(succeeded, printer_name, caps_and_defaults); 546 callback_.Run(succeeded, printer_name, caps_and_defaults);
547 callback_.Reset(); 547 callback_.Reset();
548 Release(); 548 Release();
549 } 549 }
550 550
551 virtual void OnGetPrinterSemanticCapsAndDefaults( 551 virtual void OnGetPrinterSemanticCapsAndDefaults(
552 bool succeeded, 552 bool succeeded,
553 const std::string& printer_name, 553 const std::string& printer_name,
554 const printing::PrinterSemanticCapsAndDefaults& semantic_info) OVERRIDE { 554 const printing::PrinterSemanticCapsAndDefaults& semantic_info) override {
555 printing::PrinterCapsAndDefaults printer_info; 555 printing::PrinterCapsAndDefaults printer_info;
556 if (succeeded) { 556 if (succeeded) {
557 printer_info.caps_mime_type = kContentTypeJSON; 557 printer_info.caps_mime_type = kContentTypeJSON;
558 scoped_ptr<base::DictionaryValue> description( 558 scoped_ptr<base::DictionaryValue> description(
559 PrinterSemanticCapsAndDefaultsToCdd(semantic_info)); 559 PrinterSemanticCapsAndDefaultsToCdd(semantic_info));
560 if (description) { 560 if (description) {
561 base::JSONWriter::WriteWithOptions( 561 base::JSONWriter::WriteWithOptions(
562 description.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, 562 description.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT,
563 &printer_info.printer_capabilities); 563 &printer_info.printer_capabilities);
564 } 564 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 619
620 std::string printer_name_; 620 std::string printer_name_;
621 PrintSystem::PrinterCapsAndDefaultsCallback callback_; 621 PrintSystem::PrinterCapsAndDefaultsCallback callback_;
622 }; 622 };
623 623
624 class PrintSystemWin : public PrintSystem { 624 class PrintSystemWin : public PrintSystem {
625 public: 625 public:
626 PrintSystemWin(); 626 PrintSystemWin();
627 627
628 // PrintSystem implementation. 628 // PrintSystem implementation.
629 virtual PrintSystemResult Init() OVERRIDE; 629 virtual PrintSystemResult Init() override;
630 virtual PrintSystem::PrintSystemResult EnumeratePrinters( 630 virtual PrintSystem::PrintSystemResult EnumeratePrinters(
631 printing::PrinterList* printer_list) OVERRIDE; 631 printing::PrinterList* printer_list) override;
632 virtual void GetPrinterCapsAndDefaults( 632 virtual void GetPrinterCapsAndDefaults(
633 const std::string& printer_name, 633 const std::string& printer_name,
634 const PrinterCapsAndDefaultsCallback& callback) OVERRIDE; 634 const PrinterCapsAndDefaultsCallback& callback) override;
635 virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE; 635 virtual bool IsValidPrinter(const std::string& printer_name) override;
636 virtual bool ValidatePrintTicket( 636 virtual bool ValidatePrintTicket(
637 const std::string& printer_name, 637 const std::string& printer_name,
638 const std::string& print_ticket_data, 638 const std::string& print_ticket_data,
639 const std::string& print_ticket_data_mime_type) OVERRIDE; 639 const std::string& print_ticket_data_mime_type) override;
640 virtual bool GetJobDetails(const std::string& printer_name, 640 virtual bool GetJobDetails(const std::string& printer_name,
641 PlatformJobId job_id, 641 PlatformJobId job_id,
642 PrintJobDetails *job_details) OVERRIDE; 642 PrintJobDetails *job_details) override;
643 virtual PrintSystem::PrintServerWatcher* CreatePrintServerWatcher() OVERRIDE; 643 virtual PrintSystem::PrintServerWatcher* CreatePrintServerWatcher() override;
644 virtual PrintSystem::PrinterWatcher* CreatePrinterWatcher( 644 virtual PrintSystem::PrinterWatcher* CreatePrinterWatcher(
645 const std::string& printer_name) OVERRIDE; 645 const std::string& printer_name) override;
646 virtual PrintSystem::JobSpooler* CreateJobSpooler() OVERRIDE; 646 virtual PrintSystem::JobSpooler* CreateJobSpooler() override;
647 virtual bool UseCddAndCjt() OVERRIDE; 647 virtual bool UseCddAndCjt() override;
648 virtual std::string GetSupportedMimeTypes() OVERRIDE; 648 virtual std::string GetSupportedMimeTypes() override;
649 649
650 private: 650 private:
651 std::string PrintSystemWin::GetPrinterDriverInfo( 651 std::string PrintSystemWin::GetPrinterDriverInfo(
652 const std::string& printer_name) const; 652 const std::string& printer_name) const;
653 653
654 scoped_refptr<printing::PrintBackend> print_backend_; 654 scoped_refptr<printing::PrintBackend> print_backend_;
655 bool use_cdd_; 655 bool use_cdd_;
656 DISALLOW_COPY_AND_ASSIGN(PrintSystemWin); 656 DISALLOW_COPY_AND_ASSIGN(PrintSystemWin);
657 }; 657 };
658 658
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 } 830 }
831 831
832 } // namespace 832 } // namespace
833 833
834 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( 834 scoped_refptr<PrintSystem> PrintSystem::CreateInstance(
835 const base::DictionaryValue* print_system_settings) { 835 const base::DictionaryValue* print_system_settings) {
836 return new PrintSystemWin; 836 return new PrintSystemWin;
837 } 837 }
838 838
839 } // namespace cloud_print 839 } // namespace cloud_print
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/print_system_cups.cc ('k') | chrome/service/cloud_print/printer_job_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698