Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4575)

Unified Diff: chrome/browser/ui/views/color_chooser_dialog.h

Issue 9203001: Implement input type=color UI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/color_chooser_dialog.h
diff --git a/chrome/browser/ui/views/color_chooser_dialog.h b/chrome/browser/ui/views/color_chooser_dialog.h
new file mode 100644
index 0000000000000000000000000000000000000000..04b4148df583cd68b2c02df84315236c62a5425f
--- /dev/null
+++ b/chrome/browser/ui/views/color_chooser_dialog.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2012 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_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_
+#define CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_
+#pragma once
+
+#include "base/memory/ref_counted.h"
+#include "chrome/browser/ui/base_shell_dialog.h"
+#include "chrome/browser/ui/views/color_chooser_dialog.h"
+#include "chrome/browser/ui/views/base_shell_dialog_win.h"
+#include "third_party/skia/include/core/SkColor.h"
+
+static const int kCustomColorCount = 16;
Peter Kasting 2012/03/01 20:44:18 Don't declare a static const at global scope in a
keishi 2012/03/02 06:12:13 Done.
+
+class ColorChooserDialog
+ : public base::RefCountedThreadSafe<ColorChooserDialog>,
+ public BaseShellDialog,
+ public BaseShellDialogImpl {
+ public:
+ // An interface implemented by a Listener object wishing to know about the
+ // the results from the color chooser dialog.
+ class Listener {
+ public:
+ virtual ~Listener() {}
+ virtual void DidChooseColor(SkColor color) = 0;
+ virtual void DidEnd() = 0;
+ };
+
+ ColorChooserDialog(Listener* listener,
+ SkColor initial_color,
+ gfx::NativeWindow owning_window);
+ virtual ~ColorChooserDialog();
+
+ // BaseShellDialog:
+ virtual bool IsRunning(HWND owning_hwnd) const OVERRIDE;
+ virtual void ListenerDestroyed() OVERRIDE;
+
+ private:
+ struct ExecuteOpenParams {
+ ExecuteOpenParams(SkColor color, RunState run_state, HWND owner);
+ SkColor color;
+ RunState run_state;
+ HWND owner;
+ };
+ void ExecuteOpen(const ExecuteOpenParams& params);
+ void DidChooseColor(bool success, SkColor color, RunState run_state);
+ void CopyCustomColors(COLORREF*, COLORREF*);
+
+ static COLORREF g_custom_colors[kCustomColorCount];
+ COLORREF custom_colors_[kCustomColorCount];
+ Listener* listener_;
+
+ DISALLOW_COPY_AND_ASSIGN(ColorChooserDialog);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_

Powered by Google App Engine
This is Rietveld 408576698