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

Side by Side Diff: chrome/browser/ui/webui/print_preview/extension_printer_handler.cc

Issue 1240183002: Update SplitString calls in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/extension_printer_handler.h" 5 #include "chrome/browser/ui/webui/print_preview/extension_printer_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 std::string GenerateProvisionalUsbPrinterId(const Extension* extension, 97 std::string GenerateProvisionalUsbPrinterId(const Extension* extension,
98 const UsbDevice* device) { 98 const UsbDevice* device) {
99 return base::StringPrintf("%s:%s:%s", kProvisionalUsbLabel, 99 return base::StringPrintf("%s:%s:%s", kProvisionalUsbLabel,
100 extension->id().c_str(), device->guid().c_str()); 100 extension->id().c_str(), device->guid().c_str());
101 } 101 }
102 102
103 bool ParseProvisionalUsbPrinterId(const std::string& printer_id, 103 bool ParseProvisionalUsbPrinterId(const std::string& printer_id,
104 std::string* extension_id, 104 std::string* extension_id,
105 std::string* device_guid) { 105 std::string* device_guid) {
106 std::vector<std::string> components; 106 std::vector<std::string> components = base::SplitString(
107 base::SplitString(printer_id, ':', &components); 107 printer_id, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
108 108
109 if (components.size() != 3) 109 if (components.size() != 3)
110 return false; 110 return false;
111 111
112 if (components[0] != kProvisionalUsbLabel) 112 if (components[0] != kProvisionalUsbLabel)
113 return false; 113 return false;
114 114
115 *extension_id = components[1]; 115 *extension_id = components[1];
116 *device_guid = components[2]; 116 *device_guid = components[2];
117 return true; 117 return true;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 .Set("extensionName", extension->name()) 364 .Set("extensionName", extension->name())
365 .Set("provisional", true)); 365 .Set("provisional", true));
366 } 366 }
367 } 367 }
368 } 368 }
369 369
370 DCHECK_GT(pending_enumeration_count_, 0); 370 DCHECK_GT(pending_enumeration_count_, 0);
371 pending_enumeration_count_--; 371 pending_enumeration_count_--;
372 callback.Run(*printer_list.Build().get(), pending_enumeration_count_ == 0); 372 callback.Run(*printer_list.Build().get(), pending_enumeration_count_ == 0);
373 } 373 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/net_internals/net_internals_ui.cc ('k') | chrome/browser/ui/webui/print_preview/print_preview_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698