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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 const char kGmailComposeUrl[] = | 24 const char kGmailComposeUrl[] = |
25 "https://mail.google.com/mail/?extsrc=mailto&url="; | 25 "https://mail.google.com/mail/?extsrc=mailto&url="; |
26 | 26 |
27 void OpenItemOnFileThread(const FilePath& full_path) { | 27 void OpenItemOnFileThread(const FilePath& full_path) { |
28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
29 base::Closure callback; | 29 base::Closure callback; |
30 if (file_util::DirectoryExists(full_path)) | 30 if (file_util::DirectoryExists(full_path)) |
31 callback = base::Bind(&file_manager_util::ViewFolder, full_path); | 31 callback = base::Bind(&file_manager_util::ViewFolder, full_path); |
32 else | 32 else |
33 callback = base::Bind(&file_manager_util::ViewFile, full_path, false); | 33 callback = base::Bind(&file_manager_util::ViewFile, full_path); |
34 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); | 34 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback); |
35 } | 35 } |
36 | 36 |
37 void OpenURL(const std::string& url) { | 37 void OpenURL(const std::string& url) { |
38 Browser* browser = BrowserList::GetLastActive(); | 38 Browser* browser = BrowserList::GetLastActive(); |
39 browser->AddSelectedTabWithURL(GURL(url), content::PAGE_TRANSITION_LINK); | 39 browser->AddSelectedTabWithURL(GURL(url), content::PAGE_TRANSITION_LINK); |
40 } | 40 } |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
(...skipping 13 matching lines...) Expand all Loading... |
57 void OpenExternal(const GURL& url) { | 57 void OpenExternal(const GURL& url) { |
58 if (url.SchemeIs("mailto")) { | 58 if (url.SchemeIs("mailto")) { |
59 std::string string_url = kGmailComposeUrl; | 59 std::string string_url = kGmailComposeUrl; |
60 string_url.append(url.spec()); | 60 string_url.append(url.spec()); |
61 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 61 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
62 base::Bind(OpenURL, string_url)); | 62 base::Bind(OpenURL, string_url)); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 } // namespace platform_util | 66 } // namespace platform_util |
OLD | NEW |