OLD | NEW |
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 #include "chrome/browser/chromeos/file_manager/open_util.h" | 7 #include "chrome/browser/chromeos/file_manager/open_util.h" |
8 #include "chrome/browser/ui/browser_navigator.h" | 8 #include "chrome/browser/ui/browser_navigator.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
11 | 11 |
12 using content::BrowserThread; | 12 using content::BrowserThread; |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 const char kGmailComposeUrl[] = | 16 const char kGmailComposeUrl[] = |
17 "https://mail.google.com/mail/?extsrc=mailto&url="; | 17 "https://mail.google.com/mail/?extsrc=mailto&url="; |
18 | 18 |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 namespace platform_util { | 21 namespace platform_util { |
22 | 22 |
23 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { | 23 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { |
24 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 24 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
25 file_manager::util::ShowItemInFolder(profile, full_path); | 25 file_manager::util::ShowItemInFolder(profile, full_path); |
26 } | 26 } |
27 | 27 |
28 void OpenItem(Profile* profile, const base::FilePath& full_path) { | 28 void OpenFile(Profile* profile, const base::FilePath& full_path) { |
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
30 file_manager::util::OpenItem(profile, full_path); | 30 file_manager::util::OpenFile(profile, full_path); |
| 31 } |
| 32 |
| 33 void OpenFolder(Profile* profile, const base::FilePath& full_path) { |
| 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 35 file_manager::util::OpenFolder(profile, full_path); |
31 } | 36 } |
32 | 37 |
33 void OpenExternal(Profile* profile, const GURL& url) { | 38 void OpenExternal(Profile* profile, const GURL& url) { |
34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
35 | 40 |
36 // This code should be obsolete since we have default handlers in ChromeOS | 41 // This code should be obsolete since we have default handlers in ChromeOS |
37 // which should handle this. However - there are two things which make it | 42 // which should handle this. However - there are two things which make it |
38 // necessary to keep it in: | 43 // necessary to keep it in: |
39 // a.) The user might have deleted the default handler in this session. | 44 // a.) The user might have deleted the default handler in this session. |
40 // In this case we would need to have this in place. | 45 // In this case we would need to have this in place. |
41 // b.) There are several code paths which are not clear if they would call | 46 // b.) There are several code paths which are not clear if they would call |
42 // this function directly and which would therefore break (e.g. | 47 // this function directly and which would therefore break (e.g. |
43 // "Browser::EmailPageLocation" (to name only one). | 48 // "Browser::EmailPageLocation" (to name only one). |
44 // As such we should keep this code here. | 49 // As such we should keep this code here. |
45 chrome::NavigateParams params(profile, url, ui::PAGE_TRANSITION_LINK); | 50 chrome::NavigateParams params(profile, url, ui::PAGE_TRANSITION_LINK); |
46 params.disposition = NEW_FOREGROUND_TAB; | 51 params.disposition = NEW_FOREGROUND_TAB; |
47 params.host_desktop_type = chrome::HOST_DESKTOP_TYPE_ASH; | 52 params.host_desktop_type = chrome::HOST_DESKTOP_TYPE_ASH; |
48 | 53 |
49 if (url.SchemeIs("mailto")) { | 54 if (url.SchemeIs("mailto")) { |
50 std::string string_url = kGmailComposeUrl; | 55 std::string string_url = kGmailComposeUrl; |
51 string_url.append(url.spec()); | 56 string_url.append(url.spec()); |
52 params.url = GURL(url); | 57 params.url = GURL(url); |
53 } | 58 } |
54 | 59 |
55 chrome::Navigate(¶ms); | 60 chrome::Navigate(¶ms); |
56 } | 61 } |
57 | 62 |
58 } // namespace platform_util | 63 } // namespace platform_util |
OLD | NEW |