diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-22 15:04:22 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-22 15:04:22 +0000 |
commit | 23a2dc8da8b62b771ef4b0a803cd1e0dc2257d72 (patch) | |
tree | 13bcdd5b2ad7ba23ef75f49096afcba25115fb7d /ash/root_window_controller.cc | |
parent | b71876d4980bdb17cb929fa962685bdd03aea5e0 (diff) | |
download | chromium_src-23a2dc8da8b62b771ef4b0a803cd1e0dc2257d72.zip chromium_src-23a2dc8da8b62b771ef4b0a803cd1e0dc2257d72.tar.gz chromium_src-23a2dc8da8b62b771ef4b0a803cd1e0dc2257d72.tar.bz2 |
Refactors CaptureController so that both views and ash can use it.
CaptureController and DesktopCaptureClient differed only slightly, and
the latter wasn't always cleaning things up leading to the possibility
of a use after free. Specifically DesktopCaptureClient::SetCapture()
invokes OnOtherCaptureClientTookCapture() *after* updating the
capture_window_. SetCapture in term invokes SetCapture(NULL) on
the other DesktopCaptureClient, which call GetCaptureWindow(), which
returns the first non-null capture_client_, which can be the new one
when it wants the old one.
This change also means when both ash and aura-windows are running at
the same time capture is correctly updated between the two.
BUG=268648
TEST=covered by tests.
R=erg@chromium.org, oshima@chromium.org
Review URL: https://codereview.chromium.org/22929007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219019 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/root_window_controller.cc')
-rw-r--r-- | ash/root_window_controller.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 6e49c48..2f76528 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -58,6 +58,7 @@ #include "ui/keyboard/keyboard_controller.h" #include "ui/keyboard/keyboard_util.h" #include "ui/views/controls/menu/menu_runner.h" +#include "ui/views/corewm/capture_controller.h" #include "ui/views/corewm/visibility_controller.h" #include "ui/views/view_model.h" #include "ui/views/view_model_utils.h" @@ -221,11 +222,15 @@ RootWindowController::RootWindowController(aura::RootWindow* root_window) stacking_controller_.reset(new StackingController); aura::client::SetStackingClient(root_window, stacking_controller_.get()); + capture_client_.reset(new views::corewm::ScopedCaptureClient(root_window)); } RootWindowController::~RootWindowController() { Shutdown(); root_window_.reset(); + // The CaptureClient needs to be around for as long as the RootWindow is + // valid. + capture_client_.reset(); } // static |