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 CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
6 #define CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 6 #define CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "ui/native_theme/native_theme.h" | 11 #include "ui/native_theme/native_theme.h" |
12 | 12 |
13 namespace aura { | 13 namespace aura { |
14 class Window; | 14 class Window; |
15 } | 15 } |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class CommandLine; | 18 class CommandLine; |
19 class Environment; | 19 class Environment; |
20 } | 20 } |
21 | 21 |
22 namespace ui { | 22 namespace ui { |
23 class Accelerator; | 23 class Accelerator; |
24 } | 24 } |
25 | 25 |
26 namespace libgtkui { | 26 namespace libgtkui { |
27 | 27 |
| 28 extern const SkColor kInvalidColorIdColor; |
| 29 extern const SkColor kURLTextColor; |
| 30 |
| 31 // Generates the normal URL color, a green color used in unhighlighted URL |
| 32 // text. It is a mix of |kURLTextColor| and the current text color. Unlike the |
| 33 // selected text color, it is more important to match the qualities of the |
| 34 // foreground typeface color instead of taking the background into account. |
| 35 SkColor NormalURLColor(SkColor foreground); |
| 36 |
| 37 // Generates the selected URL color, a green color used on URL text in the |
| 38 // currently highlighted entry in the autocomplete popup. It's a mix of |
| 39 // |kURLTextColor|, the current text color, and the background color (the |
| 40 // select highlight). It is more important to contrast with the background |
| 41 // saturation than to look exactly like the foreground color. |
| 42 SkColor SelectedURLColor(SkColor foreground, SkColor background); |
| 43 |
28 void GtkInitFromCommandLine(const base::CommandLine& command_line); | 44 void GtkInitFromCommandLine(const base::CommandLine& command_line); |
29 | 45 |
30 // Returns the name of the ".desktop" file associated with our running process. | 46 // Returns the name of the ".desktop" file associated with our running process. |
31 std::string GetDesktopName(base::Environment* env); | 47 std::string GetDesktopName(base::Environment* env); |
32 | 48 |
33 guint GetGdkKeyCodeForAccelerator(const ui::Accelerator& accelerator); | 49 guint GetGdkKeyCodeForAccelerator(const ui::Accelerator& accelerator); |
34 | 50 |
35 GdkModifierType GetGdkModifierForAccelerator( | 51 GdkModifierType GetGdkModifierForAccelerator( |
36 const ui::Accelerator& accelerator); | 52 const ui::Accelerator& accelerator); |
37 | 53 |
38 // Translates event flags into plaform independent event flags. | 54 // Translates event flags into plaform independent event flags. |
39 int EventFlagsFromGdkState(guint state); | 55 int EventFlagsFromGdkState(guint state); |
40 | 56 |
41 // Style a GTK button as a BlueButton | 57 // Style a GTK button as a BlueButton |
42 void TurnButtonBlue(GtkWidget* button); | 58 void TurnButtonBlue(GtkWidget* button); |
43 | 59 |
44 // Sets |dialog| as transient for |parent|, which will keep it on top and center | 60 // Sets |dialog| as transient for |parent|, which will keep it on top and center |
45 // it above |parent|. Do nothing if |parent| is NULL. | 61 // it above |parent|. Do nothing if |parent| is NULL. |
46 void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent); | 62 void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent); |
47 | 63 |
48 // Gets the transient parent aura window for |dialog|. | 64 // Gets the transient parent aura window for |dialog|. |
49 aura::Window* GetAuraTransientParent(GtkWidget* dialog); | 65 aura::Window* GetAuraTransientParent(GtkWidget* dialog); |
50 | 66 |
51 // Clears the transient parent for |dialog|. | 67 // Clears the transient parent for |dialog|. |
52 void ClearAuraTransientParent(GtkWidget* dialog); | 68 void ClearAuraTransientParent(GtkWidget* dialog); |
53 | 69 |
54 } // namespace libgtkui | 70 } // namespace libgtkui |
55 | 71 |
56 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ | 72 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ |
OLD | NEW |