| OLD | NEW |
| 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 CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // BrowsingInstance, creating a new SiteInstance if necessary. This ensures | 75 // BrowsingInstance, creating a new SiteInstance if necessary. This ensures |
| 76 // that a BrowsingInstance only has one SiteInstance per site, so that pages | 76 // that a BrowsingInstance only has one SiteInstance per site, so that pages |
| 77 // in a BrowsingInstance have the ability to script each other. Callers | 77 // in a BrowsingInstance have the ability to script each other. Callers |
| 78 // should ensure that this SiteInstance becomes ref counted, by storing it in | 78 // should ensure that this SiteInstance becomes ref counted, by storing it in |
| 79 // a scoped_refptr. (By having this method, we can hide the BrowsingInstance | 79 // a scoped_refptr. (By having this method, we can hide the BrowsingInstance |
| 80 // class from the rest of the codebase.) | 80 // class from the rest of the codebase.) |
| 81 // TODO(creis): This may be an argument to build a pass_refptr<T> class, as | 81 // TODO(creis): This may be an argument to build a pass_refptr<T> class, as |
| 82 // Darin suggests. | 82 // Darin suggests. |
| 83 virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) = 0; | 83 virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) = 0; |
| 84 | 84 |
| 85 // Returns whether the given SiteInstance is in the same BrowsingInstance as |
| 86 // this one. If so, JavaScript interactions that are permitted across |
| 87 // origins (e.g., postMessage) should be supported. |
| 88 virtual bool IsRelatedSiteInstance(const SiteInstance* instance) = 0; |
| 89 |
| 85 // Factory method to create a new SiteInstance. This will create a new | 90 // Factory method to create a new SiteInstance. This will create a new |
| 86 // new BrowsingInstance, so it should only be used when creating a new tab | 91 // new BrowsingInstance, so it should only be used when creating a new tab |
| 87 // from scratch (or similar circumstances). Callers should ensure that | 92 // from scratch (or similar circumstances). Callers should ensure that |
| 88 // this SiteInstance becomes ref counted, by storing it in a scoped_refptr. | 93 // this SiteInstance becomes ref counted, by storing it in a scoped_refptr. |
| 89 // | 94 // |
| 90 // The render process host factory may be NULL. See SiteInstance constructor. | 95 // The render process host factory may be NULL. See SiteInstance constructor. |
| 91 // | 96 // |
| 92 // TODO(creis): This may be an argument to build a pass_refptr<T> class, as | 97 // TODO(creis): This may be an argument to build a pass_refptr<T> class, as |
| 93 // Darin suggests. | 98 // Darin suggests. |
| 94 static SiteInstance* Create(content::BrowserContext* browser_context); | 99 static SiteInstance* Create(content::BrowserContext* browser_context); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 113 protected: | 118 protected: |
| 114 friend class base::RefCounted<SiteInstance>; | 119 friend class base::RefCounted<SiteInstance>; |
| 115 | 120 |
| 116 SiteInstance() {} | 121 SiteInstance() {} |
| 117 virtual ~SiteInstance() {} | 122 virtual ~SiteInstance() {} |
| 118 }; | 123 }; |
| 119 | 124 |
| 120 } // namespace content. | 125 } // namespace content. |
| 121 | 126 |
| 122 #endif // CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ | 127 #endif // CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ |
| OLD | NEW |