Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: chrome/browser/extensions/api/tab_capture/offscreen_tab.cc

Issue 1432143002: Track where WebContents are created in order to better understand issue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" 10 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/web_contents_sizer.h" 12 #include "chrome/browser/ui/web_contents_sizer.h"
13 #include "content/public/browser/render_widget_host_view.h" 13 #include "content/public/browser/render_widget_host_view.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "content/public/browser/web_contents_source.h"
15 #include "extensions/browser/extension_host.h" 16 #include "extensions/browser/extension_host.h"
16 #include "extensions/browser/process_manager.h" 17 #include "extensions/browser/process_manager.h"
17 18
18 #if defined(USE_AURA) 19 #if defined(USE_AURA)
19 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
20 #include "base/thread_task_runner_handle.h" 21 #include "base/thread_task_runner_handle.h"
21 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_list.h" 23 #include "chrome/browser/ui/browser_list.h"
23 #include "chrome/browser/ui/browser_window.h" 24 #include "chrome/browser/ui/browser_window.h"
24 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 const gfx::Size& initial_size, 175 const gfx::Size& initial_size,
175 const std::string& optional_presentation_id) { 176 const std::string& optional_presentation_id) {
176 DCHECK(start_time_.is_null()); 177 DCHECK(start_time_.is_null());
177 start_url_ = start_url; 178 start_url_ = start_url;
178 DVLOG(1) << "Starting OffscreenTab with initial size of " 179 DVLOG(1) << "Starting OffscreenTab with initial size of "
179 << initial_size.ToString() << " for start_url=" << start_url_.spec(); 180 << initial_size.ToString() << " for start_url=" << start_url_.spec();
180 181
181 // Create the WebContents to contain the off-screen tab's page. 182 // Create the WebContents to contain the off-screen tab's page.
182 offscreen_tab_web_contents_.reset( 183 offscreen_tab_web_contents_.reset(
183 WebContents::Create(WebContents::CreateParams(profile_.get()))); 184 WebContents::Create(WebContents::CreateParams(profile_.get())));
185 WebContentsSource::CreateForWebContentsAndLocation(
186 offscreen_tab_web_contents_.get(), FROM_HERE);
184 offscreen_tab_web_contents_->SetDelegate(this); 187 offscreen_tab_web_contents_->SetDelegate(this);
185 WebContentsObserver::Observe(offscreen_tab_web_contents_.get()); 188 WebContentsObserver::Observe(offscreen_tab_web_contents_.get());
186 189
187 #if defined(USE_AURA) 190 #if defined(USE_AURA)
188 WindowAdoptionAgent::Start(offscreen_tab_web_contents_->GetNativeView()); 191 WindowAdoptionAgent::Start(offscreen_tab_web_contents_->GetNativeView());
189 #endif 192 #endif
190 193
191 // Set initial size, if specified. 194 // Set initial size, if specified.
192 if (!initial_size.IsEmpty()) 195 if (!initial_size.IsEmpty())
193 ResizeWebContents(offscreen_tab_web_contents_.get(), initial_size); 196 ResizeWebContents(offscreen_tab_web_contents_.get(), initial_size);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 448
446 // Schedule the timer to check again in a second. 449 // Schedule the timer to check again in a second.
447 capture_poll_timer_.Start( 450 capture_poll_timer_.Start(
448 FROM_HERE, 451 FROM_HERE,
449 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), 452 base::TimeDelta::FromSeconds(kPollIntervalInSeconds),
450 base::Bind(&OffscreenTab::DieIfContentCaptureEnded, 453 base::Bind(&OffscreenTab::DieIfContentCaptureEnded,
451 base::Unretained(this))); 454 base::Unretained(this)));
452 } 455 }
453 456
454 } // namespace extensions 457 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698