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