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 "chrome/browser/ui/libgtk2ui/gtk2_util.h" | 5 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
11 | 11 |
12 #include <memory> | 12 #include <memory> |
13 | 13 |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/debug/leak_annotations.h" | 15 #include "base/debug/leak_annotations.h" |
16 #include "base/environment.h" | 16 #include "base/environment.h" |
17 #include "chrome/common/channel_info.h" | |
18 #include "components/version_info/version_info.h" | |
19 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
20 #include "ui/aura/window_tree_host.h" | 18 #include "ui/aura/window_tree_host.h" |
21 #include "ui/base/accelerators/accelerator.h" | 19 #include "ui/base/accelerators/accelerator.h" |
22 #include "ui/events/event_constants.h" | 20 #include "ui/events/event_constants.h" |
23 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 21 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
24 #include "ui/gfx/geometry/size.h" | 22 #include "ui/gfx/geometry/size.h" |
25 | 23 |
26 namespace { | 24 namespace { |
27 | 25 |
28 const char kAuraTransientParent[] = "aura-transient-parent"; | 26 const char kAuraTransientParent[] = "aura-transient-parent"; |
(...skipping 22 matching lines...) Expand all Loading... |
51 } | 49 } |
52 | 50 |
53 } // namespace | 51 } // namespace |
54 | 52 |
55 namespace libgtk2ui { | 53 namespace libgtk2ui { |
56 | 54 |
57 void GtkInitFromCommandLine(const base::CommandLine& command_line) { | 55 void GtkInitFromCommandLine(const base::CommandLine& command_line) { |
58 CommonInitFromCommandLine(command_line, gtk_init); | 56 CommonInitFromCommandLine(command_line, gtk_init); |
59 } | 57 } |
60 | 58 |
61 // This function should be kept in sync with the copy in | 59 // TODO(erg): This method was copied out of shell_integration_linux.cc. Because |
62 // shell_integration_linux.cc. | 60 // of how this library is structured as a stand alone .so, we can't call code |
63 // | 61 // from browser and above. |
64 // Because of how libgtk2ui.so is structured as a stand alone .so, we can't call | |
65 // code from browser and above. | |
66 std::string GetDesktopName(base::Environment* env) { | 62 std::string GetDesktopName(base::Environment* env) { |
67 #if defined(GOOGLE_CHROME_BUILD) | 63 #if defined(GOOGLE_CHROME_BUILD) |
68 version_info::Channel product_channel(chrome::GetChannel()); | 64 return "google-chrome.desktop"; |
69 switch (product_channel) { | |
70 case version_info::Channel::DEV: | |
71 return "google-chrome-unstable.desktop"; | |
72 case version_info::Channel::BETA: | |
73 return "google-chrome-beta.desktop"; | |
74 default: | |
75 return "google-chrome.desktop"; | |
76 } | |
77 #else // CHROMIUM_BUILD | 65 #else // CHROMIUM_BUILD |
78 // Allow $CHROME_DESKTOP to override the built-in value, so that development | 66 // Allow $CHROME_DESKTOP to override the built-in value, so that development |
79 // versions can set themselves as the default without interfering with | 67 // versions can set themselves as the default without interfering with |
80 // non-official, packaged versions using the built-in value. | 68 // non-official, packaged versions using the built-in value. |
81 std::string name; | 69 std::string name; |
82 if (env->GetVar("CHROME_DESKTOP", &name) && !name.empty()) | 70 if (env->GetVar("CHROME_DESKTOP", &name) && !name.empty()) |
83 return name; | 71 return name; |
84 return "chromium-browser.desktop"; | 72 return "chromium-browser.desktop"; |
85 #endif | 73 #endif |
86 } | 74 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 aura::Window* GetAuraTransientParent(GtkWidget* dialog) { | 135 aura::Window* GetAuraTransientParent(GtkWidget* dialog) { |
148 return reinterpret_cast<aura::Window*>( | 136 return reinterpret_cast<aura::Window*>( |
149 g_object_get_data(G_OBJECT(dialog), kAuraTransientParent)); | 137 g_object_get_data(G_OBJECT(dialog), kAuraTransientParent)); |
150 } | 138 } |
151 | 139 |
152 void ClearAuraTransientParent(GtkWidget* dialog) { | 140 void ClearAuraTransientParent(GtkWidget* dialog) { |
153 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, NULL); | 141 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, NULL); |
154 } | 142 } |
155 | 143 |
156 } // namespace libgtk2ui | 144 } // namespace libgtk2ui |
OLD | NEW |