| Index: chrome/browser/color_select_observer.h
|
| diff --git a/chrome/browser/color_select_observer.h b/chrome/browser/color_select_observer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7cfba4d8a603203b8a9319e78b4dde175c37a707
|
| --- /dev/null
|
| +++ b/chrome/browser/color_select_observer.h
|
| @@ -0,0 +1,67 @@
|
| +// Copyright (c) 2011 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_COLOR_SELECT_OBSERVER_H_
|
| +#define CHROME_BROWSER_COLOR_SELECT_OBSERVER_H_
|
| +#pragma once
|
| +
|
| +#if defined(ENABLE_INPUT_COLOR)
|
| +
|
| +#include "content/public/browser/web_contents_observer.h"
|
| +
|
| +#if defined(OS_WIN)
|
| +#include "chrome/browser/ui/color_chooser_dialog.h"
|
| +#else
|
| +#include "chrome/browser/ui/color_chooser.h"
|
| +#endif
|
| +
|
| +class RenderViewHost;
|
| +struct ViewHostMsg_SetSelectedColorInColorChooser_Params;
|
| +
|
| +class ColorSelectObserver
|
| + : public content::WebContentsObserver,
|
| +#if defined(OS_WIN)
|
| + public ColorChooserDialog::Listener {
|
| +#else
|
| + public ColorChooser::Listener {
|
| +#endif
|
| + public:
|
| + explicit ColorSelectObserver(content::WebContents* web_contents);
|
| + virtual ~ColorSelectObserver();
|
| +
|
| + virtual void DidChooseColor(WebKit::WebColor color) OVERRIDE;
|
| + virtual void DidDetach() OVERRIDE;
|
| +
|
| + private:
|
| + // TabContentsObserver overrides.
|
| + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
| +
|
| + // Called when web page asks to open the color chooser.
|
| + void OnOpenColorChooser(
|
| + const ViewHostMsg_SetSelectedColorInColorChooser_Params& params);
|
| +
|
| + // Called when the originating element is no longer available and the color
|
| + // chooser should detach.
|
| + void OnDetachColorChooser();
|
| +
|
| + // Called when input element's value changes and the color chooser should
|
| + // reflect that.
|
| + void OnSetSelectedColorInColorChooser(
|
| + const ViewHostMsg_SetSelectedColorInColorChooser_Params& params);
|
| +
|
| + // The RenderViewHost for the page showing the color chooser.
|
| + // DetachColorChooser and SetSelectedColorInColorChooser from other
|
| + // RenderViewHosts will be ignored.
|
| + RenderViewHost* render_view_host_;
|
| +#if defined(OS_WIN)
|
| + // Dialog box used for choosing color.
|
| + scoped_refptr<ColorChooserDialog> color_chooser_dialog_;
|
| +#endif
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ColorSelectObserver);
|
| +};
|
| +
|
| +#endif // defined(ENABLE_INPUT_COLOR)
|
| +
|
| +#endif // CHROME_BROWSER_COLOR_SELECT_OBSERVER_H_
|
|
|