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

Side by Side Diff: chrome/browser/download/download_util.cc

Issue 9791024: Check for null widget in DragDownload which is causing the crash in the bug. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 9 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) 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 // Download utility implementation 5 // Download utility implementation
6 6
7 #include "chrome/browser/download/download_util.h" 7 #include "chrome/browser/download/download_util.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <shobjidl.h> 10 #include <shobjidl.h>
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 net::GetMimeTypeFromFile(full_path, &mime_type); 391 net::GetMimeTypeFromFile(full_path, &mime_type);
392 392
393 // Add URL so that we can load supported files when dragged to WebContents. 393 // Add URL so that we can load supported files when dragged to WebContents.
394 if (net::IsSupportedMimeType(mime_type)) { 394 if (net::IsSupportedMimeType(mime_type)) {
395 data.SetURL(net::FilePathToFileURL(full_path), 395 data.SetURL(net::FilePathToFileURL(full_path),
396 download->GetFileNameToReportUser().LossyDisplayName()); 396 download->GetFileNameToReportUser().LossyDisplayName());
397 } 397 }
398 398
399 #if !defined(TOOLKIT_USES_GTK) 399 #if !defined(TOOLKIT_USES_GTK)
400 views::Widget* widget = views::Widget::GetWidgetForNativeView(view); 400 views::Widget* widget = views::Widget::GetWidgetForNativeView(view);
401 // TODO(varunjain): Widget should not be NULL here. But its causing the crash
402 // in http://code.google.com/p/chromium/issues/detail?id=120430 Find out why.
403 if (!widget || !widget->native_widget())
404 return;
405
401 gfx::Point location = gfx::Screen::GetCursorScreenPoint(); 406 gfx::Point location = gfx::Screen::GetCursorScreenPoint();
402 // We do not care about notifying the DragItemView on completion of drag. So 407 // We do not care about notifying the DragItemView on completion of drag. So
403 // we pass NULL to RunShellDrag for the source view. 408 // we pass NULL to RunShellDrag for the source view.
404 widget->RunShellDrag(NULL, data, location, 409 widget->RunShellDrag(NULL, data, location,
405 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK); 410 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK);
406 411
407 #else 412 #else
408 GtkWidget* root = gtk_widget_get_toplevel(view); 413 GtkWidget* root = gtk_widget_get_toplevel(view);
409 if (!root) 414 if (!root)
410 return; 415 return;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 UMA_HISTOGRAM_ENUMERATION( 641 UMA_HISTOGRAM_ENUMERATION(
637 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); 642 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
638 } 643 }
639 644
640 void RecordDownloadSource(ChromeDownloadSource source) { 645 void RecordDownloadSource(ChromeDownloadSource source) {
641 UMA_HISTOGRAM_ENUMERATION( 646 UMA_HISTOGRAM_ENUMERATION(
642 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); 647 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY);
643 } 648 }
644 649
645 } // namespace download_util 650 } // namespace download_util
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