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

Side by Side Diff: chrome/browser/platform_util.h

Issue 352393002: Be explicit about target type in platform_util::OpenItem() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 5 years, 10 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
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 #ifndef CHROME_BROWSER_PLATFORM_UTIL_H_ 5 #ifndef CHROME_BROWSER_PLATFORM_UTIL_H_
6 #define CHROME_BROWSER_PLATFORM_UTIL_H_ 6 #define CHROME_BROWSER_PLATFORM_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h"
10 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
11 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
12 13
13 class GURL; 14 class GURL;
14 class Profile; 15 class Profile;
15 16
16 namespace base { 17 namespace base {
17 class FilePath; 18 class FilePath;
18 } 19 }
19 20
20 namespace platform_util { 21 namespace platform_util {
21 22
22 // Show the given file in a file manager. If possible, select the file. 23 // Result of calling OpenFile() or OpenFolder() passed into OpenOperationResult.
23 // The |profile| is used to determine the running profile of file manager app 24 enum OpenOperationResult {
24 // in Chrome OS only. Not used in other platforms. 25 OPEN_SUCCEEDED,
25 // Must be called from the UI thread. 26 OPEN_FAILED_PATH_NOT_FOUND, // Specified path does not exist.
27 OPEN_FAILED_INVALID_TYPE, // Type of object found at path did not match what
28 // was expected. I.e. OpenFile was called on a
29 // folder or OpenFolder called on a file.
30 OPEN_FAILED_NO_HANLDER_FOR_FILE_TYPE, // There was no file handler capable of
31 // opening file. Only returned on
32 // ChromeOS.
33 OPEN_FAILED_FILE_ERROR, // Open operation failed due to some other file
34 // error.
35 };
36
37 // Callback used with OpenFile and OpenFolder.
38 typedef base::Callback<void(OpenOperationResult)> OpenOperationCallback;
39
40 // Opens the folder containing the item specified by |full_path| in the
41 // desktop's default manner. If possible, the item will be selected. The
42 // |profile| is used to determine the running profile of file manager app in
43 // Chrome OS only. Not used in other platforms. Must be called on the UI
44 // thread.
26 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path); 45 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path);
27 46
28 // Open the given file in the desktop's default manner. 47 // Opens the file specified by |full_path| in the desktop's default manner.
29 // Must be called from the UI thread. 48 // |callback| will be invoked on the UI thread with the result of the open
30 void OpenItem(Profile* profile, const base::FilePath& full_path); 49 // operation. |full_path| must point to a valid file. If it doesn't exist or is
50 // not a file, the corresponding error will be returned to |callback|.
51 void OpenFile(Profile* profile,
52 const base::FilePath& full_path,
53 const OpenOperationCallback& callback);
54
55 // Opens the folder specified by |full_path| in the desktop's default manner.
56 // |callback| will be invoked on the UI thread with the result of the open
57 // operation. |full_path| must be an existing directory. If not, the
58 // corresponding error will be returned to |callback|.
59 void OpenFolder(Profile* profile,
60 const base::FilePath& full_path,
61 const OpenOperationCallback& callback);
31 62
32 // Open the given external protocol URL in the desktop's default manner. 63 // Open the given external protocol URL in the desktop's default manner.
33 // (For example, mailto: URLs in the default mail user agent.) 64 // (For example, mailto: URLs in the default mail user agent.)
34 // Must be called from the UI thread. 65 // Must be called from the UI thread.
35 void OpenExternal(Profile* profile, const GURL& url); 66 void OpenExternal(Profile* profile, const GURL& url);
36 67
37 // Get the top level window for the native view. This can return NULL. 68 // Get the top level window for the native view. This can return NULL.
38 gfx::NativeWindow GetTopLevel(gfx::NativeView view); 69 gfx::NativeWindow GetTopLevel(gfx::NativeView view);
39 70
40 // Returns a NativeView handle for parenting dialogs off |window|. This can be 71 // Returns a NativeView handle for parenting dialogs off |window|. This can be
(...skipping 18 matching lines...) Expand all
59 #if defined(OS_MACOSX) 90 #if defined(OS_MACOSX)
60 // On 10.7+, back and forward swipe gestures can be triggered using a scroll 91 // On 10.7+, back and forward swipe gestures can be triggered using a scroll
61 // gesture, if enabled in System Preferences. This function returns true if 92 // gesture, if enabled in System Preferences. This function returns true if
62 // the feature is supported and enabled, and false otherwise. 93 // the feature is supported and enabled, and false otherwise.
63 bool IsSwipeTrackingFromScrollEventsEnabled(); 94 bool IsSwipeTrackingFromScrollEventsEnabled();
64 #endif 95 #endif
65 96
66 } // namespace platform_util 97 } // namespace platform_util
67 98
68 #endif // CHROME_BROWSER_PLATFORM_UTIL_H_ 99 #endif // CHROME_BROWSER_PLATFORM_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698