| 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/chromeos/file_manager/open_util.h" | 5 #include "chrome/browser/chromeos/file_manager/open_util.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 profile, | 135 profile, |
| 136 path, | 136 path, |
| 137 base::Bind(&OpenFileWithMimeType, profile, path, url, callback)); | 137 base::Bind(&OpenFileWithMimeType, profile, path, url, callback)); |
| 138 } | 138 } |
| 139 | 139 |
| 140 // Called when execution of ContinueOpenItem() is completed. | 140 // Called when execution of ContinueOpenItem() is completed. |
| 141 void OnContinueOpenItemCompleted(Profile* profile, | 141 void OnContinueOpenItemCompleted(Profile* profile, |
| 142 const base::FilePath& file_path, | 142 const base::FilePath& file_path, |
| 143 bool result) { | 143 bool result) { |
| 144 if (!result) { | 144 if (!result) { |
| 145 ShowWarningMessageBox( | 145 int message; |
| 146 profile, file_path, IDS_FILE_BROWSER_ERROR_VIEWING_FILE); | 146 if (file_path.Extension() == FILE_PATH_LITERAL(".dmg")) |
| 147 message = IDS_FILE_BROWSER_ERROR_VIEWING_FILE_FOR_DMG; |
| 148 else if (file_path.Extension() == FILE_PATH_LITERAL(".exe") || |
| 149 file_path.Extension() == FILE_PATH_LITERAL(".msi")) |
| 150 message = IDS_FILE_BROWSER_ERROR_VIEWING_FILE_FOR_EXECUTABLE; |
| 151 else |
| 152 message = IDS_FILE_BROWSER_ERROR_VIEWING_FILE; |
| 153 ShowWarningMessageBox(profile, file_path, message); |
| 147 } | 154 } |
| 148 } | 155 } |
| 149 | 156 |
| 150 // Used to implement OpenItem(). | 157 // Used to implement OpenItem(). |
| 151 void ContinueOpenItem(Profile* profile, | 158 void ContinueOpenItem(Profile* profile, |
| 152 const base::FilePath& file_path, | 159 const base::FilePath& file_path, |
| 153 const GURL& url, | 160 const GURL& url, |
| 154 base::File::Error error) { | 161 base::File::Error error) { |
| 155 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 162 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 156 | 163 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 GURL url; | 231 GURL url; |
| 225 if (!ConvertPath(profile, file_path, &converted_path, &url)) | 232 if (!ConvertPath(profile, file_path, &converted_path, &url)) |
| 226 return; | 233 return; |
| 227 | 234 |
| 228 // This action changes the selection so we do not reuse existing tabs. | 235 // This action changes the selection so we do not reuse existing tabs. |
| 229 OpenFileManagerWithInternalActionId(profile, url, "select"); | 236 OpenFileManagerWithInternalActionId(profile, url, "select"); |
| 230 } | 237 } |
| 231 | 238 |
| 232 } // namespace util | 239 } // namespace util |
| 233 } // namespace file_manager | 240 } // namespace file_manager |
| OLD | NEW |