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

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

Issue 8065016: [Sync] Refactor non-frontend DTC to handle new API properly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Try harder trybot (rebase). Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h"
16 #include "base/observer_list.h" 17 #include "base/observer_list.h"
17 #include "chrome/browser/profiles/profile_keyed_service.h" 18 #include "chrome/browser/profiles/profile_keyed_service.h"
18 #include "chrome/browser/search_engines/search_host_to_urls_map.h" 19 #include "chrome/browser/search_engines/search_host_to_urls_map.h"
19 #include "chrome/browser/search_engines/template_url_id.h" 20 #include "chrome/browser/search_engines/template_url_id.h"
20 #include "chrome/browser/sync/api/sync_change.h" 21 #include "chrome/browser/sync/api/sync_change.h"
21 #include "chrome/browser/sync/api/syncable_service.h" 22 #include "chrome/browser/sync/api/syncable_service.h"
22 #include "chrome/browser/webdata/web_data_service.h" 23 #include "chrome/browser/webdata/web_data_service.h"
23 #include "content/common/notification_observer.h" 24 #include "content/common/notification_observer.h"
24 #include "content/common/notification_registrar.h" 25 #include "content/common/notification_registrar.h"
25 26
(...skipping 29 matching lines...) Expand all
55 // OnTemplateURLServiceChanged as well as the TEMPLATE_URL_SERVICE_LOADED 56 // OnTemplateURLServiceChanged as well as the TEMPLATE_URL_SERVICE_LOADED
56 // notification message. 57 // notification message.
57 // 58 //
58 // TemplateURLService takes ownership of any TemplateURL passed to it. If there 59 // TemplateURLService takes ownership of any TemplateURL passed to it. If there
59 // is a WebDataService, deletion is handled by WebDataService, otherwise 60 // is a WebDataService, deletion is handled by WebDataService, otherwise
60 // TemplateURLService handles deletion. 61 // TemplateURLService handles deletion.
61 62
62 class TemplateURLService : public WebDataServiceConsumer, 63 class TemplateURLService : public WebDataServiceConsumer,
63 public ProfileKeyedService, 64 public ProfileKeyedService,
64 public NotificationObserver, 65 public NotificationObserver,
65 public SyncableService { 66 public SyncableService,
67 public base::SupportsWeakPtr<TemplateURLService> {
66 public: 68 public:
67 typedef std::map<std::string, std::string> QueryTerms; 69 typedef std::map<std::string, std::string> QueryTerms;
68 typedef std::vector<const TemplateURL*> TemplateURLVector; 70 typedef std::vector<const TemplateURL*> TemplateURLVector;
69 // Type for a static function pointer that acts as a time source. 71 // Type for a static function pointer that acts as a time source.
70 typedef base::Time(TimeProvider)(); 72 typedef base::Time(TimeProvider)();
71 typedef std::map<std::string, SyncData> SyncDataMap; 73 typedef std::map<std::string, SyncData> SyncDataMap;
72 74
73 // Struct used for initializing the data store with fake data. 75 // Struct used for initializing the data store with fake data.
74 // Each initializer is mapped to a TemplateURL. 76 // Each initializer is mapped to a TemplateURL.
75 struct Initializer { 77 struct Initializer {
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 // true, we ignore any local search engine changes, since we triggered them. 572 // true, we ignore any local search engine changes, since we triggered them.
571 bool processing_syncer_changes_; 573 bool processing_syncer_changes_;
572 574
573 // Sync's SyncChange handler. We push all our changes through this. 575 // Sync's SyncChange handler. We push all our changes through this.
574 SyncChangeProcessor* sync_processor_; 576 SyncChangeProcessor* sync_processor_;
575 577
576 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); 578 DISALLOW_COPY_AND_ASSIGN(TemplateURLService);
577 }; 579 };
578 580
579 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ 581 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698