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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc

Issue 3968001: Update code that previously constructed strings from string iterators only to... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Implementation of the SafeBrowsingBlockingPage class. 5 // Implementation of the SafeBrowsingBlockingPage class.
6 6
7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // We are deleted after this. 324 // We are deleted after this.
325 return; 325 return;
326 } 326 }
327 327
328 // The "report error" and "show diagnostic" commands can have a number 328 // The "report error" and "show diagnostic" commands can have a number
329 // appended to them, which is the index of the element they apply to. 329 // appended to them, which is the index of the element they apply to.
330 int element_index = 0; 330 int element_index = 0;
331 size_t colon_index = command.find(':'); 331 size_t colon_index = command.find(':');
332 if (colon_index != std::string::npos) { 332 if (colon_index != std::string::npos) {
333 DCHECK(colon_index < command.size() - 1); 333 DCHECK(colon_index < command.size() - 1);
334 std::string index_str = command.substr(colon_index + 1);
335 command = command.substr(0, colon_index); 334 command = command.substr(0, colon_index);
336 bool result = base::StringToInt(index_str, &element_index); 335 bool result = base::StringToInt(command.begin() + colon_index + 1,
336 command.end(),
337 &element_index);
337 DCHECK(result); 338 DCHECK(result);
338 } 339 }
339 340
340 if (element_index >= static_cast<int>(unsafe_resources_.size())) { 341 if (element_index >= static_cast<int>(unsafe_resources_.size())) {
341 NOTREACHED(); 342 NOTREACHED();
342 return; 343 return;
343 } 344 }
344 345
345 std::string bad_url_spec = unsafe_resources_[element_index].url.spec(); 346 std::string bad_url_spec = unsafe_resources_[element_index].url.spec();
346 if (command == kReportErrorCommand) { 347 if (command == kReportErrorCommand) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); 532 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap();
532 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource); 533 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource);
533 } 534 }
534 535
535 // static 536 // static
536 bool SafeBrowsingBlockingPage::IsMainPage( 537 bool SafeBrowsingBlockingPage::IsMainPage(
537 const UnsafeResourceList& unsafe_resources) { 538 const UnsafeResourceList& unsafe_resources) {
538 return unsafe_resources.size() == 1 && 539 return unsafe_resources.size() == 1 &&
539 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME; 540 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME;
540 } 541 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698