OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PRERENDER_PRERENDER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/task/cancelable_task_tracker.h" | |
19 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
20 #include "base/time/time.h" | 19 #include "base/time/time.h" |
21 #include "base/timer/timer.h" | 20 #include "base/timer/timer.h" |
22 #include "chrome/browser/history/history_service.h" | 21 #include "chrome/browser/history/history_service.h" |
23 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 22 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
24 #include "chrome/browser/predictors/logged_in_predictor_table.h" | 23 #include "chrome/browser/predictors/logged_in_predictor_table.h" |
25 #include "chrome/browser/prerender/prerender_config.h" | 24 #include "chrome/browser/prerender/prerender_config.h" |
26 #include "chrome/browser/prerender/prerender_contents.h" | 25 #include "chrome/browser/prerender/prerender_contents.h" |
27 #include "chrome/browser/prerender/prerender_events.h" | 26 #include "chrome/browser/prerender/prerender_events.h" |
28 #include "chrome/browser/prerender/prerender_final_status.h" | 27 #include "chrome/browser/prerender/prerender_final_status.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 312 |
314 // Checks if the LoggedInPredictor shows that the user is likely logged on | 313 // Checks if the LoggedInPredictor shows that the user is likely logged on |
315 // to the site for the URL provided. | 314 // to the site for the URL provided. |
316 void CheckIfLikelyLoggedInOnURL(const GURL& url, | 315 void CheckIfLikelyLoggedInOnURL(const GURL& url, |
317 bool* lookup_result, | 316 bool* lookup_result, |
318 bool* database_was_present, | 317 bool* database_was_present, |
319 const base::Closure& result_cb); | 318 const base::Closure& result_cb); |
320 | 319 |
321 void OnHistoryServiceDidQueryURL(Origin origin, | 320 void OnHistoryServiceDidQueryURL(Origin origin, |
322 uint8 experiment_id, | 321 uint8 experiment_id, |
| 322 CancelableRequestProvider::Handle handle, |
323 bool success, | 323 bool success, |
324 const history::URLRow& url_row, | 324 const history::URLRow* url_row, |
325 const history::VisitVector& visits); | 325 history::VisitVector* visits); |
326 | 326 |
327 Profile* profile() const { return profile_; } | 327 Profile* profile() const { return profile_; } |
328 | 328 |
329 // Classes which will be tested in prerender unit browser tests should use | 329 // Classes which will be tested in prerender unit browser tests should use |
330 // these methods to get times for comparison, so that the test framework can | 330 // these methods to get times for comparison, so that the test framework can |
331 // mock advancing/retarding time. | 331 // mock advancing/retarding time. |
332 virtual base::Time GetCurrentTime() const; | 332 virtual base::Time GetCurrentTime() const; |
333 virtual base::TimeTicks GetCurrentTimeTicks() const; | 333 virtual base::TimeTicks GetCurrentTimeTicks() const; |
334 | 334 |
335 scoped_refptr<predictors::LoggedInPredictorTable> | 335 scoped_refptr<predictors::LoggedInPredictorTable> |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 // Here, we keep the logged in predictor state, but potentially a superset | 735 // Here, we keep the logged in predictor state, but potentially a superset |
736 // of its actual (database-backed) state, since we do not incorporate | 736 // of its actual (database-backed) state, since we do not incorporate |
737 // browser data deletion. We do not use this for actual lookups, but only | 737 // browser data deletion. We do not use this for actual lookups, but only |
738 // to query cookie data for domains we know there was a login before. | 738 // to query cookie data for domains we know there was a login before. |
739 // This is required to avoid a large number of cookie lookups on bulk | 739 // This is required to avoid a large number of cookie lookups on bulk |
740 // deletion of cookies. | 740 // deletion of cookies. |
741 scoped_ptr<LoggedInStateMap> logged_in_state_; | 741 scoped_ptr<LoggedInStateMap> logged_in_state_; |
742 | 742 |
743 content::NotificationRegistrar notification_registrar_; | 743 content::NotificationRegistrar notification_registrar_; |
744 | 744 |
745 base::CancelableTaskTracker query_url_tracker_; | 745 CancelableRequestConsumer query_url_consumer_; |
746 | 746 |
747 // The number of bytes transferred over the network for the profile this | 747 // The number of bytes transferred over the network for the profile this |
748 // PrerenderManager is attached to. | 748 // PrerenderManager is attached to. |
749 int64 profile_network_bytes_; | 749 int64 profile_network_bytes_; |
750 | 750 |
751 // The value of profile_network_bytes_ that was last recorded. | 751 // The value of profile_network_bytes_ that was last recorded. |
752 int64 last_recorded_profile_network_bytes_; | 752 int64 last_recorded_profile_network_bytes_; |
753 | 753 |
754 // Set of process hosts being prerendered. | 754 // Set of process hosts being prerendered. |
755 typedef std::set<content::RenderProcessHost*> PrerenderProcessSet; | 755 typedef std::set<content::RenderProcessHost*> PrerenderProcessSet; |
756 PrerenderProcessSet prerender_process_hosts_; | 756 PrerenderProcessSet prerender_process_hosts_; |
757 | 757 |
758 // Indicates whether the cookie store for this profile has fully loaded yet. | 758 // Indicates whether the cookie store for this profile has fully loaded yet. |
759 bool cookie_store_loaded_; | 759 bool cookie_store_loaded_; |
760 | 760 |
761 base::Closure on_cookie_store_loaded_cb_for_testing_; | 761 base::Closure on_cookie_store_loaded_cb_for_testing_; |
762 | 762 |
763 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 763 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
764 }; | 764 }; |
765 | 765 |
766 } // namespace prerender | 766 } // namespace prerender |
767 | 767 |
768 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 768 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
OLD | NEW |