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

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm

Issue 7849011: Refactor Mac crash key reporting - move to base/mac/crash_logging.{h,mm} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review comments Created 9 years, 3 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 | « chrome/browser/ui/cocoa/objc_zombie.mm ('k') | chrome/common/child_process_logging.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/tab_contents/web_drag_source.h" 5 #import "chrome/browser/ui/cocoa/tab_contents/web_drag_source.h"
6 6
7 #include <sys/param.h> 7 #include <sys/param.h>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/mac/crash_logging.h"
10 #include "base/string_util.h" 11 #include "base/string_util.h"
11 #include "base/sys_string_conversions.h" 12 #include "base/sys_string_conversions.h"
12 #include "base/task.h" 13 #include "base/task.h"
13 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
14 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
15 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
16 #import "chrome/app/breakpad_mac.h" 17 #import "chrome/app/breakpad_mac.h"
17 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/download/download_util.h" 19 #include "chrome/browser/download/download_util.h"
19 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" 20 #include "chrome/browser/tab_contents/tab_contents_view_mac.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 54 }
54 55
55 // Returns a filename appropriate for the drop data 56 // Returns a filename appropriate for the drop data
56 // TODO(viettrungluu): Refactor to make it common across platforms, 57 // TODO(viettrungluu): Refactor to make it common across platforms,
57 // and move it somewhere sensible. 58 // and move it somewhere sensible.
58 FilePath GetFileNameFromDragData(const WebDropData& drop_data) { 59 FilePath GetFileNameFromDragData(const WebDropData& drop_data) {
59 // Set a breakpad key for the scope of this function to help debug 60 // Set a breakpad key for the scope of this function to help debug
60 // http://crbug.com/78782 61 // http://crbug.com/78782
61 static NSString* const kUrlKey = @"drop_data_url"; 62 static NSString* const kUrlKey = @"drop_data_url";
62 NSString* value = SysUTF8ToNSString(drop_data.url.spec()); 63 NSString* value = SysUTF8ToNSString(drop_data.url.spec());
63 ScopedCrashKey key(kUrlKey, value); 64 base::mac::ScopedCrashKey key(kUrlKey, value);
64 65
65 // Images without ALT text will only have a file extension so we need to 66 // Images without ALT text will only have a file extension so we need to
66 // synthesize one from the provided extension and URL. 67 // synthesize one from the provided extension and URL.
67 FilePath file_name(FilePathFromFilename(drop_data.file_description_filename)); 68 FilePath file_name(FilePathFromFilename(drop_data.file_description_filename));
68 file_name = file_name.BaseName().RemoveExtension(); 69 file_name = file_name.BaseName().RemoveExtension();
69 70
70 if (file_name.empty()) { 71 if (file_name.empty()) {
71 // Retrieve the name from the URL. 72 // Retrieve the name from the URL.
72 string16 suggested_filename = 73 string16 suggested_filename =
73 net::GetSuggestedFilename(drop_data.url, "", "", "", "", string16()); 74 net::GetSuggestedFilename(drop_data.url, "", "", "", "", string16());
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 445
445 - (NSImage*)dragImage { 446 - (NSImage*)dragImage {
446 if (dragImage_) 447 if (dragImage_)
447 return dragImage_; 448 return dragImage_;
448 449
449 // Default to returning a generic image. 450 // Default to returning a generic image.
450 return gfx::GetCachedImageWithName(@"nav.pdf"); 451 return gfx::GetCachedImageWithName(@"nav.pdf");
451 } 452 }
452 453
453 @end // @implementation WebDragSource (Private) 454 @end // @implementation WebDragSource (Private)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/objc_zombie.mm ('k') | chrome/common/child_process_logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698