| 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 18 matching lines...) Expand all Loading... |
| 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); | 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 // TODO(beng): improve this to locate context from call stack. | 38 // TODO(beng): improve this to locate context from call stack. |
| 39 browser::NavigateParams params(NULL, | 39 chrome::NavigateParams params(NULL, GURL(url), content::PAGE_TRANSITION_LINK); |
| 40 GURL(url), | |
| 41 content::PAGE_TRANSITION_LINK); | |
| 42 params.disposition = NEW_FOREGROUND_TAB; | 40 params.disposition = NEW_FOREGROUND_TAB; |
| 43 params.profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 41 params.profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
| 44 browser::Navigate(¶ms); | 42 chrome::Navigate(¶ms); |
| 45 } | 43 } |
| 46 | 44 |
| 47 } // namespace | 45 } // namespace |
| 48 | 46 |
| 49 namespace platform_util { | 47 namespace platform_util { |
| 50 | 48 |
| 51 void ShowItemInFolder(const FilePath& full_path) { | 49 void ShowItemInFolder(const FilePath& full_path) { |
| 52 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 53 file_manager_util::ShowFileInFolder(full_path); | 51 file_manager_util::ShowFileInFolder(full_path); |
| 54 } | 52 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 // As such we should keep this code here. | 69 // As such we should keep this code here. |
| 72 if (url.SchemeIs("mailto")) { | 70 if (url.SchemeIs("mailto")) { |
| 73 std::string string_url = kGmailComposeUrl; | 71 std::string string_url = kGmailComposeUrl; |
| 74 string_url.append(url.spec()); | 72 string_url.append(url.spec()); |
| 75 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 73 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 76 base::Bind(OpenURL, string_url)); | 74 base::Bind(OpenURL, string_url)); |
| 77 } | 75 } |
| 78 } | 76 } |
| 79 | 77 |
| 80 } // namespace platform_util | 78 } // namespace platform_util |
| OLD | NEW |