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

Side by Side Diff: chrome/browser/instant/instant_loader_manager.h

Issue 6990015: Preload Instant search when omnibox is focused. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebaseline Created 9 years, 6 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_INSTANT_INSTANT_LOADER_MANAGER_H_ 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_LOADER_MANAGER_H_
6 #define CHROME_BROWSER_INSTANT_INSTANT_LOADER_MANAGER_H_ 6 #define CHROME_BROWSER_INSTANT_INSTANT_LOADER_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // Destroys the specified loader. 59 // Destroys the specified loader.
60 void DestroyLoader(InstantLoader* loader); 60 void DestroyLoader(InstantLoader* loader);
61 61
62 // Removes references to loader. 62 // Removes references to loader.
63 InstantLoader* ReleaseLoader(InstantLoader* loader); 63 InstantLoader* ReleaseLoader(InstantLoader* loader);
64 64
65 // If |loader| is in |instant_loaders_| it is removed. 65 // If |loader| is in |instant_loaders_| it is removed.
66 void RemoveLoaderFromInstant(InstantLoader* loader); 66 void RemoveLoaderFromInstant(InstantLoader* loader);
67 67
68 // Returns the loader for loading instant results with the specified id. If
69 // there is no loader for the specified id a new one is created.
70 InstantLoader* GetInstantLoader(TemplateURLID id);
71
68 // Returns the current loader, may be null. 72 // Returns the current loader, may be null.
69 InstantLoader* current_loader() const { return current_loader_; } 73 InstantLoader* current_loader() const { return current_loader_; }
70 74
71 // Returns the pending loader, may be null. 75 // Returns the pending loader, may be null.
72 InstantLoader* pending_loader() const { return pending_loader_; } 76 InstantLoader* pending_loader() const { return pending_loader_; }
73 77
74 // The active loader is the loader that should be used for new loads. It is 78 // The active loader is the loader that should be used for new loads. It is
75 // either the pending loader or the current loader. 79 // either the pending loader or the current loader.
76 InstantLoader* active_loader() const { 80 InstantLoader* active_loader() const {
77 return pending_loader_ ? pending_loader_ : current_loader_; 81 return pending_loader_ ? pending_loader_ : current_loader_;
78 } 82 }
79 83
80 // Returns the number of instant loaders. 84 // Returns the number of instant loaders.
81 // This is exposed for tests. 85 // This is exposed for tests.
82 size_t num_instant_loaders() const { return instant_loaders_.size(); } 86 size_t num_instant_loaders() const { return instant_loaders_.size(); }
83 87
84 private: 88 private:
85 typedef std::map<TemplateURLID, InstantLoader*> Loaders; 89 typedef std::map<TemplateURLID, InstantLoader*> Loaders;
86 90
87 // Creates a loader and if |id| is non-zero registers it in instant_loaders_. 91 // Creates a loader and if |id| is non-zero registers it in instant_loaders_.
88 InstantLoader* CreateLoader(TemplateURLID id); 92 InstantLoader* CreateLoader(TemplateURLID id);
89 93
90 // Returns the loader for loading instant results with the specified id. If
91 // there is no loader for the specified id a new one is created.
92 InstantLoader* GetInstantLoader(TemplateURLID id);
93
94 InstantLoaderDelegate* loader_delegate_; 94 InstantLoaderDelegate* loader_delegate_;
95 95
96 // The current loader. 96 // The current loader.
97 InstantLoader* current_loader_; 97 InstantLoader* current_loader_;
98 98
99 // Loader we want to use as soon as ready. This is only non-null if 99 // Loader we want to use as soon as ready. This is only non-null if
100 // current_loader_ is ready and Update is invoked with a different template 100 // current_loader_ is ready and Update is invoked with a different template
101 // url id. 101 // url id.
102 InstantLoader* pending_loader_; 102 InstantLoader* pending_loader_;
103 103
104 // Maps for template url id to loader used for that template url id. 104 // Maps for template url id to loader used for that template url id.
105 Loaders instant_loaders_; 105 Loaders instant_loaders_;
106 106
107 DISALLOW_COPY_AND_ASSIGN(InstantLoaderManager); 107 DISALLOW_COPY_AND_ASSIGN(InstantLoaderManager);
108 }; 108 };
109 109
110 #endif // CHROME_BROWSER_INSTANT_INSTANT_LOADER_MANAGER_H_ 110 #endif // CHROME_BROWSER_INSTANT_INSTANT_LOADER_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_loader.cc ('k') | chrome/browser/instant/instant_loader_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698