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

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

Issue 10540003: Move guid generation from chrome/common/ to base/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: installer Created 8 years, 6 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 | Annotate | Revision Log
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/search_engines/template_url.h" 5 #include "chrome/browser/search_engines/template_url.h"
6 6
7 #include "base/guid.h"
7 #include "base/i18n/case_conversion.h" 8 #include "base/i18n/case_conversion.h"
8 #include "base/i18n/icu_string_conversions.h" 9 #include "base/i18n/icu_string_conversions.h"
9 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
12 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
13 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
14 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/autocomplete/autocomplete_field_trial.h" 16 #include "chrome/browser/autocomplete/autocomplete_field_trial.h"
16 #include "chrome/browser/google/google_util.h" 17 #include "chrome/browser/google/google_util.h"
17 #include "chrome/browser/search_engines/search_terms_data.h" 18 #include "chrome/browser/search_engines/search_terms_data.h"
18 #include "chrome/browser/search_engines/template_url_service.h" 19 #include "chrome/browser/search_engines/template_url_service.h"
19 #include "chrome/common/guid.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "net/base/escape.h" 21 #include "net/base/escape.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 23
24 namespace { 24 namespace {
25 25
26 // The TemplateURLRef has any number of terms that need to be replaced. Each of 26 // The TemplateURLRef has any number of terms that need to be replaced. Each of
27 // the terms is enclosed in braces. If the character preceeding the final 27 // the terms is enclosed in braces. If the character preceeding the final
28 // brace is a ?, it indicates the term is optional and can be replaced with 28 // brace is a ?, it indicates the term is optional and can be replaced with
29 // an empty string. 29 // an empty string.
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 551
552 TemplateURLData::TemplateURLData() 552 TemplateURLData::TemplateURLData()
553 : show_in_default_list(false), 553 : show_in_default_list(false),
554 safe_for_autoreplace(false), 554 safe_for_autoreplace(false),
555 id(0), 555 id(0),
556 date_created(base::Time::Now()), 556 date_created(base::Time::Now()),
557 last_modified(base::Time::Now()), 557 last_modified(base::Time::Now()),
558 created_by_policy(false), 558 created_by_policy(false),
559 usage_count(0), 559 usage_count(0),
560 prepopulate_id(0), 560 prepopulate_id(0),
561 sync_guid(guid::GenerateGUID()), 561 sync_guid(base::GenerateGUID()),
562 keyword_(ASCIIToUTF16("dummy")), 562 keyword_(ASCIIToUTF16("dummy")),
563 url_("x") { 563 url_("x") {
564 } 564 }
565 565
566 TemplateURLData::~TemplateURLData() { 566 TemplateURLData::~TemplateURLData() {
567 } 567 }
568 568
569 void TemplateURLData::SetKeyword(const string16& keyword) { 569 void TemplateURLData::SetKeyword(const string16& keyword) {
570 DCHECK(!keyword.empty()); 570 DCHECK(!keyword.empty());
571 571
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 679 }
680 680
681 void TemplateURL::ResetKeywordIfNecessary(bool force) { 681 void TemplateURL::ResetKeywordIfNecessary(bool force) {
682 if (IsGoogleSearchURLWithReplaceableKeyword() || force) { 682 if (IsGoogleSearchURLWithReplaceableKeyword() || force) {
683 DCHECK(!IsExtensionKeyword()); 683 DCHECK(!IsExtensionKeyword());
684 GURL url(TemplateURLService::GenerateSearchURL(this)); 684 GURL url(TemplateURLService::GenerateSearchURL(this));
685 if (url.is_valid()) 685 if (url.is_valid())
686 data_.SetKeyword(TemplateURLService::GenerateKeyword(url)); 686 data_.SetKeyword(TemplateURLService::GenerateKeyword(url));
687 } 687 }
688 } 688 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698