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

Side by Side Diff: chrome/browser/search_engines/template_url_service.cc

Issue 8704007: Protector adds the default prepopulated engine if it was removed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added histograms for missing/fallback DSP. Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/search_engines/template_url_service.h" 5 #include "chrome/browser/search_engines/template_url_service.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 void TemplateURLService::Add(TemplateURL* template_url) { 315 void TemplateURLService::Add(TemplateURL* template_url) {
316 AddNoNotify(template_url); 316 AddNoNotify(template_url);
317 NotifyObservers(); 317 NotifyObservers();
318 } 318 }
319 319
320 void TemplateURLService::Remove(const TemplateURL* template_url) { 320 void TemplateURLService::Remove(const TemplateURL* template_url) {
321 RemoveNoNotify(template_url); 321 RemoveNoNotify(template_url);
322 NotifyObservers(); 322 NotifyObservers();
323 } 323 }
324 324
325 void TemplateURLService::Update(const TemplateURL* existing_turl,
326 const TemplateURL& new_values) {
327 UpdateNoNotify(existing_turl, new_values);
sky 2011/11/28 17:03:11 Add test coverage of this.
Ivan Korotkov 2011/11/29 10:13:47 Done.
328 NotifyObservers();
329 }
330
325 void TemplateURLService::RemoveAutoGeneratedBetween(base::Time created_after, 331 void TemplateURLService::RemoveAutoGeneratedBetween(base::Time created_after,
326 base::Time created_before) { 332 base::Time created_before) {
327 bool should_notify = false; 333 bool should_notify = false;
328 for (size_t i = 0; i < template_urls_.size();) { 334 for (size_t i = 0; i < template_urls_.size();) {
329 if (template_urls_[i]->date_created() >= created_after && 335 if (template_urls_[i]->date_created() >= created_after &&
330 (created_before.is_null() || 336 (created_before.is_null() ||
331 template_urls_[i]->date_created() < created_before) && 337 template_urls_[i]->date_created() < created_before) &&
332 CanReplace(template_urls_[i])) { 338 CanReplace(template_urls_[i])) {
333 RemoveNoNotify(template_urls_[i]); 339 RemoveNoNotify(template_urls_[i]);
334 should_notify = true; 340 should_notify = true;
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 i != template_urls->end(); ++i) { 1863 i != template_urls->end(); ++i) {
1858 TemplateURL* template_url = *i; 1864 TemplateURL* template_url = *i;
1859 DCHECK(template_url); 1865 DCHECK(template_url);
1860 if (template_url->sync_guid().empty()) { 1866 if (template_url->sync_guid().empty()) {
1861 template_url->set_sync_guid(guid::GenerateGUID()); 1867 template_url->set_sync_guid(guid::GenerateGUID());
1862 if (service_.get()) 1868 if (service_.get())
1863 service_->UpdateKeyword(*template_url); 1869 service_->UpdateKeyword(*template_url);
1864 } 1870 }
1865 } 1871 }
1866 } 1872 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698