Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_COLOR_CHOOSER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_COLOR_CHOOSER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_COLOR_CHOOSER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_COLOR_CHOOSER_H_ |
| 7 | 7 |
| 8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 | 11 |
| 12 class WebContents; | 12 class WebContents; |
| 13 | 13 |
| 14 // Abstraction object for color choosers for each platform. | 14 // Interface for a color chooser. |
| 15 class ColorChooser { | 15 class ColorChooser { |
| 16 public: | 16 public: |
| 17 static ColorChooser* Create(int identifier, | 17 static ColorChooser* Open(content::WebContents* web_contents, |
|
Ben Goodger (Google)
2013/04/19 16:24:54
you shouldn't put this method on content api. sinc
keishi
2013/04/22 01:54:29
I moved it to chrome/browser/ui/color_chooser_util
| |
| 18 WebContents* web_contents, | 18 SkColor initial_color); |
| 19 SkColor initial_color); | |
| 20 | 19 |
| 21 explicit ColorChooser(int identifier) : identifier_(identifier) {} | 20 virtual ~ColorChooser() {}; |
| 22 virtual ~ColorChooser() {} | |
| 23 | |
| 24 // Returns a unique identifier for this chooser. Identifiers are unique | |
| 25 // across a renderer process. This avoids race conditions in synchronizing | |
| 26 // the browser and renderer processes. For example, if a renderer closes one | |
| 27 // chooser and opens another, and simultaneously the user picks a color in the | |
| 28 // first chooser, the IDs can be used to drop the "chose a color" message | |
| 29 // rather than erroneously tell the renderer that the user picked a color in | |
| 30 // the second chooser. | |
| 31 int identifier() const { return identifier_; } | |
| 32 | 21 |
| 33 // Ends connection with color chooser. Closes color chooser depending on the | 22 // Ends connection with color chooser. Closes color chooser depending on the |
| 34 // platform. | 23 // platform. |
| 35 virtual void End() = 0; | 24 virtual void End() = 0; |
| 36 | 25 |
| 37 // Sets the selected color. | 26 // Sets the selected color. |
| 38 virtual void SetSelectedColor(SkColor color) = 0; | 27 virtual void SetSelectedColor(SkColor color) = 0; |
| 39 | |
| 40 private: | |
| 41 int identifier_; | |
| 42 }; | 28 }; |
| 43 | 29 |
| 44 } // namespace content | 30 } // namespace content |
| 45 | 31 |
| 46 #endif // CONTENT_PUBLIC_BROWSER_COLOR_CHOOSER_H_ | 32 #endif // CONTENT_PUBLIC_BROWSER_COLOR_CHOOSER_H_ |
| OLD | NEW |