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

Side by Side Diff: chrome/browser/prerender/prerender_handle.h

Issue 2569763002: Prerender: remove PrerenderHandle::Matches() (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_handle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_HANDLE_H_ 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/prerender/prerender_manager.h" 12 #include "chrome/browser/prerender/prerender_manager.h"
13 13
14 class GURL;
15
16 namespace content {
17 class SessionStorageNamespace;
18 }
19
20 namespace prerender { 14 namespace prerender {
21 15
22 class PrerenderContents; 16 class PrerenderContents;
23 17
24 // A class representing a running prerender to a client of the PrerenderManager. 18 // A class representing a running prerender to a client of the PrerenderManager.
25 // Methods on PrerenderManager which start prerenders return a caller-owned 19 // Methods on PrerenderManager which start prerenders return a caller-owned
26 // PrerenderHandle* to the client (or NULL if they are unable to start a 20 // PrerenderHandle* to the client (or NULL if they are unable to start a
27 // prerender). Calls on the handle of a prerender that is not running at no-ops. 21 // prerender). Calls on the handle of a prerender that is not running at no-ops.
28 // Destroying a handle before a prerender starts will prevent it from ever 22 // Destroying a handle before a prerender starts will prevent it from ever
29 // starting. Destroying a handle while a prerendering is running will stop the 23 // starting. Destroying a handle while a prerendering is running will stop the
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 bool IsPrerendering() const; 64 bool IsPrerendering() const;
71 65
72 // True if we started a prerender, and it has finished loading. 66 // True if we started a prerender, and it has finished loading.
73 bool IsFinishedLoading() const; 67 bool IsFinishedLoading() const;
74 68
75 // True if the prerender is currently active, but is abandoned. 69 // True if the prerender is currently active, but is abandoned.
76 bool IsAbandoned() const; 70 bool IsAbandoned() const;
77 71
78 PrerenderContents* contents() const; 72 PrerenderContents* contents() const;
79 73
80 // Returns whether the prerender matches the URL provided.
81 bool Matches(
82 const GURL& url,
83 const content::SessionStorageNamespace* session_storage_namespace) const;
84
85 // Returns whether this PrerenderHandle represents the same prerender as 74 // Returns whether this PrerenderHandle represents the same prerender as
86 // the other PrerenderHandle object specified. 75 // the other PrerenderHandle object specified.
87 bool RepresentingSamePrerenderAs(PrerenderHandle* other) const; 76 bool RepresentingSamePrerenderAs(PrerenderHandle* other) const;
88 77
89 private: 78 private:
90 friend class PrerenderManager; 79 friend class PrerenderManager;
91 80
92 explicit PrerenderHandle(PrerenderManager::PrerenderData* prerender_data); 81 explicit PrerenderHandle(PrerenderManager::PrerenderData* prerender_data);
93 82
94 // From PrerenderContents::Observer: 83 // From PrerenderContents::Observer:
95 void OnPrerenderStart(PrerenderContents* prerender_contents) override; 84 void OnPrerenderStart(PrerenderContents* prerender_contents) override;
96 void OnPrerenderStopLoading(PrerenderContents* prerender_contents) override; 85 void OnPrerenderStopLoading(PrerenderContents* prerender_contents) override;
97 void OnPrerenderDomContentLoaded( 86 void OnPrerenderDomContentLoaded(
98 PrerenderContents* prerender_contents) override; 87 PrerenderContents* prerender_contents) override;
99 void OnPrerenderStop(PrerenderContents* prerender_contents) override; 88 void OnPrerenderStop(PrerenderContents* prerender_contents) override;
100 89
101 Observer* observer_; 90 Observer* observer_;
102 91
103 base::WeakPtr<PrerenderManager::PrerenderData> prerender_data_; 92 base::WeakPtr<PrerenderManager::PrerenderData> prerender_data_;
104 base::WeakPtrFactory<PrerenderHandle> weak_ptr_factory_; 93 base::WeakPtrFactory<PrerenderHandle> weak_ptr_factory_;
105 94
106 DISALLOW_COPY_AND_ASSIGN(PrerenderHandle); 95 DISALLOW_COPY_AND_ASSIGN(PrerenderHandle);
107 }; 96 };
108 97
109 } // namespace prerender 98 } // namespace prerender
110 99
111 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_ 100 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HANDLE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698