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

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

Issue 132733002: InstantExtended: remove dead code related to the non-cacheable NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 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"
kmadhusu 2014/01/09 23:31:43 You can remove this and compiler_specific.h
samarth 2014/01/10 05:13:32 Done.
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" 20 #include "base/prefs/pref_change_registrar.h"
21 #include "chrome/browser/google/google_url_tracker.h" 21 #include "chrome/browser/google/google_url_tracker.h"
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"
24 #include "chrome/browser/ui/search/instant_search_prerenderer.h" 23 #include "chrome/browser/ui/search/instant_search_prerenderer.h"
25 #include "chrome/common/instant_types.h" 24 #include "chrome/common/instant_types.h"
26 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 25 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
27 #include "content/public/browser/notification_observer.h" 26 #include "content/public/browser/notification_observer.h"
28 #include "content/public/browser/notification_registrar.h" 27 #include "content/public/browser/notification_registrar.h"
29 28
30 class GURL; 29 class GURL;
31 class InstantIOContext; 30 class InstantIOContext;
32 class InstantServiceObserver; 31 class InstantServiceObserver;
33 class InstantTestBase; 32 class InstantTestBase;
34 class InstantServiceTest; 33 class InstantServiceTest;
35 class Profile; 34 class Profile;
36 class ThemeService; 35 class ThemeService;
37 36
38 namespace content { 37 namespace content {
38 class RenderProcessHost;
39 class WebContents; 39 class WebContents;
kmadhusu 2014/01/09 23:31:43 Forward declaration is no longer required.
samarth 2014/01/10 05:13:32 Done.
40 } 40 }
41 41
42 namespace net { 42 namespace net {
43 class URLRequest; 43 class URLRequest;
44 } 44 }
45 45
46 // Tracks render process host IDs that are associated with Instant. 46 // Tracks render process host IDs that are associated with Instant.
47 class InstantService : public BrowserContextKeyedService, 47 class InstantService : public BrowserContextKeyedService,
48 public content::NotificationObserver { 48 public content::NotificationObserver {
49 public: 49 public:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Invoked by the InstantController to update theme information for NTP. 82 // Invoked by the InstantController to update theme information for NTP.
83 // 83 //
84 // TODO(kmadhusu): Invoking this from InstantController shouldn't be 84 // TODO(kmadhusu): Invoking this from InstantController shouldn't be
85 // necessary. Investigate more and remove this from here. 85 // necessary. Investigate more and remove this from here.
86 void UpdateThemeInfo(); 86 void UpdateThemeInfo();
87 87
88 // Invoked by the InstantController to update most visited items details for 88 // Invoked by the InstantController to update most visited items details for
89 // NTP. 89 // NTP.
90 void UpdateMostVisitedItemsInfo(); 90 void UpdateMostVisitedItemsInfo();
91 91
92 // Forwards the request to InstantNTPPrerenderer to release and return the
93 // preloaded InstantNTP WebContents. May be NULL. InstantNTPPrerenderer will
94 // load a new InstantNTP after releasing the preloaded contents.
95 scoped_ptr<content::WebContents> ReleaseNTPContents() WARN_UNUSED_RESULT;
96
97 // The NTP WebContents. May be NULL. InstantNTPPrerenderer retains ownership.
98 content::WebContents* GetNTPContents() const;
99
100 // Notifies InstantService about the creation of a BrowserInstantController
101 // object. Used to preload InstantNTP.
102 void OnBrowserInstantControllerCreated();
103
104 // Notifies InstantService about the destruction of a BrowserInstantController
105 // object. Used to destroy the preloaded InstantNTP.
106 void OnBrowserInstantControllerDestroyed();
107
108 // Sends the current set of search URLs to a renderer process. 92 // Sends the current set of search URLs to a renderer process.
109 void SendSearchURLsToRenderer(content::RenderProcessHost* rph); 93 void SendSearchURLsToRenderer(content::RenderProcessHost* rph);
110 94
111 InstantSearchPrerenderer* instant_search_prerenderer() { 95 InstantSearchPrerenderer* instant_search_prerenderer() {
112 return instant_prerenderer_.get(); 96 return instant_prerenderer_.get();
113 } 97 }
114 98
115 private: 99 private:
116 friend class InstantExtendedTest; 100 friend class InstantExtendedTest;
117 friend class InstantServiceTest; 101 friend class InstantServiceTest;
118 friend class InstantTestBase; 102 friend class InstantTestBase;
119 friend class InstantUnitTestBase; 103 friend class InstantUnitTestBase;
120 104
121 FRIEND_TEST_ALL_PREFIXES(InstantExtendedNetworkTest, 105 FRIEND_TEST_ALL_PREFIXES(InstantExtendedNetworkTest,
kmadhusu 2014/01/09 23:31:43 No longer required.
samarth 2014/01/10 05:13:32 Done.
122 NTPReactsToNetworkChanges); 106 NTPReactsToNetworkChanges);
123 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, 107 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest,
124 MANUAL_ShowsGoogleNTP); 108 MANUAL_ShowsGoogleNTP);
kmadhusu 2014/01/09 23:31:43 No longer required.
samarth 2014/01/10 05:13:32 Done.
125 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, 109 FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest,
126 MANUAL_SearchesFromFakebox); 110 MANUAL_SearchesFromFakebox);
127 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); 111 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation);
128 FRIEND_TEST_ALL_PREFIXES(InstantServiceTest, SendsSearchURLsToRenderer); 112 FRIEND_TEST_ALL_PREFIXES(InstantServiceTest, SendsSearchURLsToRenderer);
129 113
130 // Overridden from BrowserContextKeyedService: 114 // Overridden from BrowserContextKeyedService:
131 virtual void Shutdown() OVERRIDE; 115 virtual void Shutdown() OVERRIDE;
132 116
133 // Overridden from content::NotificationObserver: 117 // Overridden from content::NotificationObserver:
134 virtual void Observe(int type, 118 virtual void Observe(int type,
(...skipping 12 matching lines...) Expand all
147 void NotifyAboutMostVisitedItems(); 131 void NotifyAboutMostVisitedItems();
148 132
149 // Theme changed notification handler. 133 // Theme changed notification handler.
150 void OnThemeChanged(ThemeService* theme_service); 134 void OnThemeChanged(ThemeService* theme_service);
151 135
152 void OnGoogleURLUpdated(Profile* profile, 136 void OnGoogleURLUpdated(Profile* profile,
153 GoogleURLTracker::UpdatedDetails* details); 137 GoogleURLTracker::UpdatedDetails* details);
154 138
155 void OnDefaultSearchProviderChanged(const std::string& pref_name); 139 void OnDefaultSearchProviderChanged(const std::string& pref_name);
156 140
157 // Used by tests.
158 InstantNTPPrerenderer* ntp_prerenderer();
159
160 void ResetInstantSearchPrerenderer(); 141 void ResetInstantSearchPrerenderer();
161 142
162 Profile* const profile_; 143 Profile* const profile_;
163 144
164 // The process ids associated with Instant processes. 145 // The process ids associated with Instant processes.
165 std::set<int> process_ids_; 146 std::set<int> process_ids_;
166 147
167 // InstantMostVisitedItems sent to the Instant Pages. 148 // InstantMostVisitedItems sent to the Instant Pages.
168 std::vector<InstantMostVisitedItem> most_visited_items_; 149 std::vector<InstantMostVisitedItem> most_visited_items_;
169 150
170 // Theme-related data for NTP overlay to adopt themes. 151 // Theme-related data for NTP overlay to adopt themes.
171 scoped_ptr<ThemeBackgroundInfo> theme_info_; 152 scoped_ptr<ThemeBackgroundInfo> theme_info_;
172 153
173 ObserverList<InstantServiceObserver> observers_; 154 ObserverList<InstantServiceObserver> observers_;
174 155
175 content::NotificationRegistrar registrar_; 156 content::NotificationRegistrar registrar_;
176 157
177 PrefChangeRegistrar profile_pref_registrar_; 158 PrefChangeRegistrar profile_pref_registrar_;
178 159
179 scoped_refptr<InstantIOContext> instant_io_context_; 160 scoped_refptr<InstantIOContext> instant_io_context_;
180 161
181 InstantNTPPrerenderer ntp_prerenderer_;
182
183 // Total number of BrowserInstantController objects (does not include objects
184 // created for OTR browser windows). Used to preload and delete InstantNTP.
185 size_t browser_instant_controller_object_count_;
186
187 // Set to NULL if the default search provider does not support Instant. 162 // Set to NULL if the default search provider does not support Instant.
188 scoped_ptr<InstantSearchPrerenderer> instant_prerenderer_; 163 scoped_ptr<InstantSearchPrerenderer> instant_prerenderer_;
189 164
190 // Used for Top Sites async retrieval. 165 // Used for Top Sites async retrieval.
191 base::WeakPtrFactory<InstantService> weak_ptr_factory_; 166 base::WeakPtrFactory<InstantService> weak_ptr_factory_;
192 167
193 DISALLOW_COPY_AND_ASSIGN(InstantService); 168 DISALLOW_COPY_AND_ASSIGN(InstantService);
194 }; 169 };
195 170
196 #endif // CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ 171 #endif // CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698