| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 offscreen_window->AddObserver(this); | 85 offscreen_window->AddObserver(this); |
| 86 OnWindowParentChanged(offscreen_window_, offscreen_window_->parent()); | 86 OnWindowParentChanged(offscreen_window_, offscreen_window_->parent()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 ~WindowAdoptionAgent() final { | 89 ~WindowAdoptionAgent() final { |
| 90 DVLOG(2) << "WindowAdoptionAgent for offscreen window " << offscreen_window_ | 90 DVLOG(2) << "WindowAdoptionAgent for offscreen window " << offscreen_window_ |
| 91 << " is self-destructing."; | 91 << " is self-destructing."; |
| 92 } | 92 } |
| 93 | 93 |
| 94 void FindNewParent() { | 94 void FindNewParent() { |
| 95 BrowserList* const browsers = | 95 BrowserList* const browsers = BrowserList::GetInstance(); |
| 96 BrowserList::GetInstance(chrome::GetActiveDesktop()); | |
| 97 Browser* const active_browser = | 96 Browser* const active_browser = |
| 98 browsers ? browsers->GetLastActive() : nullptr; | 97 browsers ? browsers->GetLastActive() : nullptr; |
| 99 BrowserWindow* const active_window = | 98 BrowserWindow* const active_window = |
| 100 active_browser ? active_browser->window() : nullptr; | 99 active_browser ? active_browser->window() : nullptr; |
| 101 aura::Window* const native_window = | 100 aura::Window* const native_window = |
| 102 active_window ? active_window->GetNativeWindow() : nullptr; | 101 active_window ? active_window->GetNativeWindow() : nullptr; |
| 103 aura::Window* const root_window = | 102 aura::Window* const root_window = |
| 104 native_window ? native_window->GetRootWindow() : nullptr; | 103 native_window ? native_window->GetRootWindow() : nullptr; |
| 105 if (root_window) { | 104 if (root_window) { |
| 106 DVLOG(2) << "Root window " << root_window | 105 DVLOG(2) << "Root window " << root_window |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 445 |
| 447 // Schedule the timer to check again in a second. | 446 // Schedule the timer to check again in a second. |
| 448 capture_poll_timer_.Start( | 447 capture_poll_timer_.Start( |
| 449 FROM_HERE, | 448 FROM_HERE, |
| 450 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), | 449 base::TimeDelta::FromSeconds(kPollIntervalInSeconds), |
| 451 base::Bind(&OffscreenTab::DieIfContentCaptureEnded, | 450 base::Bind(&OffscreenTab::DieIfContentCaptureEnded, |
| 452 base::Unretained(this))); | 451 base::Unretained(this))); |
| 453 } | 452 } |
| 454 | 453 |
| 455 } // namespace extensions | 454 } // namespace extensions |
| OLD | NEW |