OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_COLOR_CHOOSER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_COLOR_CHOOSER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "third_party/skia/include/core/SkColor.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 class RenderViewHost; |
| 14 class WebContents; |
| 15 |
| 16 // Abstraction object for color choosers for each platform. |
| 17 class ColorChooser { |
| 18 public: |
| 19 static ColorChooser* Create(int identifier, |
| 20 WebContents* tab, |
| 21 SkColor initial_color); |
| 22 ColorChooser(int identifier) : identifier_(identifier) {} |
| 23 virtual ~ColorChooser() {} |
| 24 |
| 25 // Returns a unique identifier for this chooser. Identifiers are unique |
| 26 // across a renderer process. This avoids race conditions in synchronizing |
| 27 // the browser and renderer processes. For example, if a renderer closes one |
| 28 // chooser and opens another, and simultaneously the user picks a color in the |
| 29 // first chooser, the IDs can be used to drop the "chose a color" message |
| 30 // rather than erroneously tell the renderer that the user picked a color in |
| 31 // the second chooser. |
| 32 int identifier() const { return identifier_; } |
| 33 |
| 34 // Ends connection with color chooser. Closes color chooser depending on the |
| 35 // platform. |
| 36 virtual void End() = 0; |
| 37 |
| 38 // Sets the selected color. |
| 39 virtual void SetSelectedColor(SkColor color) = 0; |
| 40 |
| 41 private: |
| 42 int identifier_; |
| 43 }; |
| 44 |
| 45 } |
| 46 |
| 47 #endif // CONTENT_PUBLIC_BROWSER_COLOR_CHOOSER_H_ |
OLD | NEW |