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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 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
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 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "chrome/browser/prefs/pref_change_registrar.h" 18 #include "chrome/browser/prefs/pref_change_registrar.h"
19 #include "chrome/browser/profiles/profile_keyed_service.h" 19 #include "chrome/browser/profiles/profile_keyed_service.h"
20 #include "chrome/browser/search_engines/template_url_id.h" 20 #include "chrome/browser/search_engines/template_url_id.h"
21 #include "chrome/browser/webdata/web_data_service.h" 21 #include "chrome/browser/webdata/web_data_service.h"
22 #include "content/public/browser/notification_observer.h" 22 #include "content/public/browser/notification_observer.h"
23 #include "content/public/browser/notification_registrar.h" 23 #include "content/public/browser/notification_registrar.h"
24 #include "sync/api/sync_change.h" 24 #include "sync/api/sync_change.h"
25 #include "sync/api/syncable_service.h" 25 #include "sync/api/syncable_service.h"
26 26
27 class Extension;
28 class GURL; 27 class GURL;
29 class PrefService; 28 class PrefService;
30 class Profile; 29 class Profile;
31 class SearchHostToURLsMap; 30 class SearchHostToURLsMap;
32 class SearchTermsData; 31 class SearchTermsData;
33 class SyncData; 32 class SyncData;
34 class SyncErrorFactory; 33 class SyncErrorFactory;
35 class TemplateURLServiceObserver; 34 class TemplateURLServiceObserver;
36 35
36 namespace extensions {
37 class Extension;
38 }
39
37 namespace history { 40 namespace history {
38 struct URLVisitedDetails; 41 struct URLVisitedDetails;
39 } 42 }
40 43
41 // TemplateURLService is the backend for keywords. It's used by 44 // TemplateURLService is the backend for keywords. It's used by
42 // KeywordAutocomplete. 45 // KeywordAutocomplete.
43 // 46 //
44 // TemplateURLService stores a vector of TemplateURLs. The TemplateURLs are 47 // TemplateURLService stores a vector of TemplateURLs. The TemplateURLs are
45 // persisted to the database maintained by WebDataService. *ALL* mutations 48 // persisted to the database maintained by WebDataService. *ALL* mutations
46 // to the TemplateURLs must funnel through TemplateURLService. This allows 49 // to the TemplateURLs must funnel through TemplateURLService. This allows
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // Removes all auto-generated keywords that were created in the specified 170 // Removes all auto-generated keywords that were created in the specified
168 // range for a specified |origin|. If |origin| is empty, deletes all 171 // range for a specified |origin|. If |origin| is empty, deletes all
169 // auto-generated keywords in the range. 172 // auto-generated keywords in the range.
170 void RemoveAutoGeneratedForOriginBetween(const GURL& origin, 173 void RemoveAutoGeneratedForOriginBetween(const GURL& origin,
171 base::Time created_after, 174 base::Time created_after,
172 base::Time created_before); 175 base::Time created_before);
173 176
174 // If the given extension has an omnibox keyword, adds a TemplateURL for that 177 // If the given extension has an omnibox keyword, adds a TemplateURL for that
175 // keyword. Only 1 keyword is allowed for a given extension. If the keyword 178 // keyword. Only 1 keyword is allowed for a given extension. If the keyword
176 // already exists for this extension, does nothing. 179 // already exists for this extension, does nothing.
177 void RegisterExtensionKeyword(const Extension* extension); 180 void RegisterExtensionKeyword(const extensions::Extension* extension);
178 181
179 // Removes the TemplateURL containing the keyword for the given extension, 182 // Removes the TemplateURL containing the keyword for the given extension,
180 // if any. 183 // if any.
181 void UnregisterExtensionKeyword(const Extension* extension); 184 void UnregisterExtensionKeyword(const extensions::Extension* extension);
182 185
183 // Returns the TemplateURL associated with the keyword for this extension. 186 // Returns the TemplateURL associated with the keyword for this extension.
184 // This works by checking the extension ID, not the keyword, so it will work 187 // This works by checking the extension ID, not the keyword, so it will work
185 // even if the user changed the keyword. 188 // even if the user changed the keyword.
186 TemplateURL* GetTemplateURLForExtension(const Extension* extension); 189 TemplateURL* GetTemplateURLForExtension(
190 const extensions::Extension* extension);
187 191
188 // Returns the set of URLs describing the keywords. The elements are owned 192 // Returns the set of URLs describing the keywords. The elements are owned
189 // by TemplateURLService and should not be deleted. 193 // by TemplateURLService and should not be deleted.
190 TemplateURLVector GetTemplateURLs(); 194 TemplateURLVector GetTemplateURLs();
191 195
192 // Increment the usage count of a keyword. 196 // Increment the usage count of a keyword.
193 // Called when a URL is loaded that was generated from a keyword. 197 // Called when a URL is loaded that was generated from a keyword.
194 void IncrementUsageCount(TemplateURL* url); 198 void IncrementUsageCount(TemplateURL* url);
195 199
196 // Resets the title, keyword and search url of the specified TemplateURL. 200 // Resets the title, keyword and search url of the specified TemplateURL.
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 // A set of sync GUIDs denoting TemplateURLs that have been removed from this 637 // A set of sync GUIDs denoting TemplateURLs that have been removed from this
634 // model or the underlying WebDataService prior to MergeDataAndStartSyncing. 638 // model or the underlying WebDataService prior to MergeDataAndStartSyncing.
635 // This set is used to determine what entries from the server we want to 639 // This set is used to determine what entries from the server we want to
636 // ignore locally and return a delete command for. 640 // ignore locally and return a delete command for.
637 std::set<std::string> pre_sync_deletes_; 641 std::set<std::string> pre_sync_deletes_;
638 642
639 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); 643 DISALLOW_COPY_AND_ASSIGN(TemplateURLService);
640 }; 644 };
641 645
642 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ 646 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698