Chromium Code Reviews| 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(); |
| +} |