Chromium Code Reviews| Index: chrome/browser/guest_view/guest_view_manager.cc |
| diff --git a/chrome/browser/guest_view/guest_view_manager.cc b/chrome/browser/guest_view/guest_view_manager.cc |
| index ac5473534c3242fd87738bb05c87c75d01e2ebfc..8c5fc95695d1c1801fc53bf7e7085e7fd3001edd 100644 |
| --- a/chrome/browser/guest_view/guest_view_manager.cc |
| +++ b/chrome/browser/guest_view/guest_view_manager.cc |
| @@ -19,6 +19,7 @@ |
| #include "content/public/common/url_constants.h" |
| #include "extensions/browser/extension_system.h" |
| #include "net/base/escape.h" |
| +#include "net/base/url_util.h" |
| #include "url/gurl.h" |
| using content::BrowserContext; |
| @@ -120,10 +121,31 @@ void GuestViewManager::MaybeGetGuestByInstanceIDOrKill( |
| SiteInstance* GuestViewManager::GetGuestSiteInstance( |
| const GURL& guest_site) { |
| + std::string mime_type_param; |
| + bool has_mime_type_param = net::GetValueForKeyInQuery(guest_site, |
|
Fady Samuel
2014/07/22 10:59:49
I don't understand this change. Why not simply hav
lazyboy
2014/07/22 20:32:56
I've changed it to have mime type directly in the
|
| + guestview::kMimeTypeParam, |
| + &mime_type_param); |
| for (GuestInstanceMap::const_iterator it = |
| guest_web_contents_by_instance_id_.begin(); |
| it != guest_web_contents_by_instance_id_.end(); ++it) { |
| - if (it->second->GetSiteInstance()->GetSiteURL() == guest_site) |
| + |
| + bool guest_found = |
| + it->second->GetSiteInstance()->GetSiteURL() == guest_site; |
| + |
| + if (!guest_found && has_mime_type_param) { |
| + std::string iter_mime_type_param; |
| + bool iter_has_mime_type_param = |
| + net::GetValueForKeyInQuery(it->second->GetSiteInstance()->GetSiteURL(), |
| + guestview::kMimeTypeParam, |
| + &iter_mime_type_param); |
| + if (iter_has_mime_type_param && iter_mime_type_param == mime_type_param) { |
| + // If we have a mimeType param specified in the Site URL, we will re-use |
| + // guests that has same mimeType. |
| + guest_found = true; |
| + } |
| + } |
| + |
| + if (guest_found) |
| return it->second->GetSiteInstance(); |
| } |
| return NULL; |