OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/guest_view/guest_view_base.h" | 5 #include "chrome/browser/guest_view/guest_view_base.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "chrome/browser/guest_view/ad_view/ad_view_guest.h" | 8 #include "chrome/browser/guest_view/ad_view/ad_view_guest.h" |
9 #include "chrome/browser/guest_view/guest_view_constants.h" | 9 #include "chrome/browser/guest_view/guest_view_constants.h" |
10 #include "chrome/browser/guest_view/guest_view_manager.h" | 10 #include "chrome/browser/guest_view/guest_view_manager.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 content::WebContents* guest_web_contents = | 94 content::WebContents* guest_web_contents = |
95 GuestViewManager::FromBrowserContext(host->GetBrowserContext())-> | 95 GuestViewManager::FromBrowserContext(host->GetBrowserContext())-> |
96 GetGuestByInstanceIDSafely(guest_instance_id, embedder_process_id); | 96 GetGuestByInstanceIDSafely(guest_instance_id, embedder_process_id); |
97 if (!guest_web_contents) | 97 if (!guest_web_contents) |
98 return NULL; | 98 return NULL; |
99 | 99 |
100 return GuestViewBase::FromWebContents(guest_web_contents); | 100 return GuestViewBase::FromWebContents(guest_web_contents); |
101 } | 101 } |
102 | 102 |
103 // static | 103 // static |
| 104 bool GuestViewBase::IsGuest(WebContents* web_contents) { |
| 105 return !!GuestViewBase::FromWebContents(web_contents); |
| 106 } |
| 107 |
| 108 // static |
104 bool GuestViewBase::GetGuestPartitionConfigForSite( | 109 bool GuestViewBase::GetGuestPartitionConfigForSite( |
105 const GURL& site, | 110 const GURL& site, |
106 std::string* partition_domain, | 111 std::string* partition_domain, |
107 std::string* partition_name, | 112 std::string* partition_name, |
108 bool* in_memory) { | 113 bool* in_memory) { |
109 if (!site.SchemeIs(content::kGuestScheme)) | 114 if (!site.SchemeIs(content::kGuestScheme)) |
110 return false; | 115 return false; |
111 | 116 |
112 // Since guest URLs are only used for packaged apps, there must be an app | 117 // Since guest URLs are only used for packaged apps, there must be an app |
113 // id in the URL. | 118 // id in the URL. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 245 |
241 void GuestViewBase::SendQueuedEvents() { | 246 void GuestViewBase::SendQueuedEvents() { |
242 if (!attached()) | 247 if (!attached()) |
243 return; | 248 return; |
244 while (!pending_events_.empty()) { | 249 while (!pending_events_.empty()) { |
245 linked_ptr<Event> event_ptr = pending_events_.front(); | 250 linked_ptr<Event> event_ptr = pending_events_.front(); |
246 pending_events_.pop_front(); | 251 pending_events_.pop_front(); |
247 DispatchEvent(event_ptr.release()); | 252 DispatchEvent(event_ptr.release()); |
248 } | 253 } |
249 } | 254 } |
OLD | NEW |