Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: chrome/browser/extensions/file_manager_util.cc

Issue 7976025: Revert 102113 - Aura: Use extension-based file picker from CrOS for pure-views builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/chromeos/media/media_player.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/simple_message_box.h" 14 #include "chrome/browser/simple_message_box.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
16 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
17 #include "content/browser/browser_thread.h" 18 #include "content/browser/browser_thread.h"
18 #include "content/browser/user_metrics.h" 19 #include "content/browser/user_metrics.h"
19 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
20 #include "net/base/escape.h" 21 #include "net/base/escape.h"
21 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
22 #include "webkit/fileapi/file_system_context.h" 23 #include "webkit/fileapi/file_system_context.h"
23 #include "webkit/fileapi/file_system_mount_point_provider.h" 24 #include "webkit/fileapi/file_system_mount_point_provider.h"
24 #include "webkit/fileapi/file_system_util.h" 25 #include "webkit/fileapi/file_system_util.h"
25 26
26 #if defined(OS_CHROMEOS)
27 #include "chrome/browser/chromeos/media/media_player.h"
28 #endif
29
30 #define FILEBROWSER_DOMAIN "hhaomjibdihmijegdhdafkllkbggdgoj" 27 #define FILEBROWSER_DOMAIN "hhaomjibdihmijegdhdafkllkbggdgoj"
31 const char kFileBrowserDomain[] = FILEBROWSER_DOMAIN; 28 const char kFileBrowserDomain[] = FILEBROWSER_DOMAIN;
32 #define FILEBROWSER_URL(PATH) \ 29 #define FILEBROWSER_URL(PATH) \
33 ("chrome-extension://" FILEBROWSER_DOMAIN "/" PATH) 30 ("chrome-extension://" FILEBROWSER_DOMAIN "/" PATH)
34 // This is the "well known" url for the file manager extension from 31 // This is the "well known" url for the file manager extension from
35 // browser/resources/file_manager. In the future we may provide a way to swap 32 // browser/resources/file_manager. In the future we may provide a way to swap
36 // out this file manager for an aftermarket part, but not yet. 33 // out this file manager for an aftermarket part, but not yet.
37 const char kFileBrowserExtensionUrl[] = FILEBROWSER_URL(""); 34 const char kFileBrowserExtensionUrl[] = FILEBROWSER_URL("");
38 const char kBaseFileBrowserUrl[] = FILEBROWSER_URL("main.html"); 35 const char kBaseFileBrowserUrl[] = FILEBROWSER_URL("main.html");
39 const char kMediaPlayerUrl[] = FILEBROWSER_URL("mediaplayer.html"); 36 const char kMediaPlayerUrl[] = FILEBROWSER_URL("mediaplayer.html");
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 BrowserThread::UI, FROM_HERE, 231 BrowserThread::UI, FROM_HERE,
235 NewRunnableFunction(&ViewItem, full_path, enqueue)); 232 NewRunnableFunction(&ViewItem, full_path, enqueue));
236 DCHECK(result); 233 DCHECK(result);
237 return; 234 return;
238 } 235 }
239 Browser* browser = BrowserList::GetLastActive(); 236 Browser* browser = BrowserList::GetLastActive();
240 if (browser) 237 if (browser)
241 browser->AddSelectedTabWithURL(GURL(path), PageTransition::LINK); 238 browser->AddSelectedTabWithURL(GURL(path), PageTransition::LINK);
242 return; 239 return;
243 } 240 }
244 #if defined(OS_CHROMEOS)
245 if (IsSupportedAVExtension(ext.data())) { 241 if (IsSupportedAVExtension(ext.data())) {
246 Browser* browser = BrowserList::GetLastActive(); 242 Browser* browser = BrowserList::GetLastActive();
247 if (!browser) 243 if (!browser)
248 return; 244 return;
249 MediaPlayer* mediaplayer = MediaPlayer::GetInstance(); 245 MediaPlayer* mediaplayer = MediaPlayer::GetInstance();
250 if (enqueue) 246 if (enqueue)
251 mediaplayer->EnqueueMediaFile(browser->profile(), full_path, NULL); 247 mediaplayer->EnqueueMediaFile(browser->profile(), full_path, NULL);
252 else 248 else
253 mediaplayer->ForcePlayMediaFile(browser->profile(), full_path, NULL); 249 mediaplayer->ForcePlayMediaFile(browser->profile(), full_path, NULL);
254 return; 250 return;
255 } 251 }
256 #endif // OS_CHROMEOS
257 252
258 // Unknown file type. Record UMA and show an error message. 253 // Unknown file type. Record UMA and show an error message.
259 size_t extension_index = UMAExtensionIndex(ext.data(), 254 size_t extension_index = UMAExtensionIndex(ext.data(),
260 kUMATrackingExtensions, 255 kUMATrackingExtensions,
261 arraysize(kUMATrackingExtensions)); 256 arraysize(kUMATrackingExtensions));
262 UMA_HISTOGRAM_ENUMERATION("FileBrowser.OpeningFileType", 257 UMA_HISTOGRAM_ENUMERATION("FileBrowser.OpeningFileType",
263 extension_index, 258 extension_index,
264 arraysize(kUMATrackingExtensions) - 1); 259 arraysize(kUMATrackingExtensions) - 1);
265 260
266 BrowserThread::PostTask( 261 BrowserThread::PostTask(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 case SelectFileDialog::SELECT_OPEN_MULTI_FILE: 295 case SelectFileDialog::SELECT_OPEN_MULTI_FILE:
301 type_str = "open-multi-file"; 296 type_str = "open-multi-file";
302 break; 297 break;
303 298
304 default: 299 default:
305 NOTREACHED(); 300 NOTREACHED();
306 } 301 }
307 302
308 return type_str; 303 return type_str;
309 } 304 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_file_browser_private_api.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698