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

Side by Side Diff: chrome/browser/local_discovery/privet_http_impl.cc

Issue 148183014: Fix local printing URL parameter names (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privet_http_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/local_discovery/privet_http_impl.h" 5 #include "chrome/browser/local_discovery/privet_http_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "chrome/browser/local_discovery/privet_constants.h" 15 #include "chrome/browser/local_discovery/privet_constants.h"
16 #include "net/base/url_util.h" 16 #include "net/base/url_util.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 namespace local_discovery { 19 namespace local_discovery {
20 20
21 namespace { 21 namespace {
22 const char kUrlPlaceHolder[] = "http://host/"; 22 const char kUrlPlaceHolder[] = "http://host/";
23 const char kPrivetRegisterActionArgName[] = "action"; 23 const char kPrivetRegisterActionArgName[] = "action";
24 const char kPrivetRegisterUserArgName[] = "user"; 24 const char kPrivetRegisterUserArgName[] = "user";
25 25
26 const char kPrivetURLKeyUser[] = "user"; 26 const char kPrivetURLKeyUserName[] = "user_name";
27 const char kPrivetURLKeyJobname[] = "jobname"; 27 const char kPrivetURLKeyClientName[] = "client_name";
28 const char kPrivetURLKeyJobname[] = "job_name";
28 const char kPrivetURLKeyOffline[] = "offline"; 29 const char kPrivetURLKeyOffline[] = "offline";
29 const char kPrivetURLValueOffline[] = "1"; 30 const char kPrivetURLValueOffline[] = "1";
31 const char kPrivetURLValueClientName[] = "Chrome";
30 32
31 const char kPrivetContentTypePDF[] = "application/pdf"; 33 const char kPrivetContentTypePDF[] = "application/pdf";
32 const char kPrivetContentTypePWGRaster[] = "image/pwg-raster"; 34 const char kPrivetContentTypePWGRaster[] = "image/pwg-raster";
33 const char kPrivetContentTypeAny[] = "*/*"; 35 const char kPrivetContentTypeAny[] = "*/*";
34 const char kPrivetContentTypeCJT[] = "application/json"; 36 const char kPrivetContentTypeCJT[] = "application/json";
35 37
36 const char kPrivetStorageListPath[] = "/privet/storage/list"; 38 const char kPrivetStorageListPath[] = "/privet/storage/list";
37 const char kPrivetStorageParamPathFormat[] = "path=%s"; 39 const char kPrivetStorageParamPathFormat[] = "path=%s";
38 40
39 const char kPrivetCDDKeySupportedContentTypes[] = 41 const char kPrivetCDDKeySupportedContentTypes[] =
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 url_fetcher_->Start(); 473 url_fetcher_->Start();
472 } 474 }
473 475
474 void PrivetLocalPrintOperationImpl::DoSubmitdoc() { 476 void PrivetLocalPrintOperationImpl::DoSubmitdoc() {
475 current_response_ = base::Bind( 477 current_response_ = base::Bind(
476 &PrivetLocalPrintOperationImpl::OnSubmitdocResponse, 478 &PrivetLocalPrintOperationImpl::OnSubmitdocResponse,
477 base::Unretained(this)); 479 base::Unretained(this));
478 480
479 GURL url = CreatePrivetURL(kPrivetSubmitdocPath); 481 GURL url = CreatePrivetURL(kPrivetSubmitdocPath);
480 482
483 url = net::AppendQueryParameter(url,
484 kPrivetURLKeyClientName,
485 kPrivetURLValueClientName);
486
481 if (!user_.empty()) { 487 if (!user_.empty()) {
482 url = net::AppendQueryParameter(url, 488 url = net::AppendQueryParameter(url,
483 kPrivetURLKeyUser, 489 kPrivetURLKeyUserName,
484 user_); 490 user_);
485 } 491 }
486 492
487 if (!jobname_.empty()) { 493 if (!jobname_.empty()) {
488 url = net::AppendQueryParameter(url, 494 url = net::AppendQueryParameter(url,
489 kPrivetURLKeyJobname, 495 kPrivetURLKeyJobname,
490 jobname_); 496 jobname_);
491 } 497 }
492 498
493 if (!jobid_.empty()) { 499 if (!jobid_.empty()) {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 TokenCallbackVector token_callbacks; 814 TokenCallbackVector token_callbacks;
809 token_callbacks_.swap(token_callbacks); 815 token_callbacks_.swap(token_callbacks);
810 816
811 for (TokenCallbackVector::iterator i = token_callbacks.begin(); 817 for (TokenCallbackVector::iterator i = token_callbacks.begin();
812 i != token_callbacks.end(); i++) { 818 i != token_callbacks.end(); i++) {
813 i->Run(token); 819 i->Run(token);
814 } 820 }
815 } 821 }
816 822
817 } // namespace local_discovery 823 } // namespace local_discovery
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privet_http_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698