| Index: services/window_manager/capture_controller.cc
|
| diff --git a/services/window_manager/capture_controller.cc b/services/window_manager/capture_controller.cc
|
| deleted file mode 100644
|
| index b705677405b4b67f623a49c23d8b92b6096b8991..0000000000000000000000000000000000000000
|
| --- a/services/window_manager/capture_controller.cc
|
| +++ /dev/null
|
| @@ -1,103 +0,0 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -#include "services/window_manager/capture_controller.h"
|
| -
|
| -#include "mojo/services/view_manager/cpp/view_property.h"
|
| -#include "mojo/services/view_manager/cpp/view_tracker.h"
|
| -#include "services/window_manager/capture_controller_observer.h"
|
| -
|
| -DECLARE_VIEW_PROPERTY_TYPE(window_manager::CaptureController*);
|
| -
|
| -namespace window_manager {
|
| -
|
| -namespace {
|
| -DEFINE_VIEW_PROPERTY_KEY(CaptureController*,
|
| - kRootViewCaptureController,
|
| - nullptr);
|
| -} // namespace
|
| -
|
| -CaptureController::CaptureController()
|
| - : capture_view_(nullptr) {}
|
| -
|
| -CaptureController::~CaptureController() {}
|
| -
|
| -void CaptureController::AddObserver(CaptureControllerObserver* observer) {
|
| - capture_controller_observers_.AddObserver(observer);
|
| -}
|
| -
|
| -void CaptureController::RemoveObserver(CaptureControllerObserver* observer) {
|
| - capture_controller_observers_.RemoveObserver(observer);
|
| -}
|
| -
|
| -void CaptureController::SetCapture(mojo::View* view) {
|
| - if (capture_view_ == view)
|
| - return;
|
| -
|
| - if (capture_view_)
|
| - capture_view_->RemoveObserver(this);
|
| -
|
| - mojo::View* old_capture_view = capture_view_;
|
| - capture_view_ = view;
|
| -
|
| - if (capture_view_)
|
| - capture_view_->AddObserver(this);
|
| -
|
| - NotifyCaptureChange(capture_view_, old_capture_view);
|
| -}
|
| -
|
| -void CaptureController::ReleaseCapture(mojo::View* view) {
|
| - if (capture_view_ != view)
|
| - return;
|
| - SetCapture(nullptr);
|
| -}
|
| -
|
| -mojo::View* CaptureController::GetCapture() {
|
| - return capture_view_;
|
| -}
|
| -
|
| -void CaptureController::NotifyCaptureChange(mojo::View* new_capture,
|
| - mojo::View* old_capture) {
|
| - mojo::ViewTracker view_tracker;
|
| - if (new_capture)
|
| - view_tracker.Add(new_capture);
|
| - if (old_capture)
|
| - view_tracker.Add(old_capture);
|
| -
|
| - FOR_EACH_OBSERVER(
|
| - CaptureControllerObserver, capture_controller_observers_,
|
| - OnCaptureChanged(view_tracker.Contains(new_capture) ? new_capture
|
| - : nullptr));
|
| -}
|
| -
|
| -void CaptureController::OnViewDestroying(mojo::View* view) {
|
| - if (view == capture_view_) {
|
| - view->RemoveObserver(this);
|
| - NotifyCaptureChange(nullptr, view);
|
| - capture_view_ = nullptr;
|
| - }
|
| -}
|
| -
|
| -void SetCaptureController(mojo::View* root_view,
|
| - CaptureController* capture_controller) {
|
| - DCHECK_EQ(root_view->GetRoot(), root_view);
|
| - root_view->SetLocalProperty(kRootViewCaptureController, capture_controller);
|
| -}
|
| -
|
| -CaptureController* GetCaptureController(mojo::View* root_view) {
|
| - if (root_view)
|
| - DCHECK_EQ(root_view->GetRoot(), root_view);
|
| - return root_view ?
|
| - root_view->GetLocalProperty(kRootViewCaptureController) : nullptr;
|
| -}
|
| -
|
| -mojo::View* GetCaptureView(mojo::View* view) {
|
| - mojo::View* root = view->GetRoot();
|
| - if (!root)
|
| - return nullptr;
|
| - CaptureController* controller = GetCaptureController(root);
|
| - return controller ? controller->GetCapture() : nullptr;
|
| -}
|
| -
|
| -} // namespace window_manager
|
|
|