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

Side by Side Diff: chrome/browser/ui/libgtkui/gtk_util.cc

Issue 2707313002: Gtk: Change NULL to nullptr (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_util.h ('k') | chrome/browser/ui/libgtkui/menu_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/gtk_util.h" 5 #include "chrome/browser/ui/libgtkui/gtk_util.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <gdk/gdk.h> 8 #include <gdk/gdk.h>
9 #include <gdk/gdkx.h> 9 #include <gdk/gdkx.h>
10 #include <gtk/gtk.h> 10 #include <gtk/gtk.h>
(...skipping 22 matching lines...) Expand all
33 void CommonInitFromCommandLine(const base::CommandLine& command_line, 33 void CommonInitFromCommandLine(const base::CommandLine& command_line,
34 void (*init_func)(gint*, gchar***)) { 34 void (*init_func)(gint*, gchar***)) {
35 const std::vector<std::string>& args = command_line.argv(); 35 const std::vector<std::string>& args = command_line.argv();
36 int argc = args.size(); 36 int argc = args.size();
37 std::unique_ptr<char* []> argv(new char*[argc + 1]); 37 std::unique_ptr<char* []> argv(new char*[argc + 1]);
38 for (size_t i = 0; i < args.size(); ++i) { 38 for (size_t i = 0; i < args.size(); ++i) {
39 // TODO(piman@google.com): can gtk_init modify argv? Just being safe 39 // TODO(piman@google.com): can gtk_init modify argv? Just being safe
40 // here. 40 // here.
41 argv[i] = strdup(args[i].c_str()); 41 argv[i] = strdup(args[i].c_str());
42 } 42 }
43 argv[argc] = NULL; 43 argv[argc] = nullptr;
44 char** argv_pointer = argv.get(); 44 char** argv_pointer = argv.get();
45 45
46 { 46 {
47 // http://crbug.com/423873 47 // http://crbug.com/423873
48 ANNOTATE_SCOPED_MEMORY_LEAK; 48 ANNOTATE_SCOPED_MEMORY_LEAK;
49 init_func(&argc, &argv_pointer); 49 init_func(&argc, &argv_pointer);
50 } 50 }
51 for (size_t i = 0; i < args.size(); ++i) { 51 for (size_t i = 0; i < args.size(); ++i) {
52 free(argv[i]); 52 free(argv[i]);
53 } 53 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // the two later. 196 // the two later.
197 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, parent); 197 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, parent);
198 } 198 }
199 199
200 aura::Window* GetAuraTransientParent(GtkWidget* dialog) { 200 aura::Window* GetAuraTransientParent(GtkWidget* dialog) {
201 return reinterpret_cast<aura::Window*>( 201 return reinterpret_cast<aura::Window*>(
202 g_object_get_data(G_OBJECT(dialog), kAuraTransientParent)); 202 g_object_get_data(G_OBJECT(dialog), kAuraTransientParent));
203 } 203 }
204 204
205 void ClearAuraTransientParent(GtkWidget* dialog) { 205 void ClearAuraTransientParent(GtkWidget* dialog) {
206 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, NULL); 206 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, nullptr);
207 } 207 }
208 208
209 #if GTK_MAJOR_VERSION > 2 209 #if GTK_MAJOR_VERSION > 2
210 CairoSurface::CairoSurface(SkBitmap& bitmap) 210 CairoSurface::CairoSurface(SkBitmap& bitmap)
211 : surface_(cairo_image_surface_create_for_data( 211 : surface_(cairo_image_surface_create_for_data(
212 static_cast<unsigned char*>(bitmap.getAddr(0, 0)), 212 static_cast<unsigned char*>(bitmap.getAddr(0, 0)),
213 CAIRO_FORMAT_ARGB32, 213 CAIRO_FORMAT_ARGB32,
214 bitmap.width(), 214 bitmap.width(),
215 bitmap.height(), 215 bitmap.height(),
216 cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, bitmap.width()))), 216 cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, bitmap.width()))),
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 547 }
548 548
549 CairoSurface surface(gfx::Size(w, h)); 549 CairoSurface surface(gfx::Size(w, h));
550 gtk_render_background(context, surface.cairo(), 0, 0, w, h); 550 gtk_render_background(context, surface.cairo(), 0, 0, w, h);
551 gtk_render_frame(context, surface.cairo(), 0, 0, w, h); 551 gtk_render_frame(context, surface.cairo(), 0, 0, w, h);
552 return surface.GetAveragePixelValue(false); 552 return surface.GetAveragePixelValue(false);
553 } 553 }
554 #endif 554 #endif
555 555
556 } // namespace libgtkui 556 } // namespace libgtkui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_util.h ('k') | chrome/browser/ui/libgtkui/menu_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698