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 CONTENT_BROWSER_BROWSING_INSTANCE_H_ | 5 #ifndef CONTENT_BROWSER_BROWSING_INSTANCE_H_ |
6 #define CONTENT_BROWSER_BROWSING_INSTANCE_H_ | 6 #define CONTENT_BROWSER_BROWSING_INSTANCE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/profiles/profile.h" |
11 | 12 |
12 class GURL; | 13 class GURL; |
13 class SiteInstance; | 14 class SiteInstance; |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 class BrowserContext; | 17 class BrowserContext; |
17 } | 18 } |
18 | 19 |
19 /////////////////////////////////////////////////////////////////////////////// | 20 /////////////////////////////////////////////////////////////////////////////// |
20 // | 21 // |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 63 |
63 // Returns whether the process-per-site model is in use (globally or just for | 64 // Returns whether the process-per-site model is in use (globally or just for |
64 // the given url), in which case we should ensure there is only one | 65 // the given url), in which case we should ensure there is only one |
65 // SiteInstance per site for the entire browser context, not just for this | 66 // SiteInstance per site for the entire browser context, not just for this |
66 // BrowsingInstance. | 67 // BrowsingInstance. |
67 virtual bool ShouldUseProcessPerSite(const GURL& url); | 68 virtual bool ShouldUseProcessPerSite(const GURL& url); |
68 | 69 |
69 // Get the browser context to which this BrowsingInstance belongs. | 70 // Get the browser context to which this BrowsingInstance belongs. |
70 content::BrowserContext* browser_context() { return browser_context_; } | 71 content::BrowserContext* browser_context() { return browser_context_; } |
71 | 72 |
| 73 // Returns the profile. |
| 74 // TEMPORARY; http://crbug.com/76788 |
| 75 Profile* profile() { |
| 76 return Profile::FromBrowserContext(browser_context()); |
| 77 } |
| 78 |
72 // Returns whether this BrowsingInstance has registered a SiteInstance for | 79 // Returns whether this BrowsingInstance has registered a SiteInstance for |
73 // the site of the given URL. | 80 // the site of the given URL. |
74 bool HasSiteInstance(const GURL& url); | 81 bool HasSiteInstance(const GURL& url); |
75 | 82 |
76 // Get the SiteInstance responsible for rendering the given URL. Should | 83 // Get the SiteInstance responsible for rendering the given URL. Should |
77 // create a new one if necessary, but should not create more than one | 84 // create a new one if necessary, but should not create more than one |
78 // SiteInstance per site. | 85 // SiteInstance per site. |
79 SiteInstance* GetSiteInstanceForURL(const GURL& url); | 86 SiteInstance* GetSiteInstanceForURL(const GURL& url); |
80 | 87 |
81 // Adds the given SiteInstance to our map, to ensure that we do not create | 88 // Adds the given SiteInstance to our map, to ensure that we do not create |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // This field is only used if we are not using process-per-site. | 136 // This field is only used if we are not using process-per-site. |
130 SiteInstanceMap site_instance_map_; | 137 SiteInstanceMap site_instance_map_; |
131 | 138 |
132 // Global map of BrowserContext to SiteInstanceMap, for process-per-site. | 139 // Global map of BrowserContext to SiteInstanceMap, for process-per-site. |
133 static ContextSiteInstanceMap context_site_instance_map_; | 140 static ContextSiteInstanceMap context_site_instance_map_; |
134 | 141 |
135 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); | 142 DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); |
136 }; | 143 }; |
137 | 144 |
138 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ | 145 #endif // CONTENT_BROWSER_BROWSING_INSTANCE_H_ |
OLD | NEW |