| Index: chrome/browser/media/ash_desktop_media_list.h
|
| diff --git a/chrome/browser/media/ash_desktop_media_list.h b/chrome/browser/media/ash_desktop_media_list.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d7136559e3fe8800f0befa52c43eabfe055abf01
|
| --- /dev/null
|
| +++ b/chrome/browser/media/ash_desktop_media_list.h
|
| @@ -0,0 +1,100 @@
|
| +// Copyright 2013 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 CHROME_BROWSER_MEDIA_ASH_DESKTOP_MEDIA_LIST_H_
|
| +#define CHROME_BROWSER_MEDIA_ASH_DESKTOP_MEDIA_LIST_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "base/sequenced_task_runner.h"
|
| +#include "chrome/browser/media/desktop_media_list.h"
|
| +#include "content/public/browser/desktop_media_id.h"
|
| +#include "ui/gfx/image/image_skia.h"
|
| +
|
| +class SkBitmap;
|
| +
|
| +namespace aura {
|
| +class Window;
|
| +}
|
| +
|
| +namespace cc {
|
| +class CopyOutputResult;
|
| +class SingleReleaseCallback;
|
| +}
|
| +
|
| +// Implementation of DesktopMediaList that shows native screens and
|
| +// native windows.
|
| +class AshDesktopMediaList : public DesktopMediaList {
|
| + public:
|
| + enum SourceTypes {
|
| + SCREENS = 1,
|
| + WINDOWS = 2,
|
| + };
|
| +
|
| + explicit AshDesktopMediaList(int source_types);
|
| + virtual ~AshDesktopMediaList();
|
| +
|
| + // DesktopMediaList interface.
|
| + virtual void SetUpdatePeriod(base::TimeDelta period) OVERRIDE;
|
| + virtual void SetThumbnailSize(const gfx::Size& thumbnail_size) OVERRIDE;
|
| + virtual void StartUpdating(DesktopMediaListObserver* observer) OVERRIDE;
|
| + virtual int GetSourceCount() const OVERRIDE;
|
| + virtual const Source& GetSource(int index) const OVERRIDE;
|
| + virtual void SetViewDialogWindowId(
|
| + content::DesktopMediaID::Id dialog_id) OVERRIDE;
|
| +
|
| + private:
|
| + // Struct used to represent sources list the model gets from the Worker.
|
| + struct SourceDescription {
|
| + SourceDescription(content::DesktopMediaID id, const string16& name);
|
| +
|
| + content::DesktopMediaID id;
|
| + string16 name;
|
| + };
|
| +
|
| + // Order comparator for sources. Used to sort list of sources.
|
| + static bool CompareSources(const SourceDescription& a,
|
| + const SourceDescription& b);
|
| +
|
| + void Refresh();
|
| + void EnumerateWindowsForRoot(
|
| + std::vector<AshDesktopMediaList::SourceDescription>* windows,
|
| + aura::Window* root_window,
|
| + int container_id);
|
| + void EnumerateSources(
|
| + std::vector<AshDesktopMediaList::SourceDescription>* windows);
|
| + void CaptureThumbnail(content::DesktopMediaID id, aura::Window* window);
|
| + void OnThumbnailCaptured(content::DesktopMediaID id,
|
| + scoped_ptr<cc::CopyOutputResult> result);
|
| + void OnFrameScalingFinished(content::DesktopMediaID id,
|
| + scoped_ptr<SkBitmap> captured_bitmap,
|
| + scoped_ptr<SkBitmap> scaled_bitmap);
|
| + void OnFrameCaptureFinished();
|
| +
|
| + int source_types_;
|
| +
|
| + // Time interval between mode updates.
|
| + base::TimeDelta update_period_;
|
| +
|
| + // Size of thumbnails generated by the model.
|
| + gfx::Size thumbnail_size_;
|
| +
|
| + // ID of the hosting dialog.
|
| + content::DesktopMediaID::Id view_dialog_id_;
|
| +
|
| + // The observer passed to StartUpdating().
|
| + DesktopMediaListObserver* observer_;
|
| +
|
| + // Current list of sources.
|
| + std::vector<Source> sources_;
|
| +
|
| + int pending_window_capture_requests_;
|
| +
|
| + base::WeakPtrFactory<AshDesktopMediaList> weak_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(AshDesktopMediaList);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_MEDIA_ASH_DESKTOP_MEDIA_LIST_H_
|
|
|