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/libgtkui/gtk2_util.h" | 5 #include "chrome/browser/ui/libgtkui/gtk_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" |
(...skipping 13 matching lines...) Expand all Loading... |
29 void (*init_func)(gint*, gchar***)) { | 29 void (*init_func)(gint*, gchar***)) { |
30 const std::vector<std::string>& args = command_line.argv(); | 30 const std::vector<std::string>& args = command_line.argv(); |
31 int argc = args.size(); | 31 int argc = args.size(); |
32 std::unique_ptr<char* []> argv(new char*[argc + 1]); | 32 std::unique_ptr<char* []> argv(new char*[argc + 1]); |
33 for (size_t i = 0; i < args.size(); ++i) { | 33 for (size_t i = 0; i < args.size(); ++i) { |
34 // TODO(piman@google.com): can gtk_init modify argv? Just being safe | 34 // TODO(piman@google.com): can gtk_init modify argv? Just being safe |
35 // here. | 35 // here. |
36 argv[i] = strdup(args[i].c_str()); | 36 argv[i] = strdup(args[i].c_str()); |
37 } | 37 } |
38 argv[argc] = NULL; | 38 argv[argc] = NULL; |
39 char **argv_pointer = argv.get(); | 39 char** argv_pointer = argv.get(); |
40 | 40 |
41 { | 41 { |
42 // http://crbug.com/423873 | 42 // http://crbug.com/423873 |
43 ANNOTATE_SCOPED_MEMORY_LEAK; | 43 ANNOTATE_SCOPED_MEMORY_LEAK; |
44 init_func(&argc, &argv_pointer); | 44 init_func(&argc, &argv_pointer); |
45 } | 45 } |
46 for (size_t i = 0; i < args.size(); ++i) { | 46 for (size_t i = 0; i < args.size(); ++i) { |
47 free(argv[i]); | 47 free(argv[i]); |
48 } | 48 } |
49 } | 49 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 aura::Window* GetAuraTransientParent(GtkWidget* dialog) { | 135 aura::Window* GetAuraTransientParent(GtkWidget* dialog) { |
136 return reinterpret_cast<aura::Window*>( | 136 return reinterpret_cast<aura::Window*>( |
137 g_object_get_data(G_OBJECT(dialog), kAuraTransientParent)); | 137 g_object_get_data(G_OBJECT(dialog), kAuraTransientParent)); |
138 } | 138 } |
139 | 139 |
140 void ClearAuraTransientParent(GtkWidget* dialog) { | 140 void ClearAuraTransientParent(GtkWidget* dialog) { |
141 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, NULL); | 141 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, NULL); |
142 } | 142 } |
143 | 143 |
144 } // namespace libgtkui | 144 } // namespace libgtkui |
OLD | NEW |