| 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. If |was_blocked| is non-NULL, then |*was_blocked| will be |
| 34 // set to true if the popup gets blocked, and left unchanged otherwise. |
| 34 virtual void AddWebContents(content::WebContents* new_contents, | 35 virtual void AddWebContents(content::WebContents* new_contents, |
| 35 WindowOpenDisposition disposition, | 36 WindowOpenDisposition disposition, |
| 36 const gfx::Rect& initial_pos, | 37 const gfx::Rect& initial_pos, |
| 37 bool user_gesture) = 0; | 38 bool user_gesture, |
| 39 bool* was_blocked) = 0; |
| 38 | 40 |
| 39 protected: | 41 protected: |
| 40 virtual ~Delegate() {} | 42 virtual ~Delegate() {} |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 BackgroundContents(content::SiteInstance* site_instance, | 45 BackgroundContents(content::SiteInstance* site_instance, |
| 44 int routing_id, | 46 int routing_id, |
| 45 Delegate* delegate); | 47 Delegate* delegate); |
| 46 virtual ~BackgroundContents(); | 48 virtual ~BackgroundContents(); |
| 47 | 49 |
| 48 content::WebContents* web_contents() const { return web_contents_.get(); } | 50 content::WebContents* web_contents() const { return web_contents_.get(); } |
| 49 virtual const GURL& GetURL() const; | 51 virtual const GURL& GetURL() const; |
| 50 | 52 |
| 51 // content::WebContentsDelegate implementation: | 53 // content::WebContentsDelegate implementation: |
| 52 virtual void CloseContents(content::WebContents* source) OVERRIDE; | 54 virtual void CloseContents(content::WebContents* source) OVERRIDE; |
| 53 virtual bool ShouldSuppressDialogs() OVERRIDE; | 55 virtual bool ShouldSuppressDialogs() OVERRIDE; |
| 54 virtual void DidNavigateMainFramePostCommit( | 56 virtual void DidNavigateMainFramePostCommit( |
| 55 content::WebContents* tab) OVERRIDE; | 57 content::WebContents* tab) OVERRIDE; |
| 56 virtual void AddNewContents(content::WebContents* source, | 58 virtual void AddNewContents(content::WebContents* source, |
| 57 content::WebContents* new_contents, | 59 content::WebContents* new_contents, |
| 58 WindowOpenDisposition disposition, | 60 WindowOpenDisposition disposition, |
| 59 const gfx::Rect& initial_pos, | 61 const gfx::Rect& initial_pos, |
| 60 bool user_gesture) OVERRIDE; | 62 bool user_gesture, |
| 63 bool* was_blocked) OVERRIDE; |
| 61 | 64 |
| 62 // content::WebContentsObserver implementation: | 65 // content::WebContentsObserver implementation: |
| 63 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 66 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
| 64 | 67 |
| 65 // content::NotificationObserver | 68 // content::NotificationObserver |
| 66 virtual void Observe(int type, | 69 virtual void Observe(int type, |
| 67 const content::NotificationSource& source, | 70 const content::NotificationSource& source, |
| 68 const content::NotificationDetails& details) OVERRIDE; | 71 const content::NotificationDetails& details) OVERRIDE; |
| 69 | 72 |
| 70 protected: | 73 protected: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 88 BackgroundContents* contents; | 91 BackgroundContents* contents; |
| 89 | 92 |
| 90 // The name of the parent frame for these contents. | 93 // The name of the parent frame for these contents. |
| 91 const string16& frame_name; | 94 const string16& frame_name; |
| 92 | 95 |
| 93 // The ID of the parent application (if any). | 96 // The ID of the parent application (if any). |
| 94 const string16& application_id; | 97 const string16& application_id; |
| 95 }; | 98 }; |
| 96 | 99 |
| 97 #endif // CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ | 100 #endif // CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ |
| OLD | NEW |