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/chrome_to_mobile_service.h" | 5 #include "chrome/browser/chrome_to_mobile_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 scoped_ptr<DictionaryValue> job(new DictionaryValue()); | 56 scoped_ptr<DictionaryValue> job(new DictionaryValue()); |
57 job->SetString("url", data.url.spec()); | 57 job->SetString("url", data.url.spec()); |
58 if (data.type == ChromeToMobileService::URL) { | 58 if (data.type == ChromeToMobileService::URL) { |
59 job->SetString("type", kRequestTypeURL); | 59 job->SetString("type", kRequestTypeURL); |
60 } else { | 60 } else { |
61 job->SetString("snapID", data.snapshot_id); | 61 job->SetString("snapID", data.snapshot_id); |
62 job->SetString("type", (data.type == ChromeToMobileService::SNAPSHOT) ? | 62 job->SetString("type", (data.type == ChromeToMobileService::SNAPSHOT) ? |
63 kRequestTypeSnapshot : kRequestTypeDelayedSnapshot); | 63 kRequestTypeSnapshot : kRequestTypeDelayedSnapshot); |
64 } | 64 } |
65 std::string job_string; | 65 std::string job_string; |
66 base::JSONWriter::Write(job.get(), false, &job_string); | 66 base::JSONWriter::Write(job.get(), &job_string); |
67 return job_string; | 67 return job_string; |
68 } | 68 } |
69 | 69 |
70 // Get the URL for cloud print job submission; appends query params if needed. | 70 // Get the URL for cloud print job submission; appends query params if needed. |
71 GURL GetSubmitURL(GURL service_url, | 71 GURL GetSubmitURL(GURL service_url, |
72 const ChromeToMobileService::RequestData& data) { | 72 const ChromeToMobileService::RequestData& data) { |
73 GURL submit_url = cloud_print::GetUrlForSubmit(service_url); | 73 GURL submit_url = cloud_print::GetUrlForSubmit(service_url); |
74 if (data.type == ChromeToMobileService::SNAPSHOT) | 74 if (data.type == ChromeToMobileService::SNAPSHOT) |
75 return submit_url; | 75 return submit_url; |
76 | 76 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 return; | 327 return; |
328 | 328 |
329 // Ensure a second response is not sent after reporting failure below. | 329 // Ensure a second response is not sent after reporting failure below. |
330 request_observer_map_.erase(other); | 330 request_observer_map_.erase(other); |
331 break; | 331 break; |
332 } | 332 } |
333 } | 333 } |
334 | 334 |
335 observer->OnSendComplete(success); | 335 observer->OnSendComplete(success); |
336 } | 336 } |
OLD | NEW |