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

Side by Side Diff: chrome/browser/sync/glue/typed_url_change_processor.cc

Issue 1127353004: Revert of Don't create a sync node when updating an URL that wasn't typed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.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) 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/sync/glue/typed_url_change_processor.h" 5 #include "chrome/browser/sync/glue/typed_url_change_processor.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 bool TypedUrlChangeProcessor::CreateOrUpdateSyncNode( 150 bool TypedUrlChangeProcessor::CreateOrUpdateSyncNode(
151 history::URLRow url, syncer::WriteTransaction* trans) { 151 history::URLRow url, syncer::WriteTransaction* trans) {
152 DCHECK_GE(url.typed_count(), 0); 152 DCHECK_GE(url.typed_count(), 0);
153 // Get the visits for this node. 153 // Get the visits for this node.
154 history::VisitVector visit_vector; 154 history::VisitVector visit_vector;
155 if (!model_associator_->FixupURLAndGetVisits(&url, &visit_vector)) { 155 if (!model_associator_->FixupURLAndGetVisits(&url, &visit_vector)) {
156 DLOG(ERROR) << "Could not load visits for url: " << url.url(); 156 DLOG(ERROR) << "Could not load visits for url: " << url.url();
157 return false; 157 return false;
158 } 158 }
159 159
160 if (std::find_if(visit_vector.begin(), visit_vector.end(),
161 [](const history::VisitRow& visit) {
162 return ui::PageTransitionCoreTypeIs(
163 visit.transition, ui::PAGE_TRANSITION_TYPED);
164 }) == visit_vector.end())
165 // This URL has no TYPED visits, don't sync it.
166 return false;
167
168 syncer::ReadNode typed_url_root(trans); 160 syncer::ReadNode typed_url_root(trans);
169 if (typed_url_root.InitTypeRoot(syncer::TYPED_URLS) != 161 if (typed_url_root.InitTypeRoot(syncer::TYPED_URLS) !=
170 syncer::BaseNode::INIT_OK) { 162 syncer::BaseNode::INIT_OK) {
171 syncer::SyncError error(FROM_HERE, 163 syncer::SyncError error(FROM_HERE,
172 syncer::SyncError::DATATYPE_ERROR, 164 syncer::SyncError::DATATYPE_ERROR,
173 "No top level folder", 165 "No top level folder",
174 syncer::TYPED_URLS); 166 syncer::TYPED_URLS);
175 error_handler()->OnSingleDataTypeUnrecoverableError(error); 167 error_handler()->OnSingleDataTypeUnrecoverableError(error);
176 return false; 168 return false;
177 } 169 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 339 }
348 340
349 void TypedUrlChangeProcessor::StopObserving() { 341 void TypedUrlChangeProcessor::StopObserving() {
350 DCHECK(backend_loop_ == base::MessageLoop::current()); 342 DCHECK(backend_loop_ == base::MessageLoop::current());
351 DCHECK(history_backend_); 343 DCHECK(history_backend_);
352 DCHECK(profile_); 344 DCHECK(profile_);
353 history_backend_observer_.RemoveAll(); 345 history_backend_observer_.RemoveAll();
354 } 346 }
355 347
356 } // namespace browser_sync 348 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698