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/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/guid.h" |
10 #include "base/i18n/case_conversion.h" | 11 #include "base/i18n/case_conversion.h" |
11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
12 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
13 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
14 #include "base/string_split.h" | 15 #include "base/string_split.h" |
15 #include "base/string_util.h" | 16 #include "base/string_util.h" |
16 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
17 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
18 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
19 #include "chrome/browser/google/google_url_tracker.h" | 20 #include "chrome/browser/google/google_url_tracker.h" |
(...skipping 11 matching lines...) Expand all Loading... |
31 #include "chrome/browser/search_engines/search_terms_data.h" | 32 #include "chrome/browser/search_engines/search_terms_data.h" |
32 #include "chrome/browser/search_engines/template_url.h" | 33 #include "chrome/browser/search_engines/template_url.h" |
33 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 34 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
34 #include "chrome/browser/search_engines/template_url_service_observer.h" | 35 #include "chrome/browser/search_engines/template_url_service_observer.h" |
35 #include "chrome/browser/search_engines/util.h" | 36 #include "chrome/browser/search_engines/util.h" |
36 #include "chrome/browser/webdata/web_data_service_factory.h" | 37 #include "chrome/browser/webdata/web_data_service_factory.h" |
37 #include "chrome/common/chrome_notification_types.h" | 38 #include "chrome/common/chrome_notification_types.h" |
38 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
39 #include "chrome/common/env_vars.h" | 40 #include "chrome/common/env_vars.h" |
40 #include "chrome/common/extensions/extension.h" | 41 #include "chrome/common/extensions/extension.h" |
41 #include "chrome/common/guid.h" | |
42 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
43 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
44 #include "content/public/browser/notification_service.h" | 44 #include "content/public/browser/notification_service.h" |
45 #include "net/base/net_util.h" | 45 #include "net/base/net_util.h" |
46 #include "sync/api/sync_change.h" | 46 #include "sync/api/sync_change.h" |
47 #include "sync/api/sync_error_factory.h" | 47 #include "sync/api/sync_error_factory.h" |
48 #include "sync/protocol/search_engine_specifics.pb.h" | 48 #include "sync/protocol/search_engine_specifics.pb.h" |
49 #include "sync/protocol/sync.pb.h" | 49 #include "sync/protocol/sync.pb.h" |
50 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
51 | 51 |
(...skipping 2312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2364 DCHECK(template_urls); | 2364 DCHECK(template_urls); |
2365 for (TemplateURLVector::iterator i = template_urls->begin(); | 2365 for (TemplateURLVector::iterator i = template_urls->begin(); |
2366 i != template_urls->end(); ++i) { | 2366 i != template_urls->end(); ++i) { |
2367 TemplateURL* template_url = *i; | 2367 TemplateURL* template_url = *i; |
2368 DCHECK(template_url); | 2368 DCHECK(template_url); |
2369 // Extension keywords are never synced. | 2369 // Extension keywords are never synced. |
2370 // TODO(mpcomplete): If we allow editing extension keywords, then those | 2370 // TODO(mpcomplete): If we allow editing extension keywords, then those |
2371 // should be persisted to disk and synced. | 2371 // should be persisted to disk and synced. |
2372 if (template_url->sync_guid().empty() && | 2372 if (template_url->sync_guid().empty() && |
2373 !template_url->IsExtensionKeyword()) { | 2373 !template_url->IsExtensionKeyword()) { |
2374 template_url->data_.sync_guid = guid::GenerateGUID(); | 2374 template_url->data_.sync_guid = base::GenerateGUID(); |
2375 if (service_.get()) | 2375 if (service_.get()) |
2376 service_->UpdateKeyword(template_url->data()); | 2376 service_->UpdateKeyword(template_url->data()); |
2377 } | 2377 } |
2378 } | 2378 } |
2379 } | 2379 } |
OLD | NEW |