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

Unified Diff: chrome/browser/ui/color_chooser_controller.cc

Issue 13150004: Support color chooser inside extesions, apps, chrome frame, dev tool (Closed) Base URL: http://git.chromium.org/chromium/src.git@ngcolor
Patch Set: Created 7 years, 9 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/color_chooser_controller.cc
diff --git a/chrome/browser/ui/color_chooser_controller.cc b/chrome/browser/ui/color_chooser_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..80f2f389f49516d619eff2bccaf9e485b8511299
--- /dev/null
+++ b/chrome/browser/ui/color_chooser_controller.cc
@@ -0,0 +1,44 @@
+// 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.
+
+#include "chrome/browser/ui/color_chooser_controller.h"
+
+#include "chrome/browser/browser_process.h"
+#include "content/public/browser/color_chooser.h"
+
+using content::WebContents;
+
+ColorChooserController::ColorChooserController() {
+}
+
+ColorChooserController::~ColorChooserController() {
+}
+
+// static
+ColorChooserController* ColorChooserController::GetInstance() {
+ if (!g_browser_process)
+ return NULL;
+ return g_browser_process->color_chooser_controller();
+}
+
+content::ColorChooser* ColorChooserController::OpenColorChooser(
+ SkColor initial_color, WebContents* web_contents, int color_chooser_id) {
+#if !defined(USE_AURA) && defined(OS_WIN)
+ // On Windows, only create a color chooser if one doesn't exist, because we
+ // can't close the old color chooser dialog.
+ if (color_chooser_.get())
Ben Goodger (Google) 2013/03/29 14:56:50 It seems a little unusual to consider this case a
+ return NULL;
+#else
+ if (color_chooser_.get())
+ color_chooser_->End();
+#endif
+ color_chooser_.reset(content::ColorChooser::Create(color_chooser_id,
+ web_contents,
+ initial_color));
+ return color_chooser_.get();
Ben Goodger (Google) 2013/03/29 14:56:50 It does seem like unnecessary indirection to have
+}
+
+void ColorChooserController::DidEndColorChooser() {
+ color_chooser_.reset();
+}

Powered by Google App Engine
This is Rietveld 408576698