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

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

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

Powered by Google App Engine
This is Rietveld 408576698