OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_INSTANT_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ |
6 #define CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ | 6 #define CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 namespace content { | 31 namespace content { |
32 class RenderProcessHost; | 32 class RenderProcessHost; |
33 } | 33 } |
34 | 34 |
35 // Tracks render process host IDs that are associated with Instant. | 35 // Tracks render process host IDs that are associated with Instant. |
36 class InstantService : public KeyedService, | 36 class InstantService : public KeyedService, |
37 public content::NotificationObserver, | 37 public content::NotificationObserver, |
38 public TemplateURLServiceObserver { | 38 public TemplateURLServiceObserver { |
39 public: | 39 public: |
40 explicit InstantService(Profile* profile); | 40 explicit InstantService(Profile* profile); |
41 virtual ~InstantService(); | 41 ~InstantService() override; |
42 | 42 |
43 // Add, remove, and query RenderProcessHost IDs that are associated with | 43 // Add, remove, and query RenderProcessHost IDs that are associated with |
44 // Instant processes. | 44 // Instant processes. |
45 void AddInstantProcess(int process_id); | 45 void AddInstantProcess(int process_id); |
46 bool IsInstantProcess(int process_id) const; | 46 bool IsInstantProcess(int process_id) const; |
47 | 47 |
48 // Adds/Removes InstantService observers. | 48 // Adds/Removes InstantService observers. |
49 void AddObserver(InstantServiceObserver* observer); | 49 void AddObserver(InstantServiceObserver* observer); |
50 void RemoveObserver(InstantServiceObserver* observer); | 50 void RemoveObserver(InstantServiceObserver* observer); |
51 | 51 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 friend class InstantTestBase; | 98 friend class InstantTestBase; |
99 friend class InstantUnitTestBase; | 99 friend class InstantUnitTestBase; |
100 | 100 |
101 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, | 101 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, |
102 MANUAL_SearchesFromFakebox); | 102 MANUAL_SearchesFromFakebox); |
103 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); | 103 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); |
104 FRIEND_TEST_ALL_PREFIXES(InstantServiceEnabledTest, | 104 FRIEND_TEST_ALL_PREFIXES(InstantServiceEnabledTest, |
105 SendsSearchURLsToRenderer); | 105 SendsSearchURLsToRenderer); |
106 | 106 |
107 // KeyedService: | 107 // KeyedService: |
108 virtual void Shutdown() override; | 108 void Shutdown() override; |
109 | 109 |
110 // content::NotificationObserver: | 110 // content::NotificationObserver: |
111 virtual void Observe(int type, | 111 void Observe(int type, |
112 const content::NotificationSource& source, | 112 const content::NotificationSource& source, |
113 const content::NotificationDetails& details) override; | 113 const content::NotificationDetails& details) override; |
114 | 114 |
115 // TemplateURLServiceObserver: | 115 // TemplateURLServiceObserver: |
116 // Caches the previous value of the Default Search Provider and the Google | 116 // Caches the previous value of the Default Search Provider and the Google |
117 // base URL to filter out changes other than those affecting the Default | 117 // base URL to filter out changes other than those affecting the Default |
118 // Search Provider. | 118 // Search Provider. |
119 virtual void OnTemplateURLServiceChanged() override; | 119 void OnTemplateURLServiceChanged() override; |
120 | 120 |
121 // Called when a renderer process is terminated. | 121 // Called when a renderer process is terminated. |
122 void OnRendererProcessTerminated(int process_id); | 122 void OnRendererProcessTerminated(int process_id); |
123 | 123 |
124 // Called when we get new most visited items from TopSites, registered as an | 124 // Called when we get new most visited items from TopSites, registered as an |
125 // async callback. Parses them and sends them to the renderer via | 125 // async callback. Parses them and sends them to the renderer via |
126 // SendMostVisitedItems. | 126 // SendMostVisitedItems. |
127 void OnMostVisitedItemsReceived(const history::MostVisitedURLList& data); | 127 void OnMostVisitedItemsReceived(const history::MostVisitedURLList& data); |
128 | 128 |
129 // Notifies the observer about the last known most visited items. | 129 // Notifies the observer about the last known most visited items. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 scoped_ptr<TemplateURLData> previous_default_search_provider_; | 167 scoped_ptr<TemplateURLData> previous_default_search_provider_; |
168 GURL previous_google_base_url_; | 168 GURL previous_google_base_url_; |
169 | 169 |
170 // Used for Top Sites async retrieval. | 170 // Used for Top Sites async retrieval. |
171 base::WeakPtrFactory<InstantService> weak_ptr_factory_; | 171 base::WeakPtrFactory<InstantService> weak_ptr_factory_; |
172 | 172 |
173 DISALLOW_COPY_AND_ASSIGN(InstantService); | 173 DISALLOW_COPY_AND_ASSIGN(InstantService); |
174 }; | 174 }; |
175 | 175 |
176 #endif // CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ | 176 #endif // CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ |
OLD | NEW |