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