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

Side by Side Diff: chrome/browser/gtk/task_manager_gtk.cc

Issue 165253: gtk: Don't crash if the user double clicks an empty area of the task manager ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 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
« 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/gtk/task_manager_gtk.h" 5 #include "chrome/browser/gtk/task_manager_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 menu_controller_->RunMenu(); 545 menu_controller_->RunMenu();
546 } 546 }
547 547
548 void TaskManagerGtk::ActivateFocusedTab() { 548 void TaskManagerGtk::ActivateFocusedTab() {
549 GtkTreeSelection* selection = gtk_tree_view_get_selection( 549 GtkTreeSelection* selection = gtk_tree_view_get_selection(
550 GTK_TREE_VIEW(treeview_)); 550 GTK_TREE_VIEW(treeview_));
551 551
552 // If the user has just double clicked, only one item is selected. 552 // If the user has just double clicked, only one item is selected.
553 GtkTreeModel* model; 553 GtkTreeModel* model;
554 GList* selected = gtk_tree_selection_get_selected_rows(selection, &model); 554 GList* selected = gtk_tree_selection_get_selected_rows(selection, &model);
555 int row = GetRowNumForPath(reinterpret_cast<GtkTreePath*>(selected->data)); 555 if (selected) {
556 task_manager_->ActivateProcess(row); 556 int row = GetRowNumForPath(reinterpret_cast<GtkTreePath*>(selected->data));
557 task_manager_->ActivateProcess(row);
558 }
557 } 559 }
558 560
559 void TaskManagerGtk::OnLinkActivated() { 561 void TaskManagerGtk::OnLinkActivated() {
560 Browser* browser = BrowserList::GetLastActive(); 562 Browser* browser = BrowserList::GetLastActive();
561 DCHECK(browser); 563 DCHECK(browser);
562 browser->OpenURL(GURL("about:memory"), GURL(), NEW_FOREGROUND_TAB, 564 browser->OpenURL(GURL("about:memory"), GURL(), NEW_FOREGROUND_TAB,
563 PageTransition::LINK); 565 PageTransition::LINK);
564 // In case the browser window is minimzed, show it. If this is an application 566 // In case the browser window is minimzed, show it. If this is an application
565 // or popup, we can only have one tab, hence we need to process this in a 567 // or popup, we can only have one tab, hence we need to process this in a
566 // tabbed browser window. Currently, |browser| is pointing to the application, 568 // tabbed browser window. Currently, |browser| is pointing to the application,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { 660 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) {
659 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget 661 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget
660 // is destroyed. The deleted object will receive gtk signals otherwise. 662 // is destroyed. The deleted object will receive gtk signals otherwise.
661 gtk_dialog_response(GTK_DIALOG(task_manager->dialog_), 663 gtk_dialog_response(GTK_DIALOG(task_manager->dialog_),
662 GTK_RESPONSE_DELETE_EVENT); 664 GTK_RESPONSE_DELETE_EVENT);
663 gtk_widget_destroy(task_manager->dialog_); 665 gtk_widget_destroy(task_manager->dialog_);
664 } 666 }
665 667
666 return TRUE; 668 return TRUE;
667 } 669 }
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