OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/extensions/file_manager_util.h" | 4 #include "chrome/browser/extensions/file_manager_util.h" |
5 | 5 |
6 #include "base/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return; | 203 return; |
204 | 204 |
205 FilePath virtual_path; | 205 FilePath virtual_path; |
206 if (!FileManagerUtil::ConvertFileToRelativeFileSystemPath(browser->profile(), | 206 if (!FileManagerUtil::ConvertFileToRelativeFileSystemPath(browser->profile(), |
207 dir, | 207 dir, |
208 &virtual_path)) { | 208 &virtual_path)) { |
209 return; | 209 return; |
210 } | 210 } |
211 | 211 |
212 std::string url = chrome::kChromeUIFileManagerURL; | 212 std::string url = chrome::kChromeUIFileManagerURL; |
213 url += '#' + EscapeUrlEncodedData(virtual_path.value(), false); | 213 url += "#/" + EscapeUrlEncodedData(virtual_path.value(), false); |
214 | 214 |
215 UserMetrics::RecordAction(UserMetricsAction("ShowFileBrowserFullTab")); | 215 UserMetrics::RecordAction(UserMetricsAction("ShowFileBrowserFullTab")); |
216 browser->ShowSingletonTab(GURL(url)); | 216 browser->ShowSingletonTabRespectRef(GURL(url)); |
217 } | 217 } |
218 | 218 |
219 void FileManagerUtil::ViewItem(const FilePath& full_path, bool enqueue) { | 219 void FileManagerUtil::ViewItem(const FilePath& full_path, bool enqueue) { |
220 std::string ext = full_path.Extension(); | 220 std::string ext = full_path.Extension(); |
221 // For things supported natively by the browser, we should open it | 221 // For things supported natively by the browser, we should open it |
222 // in a tab. | 222 // in a tab. |
223 if (IsSupportedBrowserExtension(ext.data())) { | 223 if (IsSupportedBrowserExtension(ext.data())) { |
224 std::string path; | 224 std::string path; |
225 path = "file://"; | 225 path = "file://"; |
226 path.append(EscapeUrlEncodedData(full_path.value(), false)); | 226 path.append(EscapeUrlEncodedData(full_path.value(), false)); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 case SelectFileDialog::SELECT_OPEN_MULTI_FILE: | 291 case SelectFileDialog::SELECT_OPEN_MULTI_FILE: |
292 type_str = "open-multi-file"; | 292 type_str = "open-multi-file"; |
293 break; | 293 break; |
294 | 294 |
295 default: | 295 default: |
296 NOTREACHED(); | 296 NOTREACHED(); |
297 } | 297 } |
298 | 298 |
299 return type_str; | 299 return type_str; |
300 } | 300 } |
OLD | NEW |