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

Side by Side Diff: chrome/browser/platform_util_mac.mm

Issue 209613002: Download shelf autohides on showing in shell, just same as regular open Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added browser and unit tests. Renamed 'UserActed' to 'OpenedOrShown'. Created 4 years, 1 month 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 | « chrome/browser/platform_util_linux.cc ('k') | chrome/browser/platform_util_win.cc » ('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) 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 #include "chrome/browser/platform_util.h" 5 #include "chrome/browser/platform_util.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/mac/mac_logging.h" 13 #include "base/mac/mac_logging.h"
14 #import "base/mac/sdk_forward_declarations.h" 14 #import "base/mac/sdk_forward_declarations.h"
15 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
16 #include "chrome/browser/platform_util_internal.h" 16 #include "chrome/browser/platform_util_internal.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "url/gurl.h" 18 #include "url/gurl.h"
19 19
20 namespace platform_util { 20 namespace platform_util {
21 21
22 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { 22 namespace internal {
23
24 void PlatformShowItemInFolder(Profile* profile,
25 const base::FilePath& full_path) {
23 DCHECK([NSThread isMainThread]); 26 DCHECK([NSThread isMainThread]);
24 NSString* path_string = base::SysUTF8ToNSString(full_path.value()); 27 NSString* path_string = base::SysUTF8ToNSString(full_path.value());
25 if (!path_string || ![[NSWorkspace sharedWorkspace] selectFile:path_string 28 if (!path_string || ![[NSWorkspace sharedWorkspace] selectFile:path_string
26 inFileViewerRootedAtPath:@""]) 29 inFileViewerRootedAtPath:@""])
27 LOG(WARNING) << "NSWorkspace failed to select file " << full_path.value(); 30 LOG(WARNING) << "NSWorkspace failed to select file " << full_path.value();
28 } 31 }
29 32
33 } // namespace internal
34
30 void OpenFileOnMainThread(const base::FilePath& full_path) { 35 void OpenFileOnMainThread(const base::FilePath& full_path) {
31 DCHECK([NSThread isMainThread]); 36 DCHECK([NSThread isMainThread]);
32 NSString* path_string = base::SysUTF8ToNSString(full_path.value()); 37 NSString* path_string = base::SysUTF8ToNSString(full_path.value());
33 if (!path_string) 38 if (!path_string)
34 return; 39 return;
35 40
36 // On Mavericks or later, NSWorkspaceLaunchWithErrorPresentation will 41 // On Mavericks or later, NSWorkspaceLaunchWithErrorPresentation will
37 // properly handle Finder activation for quarantined files 42 // properly handle Finder activation for quarantined files
38 // (http://crbug.com/32921) and unassociated file types 43 // (http://crbug.com/32921) and unassociated file types
39 // (http://crbug.com/50263). 44 // (http://crbug.com/50263).
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 [[view window] isVisible]); 115 [[view window] isVisible]);
111 } 116 }
112 117
113 bool IsSwipeTrackingFromScrollEventsEnabled() { 118 bool IsSwipeTrackingFromScrollEventsEnabled() {
114 SEL selector = @selector(isSwipeTrackingFromScrollEventsEnabled); 119 SEL selector = @selector(isSwipeTrackingFromScrollEventsEnabled);
115 return [NSEvent respondsToSelector:selector] 120 return [NSEvent respondsToSelector:selector]
116 && [NSEvent performSelector:selector]; 121 && [NSEvent performSelector:selector];
117 } 122 }
118 123
119 } // namespace platform_util 124 } // namespace platform_util
OLDNEW
« no previous file with comments | « chrome/browser/platform_util_linux.cc ('k') | chrome/browser/platform_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698