#include "components/eye_dropper/eye_dropper_view.h"
#include <utility>
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/color/color_id.h"
#include "components/eye_dropper/features.h"
#include "content/public/browser/desktop_capture.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/web_contents.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
#include "ui/display/screen.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/widget/widget.h"
#if BUILDFLAG(IS_WIN)
#include "base/win/windows_version.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ui/aura/window_tree_host.h"
#endif
namespace eye_dropper {
class EyeDropperView::ViewPositionHandler { … };
EyeDropperView::ViewPositionHandler::ViewPositionHandler(EyeDropperView* owner)
: … { … }
EyeDropperView::ViewPositionHandler::~ViewPositionHandler() { … }
void EyeDropperView::ViewPositionHandler::UpdateViewPosition() { … }
class EyeDropperView::ScreenCapturer
: public webrtc::DesktopCapturer::Callback { … };
EyeDropperView::ScreenCapturer::ScreenCapturer(EyeDropperView* owner)
: … { … }
void EyeDropperView::ScreenCapturer::CaptureScreen(
std::optional<webrtc::DesktopCapturer::SourceId> screen) { … }
void EyeDropperView::ScreenCapturer::OnCaptureResult(
webrtc::DesktopCapturer::Result result,
std::unique_ptr<webrtc::DesktopFrame> frame) { … }
SkBitmap EyeDropperView::ScreenCapturer::GetBitmap() const { … }
SkColor EyeDropperView::ScreenCapturer::GetColor(int x, int y) const { … }
int EyeDropperView::ScreenCapturer::original_offset_x() const { … }
int EyeDropperView::ScreenCapturer::original_offset_y() const { … }
EyeDropperView::EyeDropperView(gfx::NativeView parent,
gfx::NativeView event_handler,
content::EyeDropperListener* listener)
: … { … }
EyeDropperView::~EyeDropperView() { … }
void EyeDropperView::OnCursorPositionUpdate(gfx::Point cursor_position) { … }
void EyeDropperView::OnPaint(gfx::Canvas* view_canvas) { … }
void EyeDropperView::WindowClosing() { … }
void EyeDropperView::OnWidgetMove() { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
void EyeDropperView::OnWindowAddedToRootWindow(aura::Window* window) {
display::Display display =
display::Screen::GetScreen()->GetDisplayNearestWindow(window);
CaptureScreen(display.id());
}
void EyeDropperView::OnWindowDestroying(aura::Window* window) {
window_observation_.Reset();
}
#endif
void EyeDropperView::CaptureScreen(
std::optional<webrtc::DesktopCapturer::SourceId> screen) { … }
void EyeDropperView::OnScreenCaptured() { … }
void EyeDropperView::UpdatePosition(gfx::Point position) { … }
void EyeDropperView::OnColorSelected() { … }
void EyeDropperView::OnColorSelectionCanceled() { … }
BEGIN_METADATA(…)
}