| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/history/history_types.h" | 22 #include "chrome/browser/history/history_types.h" |
| 23 #include "chrome/browser/ui/search/instant_ntp_prerenderer.h" | 23 #include "chrome/browser/ui/search/instant_ntp_prerenderer.h" |
| 24 #include "chrome/common/instant_types.h" | 24 #include "chrome/common/instant_types.h" |
| 25 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 25 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
| 26 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
| 27 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
| 28 | 28 |
| 29 class GURL; | 29 class GURL; |
| 30 class InstantIOContext; | 30 class InstantIOContext; |
| 31 class InstantServiceObserver; | 31 class InstantServiceObserver; |
| 32 class InstantTestBase; |
| 33 class InstantServiceTest; |
| 32 class Profile; | 34 class Profile; |
| 33 class ThemeService; | 35 class ThemeService; |
| 34 | 36 |
| 35 namespace content { | 37 namespace content { |
| 36 class WebContents; | 38 class WebContents; |
| 37 } | 39 } |
| 38 | 40 |
| 39 namespace net { | 41 namespace net { |
| 40 class URLRequest; | 42 class URLRequest; |
| 41 } | 43 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 content::WebContents* GetNTPContents() const; | 97 content::WebContents* GetNTPContents() const; |
| 96 | 98 |
| 97 // Notifies InstantService about the creation of a BrowserInstantController | 99 // Notifies InstantService about the creation of a BrowserInstantController |
| 98 // object. Used to preload InstantNTP. | 100 // object. Used to preload InstantNTP. |
| 99 void OnBrowserInstantControllerCreated(); | 101 void OnBrowserInstantControllerCreated(); |
| 100 | 102 |
| 101 // Notifies InstantService about the destruction of a BrowserInstantController | 103 // Notifies InstantService about the destruction of a BrowserInstantController |
| 102 // object. Used to destroy the preloaded InstantNTP. | 104 // object. Used to destroy the preloaded InstantNTP. |
| 103 void OnBrowserInstantControllerDestroyed(); | 105 void OnBrowserInstantControllerDestroyed(); |
| 104 | 106 |
| 107 // Sends the current set of search URLs to a renderer process. |
| 108 void SendSearchURLsToRenderer(content::RenderProcessHost* rph); |
| 109 |
| 105 private: | 110 private: |
| 106 friend class InstantExtendedTest; | 111 friend class InstantExtendedTest; |
| 107 friend class InstantServiceTest; | 112 friend class InstantServiceTest; |
| 108 friend class InstantTestBase; | 113 friend class InstantTestBase; |
| 109 friend class InstantUnitTestBase; | 114 friend class InstantUnitTestBase; |
| 110 | 115 |
| 111 FRIEND_TEST_ALL_PREFIXES(InstantExtendedNetworkTest, | 116 FRIEND_TEST_ALL_PREFIXES(InstantExtendedNetworkTest, |
| 112 NTPReactsToNetworkChanges); | 117 NTPReactsToNetworkChanges); |
| 113 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, | 118 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, |
| 114 MANUAL_ShowsGoogleNTP); | 119 MANUAL_ShowsGoogleNTP); |
| 115 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, | 120 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, |
| 116 MANUAL_SearchesFromFakebox); | 121 MANUAL_SearchesFromFakebox); |
| 117 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); | 122 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); |
| 123 FRIEND_TEST_ALL_PREFIXES(InstantServiceTest, SendsSearchURLsToRenderer); |
| 118 | 124 |
| 119 // Overridden from BrowserContextKeyedService: | 125 // Overridden from BrowserContextKeyedService: |
| 120 virtual void Shutdown() OVERRIDE; | 126 virtual void Shutdown() OVERRIDE; |
| 121 | 127 |
| 122 // Overridden from content::NotificationObserver: | 128 // Overridden from content::NotificationObserver: |
| 123 virtual void Observe(int type, | 129 virtual void Observe(int type, |
| 124 const content::NotificationSource& source, | 130 const content::NotificationSource& source, |
| 125 const content::NotificationDetails& details) OVERRIDE; | 131 const content::NotificationDetails& details) OVERRIDE; |
| 126 | 132 |
| 133 // Called when a renderer process is terminated. |
| 134 void OnRendererProcessTerminated(int process_id); |
| 135 |
| 127 // Called when we get new most visited items from TopSites, registered as an | 136 // Called when we get new most visited items from TopSites, registered as an |
| 128 // async callback. Parses them and sends them to the renderer via | 137 // async callback. Parses them and sends them to the renderer via |
| 129 // SendMostVisitedItems. | 138 // SendMostVisitedItems. |
| 130 void OnMostVisitedItemsReceived(const history::MostVisitedURLList& data); | 139 void OnMostVisitedItemsReceived(const history::MostVisitedURLList& data); |
| 131 | 140 |
| 132 // Notifies the observer about the last known most visited items. | 141 // Notifies the observer about the last known most visited items. |
| 133 void NotifyAboutMostVisitedItems(); | 142 void NotifyAboutMostVisitedItems(); |
| 134 | 143 |
| 135 // Theme changed notification handler. | 144 // Theme changed notification handler. |
| 136 void OnThemeChanged(ThemeService* theme_service); | 145 void OnThemeChanged(ThemeService* theme_service); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // created for OTR browser windows). Used to preload and delete InstantNTP. | 177 // created for OTR browser windows). Used to preload and delete InstantNTP. |
| 169 size_t browser_instant_controller_object_count_; | 178 size_t browser_instant_controller_object_count_; |
| 170 | 179 |
| 171 // Used for Top Sites async retrieval. | 180 // Used for Top Sites async retrieval. |
| 172 base::WeakPtrFactory<InstantService> weak_ptr_factory_; | 181 base::WeakPtrFactory<InstantService> weak_ptr_factory_; |
| 173 | 182 |
| 174 DISALLOW_COPY_AND_ASSIGN(InstantService); | 183 DISALLOW_COPY_AND_ASSIGN(InstantService); |
| 175 }; | 184 }; |
| 176 | 185 |
| 177 #endif // CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ | 186 #endif // CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ |
| OLD | NEW |