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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MESSAGE_FILTER_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MESSAGE_FILTER_H_ 7 8 #include "base/compiler_specific.h" 9 #include "content/public/browser/browser_message_filter.h" 10 #include "url/gurl.h" 11 12 class Profile; 13 struct PrerenderAttributes; 14 15 namespace content { 16 struct Referrer; 17 } 18 19 namespace gfx { 20 class Size; 21 } 22 23 namespace IPC { 24 class Message; 25 } 26 27 namespace prerender { 28 29 class PrerenderMessageFilter : public content::BrowserMessageFilter { 30 public: 31 PrerenderMessageFilter(int render_process_id, Profile* profile); 32 33 private: 34 virtual ~PrerenderMessageFilter(); 35 36 // Overridden from content::BrowserMessageFilter. 37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 38 virtual void OverrideThreadForMessage( 39 const IPC::Message& message, 40 content::BrowserThread::ID* thread) OVERRIDE; 41 virtual void OnChannelClosing() OVERRIDE; 42 43 void OnAddPrerender(int prerender_id, 44 const PrerenderAttributes& attributes, 45 const content::Referrer& referrer, 46 const gfx::Size& size, 47 int render_view_route_id); 48 void OnCancelPrerender(int prerender_id); 49 void OnAbandonPrerender(int prerender_id); 50 51 const int render_process_id_; 52 Profile* const profile_; 53 54 DISALLOW_COPY_AND_ASSIGN(PrerenderMessageFilter); 55 }; 56 57 } // namespace prerender 58 59 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MESSAGE_FILTER_H_ 60 61