| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/api/tab_capture/offscreen_tab.h" | 5 #include "chrome/browser/extensions/api/tab_capture/offscreen_tab.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 WebContents* source, | 199 WebContents* source, |
| 200 const content::DropData& data, | 200 const content::DropData& data, |
| 201 blink::WebDragOperationsMask operations_allowed) { | 201 blink::WebDragOperationsMask operations_allowed) { |
| 202 DCHECK_EQ(offscreen_tab_web_contents_.get(), source); | 202 DCHECK_EQ(offscreen_tab_web_contents_.get(), source); |
| 203 // Halt all drag attempts onto the page since there should be no direct user | 203 // Halt all drag attempts onto the page since there should be no direct user |
| 204 // interaction with it. | 204 // interaction with it. |
| 205 return false; | 205 return false; |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool OffscreenTab::ShouldCreateWebContents( | 208 bool OffscreenTab::ShouldCreateWebContents( |
| 209 WebContents* contents, | 209 content::WebContents* web_contents, |
| 210 content::SiteInstance* source_site_instance, |
| 210 int32_t route_id, | 211 int32_t route_id, |
| 211 int32_t main_frame_route_id, | 212 int32_t main_frame_route_id, |
| 212 int32_t main_frame_widget_route_id, | 213 int32_t main_frame_widget_route_id, |
| 213 WindowContainerType window_container_type, | 214 WindowContainerType window_container_type, |
| 215 const GURL& opener_url, |
| 214 const std::string& frame_name, | 216 const std::string& frame_name, |
| 215 const GURL& target_url, | 217 const GURL& target_url, |
| 216 const std::string& partition_id, | 218 const std::string& partition_id, |
| 217 content::SessionStorageNamespace* session_storage_namespace) { | 219 content::SessionStorageNamespace* session_storage_namespace) { |
| 218 DCHECK_EQ(offscreen_tab_web_contents_.get(), contents); | 220 DCHECK_EQ(offscreen_tab_web_contents_.get(), web_contents); |
| 219 // Disallow creating separate WebContentses. The WebContents implementation | 221 // Disallow creating separate WebContentses. The WebContents implementation |
| 220 // uses this to spawn new windows/tabs, which is also not allowed for | 222 // uses this to spawn new windows/tabs, which is also not allowed for |
| 221 // offscreen tabs. | 223 // offscreen tabs. |
| 222 return false; | 224 return false; |
| 223 } | 225 } |
| 224 | 226 |
| 225 bool OffscreenTab::EmbedsFullscreenWidget() const { | 227 bool OffscreenTab::EmbedsFullscreenWidget() const { |
| 226 // OffscreenTab will manage fullscreen widgets. | 228 // OffscreenTab will manage fullscreen widgets. |
| 227 return true; | 229 return true; |
| 228 } | 230 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 364 |
| 363 // Schedule the timer to check again in a second. | 365 // Schedule the timer to check again in a second. |
| 364 capture_poll_timer_.Start( | 366 capture_poll_timer_.Start( |
| 365 FROM_HERE, | 367 FROM_HERE, |
| 366 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), | 368 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), |
| 367 base::Bind(&OffscreenTab::DieIfContentCaptureEnded, | 369 base::Bind(&OffscreenTab::DieIfContentCaptureEnded, |
| 368 base::Unretained(this))); | 370 base::Unretained(this))); |
| 369 } | 371 } |
| 370 | 372 |
| 371 } // namespace extensions | 373 } // namespace extensions |
| OLD | NEW |