Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/color_chooser_controller.h" | |
| 6 | |
| 7 #include "chrome/browser/browser_process.h" | |
| 8 #include "content/public/browser/color_chooser.h" | |
| 9 | |
| 10 using content::WebContents; | |
| 11 | |
| 12 ColorChooserController::ColorChooserController() { | |
| 13 } | |
| 14 | |
| 15 ColorChooserController::~ColorChooserController() { | |
| 16 } | |
| 17 | |
| 18 // static | |
| 19 ColorChooserController* ColorChooserController::GetInstance() { | |
| 20 if (!g_browser_process) | |
| 21 return NULL; | |
| 22 return g_browser_process->color_chooser_controller(); | |
| 23 } | |
| 24 | |
| 25 content::ColorChooser* ColorChooserController::OpenColorChooser( | |
| 26 SkColor initial_color, WebContents* web_contents, int color_chooser_id) { | |
| 27 #if !defined(USE_AURA) && defined(OS_WIN) | |
| 28 // On Windows, only create a color chooser if one doesn't exist, because we | |
| 29 // can't close the old color chooser dialog. | |
| 30 if (color_chooser_.get()) | |
|
Ben Goodger (Google)
2013/03/29 14:56:50
It seems a little unusual to consider this case a
| |
| 31 return NULL; | |
| 32 #else | |
| 33 if (color_chooser_.get()) | |
| 34 color_chooser_->End(); | |
| 35 #endif | |
| 36 color_chooser_.reset(content::ColorChooser::Create(color_chooser_id, | |
| 37 web_contents, | |
| 38 initial_color)); | |
| 39 return color_chooser_.get(); | |
|
Ben Goodger (Google)
2013/03/29 14:56:50
It does seem like unnecessary indirection to have
| |
| 40 } | |
| 41 | |
| 42 void ColorChooserController::DidEndColorChooser() { | |
| 43 color_chooser_.reset(); | |
| 44 } | |
| OLD | NEW |