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 #include "ui/views/color_chooser/color_chooser_view.h" | 5 #include "ui/views/color_chooser/color_chooser_view.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" |
8 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
11 #include "skia/ext/refptr.h" | 14 #include "skia/ext/refptr.h" |
12 #include "third_party/skia/include/core/SkPaint.h" | 15 #include "third_party/skia/include/core/SkPaint.h" |
13 #include "third_party/skia/include/core/SkPath.h" | 16 #include "third_party/skia/include/core/SkPath.h" |
14 #include "third_party/skia/include/effects/SkGradientShader.h" | 17 #include "third_party/skia/include/effects/SkGradientShader.h" |
15 #include "ui/events/event.h" | 18 #include "ui/events/event.h" |
16 #include "ui/events/keycodes/keyboard_codes.h" | 19 #include "ui/events/keycodes/keyboard_codes.h" |
17 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
(...skipping 22 matching lines...) Expand all Loading... |
40 SkColorGetG(color), | 43 SkColorGetG(color), |
41 SkColorGetB(color))); | 44 SkColorGetB(color))); |
42 } | 45 } |
43 | 46 |
44 bool GetColorFromText(const base::string16& text, SkColor* result) { | 47 bool GetColorFromText(const base::string16& text, SkColor* result) { |
45 if (text.size() != 6 && !(text.size() == 7 && text[0] == '#')) | 48 if (text.size() != 6 && !(text.size() == 7 && text[0] == '#')) |
46 return false; | 49 return false; |
47 | 50 |
48 std::string input = | 51 std::string input = |
49 base::UTF16ToUTF8((text.size() == 6) ? text : text.substr(1)); | 52 base::UTF16ToUTF8((text.size() == 6) ? text : text.substr(1)); |
50 std::vector<uint8> hex; | 53 std::vector<uint8_t> hex; |
51 if (!base::HexStringToBytes(input, &hex)) | 54 if (!base::HexStringToBytes(input, &hex)) |
52 return false; | 55 return false; |
53 | 56 |
54 *result = SkColorSetRGB(hex[0], hex[1], hex[2]); | 57 *result = SkColorSetRGB(hex[0], hex[1], hex[2]); |
55 return true; | 58 return true; |
56 } | 59 } |
57 | 60 |
58 // A view that processes mouse events and gesture events using a common | 61 // A view that processes mouse events and gesture events using a common |
59 // interface. | 62 // interface. |
60 class LocatedEventHandlerView : public views::View { | 63 class LocatedEventHandlerView : public views::View { |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 const ui::KeyEvent& key_event) { | 475 const ui::KeyEvent& key_event) { |
473 if (key_event.key_code() != ui::VKEY_RETURN && | 476 if (key_event.key_code() != ui::VKEY_RETURN && |
474 key_event.key_code() != ui::VKEY_ESCAPE) | 477 key_event.key_code() != ui::VKEY_ESCAPE) |
475 return false; | 478 return false; |
476 | 479 |
477 GetWidget()->Close(); | 480 GetWidget()->Close(); |
478 return true; | 481 return true; |
479 } | 482 } |
480 | 483 |
481 } // namespace views | 484 } // namespace views |
OLD | NEW |