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

Side by Side Diff: chrome/browser/search/instant_service.h

Issue 20388003: Reload Instant NTP and Instant-process tabs on search url change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and addressed comments Created 7 years, 4 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 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;
29 class InstantIOContext; 30 class InstantIOContext;
30 class InstantServiceObserver; 31 class InstantServiceObserver;
31 class InstantTestBase;
32 class Profile; 32 class Profile;
33 class ThemeService; 33 class ThemeService;
34 34
35 namespace content { 35 namespace content {
36 class WebContents; 36 class WebContents;
37 } 37 }
38 38
39 namespace net { 39 namespace net {
40 class URLRequest; 40 class URLRequest;
41 } 41 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // Notifies InstantService about the creation of a BrowserInstantController 97 // Notifies InstantService about the creation of a BrowserInstantController
98 // object. Used to preload InstantNTP. 98 // object. Used to preload InstantNTP.
99 void OnBrowserInstantControllerCreated(); 99 void OnBrowserInstantControllerCreated();
100 100
101 // Notifies InstantService about the destruction of a BrowserInstantController 101 // Notifies InstantService about the destruction of a BrowserInstantController
102 // object. Used to destroy the preloaded InstantNTP. 102 // object. Used to destroy the preloaded InstantNTP.
103 void OnBrowserInstantControllerDestroyed(); 103 void OnBrowserInstantControllerDestroyed();
104 104
105 private: 105 private:
106 friend class InstantExtendedTest; 106 friend class InstantExtendedTest;
107 friend class InstantServiceTest;
107 friend class InstantTestBase; 108 friend class InstantTestBase;
108 109
109 FRIEND_TEST_ALL_PREFIXES(InstantExtendedNetworkTest, 110 FRIEND_TEST_ALL_PREFIXES(InstantExtendedNetworkTest,
110 NTPReactsToNetworkChanges); 111 NTPReactsToNetworkChanges);
111 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, 112 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest,
112 MANUAL_ShowsGoogleNTP); 113 MANUAL_ShowsGoogleNTP);
113 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, 114 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest,
114 MANUAL_SearchesFromFakebox); 115 MANUAL_SearchesFromFakebox);
115 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); 116 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation);
116 117
117 // Overridden from BrowserContextKeyedService: 118 // Overridden from BrowserContextKeyedService:
118 virtual void Shutdown() OVERRIDE; 119 virtual void Shutdown() OVERRIDE;
119 120
120 // Overridden from content::NotificationObserver: 121 // Overridden from content::NotificationObserver:
121 virtual void Observe(int type, 122 virtual void Observe(int type,
122 const content::NotificationSource& source, 123 const content::NotificationSource& source,
123 const content::NotificationDetails& details) OVERRIDE; 124 const content::NotificationDetails& details) OVERRIDE;
124 125
125 // Called when we get new most visited items from TopSites, registered as an 126 // Called when we get new most visited items from TopSites, registered as an
126 // async callback. Parses them and sends them to the renderer via 127 // async callback. Parses them and sends them to the renderer via
127 // SendMostVisitedItems. 128 // SendMostVisitedItems.
128 void OnMostVisitedItemsReceived(const history::MostVisitedURLList& data); 129 void OnMostVisitedItemsReceived(const history::MostVisitedURLList& data);
129 130
130 // Notifies the observer about the last known most visited items. 131 // Notifies the observer about the last known most visited items.
131 void NotifyAboutMostVisitedItems(); 132 void NotifyAboutMostVisitedItems();
132 133
133 // Theme changed notification handler. 134 // Theme changed notification handler.
134 void OnThemeChanged(ThemeService* theme_service); 135 void OnThemeChanged(ThemeService* theme_service);
135 136
137 void OnGoogleURLUpdated(Profile* profile,
138 GoogleURLTracker::UpdatedDetails* details);
139
140 void OnDefaultSearchProviderChanged(const std::string& pref_name);
141
136 // Used by tests. 142 // Used by tests.
137 InstantNTPPrerenderer* ntp_prerenderer(); 143 InstantNTPPrerenderer* ntp_prerenderer();
138 144
139 Profile* const profile_; 145 Profile* const profile_;
140 146
141 // The process ids associated with Instant processes. 147 // The process ids associated with Instant processes.
142 std::set<int> process_ids_; 148 std::set<int> process_ids_;
143 149
144 // InstantMostVisitedItems sent to the Instant Pages. 150 // InstantMostVisitedItems sent to the Instant Pages.
145 std::vector<InstantMostVisitedItem> most_visited_items_; 151 std::vector<InstantMostVisitedItem> most_visited_items_;
146 152
147 // Theme-related data for NTP overlay to adopt themes. 153 // Theme-related data for NTP overlay to adopt themes.
148 scoped_ptr<ThemeBackgroundInfo> theme_info_; 154 scoped_ptr<ThemeBackgroundInfo> theme_info_;
149 155
150 ObserverList<InstantServiceObserver> observers_; 156 ObserverList<InstantServiceObserver> observers_;
151 157
152 content::NotificationRegistrar registrar_; 158 content::NotificationRegistrar registrar_;
153 159
160 PrefChangeRegistrar profile_pref_registrar_;
161
154 scoped_refptr<InstantIOContext> instant_io_context_; 162 scoped_refptr<InstantIOContext> instant_io_context_;
155 163
156 InstantNTPPrerenderer ntp_prerenderer_; 164 InstantNTPPrerenderer ntp_prerenderer_;
157 165
158 // Total number of BrowserInstantController objects (does not include objects 166 // Total number of BrowserInstantController objects (does not include objects
159 // created for OTR browser windows). Used to preload and delete InstantNTP. 167 // created for OTR browser windows). Used to preload and delete InstantNTP.
160 size_t browser_instant_controller_object_count_; 168 size_t browser_instant_controller_object_count_;
161 169
162 // Used for Top Sites async retrieval. 170 // Used for Top Sites async retrieval.
163 base::WeakPtrFactory<InstantService> weak_ptr_factory_; 171 base::WeakPtrFactory<InstantService> weak_ptr_factory_;
164 172
165 DISALLOW_COPY_AND_ASSIGN(InstantService); 173 DISALLOW_COPY_AND_ASSIGN(InstantService);
166 }; 174 };
167 175
168 #endif // CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ 176 #endif // CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search/instant_service.cc » ('j') | chrome/browser/search/instant_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698