Commit 1e9bf98d authored by Mike Wasserman's avatar Mike Wasserman Committed by Commit Bot

Remove unused window_activity_tracker* files

These files are not mentioned in BUILD.gn files.
The cc and mm files also mention headers that do not exist.

Bug: None
Change-Id: Ifb459ff2e515efa857e1e48748b3cfab9a4151c6
Reviewed-on: https://chromium-review.googlesource.com/c/1287301
Commit-Queue: Yuri Wiitala <miu@chromium.org>
Reviewed-by: default avatarYuri Wiitala <miu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600604}
parent a6ed00a4
// Copyright (c) 2015 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.
#ifndef CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_H_
#define CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_H_
#include <memory>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "content/common/content_export.h"
#include "ui/gfx/native_widget_types.h"
namespace content {
// WindowActivityTracker is an interface that can be implememented to report
// whether the user is actively interacting with UI.
class CONTENT_EXPORT WindowActivityTracker {
public:
static std::unique_ptr<WindowActivityTracker> Create(gfx::NativeView view);
WindowActivityTracker();
virtual ~WindowActivityTracker();
// Returns true if UI interaction is active.
bool IsUiInteractionActive() const;
// Reports on every mouse movement activity on the window.
void RegisterMouseInteractionObserver(const base::Closure& observer);
// Resets any previous UI activity tracked.
void Reset();
// Returns a weak pointer.
virtual base::WeakPtr<WindowActivityTracker> GetWeakPtr() = 0;
protected:
void OnMouseActivity();
private:
// The last time a UI event was detected.
base::TimeTicks last_time_ui_event_detected_;
// Runs on any mouse interaction from user.
base::Closure mouse_interaction_observer_;
// The number of UI events detected so far. In case of continuous events
// such as mouse movement, a single continuous movement is treated
// as one event.
int ui_events_count_;
DISALLOW_COPY_AND_ASSIGN(WindowActivityTracker);
};
} // namespace content
#endif // CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_H_
// Copyright (c) 2015 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 "content/browser/media/capture/window_activity_tracker_aura.h"
#include "base/logging.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/events/event_utils.h"
namespace content {
// static
std::unique_ptr<WindowActivityTracker> WindowActivityTracker::Create(
gfx::NativeView window) {
return std::unique_ptr<WindowActivityTracker>(
new WindowActivityTrackerAura(window));
}
WindowActivityTrackerAura::WindowActivityTrackerAura(aura::Window* window)
: window_(window),
weak_factory_(this) {
if (window_) {
window_->AddObserver(this);
window_->AddPreTargetHandler(this);
}
}
WindowActivityTrackerAura::~WindowActivityTrackerAura() {
if (window_) {
window_->RemoveObserver(this);
window_->RemovePreTargetHandler(this);
}
}
base::WeakPtr<WindowActivityTracker> WindowActivityTrackerAura::GetWeakPtr() {
return weak_factory_.GetWeakPtr();
}
void WindowActivityTrackerAura::OnEvent(ui::Event* event) {
switch (event->type()) {
case ui::ET_MOUSE_PRESSED:
case ui::ET_MOUSE_RELEASED:
case ui::ET_MOUSE_MOVED:
WindowActivityTracker::OnMouseActivity();
break;
default:
break;
}
}
void WindowActivityTrackerAura::OnWindowDestroying(aura::Window* window) {
DCHECK_EQ(window_, window);
window_->RemovePreTargetHandler(this);
window_->RemoveObserver(this);
window_ = nullptr;
}
} // namespace content
// Copyright 2016 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 "content/browser/media/capture/window_activity_tracker_mac.h"
#include <AppKit/AppKit.h>
#include <CoreFoundation/CoreFoundation.h>
#include "base/bind.h"
#include "ui/base/cocoa/tracking_area.h"
@implementation MouseTracker
- (instancetype)initWithView:(NSView*)nsView {
self = [super init];
// TODO(isheriff): why are there no pressed/released events ?
NSTrackingAreaOptions trackingOptions =
NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited |
NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect;
trackingArea_.reset([[CrTrackingArea alloc] initWithRect:NSZeroRect
options:trackingOptions
owner:self
userInfo:nil]);
[nsView addTrackingArea:trackingArea_.get()];
nsView_ = nsView;
return self;
}
- (void)stopTracking {
if (trackingArea_.get()) {
[nsView_ removeTrackingArea:trackingArea_.get()];
trackingArea_.reset();
}
}
- (void)registerMouseInteractionObserver:(const base::Closure&)observer {
mouseInteractionObserver_ = observer;
}
- (void)mouseMoved:(NSEvent*)theEvent {
mouseInteractionObserver_.Run();
}
- (void)mouseEntered:(NSEvent*)theEvent {
}
- (void)mouseExited:(NSEvent*)theEvent {
}
@end
namespace content {
// static
std::unique_ptr<WindowActivityTracker> WindowActivityTracker::Create(
gfx::NativeView view) {
return std::unique_ptr<WindowActivityTracker>(
new WindowActivityTrackerMac(view));
}
WindowActivityTrackerMac::WindowActivityTrackerMac(NSView* view)
: weak_factory_(this) {
mouse_tracker_.reset([[MouseTracker alloc] initWithView:view]);
[mouse_tracker_ registerMouseInteractionObserver:
base::Bind(&WindowActivityTrackerMac::OnMouseActivity,
base::Unretained(this))];
}
WindowActivityTrackerMac::~WindowActivityTrackerMac() {
[mouse_tracker_ stopTracking];
}
void WindowActivityTrackerMac::OnMouseActivity() {
WindowActivityTracker::OnMouseActivity();
}
base::WeakPtr<WindowActivityTracker> WindowActivityTrackerMac::GetWeakPtr() {
return weak_factory_.GetWeakPtr();
}
} // namespace content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment