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 // TODO(erg): This method was copied out of shell_integration_linux.cc. Because |
Lei Zhang
2016/07/30 00:40:33
Can we update the comment? The two copies also nee
| |
60 // of how this library is structured as a stand alone .so, we can't call code | 62 // of how this library is structured as a stand alone .so, we can't call code |
61 // from browser and above. | 63 // from browser and above. |
62 std::string GetDesktopName(base::Environment* env) { | 64 std::string GetDesktopName(base::Environment* env) { |
63 #if defined(GOOGLE_CHROME_BUILD) | 65 #if defined(GOOGLE_CHROME_BUILD) |
64 return "google-chrome.desktop"; | 66 version_info::Channel product_channel(chrome::GetChannel()); |
67 switch (product_channel) { | |
68 case version_info::Channel::DEV: | |
69 return "google-chrome-unstable.desktop"; | |
70 case version_info::Channel::BETA: | |
71 return "google-chrome-beta.desktop"; | |
72 default: | |
73 return "google-chrome.desktop"; | |
74 } | |
65 #else // CHROMIUM_BUILD | 75 #else // CHROMIUM_BUILD |
66 // Allow $CHROME_DESKTOP to override the built-in value, so that development | 76 // Allow $CHROME_DESKTOP to override the built-in value, so that development |
67 // versions can set themselves as the default without interfering with | 77 // versions can set themselves as the default without interfering with |
68 // non-official, packaged versions using the built-in value. | 78 // non-official, packaged versions using the built-in value. |
69 std::string name; | 79 std::string name; |
70 if (env->GetVar("CHROME_DESKTOP", &name) && !name.empty()) | 80 if (env->GetVar("CHROME_DESKTOP", &name) && !name.empty()) |
71 return name; | 81 return name; |
72 return "chromium-browser.desktop"; | 82 return "chromium-browser.desktop"; |
73 #endif | 83 #endif |
74 } | 84 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 aura::Window* GetAuraTransientParent(GtkWidget* dialog) { | 145 aura::Window* GetAuraTransientParent(GtkWidget* dialog) { |
136 return reinterpret_cast<aura::Window*>( | 146 return reinterpret_cast<aura::Window*>( |
137 g_object_get_data(G_OBJECT(dialog), kAuraTransientParent)); | 147 g_object_get_data(G_OBJECT(dialog), kAuraTransientParent)); |
138 } | 148 } |
139 | 149 |
140 void ClearAuraTransientParent(GtkWidget* dialog) { | 150 void ClearAuraTransientParent(GtkWidget* dialog) { |
141 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, NULL); | 151 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, NULL); |
142 } | 152 } |
143 | 153 |
144 } // namespace libgtk2ui | 154 } // namespace libgtk2ui |
OLD | NEW |