Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: chrome/browser/ui/libgtk2ui/gtk2_util.cc

Issue 10545037: Aura/GTK integration: Create a small stub library that can talk to GTK. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sky nits Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h"
6
7 #include <gtk/gtk.h>
8
9 #include "base/command_line.h"
10 #include "base/memory/scoped_ptr.h"
11
12 namespace {
13
14 void CommonInitFromCommandLine(const CommandLine& command_line,
15 void (*init_func)(gint*, gchar***)) {
16 const std::vector<std::string>& args = command_line.argv();
17 int argc = args.size();
18 scoped_array<char *> argv(new char *[argc + 1]);
19 for (size_t i = 0; i < args.size(); ++i) {
20 // TODO(piman@google.com): can gtk_init modify argv? Just being safe
21 // here.
22 argv[i] = strdup(args[i].c_str());
23 }
24 argv[argc] = NULL;
25 char **argv_pointer = argv.get();
26
27 init_func(&argc, &argv_pointer);
28 for (size_t i = 0; i < args.size(); ++i) {
29 free(argv[i]);
30 }
31 }
32
33 } // namespace
34
35 namespace libgtk2ui {
36
37 void GtkInitFromCommandLine(const CommandLine& command_line) {
38 CommonInitFromCommandLine(command_line, gtk_init);
39 }
40
41 } // namespace libgtk2ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698