summaryrefslogtreecommitdiffstats
path: root/chrome/browser/search_engines
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 22:37:11 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 22:37:11 +0000
commit8b62334be15306086414ae6c490ee8a58de65338 (patch)
treeabe94dd6210e914146ed1e177087320a0eb60cf5 /chrome/browser/search_engines
parentcba2196088043137c76fe1a7206506154e3c0a1d (diff)
downloadchromium_src-8b62334be15306086414ae6c490ee8a58de65338.zip
chromium_src-8b62334be15306086414ae6c490ee8a58de65338.tar.gz
chromium_src-8b62334be15306086414ae6c490ee8a58de65338.tar.bz2
Reduce the number of files that recompile when changing template_url.h or template_url_model.h.
Separated out the TemplateURL::IDType which is now TemplateURLId into its own file, since this was a primary reason for including template_url.h in another header. Similarly separate out the TemplateURLModelObserver from template_url_model.h to reduce how often that file is included. BUG=None TEST=Compiling. Review URL: http://codereview.chromium.org/3270011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58080 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines')
-rw-r--r--chrome/browser/search_engines/search_host_to_urls_map.cc2
-rw-r--r--chrome/browser/search_engines/template_url.h9
-rw-r--r--chrome/browser/search_engines/template_url_id.h11
-rw-r--r--chrome/browser/search_engines/template_url_model.cc2
-rw-r--r--chrome/browser/search_engines/template_url_model.h15
-rw-r--r--chrome/browser/search_engines/template_url_model_observer.h20
-rw-r--r--chrome/browser/search_engines/template_url_model_unittest.cc4
-rw-r--r--chrome/browser/search_engines/template_url_table_model.cc2
-rw-r--r--chrome/browser/search_engines/template_url_table_model.h3
9 files changed, 47 insertions, 21 deletions
diff --git a/chrome/browser/search_engines/search_host_to_urls_map.cc b/chrome/browser/search_engines/search_host_to_urls_map.cc
index 3fc228b..584ecc5 100644
--- a/chrome/browser/search_engines/search_host_to_urls_map.cc
+++ b/chrome/browser/search_engines/search_host_to_urls_map.cc
@@ -74,7 +74,7 @@ void SearchHostToURLsMap::Update(const TemplateURL* existing_turl,
RemoveNoLock(existing_turl);
// Use the information from new_values but preserve existing_turl's id.
- TemplateURL::IDType previous_id = existing_turl->id();
+ TemplateURLID previous_id = existing_turl->id();
TemplateURL* modifiable_turl = const_cast<TemplateURL*>(existing_turl);
*modifiable_turl = new_values;
modifiable_turl->set_id(previous_id);
diff --git a/chrome/browser/search_engines/template_url.h b/chrome/browser/search_engines/template_url.h
index 7c061c4..35e88d5 100644
--- a/chrome/browser/search_engines/template_url.h
+++ b/chrome/browser/search_engines/template_url.h
@@ -11,6 +11,7 @@
#include "base/gtest_prod_util.h"
#include "base/time.h"
+#include "chrome/browser/search_engines/template_url_id.h"
#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
#include "googleurl/src/gurl.h"
@@ -235,8 +236,6 @@ class TemplateURLRef {
// Describes the relevant portions of a single OSD document.
class TemplateURL {
public:
- typedef int64 IDType;
-
// Describes a single image reference. Each TemplateURL may have
// any number (including 0) of ImageRefs.
//
@@ -428,7 +427,7 @@ class TemplateURL {
// Returns the unique identifier of this TemplateURL. The unique ID is set
// by the TemplateURLModel when the TemplateURL is added to it.
- IDType id() const { return id_; }
+ TemplateURLID id() const { return id_; }
// If this TemplateURL comes from prepopulated data the prepopulate_id is > 0.
void set_prepopulate_id(int id) { prepopulate_id_ = id; }
@@ -452,7 +451,7 @@ class TemplateURL {
void InvalidateCachedValues() const;
// Unique identifier, used when archived to the database.
- void set_id(IDType id) { id_ = id;}
+ void set_id(TemplateURLID id) { id_ = id;}
std::wstring short_name_;
std::wstring description_;
@@ -471,7 +470,7 @@ class TemplateURL {
std::vector<std::wstring> languages_;
// List of supported input encodings.
std::vector<std::string> input_encodings_;
- IDType id_;
+ TemplateURLID id_;
base::Time date_created_;
int usage_count_;
TemplateURLPrepopulateData::SearchEngineType search_engine_type_;
diff --git a/chrome/browser/search_engines/template_url_id.h b/chrome/browser/search_engines/template_url_id.h
new file mode 100644
index 0000000..db607e2
--- /dev/null
+++ b/chrome/browser/search_engines/template_url_id.h
@@ -0,0 +1,11 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_ID_H_
+#define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_ID_H_
+#pragma once
+
+typedef int64 TemplateURLID;
+
+#endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_ID_H_
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc
index 5eb345e..b5cf1df 100644
--- a/chrome/browser/search_engines/template_url_model.cc
+++ b/chrome/browser/search_engines/template_url_model.cc
@@ -20,6 +20,8 @@
#include "chrome/browser/rlz/rlz.h"
#include "chrome/browser/search_engines/search_host_to_urls_map.h"
#include "chrome/browser/search_engines/search_terms_data.h"
+#include "chrome/browser/search_engines/template_url.h"
+#include "chrome/browser/search_engines/template_url_model_observer.h"
#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
#include "chrome/browser/search_engines/util.h"
#include "chrome/common/chrome_switches.h"
diff --git a/chrome/browser/search_engines/template_url_model.h b/chrome/browser/search_engines/template_url_model.h
index d940cbd..ab6e171 100644
--- a/chrome/browser/search_engines/template_url_model.h
+++ b/chrome/browser/search_engines/template_url_model.h
@@ -11,6 +11,7 @@
#include "base/gtest_prod_util.h"
#include "base/observer_list.h"
#include "base/scoped_ptr.h"
+#include "chrome/browser/search_engines/template_url_id.h"
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
@@ -21,6 +22,7 @@ class PrefService;
class Profile;
class SearchHostToURLsMap;
class SearchTermsData;
+class TemplateURLModelObserver;
namespace history {
struct URLVisitedDetails;
@@ -47,17 +49,6 @@ struct URLVisitedDetails;
// is a WebDataService, deletion is handled by WebDataService, otherwise
// TemplateURLModel handles deletion.
-// TemplateURLModelObserver is notified whenever the set of TemplateURLs
-// are modified.
-class TemplateURLModelObserver {
- public:
- // Notification that the template url model has changed in some way.
- virtual void OnTemplateURLModelChanged() = 0;
-
- protected:
- virtual ~TemplateURLModelObserver() {}
-};
-
class TemplateURLModel : public WebDataServiceConsumer,
public NotificationObserver {
public:
@@ -378,7 +369,7 @@ class TemplateURLModel : public WebDataServiceConsumer,
// ID assigned to next TemplateURL added to this model. This is an ever
// increasing integer that is initialized from the database.
- TemplateURL::IDType next_id_;
+ TemplateURLID next_id_;
// List of extension IDs waiting for Load to have keywords registered.
std::vector<std::string> pending_extension_ids_;
diff --git a/chrome/browser/search_engines/template_url_model_observer.h b/chrome/browser/search_engines/template_url_model_observer.h
new file mode 100644
index 0000000..860c01e
--- /dev/null
+++ b/chrome/browser/search_engines/template_url_model_observer.h
@@ -0,0 +1,20 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_OBSERVER_H_
+#define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_OBSERVER_H_
+#pragma once
+
+// TemplateURLModelObserver is notified whenever the set of TemplateURLs
+// are modified.
+class TemplateURLModelObserver {
+ public:
+ // Notification that the template url model has changed in some way.
+ virtual void OnTemplateURLModelChanged() = 0;
+
+ protected:
+ virtual ~TemplateURLModelObserver() {}
+};
+
+#endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_OBSERVER_H_
diff --git a/chrome/browser/search_engines/template_url_model_unittest.cc b/chrome/browser/search_engines/template_url_model_unittest.cc
index 95a18ad..c67bec9 100644
--- a/chrome/browser/search_engines/template_url_model_unittest.cc
+++ b/chrome/browser/search_engines/template_url_model_unittest.cc
@@ -12,7 +12,9 @@
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/search_engines/search_host_to_urls_map.h"
+#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
+#include "chrome/browser/search_engines/template_url_model_observer.h"
#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
#include "chrome/browser/webdata/web_database.h"
#include "chrome/test/testing_profile.h"
@@ -606,7 +608,7 @@ TEST_F(TemplateURLModelTest, DefaultSearchProviderLoadedFromPrefs) {
model_->Add(template_url);
- const TemplateURL::IDType id = template_url->id();
+ const TemplateURLID id = template_url->id();
model_->SetDefaultSearchProvider(template_url);
diff --git a/chrome/browser/search_engines/template_url_table_model.cc b/chrome/browser/search_engines/template_url_table_model.cc
index 6a59978..4570b25 100644
--- a/chrome/browser/search_engines/template_url_table_model.cc
+++ b/chrome/browser/search_engines/template_url_table_model.cc
@@ -16,6 +16,8 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/favicon_service.h"
#include "chrome/browser/profile.h"
+#include "chrome/browser/search_engines/template_url.h"
+#include "chrome/browser/search_engines/template_url_model.h"
#include "gfx/codec/png_codec.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/search_engines/template_url_table_model.h b/chrome/browser/search_engines/template_url_table_model.h
index af2f1e7..03bb43a 100644
--- a/chrome/browser/search_engines/template_url_table_model.h
+++ b/chrome/browser/search_engines/template_url_table_model.h
@@ -8,13 +8,12 @@
#include "app/table_model.h"
#include "base/string16.h"
-#include "chrome/browser/search_engines/template_url_model.h"
+#include "chrome/browser/search_engines/template_url_model_observer.h"
class ModelEntry;
class SkBitmap;
class TemplateURL;
class TemplateURLModel;
-class TemplateURLTableModel;
// TemplateURLTableModel is the TableModel implementation used by
// KeywordEditorView to show the keywords in a TableView.