| OLD | NEW |
| 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_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // This class consumes WebContents. It can host a renderer, but does not | 23 // This class consumes WebContents. It can host a renderer, but does not |
| 24 // have any visible display. | 24 // have any visible display. |
| 25 class BackgroundContents : public content::WebContentsDelegate, | 25 class BackgroundContents : public content::WebContentsDelegate, |
| 26 public content::WebContentsObserver, | 26 public content::WebContentsObserver, |
| 27 public content::NotificationObserver { | 27 public content::NotificationObserver { |
| 28 public: | 28 public: |
| 29 class Delegate { | 29 class Delegate { |
| 30 public: | 30 public: |
| 31 // Called by AddNewContents(). Asks the delegate to attach the opened | 31 // Called by AddNewContents(). Asks the delegate to attach the opened |
| 32 // WebContents to a suitable container (e.g. browser) or to show it if it's | 32 // WebContents to a suitable container (e.g. browser) or to show it if it's |
| 33 // a popup window. | 33 // a popup window. Returns false if the popup was blocked. |
| 34 virtual void AddWebContents(content::WebContents* new_contents, | 34 virtual bool AddWebContents(content::WebContents* new_contents, |
| 35 WindowOpenDisposition disposition, | 35 WindowOpenDisposition disposition, |
| 36 const gfx::Rect& initial_pos, | 36 const gfx::Rect& initial_pos, |
| 37 bool user_gesture) = 0; | 37 bool user_gesture) = 0; |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 virtual ~Delegate() {} | 40 virtual ~Delegate() {} |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 BackgroundContents(content::SiteInstance* site_instance, | 43 BackgroundContents(content::SiteInstance* site_instance, |
| 44 int routing_id, | 44 int routing_id, |
| 45 Delegate* delegate); | 45 Delegate* delegate); |
| 46 virtual ~BackgroundContents(); | 46 virtual ~BackgroundContents(); |
| 47 | 47 |
| 48 content::WebContents* web_contents() const { return web_contents_.get(); } | 48 content::WebContents* web_contents() const { return web_contents_.get(); } |
| 49 virtual const GURL& GetURL() const; | 49 virtual const GURL& GetURL() const; |
| 50 | 50 |
| 51 // content::WebContentsDelegate implementation: | 51 // content::WebContentsDelegate implementation: |
| 52 virtual void CloseContents(content::WebContents* source) OVERRIDE; | 52 virtual void CloseContents(content::WebContents* source) OVERRIDE; |
| 53 virtual bool ShouldSuppressDialogs() OVERRIDE; | 53 virtual bool ShouldSuppressDialogs() OVERRIDE; |
| 54 virtual void DidNavigateMainFramePostCommit( | 54 virtual void DidNavigateMainFramePostCommit( |
| 55 content::WebContents* tab) OVERRIDE; | 55 content::WebContents* tab) OVERRIDE; |
| 56 virtual void AddNewContents(content::WebContents* source, | 56 virtual bool AddNewContents(content::WebContents* source, |
| 57 content::WebContents* new_contents, | 57 content::WebContents* new_contents, |
| 58 WindowOpenDisposition disposition, | 58 WindowOpenDisposition disposition, |
| 59 const gfx::Rect& initial_pos, | 59 const gfx::Rect& initial_pos, |
| 60 bool user_gesture) OVERRIDE; | 60 bool user_gesture) OVERRIDE; |
| 61 | 61 |
| 62 // content::WebContentsObserver implementation: | 62 // content::WebContentsObserver implementation: |
| 63 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 63 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
| 64 | 64 |
| 65 // content::NotificationObserver | 65 // content::NotificationObserver |
| 66 virtual void Observe(int type, | 66 virtual void Observe(int type, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 88 BackgroundContents* contents; | 88 BackgroundContents* contents; |
| 89 | 89 |
| 90 // The name of the parent frame for these contents. | 90 // The name of the parent frame for these contents. |
| 91 const string16& frame_name; | 91 const string16& frame_name; |
| 92 | 92 |
| 93 // The ID of the parent application (if any). | 93 // The ID of the parent application (if any). |
| 94 const string16& application_id; | 94 const string16& application_id; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 #endif // CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ | 97 #endif // CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ |
| OLD | NEW |