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 #include "content/browser/browsing_instance.h" | 5 #include "content/browser/browsing_instance.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/browser/site_instance_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
11 #include "content/public/browser/content_browser_client.h" | 11 #include "content/public/browser/content_browser_client.h" |
12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
13 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
14 | 14 |
15 using content::SiteInstance; | 15 namespace content { |
16 | 16 |
17 BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context) | 17 BrowsingInstance::BrowsingInstance(BrowserContext* browser_context) |
18 : browser_context_(browser_context) { | 18 : browser_context_(browser_context) { |
19 } | 19 } |
20 | 20 |
21 bool BrowsingInstance::HasSiteInstance(const GURL& url) { | 21 bool BrowsingInstance::HasSiteInstance(const GURL& url) { |
22 std::string site = | 22 std::string site = |
23 SiteInstanceImpl::GetSiteForURL(browser_context_, url) | 23 SiteInstanceImpl::GetSiteForURL(browser_context_, url) |
24 .possibly_invalid_spec(); | 24 .possibly_invalid_spec(); |
25 | 25 |
26 return site_instance_map_.find(site) != site_instance_map_.end(); | 26 return site_instance_map_.find(site) != site_instance_map_.end(); |
27 } | 27 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Matches, so erase it. | 76 // Matches, so erase it. |
77 site_instance_map_.erase(i); | 77 site_instance_map_.erase(i); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 BrowsingInstance::~BrowsingInstance() { | 81 BrowsingInstance::~BrowsingInstance() { |
82 // We should only be deleted when all of the SiteInstances that refer to | 82 // We should only be deleted when all of the SiteInstances that refer to |
83 // us are gone. | 83 // us are gone. |
84 DCHECK(site_instance_map_.empty()); | 84 DCHECK(site_instance_map_.empty()); |
85 } | 85 } |
| 86 |
| 87 } // namespace content |
OLD | NEW |