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

Side by Side Diff: chrome/browser/password_manager/password_form_manager.cc

Issue 3750001: base: Move SplitString functions into the base namespace and update the callers. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: brett review, reverted changes in o3d due to it's using an old base revision 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
« no previous file with comments | « chrome/browser/language_order_table_model.cc ('k') | chrome/browser/process_singleton_linux.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 (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 #include "chrome/browser/password_manager/password_form_manager.h" 5 #include "chrome/browser/password_manager/password_form_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 16 matching lines...) Expand all
27 password_manager_(password_manager), 27 password_manager_(password_manager),
28 pending_login_query_(0), 28 pending_login_query_(0),
29 preferred_match_(NULL), 29 preferred_match_(NULL),
30 state_(PRE_MATCHING_PHASE), 30 state_(PRE_MATCHING_PHASE),
31 profile_(profile), 31 profile_(profile),
32 manager_action_(kManagerActionNone), 32 manager_action_(kManagerActionNone),
33 user_action_(kUserActionNone), 33 user_action_(kUserActionNone),
34 submit_result_(kSubmitResultNotSubmitted) { 34 submit_result_(kSubmitResultNotSubmitted) {
35 DCHECK(profile_); 35 DCHECK(profile_);
36 if (observed_form_.origin.is_valid()) 36 if (observed_form_.origin.is_valid())
37 SplitString(observed_form_.origin.path(), '/', &form_path_tokens_); 37 base::SplitString(observed_form_.origin.path(), '/', &form_path_tokens_);
38 observed_form_.ssl_valid = ssl_valid; 38 observed_form_.ssl_valid = ssl_valid;
39 } 39 }
40 40
41 PasswordFormManager::~PasswordFormManager() { 41 PasswordFormManager::~PasswordFormManager() {
42 CancelLoginsQuery(); 42 CancelLoginsQuery();
43 UMA_HISTOGRAM_ENUMERATION("PasswordManager.ActionsTaken", 43 UMA_HISTOGRAM_ENUMERATION("PasswordManager.ActionsTaken",
44 GetActionsTaken(), 44 GetActionsTaken(),
45 kMaxNumActionsTaken); 45 kMaxNumActionsTaken);
46 } 46 }
47 47
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 if (candidate.origin == observed_form_.origin) { 446 if (candidate.origin == observed_form_.origin) {
447 // This check is here for the most common case which 447 // This check is here for the most common case which
448 // is we have a single match in the db for the given host, 448 // is we have a single match in the db for the given host,
449 // so we don't generally need to walk the entire URL path (the else 449 // so we don't generally need to walk the entire URL path (the else
450 // clause). 450 // clause).
451 score += (1 << 5) + static_cast<int>(form_path_tokens_.size()); 451 score += (1 << 5) + static_cast<int>(form_path_tokens_.size());
452 } else { 452 } else {
453 // Walk the origin URL paths one directory at a time to see how 453 // Walk the origin URL paths one directory at a time to see how
454 // deep the two match. 454 // deep the two match.
455 std::vector<std::string> candidate_path_tokens; 455 std::vector<std::string> candidate_path_tokens;
456 SplitString(candidate.origin.path(), '/', &candidate_path_tokens); 456 base::SplitString(candidate.origin.path(), '/', &candidate_path_tokens);
457 size_t depth = 0; 457 size_t depth = 0;
458 size_t max_dirs = std::min(form_path_tokens_.size(), 458 size_t max_dirs = std::min(form_path_tokens_.size(),
459 candidate_path_tokens.size()); 459 candidate_path_tokens.size());
460 while ((depth < max_dirs) && (form_path_tokens_[depth] == 460 while ((depth < max_dirs) && (form_path_tokens_[depth] ==
461 candidate_path_tokens[depth])) { 461 candidate_path_tokens[depth])) {
462 depth++; 462 depth++;
463 score++; 463 score++;
464 } 464 }
465 // do we have a partial match? 465 // do we have a partial match?
466 score += (depth > 0) ? 1 << 4 : 0; 466 score += (depth > 0) ? 1 << 4 : 0;
(...skipping 12 matching lines...) Expand all
479 return score; 479 return score;
480 } 480 }
481 481
482 void PasswordFormManager::SubmitPassed() { 482 void PasswordFormManager::SubmitPassed() {
483 submit_result_ = kSubmitResultPassed; 483 submit_result_ = kSubmitResultPassed;
484 } 484 }
485 485
486 void PasswordFormManager::SubmitFailed() { 486 void PasswordFormManager::SubmitFailed() {
487 submit_result_ = kSubmitResultFailed; 487 submit_result_ = kSubmitResultFailed;
488 } 488 }
OLDNEW
« no previous file with comments | « chrome/browser/language_order_table_model.cc ('k') | chrome/browser/process_singleton_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698