| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
| 14 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
| 15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 16 #include "webkit/glue/window_open_disposition.h" | 16 #include "webkit/glue/window_open_disposition.h" |
| 17 | 17 |
| 18 class Profile; | 18 class Profile; |
| 19 |
| 20 namespace content { |
| 19 class SiteInstance; | 21 class SiteInstance; |
| 22 }; |
| 20 | 23 |
| 21 // This class consumes TabContents. It can host a renderer, but does not | 24 // This class consumes TabContents. It can host a renderer, but does not |
| 22 // have any visible display. | 25 // have any visible display. |
| 23 class BackgroundContents : public content::WebContentsDelegate, | 26 class BackgroundContents : public content::WebContentsDelegate, |
| 24 public content::WebContentsObserver, | 27 public content::WebContentsObserver, |
| 25 public content::NotificationObserver { | 28 public content::NotificationObserver { |
| 26 public: | 29 public: |
| 27 class Delegate { | 30 class Delegate { |
| 28 public: | 31 public: |
| 29 // Called by AddNewContents(). Asks the delegate to attach the opened | 32 // Called by AddNewContents(). Asks the delegate to attach the opened |
| 30 // WebContents to a suitable container (e.g. browser) or to show it if it's | 33 // WebContents to a suitable container (e.g. browser) or to show it if it's |
| 31 // a popup window. | 34 // a popup window. |
| 32 virtual void AddWebContents(content::WebContents* new_contents, | 35 virtual void AddWebContents(content::WebContents* new_contents, |
| 33 WindowOpenDisposition disposition, | 36 WindowOpenDisposition disposition, |
| 34 const gfx::Rect& initial_pos, | 37 const gfx::Rect& initial_pos, |
| 35 bool user_gesture) = 0; | 38 bool user_gesture) = 0; |
| 36 | 39 |
| 37 protected: | 40 protected: |
| 38 virtual ~Delegate() {} | 41 virtual ~Delegate() {} |
| 39 }; | 42 }; |
| 40 | 43 |
| 41 BackgroundContents(SiteInstance* site_instance, | 44 BackgroundContents(content::SiteInstance* site_instance, |
| 42 int routing_id, | 45 int routing_id, |
| 43 Delegate* delegate); | 46 Delegate* delegate); |
| 44 virtual ~BackgroundContents(); | 47 virtual ~BackgroundContents(); |
| 45 | 48 |
| 46 content::WebContents* web_contents() const { return web_contents_.get(); } | 49 content::WebContents* web_contents() const { return web_contents_.get(); } |
| 47 virtual const GURL& GetURL() const; | 50 virtual const GURL& GetURL() const; |
| 48 | 51 |
| 49 // content::WebContentsDelegate implementation: | 52 // content::WebContentsDelegate implementation: |
| 50 virtual void CloseContents(content::WebContents* source) OVERRIDE; | 53 virtual void CloseContents(content::WebContents* source) OVERRIDE; |
| 51 virtual bool ShouldSuppressDialogs() OVERRIDE; | 54 virtual bool ShouldSuppressDialogs() OVERRIDE; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 BackgroundContents* contents; | 89 BackgroundContents* contents; |
| 87 | 90 |
| 88 // The name of the parent frame for these contents. | 91 // The name of the parent frame for these contents. |
| 89 const string16& frame_name; | 92 const string16& frame_name; |
| 90 | 93 |
| 91 // The ID of the parent application (if any). | 94 // The ID of the parent application (if any). |
| 92 const string16& application_id; | 95 const string16& application_id; |
| 93 }; | 96 }; |
| 94 | 97 |
| 95 #endif // CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ | 98 #endif // CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ |
| OLD | NEW |