OLD | NEW |
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/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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 next_id_(kInvalidTemplateURLID + 1), | 299 next_id_(kInvalidTemplateURLID + 1), |
300 time_provider_(&base::Time::Now), | 300 time_provider_(&base::Time::Now), |
301 models_associated_(false), | 301 models_associated_(false), |
302 processing_syncer_changes_(false), | 302 processing_syncer_changes_(false), |
303 pending_synced_default_search_(false), | 303 pending_synced_default_search_(false), |
304 dsp_change_origin_(DSP_CHANGE_NOT_SYNC) { | 304 dsp_change_origin_(DSP_CHANGE_NOT_SYNC) { |
305 Init(initializers, count); | 305 Init(initializers, count); |
306 } | 306 } |
307 | 307 |
308 TemplateURLService::~TemplateURLService() { | 308 TemplateURLService::~TemplateURLService() { |
309 if (service_) | 309 if (service_.get()) |
310 Shutdown(); | 310 Shutdown(); |
311 STLDeleteElements(&template_urls_); | 311 STLDeleteElements(&template_urls_); |
312 } | 312 } |
313 | 313 |
314 // static | 314 // static |
315 string16 TemplateURLService::GenerateKeyword(const GURL& url) { | 315 string16 TemplateURLService::GenerateKeyword(const GURL& url) { |
316 DCHECK(url.is_valid()); | 316 DCHECK(url.is_valid()); |
317 // Strip "www." off the front of the keyword; otherwise the keyword won't work | 317 // Strip "www." off the front of the keyword; otherwise the keyword won't work |
318 // properly. See http://code.google.com/p/chromium/issues/detail?id=6984 . | 318 // properly. See http://code.google.com/p/chromium/issues/detail?id=6984 . |
319 // Special case: if the host was exactly "www." (not sure this can happen but | 319 // Special case: if the host was exactly "www." (not sure this can happen but |
(...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2559 // Don't log anything if the user has a NULL default search provider. A | 2559 // Don't log anything if the user has a NULL default search provider. A |
2560 // logged value of 0 indicates a custom default search provider. | 2560 // logged value of 0 indicates a custom default search provider. |
2561 if (default_search_provider_) { | 2561 if (default_search_provider_) { |
2562 UMA_HISTOGRAM_ENUMERATION( | 2562 UMA_HISTOGRAM_ENUMERATION( |
2563 kDSPHistogramName, | 2563 kDSPHistogramName, |
2564 default_search_provider_->prepopulate_id(), | 2564 default_search_provider_->prepopulate_id(), |
2565 TemplateURLPrepopulateData::kMaxPrepopulatedEngineID); | 2565 TemplateURLPrepopulateData::kMaxPrepopulatedEngineID); |
2566 } | 2566 } |
2567 } | 2567 } |
2568 } | 2568 } |
OLD | NEW |