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

Side by Side Diff: content/shell/browser/shell_gtk.cc

Issue 25841002: Don't crash on invalid URL in GTK ContentShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: url was already a GURL Created 7 years, 2 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell.h" 5 #include "content/shell/browser/shell.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 void Shell::OnStopButtonClicked(GtkWidget* widget) { 275 void Shell::OnStopButtonClicked(GtkWidget* widget) {
276 Stop(); 276 Stop();
277 } 277 }
278 278
279 void Shell::OnURLEntryActivate(GtkWidget* entry) { 279 void Shell::OnURLEntryActivate(GtkWidget* entry) {
280 const gchar* str = gtk_entry_get_text(GTK_ENTRY(entry)); 280 const gchar* str = gtk_entry_get_text(GTK_ENTRY(entry));
281 GURL url(str); 281 GURL url(str);
282 if (!url.has_scheme()) 282 if (!url.has_scheme())
283 url = GURL(std::string("http://") + std::string(str)); 283 url = GURL(std::string("http://") + std::string(str));
284 LoadURL(GURL(url)); 284 if (url.is_valid())
285 LoadURL(url);
285 } 286 }
286 287
287 // Callback for when the main window is destroyed. 288 // Callback for when the main window is destroyed.
288 gboolean Shell::OnWindowDestroyed(GtkWidget* window) { 289 gboolean Shell::OnWindowDestroyed(GtkWidget* window) {
289 delete this; 290 delete this;
290 return FALSE; // Don't stop this message. 291 return FALSE; // Don't stop this message.
291 } 292 }
292 293
293 gboolean Shell::OnCloseWindowKeyPressed(GtkAccelGroup* accel_group, 294 gboolean Shell::OnCloseWindowKeyPressed(GtkAccelGroup* accel_group,
294 GObject* acceleratable, 295 GObject* acceleratable,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 331
331 void Shell::PlatformSetTitle(const string16& title) { 332 void Shell::PlatformSetTitle(const string16& title) {
332 if (headless_) 333 if (headless_)
333 return; 334 return;
334 335
335 std::string title_utf8 = UTF16ToUTF8(title); 336 std::string title_utf8 = UTF16ToUTF8(title);
336 gtk_window_set_title(GTK_WINDOW(window_), title_utf8.c_str()); 337 gtk_window_set_title(GTK_WINDOW(window_), title_utf8.c_str());
337 } 338 }
338 339
339 } // namespace content 340 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698