| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 20 #include "base/prefs/pref_change_registrar.h" |
| 21 #include "chrome/browser/google/google_url_tracker.h" |
| 20 #include "chrome/browser/history/history_types.h" | 22 #include "chrome/browser/history/history_types.h" |
| 21 #include "chrome/browser/ui/search/instant_ntp_prerenderer.h" | 23 #include "chrome/browser/ui/search/instant_ntp_prerenderer.h" |
| 22 #include "chrome/common/instant_types.h" | 24 #include "chrome/common/instant_types.h" |
| 23 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 25 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
| 24 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
| 25 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
| 26 | 28 |
| 27 class GURL; | 29 class GURL; |
| 28 class InstantExtendedTest; | 30 class InstantExtendedTest; |
| 29 class InstantIOContext; | 31 class InstantIOContext; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // async callback. Parses them and sends them to the renderer via | 128 // async callback. Parses them and sends them to the renderer via |
| 127 // SendMostVisitedItems. | 129 // SendMostVisitedItems. |
| 128 void OnMostVisitedItemsReceived(const history::MostVisitedURLList& data); | 130 void OnMostVisitedItemsReceived(const history::MostVisitedURLList& data); |
| 129 | 131 |
| 130 // Notifies the observer about the last known most visited items. | 132 // Notifies the observer about the last known most visited items. |
| 131 void NotifyAboutMostVisitedItems(); | 133 void NotifyAboutMostVisitedItems(); |
| 132 | 134 |
| 133 // Theme changed notification handler. | 135 // Theme changed notification handler. |
| 134 void OnThemeChanged(ThemeService* theme_service); | 136 void OnThemeChanged(ThemeService* theme_service); |
| 135 | 137 |
| 138 void OnGoogleURLUpdated(Profile* profile, |
| 139 GoogleURLTracker::UpdatedDetails* details); |
| 140 |
| 141 void OnDefaultSearchProviderChanged(const std::string& pref_name); |
| 142 |
| 136 // Used by tests. | 143 // Used by tests. |
| 137 InstantNTPPrerenderer* ntp_prerenderer(); | 144 InstantNTPPrerenderer* ntp_prerenderer(); |
| 138 | 145 |
| 139 Profile* const profile_; | 146 Profile* const profile_; |
| 140 | 147 |
| 141 // The process ids associated with Instant processes. | 148 // The process ids associated with Instant processes. |
| 142 std::set<int> process_ids_; | 149 std::set<int> process_ids_; |
| 143 | 150 |
| 144 // InstantMostVisitedItems sent to the Instant Pages. | 151 // InstantMostVisitedItems sent to the Instant Pages. |
| 145 std::vector<InstantMostVisitedItem> most_visited_items_; | 152 std::vector<InstantMostVisitedItem> most_visited_items_; |
| 146 | 153 |
| 147 // Theme-related data for NTP overlay to adopt themes. | 154 // Theme-related data for NTP overlay to adopt themes. |
| 148 scoped_ptr<ThemeBackgroundInfo> theme_info_; | 155 scoped_ptr<ThemeBackgroundInfo> theme_info_; |
| 149 | 156 |
| 150 ObserverList<InstantServiceObserver> observers_; | 157 ObserverList<InstantServiceObserver> observers_; |
| 151 | 158 |
| 152 content::NotificationRegistrar registrar_; | 159 content::NotificationRegistrar registrar_; |
| 153 | 160 |
| 161 PrefChangeRegistrar profile_pref_registrar_; |
| 162 |
| 154 scoped_refptr<InstantIOContext> instant_io_context_; | 163 scoped_refptr<InstantIOContext> instant_io_context_; |
| 155 | 164 |
| 156 InstantNTPPrerenderer ntp_prerenderer_; | 165 InstantNTPPrerenderer ntp_prerenderer_; |
| 157 | 166 |
| 158 // Total number of BrowserInstantController objects (does not include objects | 167 // Total number of BrowserInstantController objects (does not include objects |
| 159 // created for OTR browser windows). Used to preload and delete InstantNTP. | 168 // created for OTR browser windows). Used to preload and delete InstantNTP. |
| 160 size_t browser_instant_controller_object_count_; | 169 size_t browser_instant_controller_object_count_; |
| 161 | 170 |
| 162 // Used for Top Sites async retrieval. | 171 // Used for Top Sites async retrieval. |
| 163 base::WeakPtrFactory<InstantService> weak_ptr_factory_; | 172 base::WeakPtrFactory<InstantService> weak_ptr_factory_; |
| 164 | 173 |
| 165 DISALLOW_COPY_AND_ASSIGN(InstantService); | 174 DISALLOW_COPY_AND_ASSIGN(InstantService); |
| 166 }; | 175 }; |
| 167 | 176 |
| 168 #endif // CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ | 177 #endif // CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ |
| OLD | NEW |