OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |